diff --git a/dashboard-frontend/src/index.css b/dashboard-frontend/src/index.css index b578cce..de14eea 100644 --- a/dashboard-frontend/src/index.css +++ b/dashboard-frontend/src/index.css @@ -1,3 +1,6 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap'); + @tailwind base; @tailwind components; @tailwind utilities; @@ -5,12 +8,12 @@ body { background: #0a0e17; margin: 0; - font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + font-family: 'Inter', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } -/* Custom scrollbar */ +/* Custom scrollbar — sharp, no radius */ ::-webkit-scrollbar { width: 8px; height: 8px; @@ -22,13 +25,29 @@ body { ::-webkit-scrollbar-thumb { background: #2d3a4d; - border-radius: 4px; + border-radius: 0; } ::-webkit-scrollbar-thumb:hover { background: #3b4a5d; } +/* Scanline texture on cards */ +.bg-bg-card { + background-image: repeating-linear-gradient( + 0deg, + transparent, + transparent 2px, + rgba(255,255,255,0.008) 2px, + rgba(255,255,255,0.008) 3px + ); +} + +/* Amber glow utility */ +.amber-glow { + box-shadow: 0 0 12px rgba(245,158,11,0.25); +} + /* Data values use JetBrains Mono */ .font-mono { font-family: 'JetBrains Mono', monospace; @@ -48,7 +67,6 @@ body { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; } - /* Toast slide-in animation */ @keyframes slide-in { from { diff --git a/dashboard-frontend/src/pages/Dashboard.tsx b/dashboard-frontend/src/pages/Dashboard.tsx index f7c4c59..7dfd28b 100644 --- a/dashboard-frontend/src/pages/Dashboard.tsx +++ b/dashboard-frontend/src/pages/Dashboard.tsx @@ -40,31 +40,23 @@ import { function HealthGauge({ health }: { health: MeshHealth }) { const score = health.score const tier = health.tier - - const getColor = (s: number) => { - if (s >= 80) return '#22c55e' - if (s >= 60) return '#f59e0b' - return '#ef4444' - } - - const color = getColor(score) const circumference = 2 * Math.PI * 45 const progress = (score / 100) * circumference return (
- + - + {score.toFixed(1)} - + {tier} @@ -74,15 +66,15 @@ function HealthGauge({ health }: { health: MeshHealth }) { function PillarBar({ label, value }: { label: string; value: number }) { const getColor = (v: number) => { - if (v >= 80) return 'bg-green-500' - if (v >= 60) return 'bg-amber-500' - return 'bg-red-500' + if (v > 66) return 'bg-amber' + if (v > 33) return 'bg-amber-dim' + return 'bg-danger' } return ( -
-
{label}
-
+
+
{label}
+
{value.toFixed(1)}
@@ -96,13 +88,13 @@ function AlertItem({ alert }: { alert: Alert }) { case 'critical': case 'emergency': case 'immediate': - return { bg: 'bg-red-500/10', border: 'border-red-500', icon: AlertCircle, iconColor: 'text-red-500' } + return { bg: 'bg-danger-muted', border: 'border-danger', icon: AlertCircle, iconColor: 'text-danger' } case 'warning': case 'priority': - return { bg: 'bg-amber-500/10', border: 'border-amber-500', icon: AlertTriangle, iconColor: 'text-amber-500' } + return { bg: 'bg-amber-muted', border: 'border-amber', icon: AlertTriangle, iconColor: 'text-amber' } case 'routine': default: - return { bg: 'bg-blue-500/10', border: 'border-blue-500', icon: Info, iconColor: 'text-blue-500' } + return { bg: 'bg-blue-muted', border: 'border-blue', icon: Info, iconColor: 'text-blue' } } } @@ -110,11 +102,11 @@ function AlertItem({ alert }: { alert: Alert }) { const Icon = styles.icon return ( -
+
-
{alert.message}
-
{alert.timestamp || 'Just now'}
+
{alert.message}
+
{alert.timestamp || 'Just now'}
) @@ -122,31 +114,31 @@ function AlertItem({ alert }: { alert: Alert }) { function SourceCard({ source }: { source: SourceHealth }) { const getStatusColor = () => { - if (!source.is_loaded) return 'bg-red-500' - if (source.last_error) return 'bg-amber-500' - return 'bg-green-500' + if (!source.is_loaded) return 'bg-danger' + if (source.last_error) return 'bg-amber' + return 'bg-blue' } return ( -
+
-
{source.name}
-
{source.node_count} nodes · {source.type}
+
{source.name}
+
{source.node_count} nodes · {source.type}
) } -function StatCard({ icon: Icon, label, value, subvalue }: { icon: typeof Radio; label: string; value: string | number; subvalue?: string }) { +function StatCard({ icon: Icon, label, value, subvalue, valueClass, subvalueClass }: { icon: typeof Radio; label: string; value: string | number; subvalue?: string; valueClass?: string; subvalueClass?: string }) { return ( -
+
- {label} + {label}
-
{value}
- {subvalue &&
{subvalue}
} +
{value}
+ {subvalue &&
{subvalue}
}
) } @@ -157,12 +149,21 @@ function StatCard({ icon: Icon, label, value, subvalue }: { icon: typeof Radio; // Band Conditions Card function BandConditionsCard({ bandConditions }: { bandConditions: BandConditionsStatus | null }) { - const getRatingEmoji = (rating?: string) => { + const getRatingColor = (rating?: string) => { switch (rating) { - case 'Good': return '🟢' // green circle - case 'Fair': return '🟡' // yellow circle - case 'Poor': return '🔴' // red circle - default: return '—' + case 'Good': return 'bg-blue' + case 'Fair': return 'bg-amber-dim' + case 'Poor': return 'bg-danger' + default: return 'bg-slate-600' + } + } + + const getRatingTextColor = (rating?: string) => { + switch (rating) { + case 'Good': return 'text-blue' + case 'Fair': return 'text-amber-dim' + case 'Poor': return 'text-danger' + default: return 'text-slate-500' } } @@ -173,14 +174,14 @@ function BandConditionsCard({ bandConditions }: { bandConditions: BandConditions if (!bandConditions?.enabled || !bandConditions?.ratings) { return ( -
-

+
+

RF Propagation

-
No band conditions data
+
No band conditions data
@@ -190,32 +191,33 @@ function BandConditionsCard({ bandConditions }: { bandConditions: BandConditions const bands = ['80-40m', '30-20m', '17-15m', '12-10m'] as const return ( -
-

+
+

RF Propagation

{/* Slot label */} -
+
{getSlotEmoji(bandConditions.slot_label)} - {bandConditions.slot_label} + {bandConditions.slot_label}
{/* Band conditions header */} -
+
📡 Band Conditions:
{/* Band rows */} -
+
{bands.map(band => { const rating = bandConditions.ratings?.[band] return ( -
+
{band} - - {getRatingEmoji(rating)} {rating || '—'} + + + {rating || '—'}
) @@ -223,12 +225,12 @@ function BandConditionsCard({ bandConditions }: { bandConditions: BandConditions
{/* Footer: source and time */} -
+
{bandConditions.source && ( {bandConditions.source === 'swpc_local' ? 'SWPC' : 'HamQSL'} )} {bandConditions.sent_at && ( - + {new Date(bandConditions.sent_at * 1000).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })} )} @@ -299,18 +301,18 @@ function HepburnTropoCard() { const regionLabel = TROPO_REGIONS.find(r => r.code === region)?.label || region return ( -
+
-

+

Tropo Forecast (Hepburn)

- {saving && saving...} + {saving && saving...} ",k=document.createElement("div");return k.innerHTML=C,k.firstChild},_addItem:function(p){var b=document.createElement("label"),C=this._map.hasLayer(p.layer),k;p.overlay?(k=document.createElement("input"),k.type="checkbox",k.className="leaflet-control-layers-selector",k.defaultChecked=C):k=this._createRadioElement("leaflet-base-layers_"+l(this),C),this._layerControlInputs.push(k),k.layerId=l(p.layer),nt(k,"click",this._onInputClick,this);var E=document.createElement("span");E.innerHTML=" "+p.name;var B=document.createElement("span");b.appendChild(B),B.appendChild(k),B.appendChild(E);var X=p.overlay?this._overlaysList:this._baseLayersList;return X.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,C,k=[],E=[];this._handlingClick=!0;for(var B=p.length-1;B>=0;B--)b=p[B],C=this._getLayer(b.layerId).layer,b.checked?k.push(C):b.checked||E.push(C);for(B=0;B=0;E--)b=p[E],C=this._getLayer(b.layerId).layer,b.disabled=C.options.minZoom!==void 0&&kC.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,nt(p,"click",Hr),this.expand();var b=this;setTimeout(function(){Rt(p,"click",Hr),b._preventClick=!1})}}),fU=function(p,b,C){return new zL(p,b,C)},l1=Wi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",C=St("div",b+" leaflet-bar"),k=this.options;return this._zoomInButton=this._createButton(k.zoomInText,k.zoomInTitle,b+"-in",C,this._zoomIn),this._zoomOutButton=this._createButton(k.zoomOutText,k.zoomOutTitle,b+"-out",C,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),C},onRemove:function(p){p.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,C,k,E){var B=St("a",C,k);return B.innerHTML=p,B.href="#",B.title=b,B.setAttribute("role","button"),B.setAttribute("aria-label",b),Wf(B),nt(B,"click",_l),nt(B,"click",E,this),nt(B,"click",this._refocusOnMap,this),B},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";cr(this._zoomInButton,b),cr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(at(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(at(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});mt.mergeOptions({zoomControl:!0}),mt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new l1,this.addControl(this.zoomControl))});var dU=function(p){return new l1(p)},BL=Wi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",C=St("div",b),k=this.options;return this._addScales(k,b+"-line",C),p.on(k.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),C},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,C){p.metric&&(this._mScale=St("div",b,C)),p.imperial&&(this._iScale=St("div",b,C))},_update:function(){var p=this._map,b=p.getSize().y/2,C=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(C)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),C=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,C,b/p)},_updateImperial:function(p){var b=p*3.2808399,C,k,E;b>5280?(C=b/5280,k=this._getRoundNum(C),this._updateScale(this._iScale,k+" mi",k/C)):(E=this._getRoundNum(b),this._updateScale(this._iScale,E+" ft",E/b))},_updateScale:function(p,b,C){p.style.width=Math.round(this.options.maxWidth*C)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),C=p/b;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:1,b*C}}),vU=function(p){return new BL(p)},pU='',u1=Wi.extend({options:{position:"bottomright",prefix:''+(Be.inlineSvg?pU+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=St("div","leaflet-control-attribution"),Wf(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var C=[];this.options.prefix&&C.push(this.options.prefix),p.length&&C.push(p.join(", ")),this._container.innerHTML=C.join(' ')}}});mt.mergeOptions({attributionControl:!0}),mt.addInitHook(function(){this.options.attributionControl&&new u1().addTo(this)});var gU=function(p){return new u1(p)};Wi.Layers=zL,Wi.Zoom=l1,Wi.Scale=BL,Wi.Attribution=u1,Hf.layers=fU,Hf.zoom=dU,Hf.scale=vU,Hf.attribution=gU;var ma=F.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ma.addTo=function(p,b){return p.addHandler(b,this),this};var mU={Events:W},FL=Be.touch?"touchstart mousedown":"mousedown",es=V.extend({options:{clickTolerance:3},initialize:function(p,b,C,k){m(this,k),this._element=p,this._dragStartTarget=b||p,this._preventOutline=C},enable:function(){this._enabled||(nt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(es._dragging===this&&this.finishDrag(!0),Rt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!X_(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){es._dragging===this&&this.finishDrag();return}if(!(es._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(es._dragging=this,this._preventOutline&&t1(this._element),J_(),Ff(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,C=IL(this._element);this._startPoint=new z(b.clientX,b.clientY),this._startPos=yl(this._element),this._parentScale=r1(C);var k=p.type==="mousedown";nt(document,k?"mousemove":"touchmove",this._onMove,this),nt(document,k?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,C=new z(b.clientX,b.clientY)._subtract(this._startPoint);!C.x&&!C.y||Math.abs(C.x)+Math.abs(C.y)B&&(X=J,B=ne);B>C&&(b[X]=1,h1(p,b,C,k,X),h1(p,b,C,X,E))}function bU(p,b){for(var C=[p[0]],k=1,E=0,B=p.length;kb&&(C.push(p[k]),E=k);return Eb.max.x&&(C|=2),p.yb.max.y&&(C|=8),C}function wU(p,b){var C=b.x-p.x,k=b.y-p.y;return C*C+k*k}function Uf(p,b,C,k){var E=b.x,B=b.y,X=C.x-E,J=C.y-B,ne=X*X+J*J,ue;return ne>0&&(ue=((p.x-E)*X+(p.y-B)*J)/ne,ue>1?(E=C.x,B=C.y):ue>0&&(E+=X*ue,B+=J*ue)),X=p.x-E,J=p.y-B,k?X*X+J*J:new z(E,B)}function hi(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function $L(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),hi(p)}function YL(p,b){var C,k,E,B,X,J,ne,ue;if(!p||p.length===0)throw new Error("latlngs not passed");hi(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var Ie=le([0,0]),Xe=ie(p),ut=Xe.getNorthWest().distanceTo(Xe.getSouthWest())*Xe.getNorthEast().distanceTo(Xe.getNorthWest());ut<1700&&(Ie=c1(p));var pn=p.length,jr=[];for(C=0;Ck){ne=(B-k)/E,ue=[J.x-ne*(J.x-X.x),J.y-ne*(J.y-X.y)];break}var An=b.unproject(U(ue));return le([An.lat+Ie.lat,An.lng+Ie.lng])}var SU={__proto__:null,simplify:WL,pointToSegmentDistance:HL,closestPointOnSegment:xU,clipSegment:ZL,_getEdgeIntersection:xg,_getBitCode:bl,_sqClosestPointOnSegment:Uf,isFlat:hi,_flat:$L,polylineCenter:YL},f1={project:function(p){return new z(p.lng,p.lat)},unproject:function(p){return new se(p.y,p.x)},bounds:new $([-180,-90],[180,90])},d1={R:6378137,R_MINOR:6356752314245179e-9,bounds:new $([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,C=this.R,k=p.lat*b,E=this.R_MINOR/C,B=Math.sqrt(1-E*E),X=B*Math.sin(k),J=Math.tan(Math.PI/4-k/2)/Math.pow((1-X)/(1+X),B/2);return k=-C*Math.log(Math.max(J,1e-10)),new z(p.lng*b*C,k)},unproject:function(p){for(var b=180/Math.PI,C=this.R,k=this.R_MINOR/C,E=Math.sqrt(1-k*k),B=Math.exp(-p.y/C),X=Math.PI/2-2*Math.atan(B),J=0,ne=.1,ue;J<15&&Math.abs(ne)>1e-7;J++)ue=E*Math.sin(X),ue=Math.pow((1-ue)/(1+ue),E/2),ne=Math.PI/2-2*Math.atan(B*ue)-X,X+=ne;return new se(X*b,p.x*b/C)}},CU={__proto__:null,LonLat:f1,Mercator:d1,SphericalMercator:Me},TU=i({},me,{code:"EPSG:3395",projection:d1,transformation:function(){var p=.5/(Math.PI*d1.R);return Te(p,.5,-p,.5)}()}),XL=i({},me,{code:"EPSG:4326",projection:f1,transformation:Te(1/180,1,-1/180,.5)}),MU=i({},Ee,{projection:f1,transformation:Te(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var C=b.lng-p.lng,k=b.lat-p.lat;return Math.sqrt(C*C+k*k)},infinite:!0});Ee.Earth=me,Ee.EPSG3395=TU,Ee.EPSG3857=st,Ee.EPSG900913=ze,Ee.EPSG4326=XL,Ee.Simple=MU;var Hi=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var C=this.getEvents();b.on(C,this),this.once("remove",function(){b.off(C,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});mt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var C in this._layers)p.call(b,this._layers[C]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,C=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof se&&b[0].equals(b[C-1])&&b.pop(),b},_setLatLngs:function(p){uo.prototype._setLatLngs.call(this,p),hi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return hi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,C=new z(b,b);if(p=new $(p.min.subtract(C),p.max.add(C)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var k=0,E=this._rings.length,B;kp.y!=E.y>p.y&&p.x<(E.x-k.x)*(p.y-k.y)/(E.y-k.y)+k.x&&(b=!b);return b||uo.prototype._containsPoint.call(this,p,!0)}});function EU(p,b){return new hc(p,b)}var co=lo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,C,k,E;if(b){for(C=0,k=b.length;C0&&E.push(E[0].slice()),E}function fc(p,b){return p.feature?i({},p.feature,{geometry:b}):Tg(b)}function Tg(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var m1={toGeoJSON:function(p){return fc(this,{type:"Point",coordinates:g1(this.getLatLng(),p)})}};_g.include(m1),v1.include(m1),bg.include(m1),uo.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=Cg(this._latlngs,b?1:0,!1,p);return fc(this,{type:(b?"Multi":"")+"LineString",coordinates:C})}}),hc.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=b&&!hi(this._latlngs[0]),k=Cg(this._latlngs,C?2:b?1:0,!0,p);return b||(k=[k]),fc(this,{type:(C?"Multi":"")+"Polygon",coordinates:k})}}),uc.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(C){b.push(C.toGeoJSON(p).geometry.coordinates)}),fc(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var C=b==="GeometryCollection",k=[];return this.eachLayer(function(E){if(E.toGeoJSON){var B=E.toGeoJSON(p);if(C)k.push(B.geometry);else{var X=Tg(B);X.type==="FeatureCollection"?k.push.apply(k,X.features):k.push(X)}}}),C?fc(this,{geometries:k,type:"GeometryCollection"}):{type:"FeatureCollection",features:k}}});function JL(p,b){return new co(p,b)}var jU=JL,Mg=Hi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,C){this._url=p,this._bounds=ie(b),m(this,C)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(at(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Zt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&sc(this._image),this},bringToBack:function(){return this._map&&lc(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=ie(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:St("img");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),C=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;ml(this._image,C,b)},_reset:function(){var p=this._image,b=new $(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),C=b.getSize();mr(p,b.min),p.style.width=C.x+"px",p.style.height=C.y+"px"},_updateOpacity:function(){ci(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),RU=function(p,b,C){return new Mg(p,b,C)},QL=Mg.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:St("video");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var C=b.getElementsByTagName("source"),k=[],E=0;E0?k:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var B=0;BE?(b.height=E+"px",at(p,B)):cr(p,B),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),C=this._getAnchor();mr(this._container,b.add(C))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(Bf(this._container,"marginBottom"),10)||0,C=this._container.offsetHeight+b,k=this._containerWidth,E=new z(this._containerLeft,-C-this._containerBottom);E._add(yl(this._container));var B=p.layerPointToContainerPoint(E),X=U(this.options.autoPanPadding),J=U(this.options.autoPanPaddingTopLeft||X),ne=U(this.options.autoPanPaddingBottomRight||X),ue=p.getSize(),Ie=0,Xe=0;B.x+k+ne.x>ue.x&&(Ie=B.x+k-ue.x+ne.x),B.x-Ie-J.x<0&&(Ie=B.x-J.x),B.y+C+ne.y>ue.y&&(Xe=B.y+C-ue.y+ne.y),B.y-Xe-J.y<0&&(Xe=B.y-J.y),(Ie||Xe)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([Ie,Xe]))}},_getAnchor:function(){return U(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),BU=function(p,b){return new Ag(p,b)};mt.mergeOptions({closePopupOnClick:!0}),mt.include({openPopup:function(p,b,C){return this._initOverlay(Ag,p,b,C).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Hi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Ag,this._popup,p,b),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(p){return this._popup&&(this instanceof lo||(this._popup._source=this),this._popup._prepareOpen(p||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){_l(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ts)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var kg=ya.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){ya.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){ya.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=ya.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=St("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,C,k=this._map,E=this._container,B=k.latLngToContainerPoint(k.getCenter()),X=k.layerPointToContainerPoint(p),J=this.options.direction,ne=E.offsetWidth,ue=E.offsetHeight,Ie=U(this.options.offset),Xe=this._getAnchor();J==="top"?(b=ne/2,C=ue):J==="bottom"?(b=ne/2,C=0):J==="center"?(b=ne/2,C=ue/2):J==="right"?(b=0,C=ue/2):J==="left"?(b=ne,C=ue/2):X.xthis.options.maxZoom||Ck?this._retainParent(E,B,X,k):!1)},_retainChildren:function(p,b,C,k){for(var E=2*p;E<2*p+2;E++)for(var B=2*b;B<2*b+2;B++){var X=new z(E,B);X.z=C+1;var J=this._tileCoordsToKey(X),ne=this._tiles[J];if(ne&&ne.active){ne.retain=!0;continue}else ne&&ne.loaded&&(ne.retain=!0);C+1this.options.maxZoom||this.options.minZoom!==void 0&&E1){this._setView(p,C);return}for(var Xe=E.min.y;Xe<=E.max.y;Xe++)for(var ut=E.min.x;ut<=E.max.x;ut++){var pn=new z(ut,Xe);if(pn.z=this._tileZoom,!!this._isValidTile(pn)){var jr=this._tiles[this._tileCoordsToKey(pn)];jr?jr.current=!0:X.push(pn)}}if(X.sort(function(An,vc){return An.distanceTo(B)-vc.distanceTo(B)}),X.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var fi=document.createDocumentFragment();for(ut=0;utC.max.x)||!b.wrapLat&&(p.yC.max.y))return!1}if(!this.options.bounds)return!0;var k=this._tileCoordsToBounds(p);return ie(this.options.bounds).overlaps(k)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,C=this.getTileSize(),k=p.scaleBy(C),E=k.add(C),B=b.unproject(k,p.z),X=b.unproject(E,p.z);return[B,X]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),C=new te(b[0],b[1]);return this.options.noWrap||(C=this._map.wrapLatLngBounds(C)),C},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),C=new z(+b[0],+b[1]);return C.z=+b[2],C},_removeTile:function(p){var b=this._tiles[p];b&&(Zt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){at(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,Be.ielt9&&this.options.opacity<1&&ci(p,this.options.opacity)},_addTile:function(p,b){var C=this._getTilePos(p),k=this._tileCoordsToKey(p),E=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(E),this.createTile.length<2&&D(o(this._tileReady,this,p,null,E)),mr(E,C),this._tiles[k]={el:E,coords:p,current:!0},b.appendChild(E),this.fire("tileloadstart",{tile:E,coords:p})},_tileReady:function(p,b,C){b&&this.fire("tileerror",{error:b,tile:C,coords:p});var k=this._tileCoordsToKey(p);C=this._tiles[k],C&&(C.loaded=+new Date,this._map._fadeAnimated?(ci(C.el,0),O(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(C.active=!0,this._pruneTiles()),b||(at(C.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:C.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Be.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new z(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new $(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function GU(p){return new $f(p)}var dc=$f.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&Be.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var C=document.createElement("img");return nt(C,"load",o(this._tileOnLoad,this,b,C)),nt(C,"error",o(this._tileOnError,this,b,C)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(C.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(C.referrerPolicy=this.options.referrerPolicy),C.alt="",C.src=this.getTileUrl(p),C},getTileUrl:function(p){var b={r:Be.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var C=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=C),b["-y"]=C}return _(this._url,i(b,this.options))},_tileOnLoad:function(p,b){Be.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,C){var k=this.options.errorTileUrl;k&&b.getAttribute("src")!==k&&(b.src=k),p(C,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,C=this.options.zoomReverse,k=this.options.zoomOffset;return C&&(p=b-p),p+k},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=T;var C=this._tiles[p].coords;Zt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:C})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",T),$f.prototype._removeTile.call(this,p)},_tileReady:function(p,b,C){if(!(!this._map||C&&C.getAttribute("src")===T))return $f.prototype._tileReady.call(this,p,b,C)}});function rN(p,b){return new dc(p,b)}var nN=dc.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var C=i({},this.defaultWmsParams);for(var k in b)k in this.options||(C[k]=b[k]);b=m(this,b);var E=b.detectRetina&&Be.retina?2:1,B=this.getTileSize();C.width=B.x*E,C.height=B.y*E,this.wmsParams=C},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,dc.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),C=this._crs,k=Y(C.project(b[0]),C.project(b[1])),E=k.min,B=k.max,X=(this._wmsVersion>=1.3&&this._crs===XL?[E.y,E.x,B.y,B.x]:[E.x,E.y,B.x,B.y]).join(","),J=dc.prototype.getTileUrl.call(this,p);return J+y(this.wmsParams,J,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+X},setParams:function(p,b){return i(this.wmsParams,p),b||this.redraw(),this}});function WU(p,b){return new nN(p,b)}dc.WMS=nN,rN.wms=WU;var ho=Hi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),at(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var C=this._map.getZoomScale(b,this._zoom),k=this._map.getSize().multiplyBy(.5+this.options.padding),E=this._map.project(this._center,b),B=k.multiplyBy(-C).add(E).subtract(this._map._getNewPixelOrigin(p,b));Be.any3d?ml(this._container,B,C):mr(this._container,B)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),C=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new $(C,C.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iN=ho.extend({options:{tolerance:0},getEvents:function(){var p=ho.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ho.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");nt(p,"mousemove",this._onMouseMove,this),nt(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,Zt(this._container),Rt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=this._container,C=p.getSize(),k=Be.retina?2:1;mr(b,p.min),b.width=k*C.x,b.height=k*C.y,b.style.width=C.x+"px",b.style.height=C.y+"px",Be.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){ho.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,C=b.next,k=b.prev;C?C.prev=k:this._drawLast=k,k?k.next=C:this._drawFirst=C,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),C=[],k,E;for(E=0;E')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),HU={_initContainer:function(){this._container=St("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ho.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Yf("shape");at(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Yf("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;Zt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,C=p._fill,k=p.options,E=p._container;E.stroked=!!k.stroke,E.filled=!!k.fill,k.stroke?(b||(b=p._stroke=Yf("stroke")),E.appendChild(b),b.weight=k.weight+"px",b.color=k.color,b.opacity=k.opacity,k.dashArray?b.dashStyle=w(k.dashArray)?k.dashArray.join(" "):k.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=k.lineCap.replace("butt","flat"),b.joinstyle=k.lineJoin):b&&(E.removeChild(b),p._stroke=null),k.fill?(C||(C=p._fill=Yf("fill")),E.appendChild(C),C.color=k.fillColor||k.color,C.opacity=k.fillOpacity):C&&(E.removeChild(C),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),C=Math.round(p._radius),k=Math.round(p._radiusY||C);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+C+","+k+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){sc(p._container)},_bringToBack:function(p){lc(p._container)}},Lg=Be.vml?Yf:et,Xf=ho.extend({_initContainer:function(){this._container=Lg("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Lg("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Zt(this._container),Rt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=p.getSize(),C=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,C.setAttribute("width",b.x),C.setAttribute("height",b.y)),mr(C,p.min),C.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Lg("path");p.options.className&&at(b,p.options.className),p.options.interactive&&at(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){Zt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,C=p.options;b&&(C.stroke?(b.setAttribute("stroke",C.color),b.setAttribute("stroke-opacity",C.opacity),b.setAttribute("stroke-width",C.weight),b.setAttribute("stroke-linecap",C.lineCap),b.setAttribute("stroke-linejoin",C.lineJoin),C.dashArray?b.setAttribute("stroke-dasharray",C.dashArray):b.removeAttribute("stroke-dasharray"),C.dashOffset?b.setAttribute("stroke-dashoffset",C.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),C.fill?(b.setAttribute("fill",C.fillColor||C.color),b.setAttribute("fill-opacity",C.fillOpacity),b.setAttribute("fill-rule",C.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,lt(p._parts,b))},_updateCircle:function(p){var b=p._point,C=Math.max(Math.round(p._radius),1),k=Math.max(Math.round(p._radiusY),1)||C,E="a"+C+","+k+" 0 1,0 ",B=p._empty()?"M0 0":"M"+(b.x-C)+","+b.y+E+C*2+",0 "+E+-C*2+",0 ";this._setPath(p,B)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){sc(p._path)},_bringToBack:function(p){lc(p._path)}});Be.vml&&Xf.include(HU);function oN(p){return Be.svg||Be.vml?new Xf(p):null}mt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&aN(p)||oN(p)}});var sN=hc.extend({initialize:function(p,b){hc.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=ie(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function UU(p,b){return new sN(p,b)}Xf.create=Lg,Xf.pointsToPath=lt,co.geometryToLayer=wg,co.coordsToLatLng=p1,co.coordsToLatLngs=Sg,co.latLngToCoords=g1,co.latLngsToCoords=Cg,co.getFeature=fc,co.asFeature=Tg,mt.mergeOptions({boxZoom:!0});var lN=ma.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Rt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Zt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Ff(),J_(),this._startPoint=this._map.mouseEventToContainerPoint(p),nt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=St("div","leaflet-zoom-box",this._container),at(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new $(this._point,this._startPoint),C=b.getSize();mr(this._box,b.min),this._box.style.width=C.x+"px",this._box.style.height=C.y+"px"},_finish:function(){this._moved&&(Zt(this._box),cr(this._container,"leaflet-crosshair")),Vf(),Q_(),Rt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new te(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});mt.addInitHook("addHandler","boxZoom",lN),mt.mergeOptions({doubleClickZoom:!0});var uN=ma.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,C=b.getZoom(),k=b.options.zoomDelta,E=p.originalEvent.shiftKey?C-k:C+k;b.options.doubleClickZoom==="center"?b.setZoom(E):b.setZoomAround(p.containerPoint,E)}});mt.addInitHook("addHandler","doubleClickZoom",uN),mt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var cN=ma.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new es(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}at(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){cr(this._map._container,"leaflet-grab"),cr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=ie(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,C=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(C),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),C=this._initialWorldOffset,k=this._draggable._newPos.x,E=(k-b+C)%p+b-C,B=(k+b+C)%p-b-C,X=Math.abs(E+C)0?B:-B))-b;this._delta=0,this._startTime=null,X&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+X):p.setZoomAround(this._lastMousePos,b+X))}});mt.addInitHook("addHandler","scrollWheelZoom",fN);var ZU=600;mt.mergeOptions({tapHold:Be.touchNative&&Be.safari&&Be.mobile,tapTolerance:15});var dN=ma.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Rt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new z(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",Hr),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),ZU),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Rt(document,"touchend",Hr),Rt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Rt(document,"touchend touchcancel contextmenu",this._cancel,this),Rt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new z(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var C=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});C._simulated=!0,b.target.dispatchEvent(C)}});mt.addInitHook("addHandler","tapHold",dN),mt.mergeOptions({touchZoom:Be.touch,bounceAtZoomLimits:!0});var vN=ma.extend({addHooks:function(){at(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){cr(this._map._container,"leaflet-touch-zoom"),Rt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(C.add(k)._divideBy(2))),this._startDist=C.distanceTo(k),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),Hr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]),E=C.distanceTo(k)/this._startDist;if(this._zoom=b.getScaleZoom(E,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&E>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,E===1)return}else{var B=C._add(k)._divideBy(2)._subtract(this._centerPoint);if(E===1&&B.x===0&&B.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(B),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var X=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(X,this,!0),Hr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Rt(document,"touchmove",this._onTouchMove,this),Rt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});mt.addInitHook("addHandler","touchZoom",vN),mt.BoxZoom=lN,mt.DoubleClickZoom=uN,mt.Drag=cN,mt.Keyboard=hN,mt.ScrollWheelZoom=fN,mt.TapHold=dN,mt.TouchZoom=vN,r.Bounds=$,r.Browser=Be,r.CRS=Ee,r.Canvas=iN,r.Circle=v1,r.CircleMarker=bg,r.Class=F,r.Control=Wi,r.DivIcon=tN,r.DivOverlay=ya,r.DomEvent=cU,r.DomUtil=lU,r.Draggable=es,r.Evented=V,r.FeatureGroup=lo,r.GeoJSON=co,r.GridLayer=$f,r.Handler=ma,r.Icon=cc,r.ImageOverlay=Mg,r.LatLng=se,r.LatLngBounds=te,r.Layer=Hi,r.LayerGroup=uc,r.LineUtil=SU,r.Map=mt,r.Marker=_g,r.Mixin=mU,r.Path=ts,r.Point=z,r.PolyUtil=yU,r.Polygon=hc,r.Polyline=uo,r.Popup=Ag,r.PosAnimation=OL,r.Projection=CU,r.Rectangle=sN,r.Renderer=ho,r.SVG=Xf,r.SVGOverlay=eN,r.TileLayer=dc,r.Tooltip=kg,r.Transformation=pe,r.Util=R,r.VideoOverlay=QL,r.bind=o,r.bounds=Y,r.canvas=aN,r.circle=IU,r.circleMarker=PU,r.control=Hf,r.divIcon=VU,r.extend=i,r.featureGroup=kU,r.geoJSON=JL,r.geoJson=jU,r.gridLayer=GU,r.icon=LU,r.imageOverlay=RU,r.latLng=le,r.latLngBounds=ie,r.layerGroup=AU,r.map=hU,r.marker=NU,r.point=U,r.polygon=EU,r.polyline=DU,r.popup=BU,r.rectangle=UU,r.setOptions=m,r.stamp=l,r.svg=oN,r.svgOverlay=zU,r.tileLayer=rN,r.tooltip=FU,r.transformation=Te,r.version=n,r.videoOverlay=OU;var $U=window.L;r.noConflict=function(){return window.L=$U,this},window.L=r})})(E2,E2.exports);var ic=E2.exports;const YH=R2(ic);function rg(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function AL(e,t){return t==null?function(n,i){const a=G.useRef();return a.current||(a.current=e(n,i)),a}:function(n,i){const a=G.useRef();a.current||(a.current=e(n,i));const o=G.useRef(n),{instance:s}=a.current;return G.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,i]),a}}function XH(e,t){G.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function s0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return HH(n.map,r.attribution),ML(i.current,r.eventHandlers),XH(i.current,n),i}}function l0e(e,t){const r=G.useRef();G.useEffect(function(){if(t.pathOptions!==r.current){const i=t.pathOptions??{};e.instance.setStyle(i),r.current=i}},[e,t])}function u0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return ML(i.current,r.eventHandlers),XH(i.current,n),l0e(i.current,r),i}}function qH(e,t){const r=AL(e),n=o0e(r,t);return i0e(n)}function KH(e,t){const r=AL(e,t),n=u0e(r);return n0e(n)}function c0e(e,t){const r=AL(e,t),n=s0e(r);return a0e(n)}function h0e(e,t,r){const{opacity:n,zIndex:i}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function f0e(){return U_().map}const d0e=KH(function({center:t,children:r,...n},i){const a=new ic.CircleMarker(t,n);return rg(a,UH(i,{overlayContainer:a}))},e0e);function j2(){return j2=Object.assign||function(e){for(var t=1;t(d==null?void 0:d.map)??null,[d]);const m=G.useCallback(x=>{if(x!==null&&d===null){const _=new ic.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(r0e(_))}},[]);G.useEffect(()=>()=>{d==null||d.map.remove()},[d]);const y=d?Ch.createElement($H,{value:d},n):o??null;return Ch.createElement("div",j2({},f,{ref:m}),y)}const p0e=G.forwardRef(v0e),g0e=KH(function({positions:t,...r},n){const i=new ic.Polyline(t,r);return rg(i,UH(n,{overlayContainer:i}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),m0e=qH(function(t,r){const n=new ic.Popup(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),i(!0))}function l(u){u.popup===o&&i(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,i,n])}),y0e=c0e(function({url:t,...r},n){const i=new ic.TileLayer(t,Z_(r,n));return rg(i,n)},function(t,r,n){h0e(t,r,n);const{url:i}=r;i!=null&&i!==n.url&&t.setUrl(i)}),x0e=qH(function(t,r){const n=new ic.Tooltip(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),i(!0))},u=c=>{c.tooltip===s&&i(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,i,n])}),_0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",b0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",w0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete YH.Icon.Default.prototype._getIconUrl;YH.Icon.Default.mergeOptions({iconUrl:_0e,iconRetinaUrl:b0e,shadowUrl:w0e});const w3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],S0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C0e(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function T0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function M0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function A0e({bounds:e}){const t=f0e();return G.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function k0e({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return v.jsxs("div",{className:"min-w-[200px]",children:[v.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),v.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[v.jsx("div",{className:"text-slate-500",children:"Role"}),v.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),v.jsx("div",{className:"text-slate-500",children:"Hardware"}),v.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),v.jsx("div",{className:"text-slate-500",children:"Battery"}),v.jsx("div",{className:"text-slate-700",children:r}),v.jsx("div",{className:"text-slate-500",children:"Last Heard"}),v.jsx("div",{className:"text-slate-700",children:M0e(e.last_heard)})]}),t&&v.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"OSM"]})]})]})}function L0e({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),a=e.length-i.length,o=G.useMemo(()=>new Map(i.map(h=>[h.node_num,h])),[i]),s=G.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=G.useMemo(()=>{if(i.length===0)return null;const h=i.map(d=>d.latitude),f=i.map(d=>d.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[i]),u=[43.6,-114.4],c=G.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return v.jsxs("div",{className:"relative bg-bg-card rounded-lg border border-border overflow-hidden",children:[v.jsxs(p0e,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[v.jsx(y0e,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),v.jsx(A0e,{bounds:l}),s.map((h,f)=>{const d=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return v.jsx(g0e,{positions:[[d.latitude,d.longitude],[g.latitude,g.longitude]],color:C0e(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),i.map(h=>{const f=h.node_num===r,d=c.has(h.node_num),g=r===null||f||d,m=S0e.includes(h.role),y=T0e(h.latitude),x=w3[y%w3.length];return v.jsxs(d0e,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[v.jsx(x0e,{direction:"top",offset:[0,-8],children:v.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),v.jsx(m0e,{children:v.jsx(k0e,{node:h})})]},h.node_num)})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[v.jsx(nf,{size:12}),v.jsxs("span",{children:["Showing ",i.length," of ",e.length," nodes",a>0&&v.jsxs("span",{className:"text-slate-500",children:[" (",a," without coordinates)"]})]})]})]})}const S3=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],N0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C3(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function P0e(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function I0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function D0e(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function E0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function j0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function R0e({node:e,edges:t,nodes:r,onSelectNode:n}){const i=G.useMemo(()=>{if(!e)return[];const h=new Map(r.map(d=>[d.node_num,d])),f=[];return t.forEach(d=>{if(d.from_node===e.node_num){const g=h.get(d.to_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}else if(d.to_node===e.node_num){const g=h.get(d.from_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}}),f.sort((d,g)=>g.snr-d.snr)},[e,t,r]);if(!e)return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:v.jsx(Di,{size:24,className:"text-slate-500"})}),v.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const a=N0e.includes(e.role),o=I0e(e.latitude),s=S3[o%S3.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[v.jsxs("div",{className:"p-4 border-b border-border",children:[v.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),v.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),v.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),v.jsx("div",{className:`text-sm font-medium ${a?"text-cyan-400":"text-slate-300"}`,children:e.role})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),v.jsx("div",{className:"text-sm text-slate-300",children:D0e(o)})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),v.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&v.jsx(Dh,{size:12,className:"text-amber-400"}),u]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${j0e(e.last_heard)}`}),v.jsx("span",{className:"text-sm text-slate-300",children:E0e(e.last_heard)})]})]}),v.jsxs("div",{className:"col-span-2",children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),v.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&v.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300",children:[v.jsx(Ih,{size:10}),"OSM"]})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",i.length,")"]}),i.length>0?v.jsx("div",{className:"divide-y divide-border",children:i.map(h=>v.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:C3(h.snr)},children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),v.jsxs("div",{className:"text-right flex-shrink-0",children:[v.jsxs("div",{className:"text-xs font-mono",style:{color:C3(h.snr)},children:[h.snr.toFixed(1)," dB"]}),v.jsx("div",{className:"text-xs text-slate-500",children:P0e(h.snr)})]})]},h.node.node_num))}):v.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const T3=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function O0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function z0e(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function B0e(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function M3(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function F0e({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,i]=G.useState(""),[a,o]=G.useState("short_name"),[s,l]=G.useState("asc"),[u,c]=G.useState("all"),h=G.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>T3.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||M3(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(a){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,a,s,u]),f=g=>{a===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},d=({field:g})=>a!==g?null:s==="asc"?v.jsx(V$,{size:14,className:"inline ml-1"}):v.jsx(ll,{size:14,className:"inline ml-1"});return v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[v.jsxs("div",{className:"relative flex-1 max-w-xs",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>i(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(RM,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>v.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),v.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),v.jsxs("div",{className:"overflow-x-auto",children:[v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[v.jsx("th",{className:"w-8 px-3 py-2"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",v.jsx(d,{field:"short_name"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",v.jsx(d,{field:"role"})]}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[v.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",v.jsx(d,{field:"battery_level"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[v.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",v.jsx(d,{field:"last_heard"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",v.jsx(d,{field:"hardware"})]})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=T3.includes(g.role),y=g.node_num===t;return v.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[v.jsx("td",{className:"px-3 py-2",children:v.jsx("div",{className:`w-2 h-2 rounded-full ${O0e(g.last_heard)}`})}),v.jsxs("td",{className:"px-3 py-2",children:[v.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),v.jsx("td",{className:"px-3 py-2",children:v.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-cyan-400":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:M3(g.latitude)}),v.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:B0e(g)}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:z0e(g.last_heard)}),v.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&v.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&v.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function V0e(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState("topo"),[c,h]=G.useState(!0),[f,d]=G.useState(null);G.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([tY(),rY(),oY()]).then(([y,x,_])=>{t(y),n(x),a(_),h(!1)}).catch(y=>{d(y.message),h(!1)})},[]);const g=G.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=G.useCallback(y=>{s(y)},[]);return c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),v.jsxs("div",{className:"flex items-center bg-bg-card border border-border rounded-lg p-1",children:[v.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(dB,{size:14}),v.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),v.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(X$,{size:14}),v.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),v.jsxs("div",{className:"flex gap-0",children:[v.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?v.jsx(Qye,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):v.jsx(L0e,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),v.jsx(R0e,{node:g,edges:r,nodes:e,onSelectNode:m})]}),v.jsx(F0e,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function kL({label:e,value:t,onChange:r,helper:n,info:i,roleFilter:a,valueType:o="short_name"}){const[s,l]=G.useState([]),[u,c]=G.useState(!0),[h,f]=G.useState(""),[d,g]=G.useState(!1);G.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=G.useMemo(()=>{let S=s;if(a&&(S=S.filter(T=>a==="ROUTER"||a==="infrastructure"?T.is_infrastructure||T.role==="ROUTER"||T.role==="ROUTER_CLIENT"||T.role==="REPEATER":T.role===a)),h.trim()){const T=h.toLowerCase();S=S.filter(M=>{var A,P,I,N;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(T))||((P=M.long_name)==null?void 0:P.toLowerCase().includes(T))||((I=M.role)==null?void 0:I.toLowerCase().includes(T))||((N=M.node_id_hex)==null?void 0:N.toLowerCase().includes(T))})}return S.sort((T,M)=>(T.short_name||"").localeCompare(M.short_name||""))},[s,h,a]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const T=y(S);return t.includes(T)},_=S=>{const T=y(S);t.includes(T)?r(t.filter(M=>M!==T)):r([...t,T])},w=S=>{const T=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&T.push(`— ${S.long_name}`),S.role&&T.push(`(${S.role})`),T.join(" ")};return!u&&s.length===0?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),v.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(T=>T.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const T=s.find(M=>y(M)===S);return v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[T?T.short_name:S,v.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:v.jsx(ca,{size:14})})]},S)})}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),d&&!u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] rounded-lg shadow-xl",children:m.length===0?v.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>v.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LL(e){const[t,r]=G.useState([]),[n,i]=G.useState(!0);G.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),i(!1)}).catch(()=>{r([]),i(!1)})},[]);const a=f=>{const d=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${d?` (${d})`:""}`};if(!n&&t.length===0)return e.mode==="single"?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const d=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(d)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:d,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),v.jsxs("select",{value:f,onChange:_=>d(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&v.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>v.jsx("option",{value:_.index,children:a(_)},_.index))]}),m&&v.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(d=>d!==f)):s([...o,f].sort((d,g)=>d-g))};return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-2 space-y-1",children:[c.map(f=>v.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-sm text-slate-200",children:a(f)})]},f.index)),c.length===0&&v.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&v.jsx("p",{className:"text-xs text-slate-600",children:u})]})}const A3=[{key:"bot",label:"Bot",icon:O$},{key:"connection",label:"Connection",icon:t_},{key:"response",label:"Response",icon:OM},{key:"history",label:"History",icon:uB},{key:"memory",label:"Memory",icon:z$},{key:"context",label:"Context",icon:jM},{key:"commands",label:"Commands",icon:gB},{key:"llm",label:"LLM",icon:lB},{key:"weather",label:"Weather",icon:Du},{key:"meshmonitor",label:"MeshMonitor",icon:Di},{key:"knowledge",label:"Knowledge",icon:oB},{key:"mesh_sources",label:"Mesh Sources",icon:hB},{key:"mesh_intelligence",label:"Intelligence",icon:rf},{key:"dashboard",label:"Dashboard",icon:fB}],Fn={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},G0e=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"sub",description:"Subscribe to scheduled reports or alerts"},{name:"unsub",description:"Remove a subscription"},{name:"mysubs",description:"List your active subscriptions"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],W0e=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function eo({info:e,link:t,linkText:r="Learn more"}){const[n,i]=G.useState(!1),a=G.useRef(null);return G.useEffect(()=>{if(!n)return;function o(l){a.current&&!a.current.contains(l.target)&&i(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),v.jsxs("div",{className:"relative inline-block",ref:a,children:[v.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),i(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&v.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl text-xs text-slate-300 leading-relaxed",children:[v.jsx("button",{type:"button",onClick:()=>i(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(ca,{size:12})}),v.jsx("div",{className:"pr-4",children:e}),t&&v.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",v.jsx(Ih,{size:10})]})]})]})}function Vn({text:e}){return v.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function ct({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o="",infoLink:s=""}){const[l,u]=G.useState(!1),c=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(eo,{info:o,link:s})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&v.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function We({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s="",infoLink:l=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(eo,{info:s,link:l})]}),v.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function or({label:e,checked:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Ln({label:e,value:t,onChange:r,options:n,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>v.jsx("option",{value:s.value,children:s.label},s.value))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function H0e({label:e,value:t,onChange:r,rows:n=4,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function ou({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function U0e({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function sn({label:e,description:t,checked:r,onChange:n,threshold:i,onThresholdChange:a,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-3 space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("span",{className:"text-sm text-slate-300",children:e}),v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&i!==void 0&&a&&v.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[v.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),v.jsx("input",{type:"number",value:i,onChange:h=>a(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&v.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function Z0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.bot}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),v.jsx(ct,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."})]}),v.jsx(or,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),v.jsx(or,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function $0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.connection}),v.jsx(Ln,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?v.jsx(ct,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),placeholder:"/dev/ttyUSB0",helper:"Device path for your USB radio",info:"Usually /dev/ttyUSB0 on Linux or /dev/ttyACM0. Check with 'ls /dev/tty*' after plugging in your radio."}):v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),v.jsx(We,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]})]})}function Y0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.response}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),v.jsx(We,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),v.jsx(We,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function X0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.history}),v.jsx(ct,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),v.jsx(We,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),v.jsx(or,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),v.jsx(We,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.memory}),v.jsx(or,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),v.jsx(We,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function K0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.context}),v.jsx(or,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Observe Channels",value:e.observe_channels,onChange:r=>t({...e,observe_channels:r}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),v.jsx(kL,{label:"Ignore Nodes",value:e.ignore_nodes,onChange:r=>t({...e,ignore_nodes:r}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Age (sec)",value:e.max_age,onChange:r=>t({...e,max_age:r}),min:0,helper:"Ignore messages older than this"}),v.jsx(We,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})]})]})}function J0e({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(i=>i.toLowerCase())),n=i=>{const a=i.toLowerCase();r.has(a)?t({...e,disabled_commands:e.disabled_commands.filter(o=>o.toLowerCase()!==a)}):t({...e,disabled_commands:[...e.disabled_commands,i]})};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.commands}),v.jsx(or,{label:"Enable Commands",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Allow !commands on the mesh"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Command Prefix",value:e.prefix,onChange:i=>t({...e,prefix:i}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",v.jsx(eo,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),v.jsx("div",{className:"grid gap-1",children:G0e.map(i=>{const a=!r.has(i.name.toLowerCase());return v.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("code",{className:"text-accent text-sm",children:["!",i.name]}),v.jsx("span",{className:"text-xs text-slate-500",children:i.description})]}),v.jsx("button",{type:"button",onClick:()=>n(i.name),className:`relative w-9 h-5 rounded-full transition-colors ${a?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${a?"translate-x-4":""}`})})]},i.name)})})]})]})]})}function Q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.llm}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),v.jsx(ct,{label:"Model",value:e.model,onChange:r=>t({...e,model:r}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),v.jsx(ct,{label:"API Key",value:e.api_key,onChange:r=>t({...e,api_key:r}),type:"password",helper:"Supports ${ENV_VAR} syntax",info:"Your API key from the provider. You can also use ${ENV_VAR} syntax to read from an environment variable instead of storing the key in the config file."}),v.jsx(ct,{label:"Base URL",value:e.base_url,onChange:r=>t({...e,base_url:r}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Timeout (sec)",value:e.timeout,onChange:r=>t({...e,timeout:r}),min:5,max:120,helper:"Maximum seconds to wait for response"}),v.jsx(We,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:r=>t({...e,max_response_tokens:r}),min:100,helper:"Token limit for LLM responses"})]}),v.jsx(or,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:r=>t({...e,use_system_prompt:r}),helper:"Enable custom system instructions"}),e.use_system_prompt&&v.jsx(H0e,{label:"System Prompt",value:e.system_prompt,onChange:r=>t({...e,system_prompt:r}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),v.jsx(or,{label:"Web Search",checked:e.web_search,onChange:r=>t({...e,web_search:r}),helper:"Enable web search tool (Open WebUI feature)"}),v.jsx(or,{label:"Google Grounding",checked:e.google_grounding,onChange:r=>t({...e,google_grounding:r}),helper:"Ground responses in web search (Gemini only)"})]})}function exe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.weather}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),v.jsx(Ln,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),v.jsx(ct,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"})]})}function txe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.meshmonitor}),v.jsx(or,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),v.jsx(or,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function rxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.knowledge}),v.jsx(or,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),v.jsx(We,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),v.jsx(ct,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),v.jsx(We,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),v.jsx(or,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),v.jsx(ct,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),v.jsx(We,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function nxe({source:e,onChange:t,onDelete:r}){const[n,i]=G.useState(!1),a={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>i(!n),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[n?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),v.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),v.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),v.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),n&&v.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),v.jsx(Ln,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:a[e.type]||""})]}),e.type!=="mqtt"&&v.jsx(ct,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&v.jsx(ct,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),v.jsx(We,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),v.jsx(ct,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),v.jsx(ct,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),v.jsx(or,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),v.jsx(or,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function ixe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.mesh_sources}),e.map((n,i)=>v.jsx(nxe,{source:n,onChange:a=>{const o=[...e];o[i]=a,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((a,o)=>o!==i))}},i)),v.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Source"]})]})}function axe({data:e,onChange:t}){const[r,n]=G.useState(null);return v.jsxs("div",{className:"space-y-6",children:[v.jsx(Vn,{text:Fn.mesh_intelligence}),v.jsx(or,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Activate health scoring and alerting"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:i=>t({...e,locality_radius_miles:i}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),v.jsx(We,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:i=>t({...e,offline_threshold_hours:i}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Packet Threshold",value:e.packet_threshold,onChange:i=>t({...e,packet_threshold:i}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),v.jsx(We,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:i=>t({...e,battery_warning_percent:i}),min:1,max:100,helper:"Global battery warning level"})]}),v.jsx(kL,{label:"Critical Nodes",value:e.critical_nodes,onChange:i=>t({...e,critical_nodes:i}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(LL,{label:"Alert Channel",value:e.alert_channel,onChange:i=>t({...e,alert_channel:i}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),v.jsx(We,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:i=>t({...e,alert_cooldown_minutes:i}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",v.jsx(eo,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((i,a)=>v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===a?null:a),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[r===a?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("span",{className:"font-medium text-slate-200",children:i.name||"Unnamed Region"}),v.jsx("span",{className:"text-xs text-slate-500",children:i.local_name})]}),v.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${i.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==a);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),r===a&&v.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:i.name,onChange:o=>{const s=[...e.regions];s[a]={...i,name:o},t({...e,regions:s})}}),v.jsx(ct,{label:"Local Name",value:i.local_name,onChange:o=>{const s=[...e.regions];s[a]={...i,local_name:o},t({...e,regions:s})}})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Latitude",value:i.lat,onChange:o=>{const s=[...e.regions];s[a]={...i,lat:o},t({...e,regions:s})},step:1e-4}),v.jsx(We,{label:"Longitude",value:i.lon,onChange:o=>{const s=[...e.regions];s[a]={...i,lon:o},t({...e,regions:s})},step:1e-4})]}),v.jsx(ct,{label:"Description",value:i.description,onChange:o=>{const s=[...e.regions];s[a]={...i,description:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Aliases",value:i.aliases,onChange:o=>{const s=[...e.regions];s[a]={...i,aliases:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Cities",value:i.cities,onChange:o=>{const s=[...e.regions];s[a]={...i,cities:o},t({...e,regions:s})}})]})]},a)),v.jsxs("button",{onClick:()=>{const i={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,i]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Region"]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",v.jsx(eo,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),v.jsx(sn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_offline:i}})}),v.jsx(sn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:i}})}),v.jsx(sn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:i=>t({...e,alert_rules:{...e.alert_rules,new_router:i}})}),v.jsx(sn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:i}})}),v.jsx(sn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:i}})}),v.jsx(sn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),v.jsx(sn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning:i}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:i}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical:i}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:i}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:i}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:i}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:i}})}),v.jsx(sn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:i=>t({...e,alert_rules:{...e.alert_rules,power_source_change:i}})}),v.jsx(sn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:i=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),v.jsx(sn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:i=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:i}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:i}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),v.jsx(sn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood:i}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:i}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),v.jsx(sn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:i}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),v.jsx(sn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:i}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function oxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.dashboard}),v.jsx(or,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),v.jsx(We,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function sxe(){var I;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState("bot"),[o,s]=G.useState(!0),[l,u]=G.useState(!1),[c,h]=G.useState(null),[f,d]=G.useState(null),[g,m]=G.useState(!1),[y,x]=G.useState(!1),_=G.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error("Failed to fetch config");const D=await N.json();t(D),n(JSON.parse(JSON.stringify(D))),x(!1),h(null)}catch(N){h(N instanceof Error?N.message:"Unknown error")}finally{s(!1)}},[]);G.useEffect(()=>{document.title="Config — MeshAI",_()},[_]),G.useEffect(()=>{e&&r&&x(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const w=async()=>{if(e){u(!0),h(null),d(null);try{const N=e[i],D=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),O=await D.json();if(!D.ok)throw new Error(O.detail||"Save failed");d(`${i} saved successfully`),n(JSON.parse(JSON.stringify(e))),x(!1),O.restart_required&&(m(!0),hY(Array.isArray(O.changed_keys)?O.changed_keys:[])),setTimeout(()=>d(null),3e3)}catch(N){h(N instanceof Error?N.message:"Save failed")}finally{u(!1)}}},S=()=>{r&&(t(JSON.parse(JSON.stringify(r))),x(!1))},T=async()=>{try{await fetch("/api/restart",{method:"POST"}),m(!1),d("Restart initiated")}catch{h("Restart failed")}},M=(N,D)=>{e&&t({...e,[N]:D})};if(o)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const A=()=>{switch(i){case"bot":return v.jsx(Z0e,{data:e.bot,onChange:N=>M("bot",N)});case"connection":return v.jsx($0e,{data:e.connection,onChange:N=>M("connection",N)});case"response":return v.jsx(Y0e,{data:e.response,onChange:N=>M("response",N)});case"history":return v.jsx(X0e,{data:e.history,onChange:N=>M("history",N)});case"memory":return v.jsx(q0e,{data:e.memory,onChange:N=>M("memory",N)});case"context":return v.jsx(K0e,{data:e.context,onChange:N=>M("context",N)});case"commands":return v.jsx(J0e,{data:e.commands,onChange:N=>M("commands",N)});case"llm":return v.jsx(Q0e,{data:e.llm,onChange:N=>M("llm",N)});case"weather":return v.jsx(exe,{data:e.weather,onChange:N=>M("weather",N)});case"meshmonitor":return v.jsx(txe,{data:e.meshmonitor,onChange:N=>M("meshmonitor",N)});case"knowledge":return v.jsx(rxe,{data:e.knowledge,onChange:N=>M("knowledge",N)});case"mesh_sources":return v.jsx(ixe,{data:e.mesh_sources,onChange:N=>M("mesh_sources",N)});case"mesh_intelligence":return v.jsx(axe,{data:e.mesh_intelligence,onChange:N=>M("mesh_intelligence",N)});case"dashboard":return v.jsx(oxe,{data:e.dashboard,onChange:N=>M("dashboard",N)});default:return null}},P=((I=A3.find(N=>N.key===i))==null?void 0:I.label)||i;return v.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[v.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:A3.map(({key:N,label:D,icon:O})=>v.jsxs("button",{onClick:()=>a(N),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===N?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[v.jsx(O,{size:16}),v.jsx("span",{children:D}),y&&i===N&&v.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},N))}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center justify-between mb-6",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(vB,{size:20,className:"text-slate-500"}),v.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:P})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[y&&v.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[v.jsx(Jx,{size:14}),"Discard"]}),v.jsxs("button",{onClick:w,disabled:l||!y,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[l?v.jsx($v,{size:14,className:"animate-spin"}):v.jsx(zM,{size:14}),"Save"]})]})]}),g&&v.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30 rounded-lg",children:[v.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[v.jsx($a,{size:16}),v.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),v.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),c&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400",children:[v.jsx(ca,{size:16}),v.jsx("span",{className:"text-sm",children:c})]}),f&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 rounded-lg text-green-400",children:[v.jsx(Za,{size:16}),v.jsx("span",{className:"text-sm",children:f})]}),v.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:v.jsx("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:A()})})]})]})}function lxe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return v.jsxs("div",{className:"bg-bg-hover rounded-lg p-4",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),v.jsx("span",{className:"text-sm font-medium text-slate-200 uppercase",children:e.source})]}),v.jsx("span",{className:"text-xs text-slate-400",children:r})]}),v.jsxs("div",{className:"text-xs text-slate-500 space-y-1",children:[v.jsxs("div",{children:["Events: ",e.event_count]}),v.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&v.jsx("div",{className:"text-amber-500 truncate",children:e.last_error})]})]})}function uxe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Vo,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-amber-500/10",border:"border-amber-500",Icon:$a,color:"text-amber-500"}:{bg:"bg-blue-500/10",border:"border-blue-500",Icon:qx,color:"text-blue-500"},n=r.Icon;return v.jsx("div",{className:`p-3 rounded-lg ${r.bg} border-l-2 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:16,className:r.color}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-sm font-medium text-slate-200",children:e.event_type}),v.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${r.bg} ${r.color}`,children:e.severity})]}),v.jsx("div",{className:"text-sm text-slate-300",children:e.headline})]})]})})}function JH({value:e,onChange:t,disabled:r,centralDisabled:n}){const i="px-2 py-1 text-xs transition-colors";return v.jsxs("div",{className:`flex rounded border border-[#1e2a3a] overflow-hidden ${r?"opacity-40":""}`,children:[v.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${i} ${e==="native"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:"native"}),v.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${i} ${n?"text-slate-600 cursor-not-allowed":e==="central"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:"central"})]})}function cxe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:i,onFeedSource:a,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h}){const f=s||!o;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:e}),t&&v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"source"}),v.jsx(JH,{value:i,onChange:a,disabled:!r,centralDisabled:f})]}),v.jsx(or,{label:"",checked:r,onChange:n})]})]}),!l&&v.jsx("div",{className:"text-xs text-amber-400 bg-amber-500/10 rounded p-2",children:"API key not configured — contact admin"}),s&&v.jsx("div",{className:"text-[11px] text-slate-600",children:"Central not available for this adapter — native only"}),v.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&v.jsxs("div",{className:"pt-2 border-t border-[#1e2a3a] space-y-3",children:[v.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"Live status"}),u?v.jsx(lxe,{feed:u}):v.jsx("div",{className:"text-xs text-slate-600",children:"No status reported."}),c&&c.length>0&&v.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((d,g)=>v.jsx(uxe,{event:d},g))})]})]})}const hs={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0}},_S=[{key:"central",label:"Central",icon:K$,adapters:[]},{key:"weather",label:"Weather",icon:Du,adapters:["nws"]},{key:"fire",label:"Fire",icon:Xx,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:Di,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:$x,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:Kx,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:Qx,adapters:[]},{key:"mesh",label:"Mesh Health",icon:rf,adapters:[]}];function hxe(){var Lf,Nf;const[e,t]=G.useState(null),[r,n]=G.useState(""),[i,a]=G.useState(null),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(!1),[_,w]=G.useState("weather"),[S,T]=G.useState("nws"),[M,A]=G.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[P,I]=G.useState(""),[N,D]=G.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[O,R]=G.useState(""),[F,H]=G.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[W,V]=G.useState(""),[z,Z]=G.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[U,$]=G.useState(""),[Y,te]=G.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[ie,se]=G.useState(""),[le,Ee]=G.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[me,ye]=G.useState(""),[Me,pe]=G.useState({min_danger_level:3}),[Te,st]=G.useState(""),[ze,et]=G.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[lt,Et]=G.useState("");G.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var xe,Ut,Hn,ui,Gi,gl,ee,xt,pt,dt,ur,oo,rn,Be,Pf,If,Df,Ef,oc,jf,so,Rf,hg;try{const fg=await(await fetch("/api/config/environmental")).json();t(fg),n(JSON.stringify(fg));try{const Bt=await fetch("/api/adapter-config/wfigs");if(Bt.ok){const wt=await Bt.json(),Ft={allowed_incident_types:((xe=wt.allowed_incident_types)==null?void 0:xe.value)??["WF"],freshness_seconds:((Ut=wt.freshness_seconds)==null?void 0:Ut.value)??0,cooldown_seconds:((Hn=wt.cooldown_seconds)==null?void 0:Hn.value)??28800,broadcast_on_acres:((ui=wt.broadcast_on_acres)==null?void 0:ui.value)??!0,broadcast_on_contained:((Gi=wt.broadcast_on_contained)==null?void 0:Gi.value)??!0};A(Ft),I(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/fires");if(Bt.ok){const wt=await Bt.json(),Ft={digest_enabled:((gl=wt.digest_enabled)==null?void 0:gl.value)??!0,digest_schedule:((ee=wt.digest_schedule)==null?void 0:ee.value)??["06:00","18:00"],digest_timezone:((xt=wt.digest_timezone)==null?void 0:xt.value)??"America/Boise"};D(Ft),R(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/tomtom_incidents");if(Bt.ok){const wt=await Bt.json(),Ft={min_magnitude:((pt=wt.min_magnitude)==null?void 0:pt.value)??4,drop_non_present:((dt=wt.drop_non_present)==null?void 0:dt.value)??!0,drop_zero_magnitude:((ur=wt.drop_zero_magnitude)==null?void 0:ur.value)??!0};H(Ft),V(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/itd_511");if(Bt.ok){const wt=await Bt.json(),Ft={min_severity:((oo=wt.min_severity)==null?void 0:oo.value)??"None",enabled_categories:((rn=wt.enabled_categories)==null?void 0:rn.value)??["incident","closure"],enabled_sub_types:((Be=wt.enabled_sub_types)==null?void 0:Be.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ft),$(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/wzdx");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast:((Pf=wt.broadcast)==null?void 0:Pf.value)??!1,min_severity:((If=wt.min_severity)==null?void 0:If.value)??"Minor",sub_types:((Df=wt.sub_types)==null?void 0:Df.value)??["road_works","lane_closed","road_closed"]};te(Ft),se(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/nws");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast_severities:((Ef=wt.broadcast_severities)==null?void 0:Ef.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((oc=wt.duplicate_allowed_after_seconds)==null?void 0:oc.value)??3600};Ee(Ft),ye(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/avalanche");if(Bt.ok){const Ft={min_danger_level:((jf=(await Bt.json()).min_danger_level)==null?void 0:jf.value)??3};pe(Ft),st(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/swpc");if(Bt.ok){const wt=await Bt.json(),Ft={geomag_kp_floor:((so=wt.geomag_kp_floor)==null?void 0:so.value)??7,flare_class_floor:((Rf=wt.flare_class_floor)==null?void 0:Rf.value)??"X1",proton_pfu_floor:((hg=wt.proton_pfu_floor)==null?void 0:hg.value)??10};et(Ft),Et(JSON.stringify(Ft))}}catch{}}catch(Of){d(Of instanceof Error?Of.message:"Failed to load config")}finally{u(!1)}})()},[]),G.useEffect(()=>{const xe=async()=>{try{a(await xB()),s(await _B())}catch{}};xe();const Ut=setInterval(xe,3e4);return()=>clearInterval(Ut)},[]);const lr=e!==null&&JSON.stringify(e)!==r,Mr=JSON.stringify(M)!==P,Gn=JSON.stringify(N)!==O,Wn=JSON.stringify(F)!==W,io=JSON.stringify(z)!==U,Af=JSON.stringify(Y)!==ie,ng=JSON.stringify(le)!==me,ig=JSON.stringify(Me)!==Te,ac=JSON.stringify(ze)!==lt,ag=lr||Mr||Gn||Wn||io||Af||ng||ig||ac,jt=async(xe,Ut,Hn)=>{const ui=await fetch(`/api/adapter-config/${xe}/${Ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Hn})});if(!ui.ok){const Gi=await ui.json().catch(()=>({}));throw new Error(Gi.detail||`Failed to save ${xe}.${Ut}`)}},$_=async()=>{if(e){h(!0),d(null),m(null);try{if(lr){const xe=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Ut=await xe.json();if(!xe.ok)throw new Error(Ut.detail||"Save failed");n(JSON.stringify(e)),Ut.restart_required&&x(!0)}if(Mr){const xe=JSON.parse(P);M.freshness_seconds!==xe.freshness_seconds&&await jt("wfigs","freshness_seconds",M.freshness_seconds),JSON.stringify(M.allowed_incident_types)!==JSON.stringify(xe.allowed_incident_types)&&await jt("wfigs","allowed_incident_types",M.allowed_incident_types),M.cooldown_seconds!==xe.cooldown_seconds&&await jt("wfigs","cooldown_seconds",M.cooldown_seconds),M.broadcast_on_acres!==xe.broadcast_on_acres&&await jt("wfigs","broadcast_on_acres",M.broadcast_on_acres),M.broadcast_on_contained!==xe.broadcast_on_contained&&await jt("wfigs","broadcast_on_contained",M.broadcast_on_contained),I(JSON.stringify(M))}if(Gn){const xe=JSON.parse(O);N.digest_enabled!==xe.digest_enabled&&await jt("fires","digest_enabled",N.digest_enabled),JSON.stringify(N.digest_schedule)!==JSON.stringify(xe.digest_schedule)&&await jt("fires","digest_schedule",N.digest_schedule),N.digest_timezone!==xe.digest_timezone&&await jt("fires","digest_timezone",N.digest_timezone),R(JSON.stringify(N))}if(Wn){const xe=JSON.parse(W);F.min_magnitude!==xe.min_magnitude&&await jt("tomtom_incidents","min_magnitude",F.min_magnitude),F.drop_non_present!==xe.drop_non_present&&await jt("tomtom_incidents","drop_non_present",F.drop_non_present),F.drop_zero_magnitude!==xe.drop_zero_magnitude&&await jt("tomtom_incidents","drop_zero_magnitude",F.drop_zero_magnitude),V(JSON.stringify(F))}if(io){const xe=JSON.parse(U);z.min_severity!==xe.min_severity&&await jt("itd_511","min_severity",z.min_severity),JSON.stringify(z.enabled_categories)!==JSON.stringify(xe.enabled_categories)&&await jt("itd_511","enabled_categories",z.enabled_categories),JSON.stringify(z.enabled_sub_types)!==JSON.stringify(xe.enabled_sub_types)&&await jt("itd_511","enabled_sub_types",z.enabled_sub_types),$(JSON.stringify(z))}if(Af){const xe=JSON.parse(ie);Y.broadcast!==xe.broadcast&&await jt("wzdx","broadcast",Y.broadcast),Y.min_severity!==xe.min_severity&&await jt("wzdx","min_severity",Y.min_severity),JSON.stringify(Y.sub_types)!==JSON.stringify(xe.sub_types)&&await jt("wzdx","sub_types",Y.sub_types),se(JSON.stringify(Y))}if(ng){const xe=JSON.parse(me);JSON.stringify(le.broadcast_severities)!==JSON.stringify(xe.broadcast_severities)&&await jt("nws","broadcast_severities",le.broadcast_severities),le.duplicate_allowed_after_seconds!==xe.duplicate_allowed_after_seconds&&await jt("nws","duplicate_allowed_after_seconds",le.duplicate_allowed_after_seconds),ye(JSON.stringify(le))}if(ig){const xe=JSON.parse(Te);Me.min_danger_level!==xe.min_danger_level&&await jt("avalanche","min_danger_level",Me.min_danger_level),st(JSON.stringify(Me))}if(ac){const xe=JSON.parse(lt);ze.geomag_kp_floor!==xe.geomag_kp_floor&&await jt("swpc","geomag_kp_floor",ze.geomag_kp_floor),ze.flare_class_floor!==xe.flare_class_floor&&await jt("swpc","flare_class_floor",ze.flare_class_floor),ze.proton_pfu_floor!==xe.proton_pfu_floor&&await jt("swpc","proton_pfu_floor",ze.proton_pfu_floor),Et(JSON.stringify(ze))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(xe){d(xe instanceof Error?xe.message:"Save failed")}finally{h(!1)}}},og=()=>{e&&t(JSON.parse(r)),A(JSON.parse(P||JSON.stringify(M))),D(JSON.parse(O||JSON.stringify(N))),H(JSON.parse(W||JSON.stringify(F))),Z(JSON.parse(U||JSON.stringify(z))),te(JSON.parse(ie||JSON.stringify(Y))),Ee(JSON.parse(me||JSON.stringify(le))),pe(JSON.parse(Te||JSON.stringify(Me))),et(JSON.parse(lt||JSON.stringify(ze)))},sg=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{d("Restart failed")}},Ue=xe=>e&&t({...e,...xe});if(l)return v.jsx("div",{className:"flex items-center justify-center h-64 text-slate-400",children:"Loading environmental config…"});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const lg=xe=>i==null?void 0:i.feeds.find(Ut=>Ut.source===hs[xe].health),kf=xe=>o.filter(Ut=>Ut.source===hs[xe].health),ao=_S.find(xe=>xe.key===_),tn=ao.adapters.length===0?null:S&&ao.adapters.includes(S)?S:ao.adapters[0],pl=xe=>{var Ut,Hn,ui,Gi,gl;switch(xe){case"nws":return v.jsxs(v.Fragment,{children:[v.jsx(ou,{label:"NWS Zones",value:e.nws_zones,onChange:ee=>Ue({nws_zones:ee}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),e.nws.feed_source!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"User Agent",value:e.nws.user_agent,onChange:ee=>Ue({nws:{...e.nws,user_agent:ee}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:ee=>Ue({nws:{...e.nws,tick_seconds:ee}}),min:30}),v.jsx(Ln,{label:"Min Severity",value:e.nws.severity_min,onChange:ee=>Ue({nws:{...e.nws,severity_min:ee}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsxs("div",{className:"mb-3",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Severities to broadcast"}),v.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:le.broadcast_severities.includes(ee),onChange:xt=>{const pt=le.broadcast_severities;Ee({...le,broadcast_severities:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:ee})]},ee))})]}),v.jsx(We,{label:"Re-broadcast Cooldown (seconds)",value:le.duplicate_allowed_after_seconds,onChange:ee=>Ee({...le,duplicate_allowed_after_seconds:ee}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return v.jsx("div",{className:"space-y-6",children:v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Thresholds"}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ln,{label:"Geomag Kp Floor",value:String(ze.geomag_kp_floor),onChange:ee=>et({...ze,geomag_kp_floor:Number(ee)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),v.jsx(Ln,{label:"Flare Class Floor",value:ze.flare_class_floor,onChange:ee=>et({...ze,flare_class_floor:ee}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),v.jsx(Ln,{label:"Proton pfu Floor",value:String(ze.proton_pfu_floor),onChange:ee=>et({...ze,proton_pfu_floor:Number(ee)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:ee=>Ue({ducting:{...e.ducting,tick_seconds:ee}}),min:60}),v.jsx(We,{label:"Latitude",value:e.ducting.latitude,onChange:ee=>Ue({ducting:{...e.ducting,latitude:ee}}),step:.01}),v.jsx(We,{label:"Longitude",value:e.ducting.longitude,onChange:ee=>Ue({ducting:{...e.ducting,longitude:ee}}),step:.01})]});case"fires":return v.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:ee=>Ue({fires:{...e.fires,tick_seconds:ee}}),min:60}),v.jsx(Ln,{label:"State",value:e.fires.state,onChange:ee=>Ue({fires:{...e.fires,state:ee}}),options:W0e})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Incident Types"}),v.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([ee,xt])=>{var pt;return v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:((pt=M.allowed_incident_types)==null?void 0:pt.includes(ee))??ee==="WF",onChange:dt=>{const ur=M.allowed_incident_types??["WF"];A({...M,allowed_incident_types:dt.target.checked?[...ur,ee]:ur.filter(oo=>oo!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee)})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Triggers"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast on acres increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_acres,onChange:ee=>A({...M,broadcast_on_acres:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast on containment increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_contained,onChange:ee=>A({...M,broadcast_on_contained:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Update Cooldown (hours)",value:Math.round(M.cooldown_seconds/3600),onChange:ee=>A({...M,cooldown_seconds:ee*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),v.jsx(We,{label:"Freshness Window (hours)",value:Math.round(M.freshness_seconds/3600),onChange:ee=>A({...M,freshness_seconds:ee*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return v.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:ee=>Ue({avalanche:{...e.avalanche,tick_seconds:ee}}),min:60}),v.jsx(U0e,{label:"Season Months",value:e.avalanche.season_months,onChange:ee=>Ue({avalanche:{...e.avalanche,season_months:ee}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),v.jsx(ou,{label:"Center IDs",value:e.avalanche.center_ids,onChange:ee=>Ue({avalanche:{...e.avalanche,center_ids:ee}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Settings"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Ln,{label:"Min Danger Level",value:String(Me.min_danger_level),onChange:ee=>pe({...Me,min_danger_level:Number(ee)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return v.jsxs(v.Fragment,{children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:ee=>Ue({usgs:{...e.usgs,tick_seconds:ee}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),v.jsx(ou,{label:"Site IDs",value:e.usgs.sites,onChange:ee=>Ue({usgs:{...e.usgs,sites:ee}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"})]});case"usgs_quake":return v.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,tick_seconds:ee}}),min:60}),v.jsx(ct,{label:"Region Tag",value:e.usgs_quake.region,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,region:ee}})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Magnitude Thresholds"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,global_mag_floor:ee}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),v.jsx(We,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_mag_floor:ee}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),v.jsx(We,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_radius_mi:ee}}),min:50,helper:"Radius around region centroid for reduced floor"}),v.jsx(We,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,escalate_mag_floor:ee}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"PAGER Alert Levels"}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),v.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(ee),onChange:xt=>{const pt=e.usgs_quake.broadcast_pager_alerts??[];Ue({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)}})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300 capitalize",children:ee})]},ee))})]})]});case"traffic":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"API Key",value:e.traffic.api_key,onChange:ee=>Ue({traffic:{...e.traffic,api_key:ee}}),type:"password",helper:"developer.tomtom.com"}),v.jsx(We,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:ee=>Ue({traffic:{...e.traffic,tick_seconds:ee}}),min:60}),v.jsx("div",{className:"text-xs text-slate-500 mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((ee,xt)=>v.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[v.jsx(ct,{label:"Name",value:ee.name,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,name:pt},Ue({traffic:{...e.traffic,corridors:dt}})}}),v.jsx(We,{label:"Lat",value:ee.lat,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lat:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx(We,{label:"Lon",value:ee.lon,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lon:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((pt,dt)=>dt!==xt)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30 rounded",children:"Remove"})]},xt)),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Minimum Magnitude"}),v.jsxs("select",{value:F.min_magnitude,onChange:ee=>H({...F,min_magnitude:parseInt(ee.target.value)}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:1,children:"1 — Minor (all)"}),v.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),v.jsx("option",{value:3,children:"3 — Major (orange+)"}),v.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),v.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Drop TomTom incidents below this severity level"})]})}),v.jsxs("div",{className:"mt-3 space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Drop non-present time validity"}),v.jsx("input",{type:"checkbox",checked:F.drop_non_present,onChange:ee=>H({...F,drop_non_present:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Drop zero-magnitude events"}),v.jsx("input",{type:"checkbox",checked:F.drop_zero_magnitude,onChange:ee=>H({...F,drop_zero_magnitude:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]})]})]})]});case"roads511":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:e.roads511.base_url,onChange:ee=>Ue({roads511:{...e.roads511,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:e.roads511.api_key,onChange:ee=>Ue({roads511:{...e.roads511,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:ee=>Ue({roads511:{...e.roads511,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:e.roads511.endpoints,onChange:ee=>Ue({roads511:{...e.roads511,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.roads511.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.roads511.bbox||[0,0,0,0]];ur[xt]=dt,Ue({roads511:{...e.roads511,bbox:ur}})},step:.01},ee)})}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Minimum Severity"}),v.jsxs("select",{value:z.min_severity,onChange:ee=>Z({...z,min_severity:ee.target.value}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]}),v.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Drop ITD 511 events below this severity"})]})}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Categories"}),v.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_categories.includes(ee),onChange:pt=>{const dt=z.enabled_categories;Z({...z,enabled_categories:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Sub-types"}),v.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_sub_types.includes(ee),onChange:pt=>{const dt=z.enabled_sub_types;Z({...z,enabled_sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]})]})]});case"wzdx":return v.jsxs(v.Fragment,{children:[((Ut=e.wzdx)==null?void 0:Ut.feed_source)!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:((Hn=e.wzdx)==null?void 0:Hn.base_url)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:((ui=e.wzdx)==null?void 0:ui.api_key)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:((Gi=e.wzdx)==null?void 0:Gi.tick_seconds)??300,onChange:ee=>Ue({wzdx:{...e.wzdx,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:((gl=e.wzdx)==null?void 0:gl.endpoints)??["/get/event"],onChange:ee=>Ue({wzdx:{...e.wzdx,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt,dt;return v.jsx(We,{label:ee,value:((dt=(pt=e.wzdx)==null?void 0:pt.bbox)==null?void 0:dt[xt])??0,onChange:ur=>{var rn;const oo=[...((rn=e.wzdx)==null?void 0:rn.bbox)||[0,0,0,0]];oo[xt]=ur,Ue({wzdx:{...e.wzdx,bbox:oo}})},step:.01},ee)})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Bounding box [W,S,E,N] geographic filter"})]}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Settings"}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast work zone events"}),v.jsx("input",{type:"checkbox",checked:Y.broadcast,onChange:ee=>te({...Y,broadcast:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),Y.broadcast?v.jsxs("div",{className:"space-y-3 mt-3",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Min Severity"}),v.jsxs("select",{value:Y.min_severity,onChange:ee=>te({...Y,min_severity:ee.target.value}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Sub-types"}),v.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:Y.sub_types.includes(ee),onChange:pt=>{const dt=Y.sub_types;te({...Y,sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]})]}):v.jsxs("p",{className:"text-xs text-slate-500 mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"MAP Key",value:e.firms.map_key,onChange:ee=>Ue({firms:{...e.firms,map_key:ee}}),type:"password",helper:"firms.modaps.eosdis.nasa.gov/api/area/",infoLink:"https://firms.modaps.eosdis.nasa.gov/api/area/"}),v.jsx(We,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:ee=>Ue({firms:{...e.firms,tick_seconds:ee}}),min:300}),v.jsx(Ln,{label:"Satellite Source",value:e.firms.source,onChange:ee=>Ue({firms:{...e.firms,source:ee}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Day Range",value:e.firms.day_range,onChange:ee=>Ue({firms:{...e.firms,day_range:ee}}),min:1,max:10}),v.jsx(Ln,{label:"Min Confidence",value:e.firms.confidence_min,onChange:ee=>Ue({firms:{...e.firms,confidence_min:ee}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),v.jsx(We,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:ee=>Ue({firms:{...e.firms,proximity_km:ee}}),step:.5})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.firms.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.firms.bbox||[0,0,0,0]];ur[xt]=dt,Ue({firms:{...e.firms,bbox:ur}})},step:.01},ee)})})]})}},ug=e,cg=(xe,Ut)=>{const Hn=e[xe]||{};Ue({[xe]:{...Hn,...Ut}})};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h1",{className:"text-xl font-semibold text-slate-200",children:"Environment"}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(or,{label:"Feeds Enabled",checked:e.enabled,onChange:xe=>Ue({enabled:xe})}),ag&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:og,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 border border-border rounded",children:[v.jsx(Jx,{size:14})," Discard"]}),v.jsxs("button",{onClick:$_,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white rounded disabled:opacity-50",children:[v.jsx(zM,{size:14})," ",c?"Saving…":"Save"]})]})]})]}),f&&v.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3",children:f}),g&&v.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 rounded p-3",children:g}),y&&v.jsxs("div",{className:"flex items-center justify-between text-sm text-amber-400 bg-amber-500/10 border border-amber-500/30 rounded p-3",children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx($v,{size:14})," A restart is required for some changes to take effect."]}),v.jsx("button",{onClick:sg,className:"px-3 py-1 bg-amber-500/20 hover:bg-amber-500/30 rounded",children:"Restart now"})]}),v.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:_S.map(({key:xe,label:Ut,icon:Hn})=>v.jsxs("button",{onClick:()=>{w(xe);const ui=_S.find(Gi=>Gi.key===xe);T(ui.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===xe?"border-accent text-accent":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Hn,{size:15})," ",Ut]},xe))}),_==="central"&&e.central&&v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Central Connection"}),v.jsx("p",{className:"text-xs text-slate-600",children:'NATS JetStream source for any adapter set to "central"'})]}),v.jsx(or,{label:"",checked:!!e.central.enabled,onChange:xe=>Ue({central:{...e.central,enabled:xe}})})]}),v.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[v.jsx(ct,{label:"URL",value:e.central.url||"",onChange:xe=>Ue({central:{...e.central,url:xe}}),placeholder:"nats://central.echo6.mesh:4222"}),v.jsx(ct,{label:"Durable",value:e.central.durable||"",onChange:xe=>Ue({central:{...e.central,durable:xe}}),placeholder:"meshai-v04"}),v.jsx(ct,{label:"Region",value:e.central.region||"",onChange:xe=>Ue({central:{...e.central,region:xe}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="tracking"&&v.jsxs("div",{className:"flex flex-col items-center justify-center h-[40vh] text-center",children:[v.jsx(Qx,{size:32,className:"text-slate-600 mb-4"}),v.jsx("p",{className:"text-slate-500 max-w-md",children:"No adapters yet. ADS-B / AIS / satellite passes are planned for v0.5."})]}),_==="mesh"&&v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Mesh Health"}),v.jsx("p",{className:"text-xs text-slate-600",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"source"}),v.jsx(JH,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),v.jsx("div",{className:"text-[11px] text-slate-600",children:"Central not available — reserved for a future migration."})]}),ao.adapters.length>0&&tn&&v.jsxs(v.Fragment,{children:[ao.adapters.length>1&&v.jsx("div",{className:"flex gap-1",children:ao.adapters.map(xe=>v.jsx("button",{onClick:()=>T(xe),className:`px-3 py-1.5 text-sm rounded ${tn===xe?"bg-bg-hover text-slate-100":"text-slate-400 hover:text-slate-200"}`,children:hs[xe].label},xe))}),v.jsx(cxe,{title:hs[tn].label,subtitle:hs[tn].subtitle,enabled:((Lf=ug[tn])==null?void 0:Lf.enabled)??!1,onEnabled:xe=>cg(tn,{enabled:xe}),feedSource:((Nf=ug[tn])==null?void 0:Nf.feed_source)??"native",onFeedSource:xe=>cg(tn,{feed_source:xe}),hasCentral:hs[tn].hasCentral,nativeOnly:hs[tn].nativeOnly,hasKey:hs[tn].hasKey,health:lg(tn),events:kf(tn),children:pl(tn)})]})]})}const k3={infra_offline:mB,infra_recovery:t_,battery_warning:Z1,battery_critical:Z1,battery_emergency:Z1,hf_blackout:Dh,uhf_ducting:Di,weather_warning:Du,weather_watch:Du,new_router:Di,packet_flood:$a,sustained_high_util:$a,region_blackout:Vo,default:Zv};function fxe(e){return k3[e]||k3.default}function QH(e){switch(e==null?void 0:e.toLowerCase()){case"immediate":return{bg:"bg-red-500/10",border:"border-red-500",badge:"bg-red-500/20 text-red-400",iconColor:"text-red-500"};case"priority":return{bg:"bg-amber-500/10",border:"border-amber-500",badge:"bg-amber-500/20 text-amber-400",iconColor:"text-amber-500"};case"routine":default:return{bg:"bg-blue-500/10",border:"border-blue-500",badge:"bg-blue-500/20 text-blue-400",iconColor:"text-blue-500"}}}function dxe(e){const t=typeof e=="number"?new Date(e*1e3):new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24);return i<60?"Just now":a<60?`${a}m ago`:o<24?`${o}h ago`:`${s}d ago`}function vxe(e){return(typeof e=="number"?new Date(e*1e3):new Date(e)).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function pxe(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d`}function gxe({alert:e,onAcknowledge:t}){var i;const r=QH(e.severity),n=fxe(e.type);return v.jsx("div",{className:`p-4 rounded-lg ${r.bg} border-l-4 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:20,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.badge}`,children:(i=e.severity)==null?void 0:i.toUpperCase()}),v.jsx("span",{className:"text-xs text-slate-500",children:e.type})]}),v.jsx("div",{className:"text-sm text-slate-200",children:e.message}),v.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(Iu,{size:12}),e.timestamp?dxe(e.timestamp):"Just now"]}),e.scope_value&&v.jsxs("span",{children:[e.scope_type,": ",e.scope_value]})]})]}),v.jsx("button",{onClick:()=>t(e),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200 border border-border rounded hover:bg-bg-hover transition-colors",children:"Acknowledge"})]})})}function mxe({history:e,typeFilter:t,severityFilter:r,onTypeFilterChange:n,onSeverityFilterChange:i,page:a,totalPages:o,onPageChange:s}){const l=["all","infra_offline","infra_recovery","battery_warning","battery_critical","hf_blackout","uhf_ducting","weather_warning","new_router","packet_flood"],u=["all","immediate","priority","routine"];return v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg",children:[v.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(RM,{size:14,className:"text-slate-400"}),v.jsx("span",{className:"text-sm text-slate-400",children:"Filter:"})]}),v.jsx("select",{value:t,onChange:c=>n(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-blue-500",children:l.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Types":c.replace(/_/g," ")},c))}),v.jsx("select",{value:r,onChange:c=>i(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-blue-500",children:u.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Severities":c.charAt(0).toUpperCase()+c.slice(1)},c))})]}),v.jsx("div",{className:"overflow-x-auto",children:v.jsxs("table",{className:"w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"border-b border-border",children:[v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Time"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Type"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Severity"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Message"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Duration"})]})}),v.jsx("tbody",{children:e.length>0?e.map((c,h)=>{const f=QH(c.severity);return v.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover",children:[v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono whitespace-nowrap",children:vxe(c.timestamp)}),v.jsx("td",{className:"p-4 text-sm text-slate-300",children:c.type.replace(/_/g," ")}),v.jsx("td",{className:"p-4",children:v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f.badge}`,children:c.severity})}),v.jsx("td",{className:"p-4 text-sm text-slate-200 max-w-md truncate",children:c.message}),v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono",children:c.duration?pxe(c.duration):"-"})]},c.id||h)}):v.jsx("tr",{children:v.jsx("td",{colSpan:5,className:"p-8 text-center text-slate-500",children:"No alert history available"})})})]})}),o>1&&v.jsxs("div",{className:"p-4 border-t border-border flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm text-slate-400",children:["Page ",a," of ",o]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:()=>s(a-1),disabled:a<=1,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(F$,{size:16})}),v.jsx("button",{onClick:()=>s(a+1),disabled:a>=o,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(Js,{size:16})})]})]})]})}function yxe({subscription:e,nodes:t}){const r=o=>{const s=t.find(l=>l.node_id_hex===o||String(l.node_num)===o||l.short_name===o);return s?s.long_name&&s.long_name!==s.short_name?`${s.short_name} (${s.long_name})`:s.short_name:o},n=()=>{if(e.sub_type==="alerts")return"Real-time";const o=e.schedule_time||"0000",s=parseInt(o.slice(0,2)),l=o.slice(2),u=s>=12?"PM":"AM";let h=`${s%12||12}:${l} ${u}`;return e.sub_type==="weekly"&&e.schedule_day&&(h+=` ${e.schedule_day.charAt(0).toUpperCase()}${e.schedule_day.slice(1)}`),h},a=(()=>{switch(e.sub_type){case"alerts":return Zv;case"daily":return Iu;case"weekly":return Iu;default:return Zv}})();return v.jsx("div",{className:"p-4 rounded-lg bg-bg-hover border border-border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:v.jsx(a,{size:18,className:"text-blue-400"})}),v.jsxs("div",{className:"flex-1",children:[v.jsxs("div",{className:"text-sm text-slate-200 font-medium",children:[e.sub_type.charAt(0).toUpperCase()+e.sub_type.slice(1),e.scope_type!=="mesh"&&e.scope_value&&v.jsxs("span",{className:"text-slate-400 font-normal ml-2",children:["(",e.scope_type,": ",e.scope_value,")"]})]}),v.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[n()," • ",r(e.user_id)]})]}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`})]})})}function xxe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(null),[f,d]=G.useState("all"),[g,m]=G.useState("all"),[y,x]=G.useState(1),[_,w]=G.useState(1),S=20,[T,M]=G.useState(new Set),{lastAlert:A}=FM();G.useEffect(()=>{document.title="Alerts — MeshAI"},[]),G.useEffect(()=>{Promise.all([yB().catch(()=>[]),OP(S,0).catch(()=>({items:[],total:0})),iY().catch(()=>[]),fetch("/api/nodes").then(N=>N.json()).catch(()=>[])]).then(([N,D,O,R])=>{t(N),Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S))),a(O),s(R),u(!1)}).catch(N=>{h(N.message),u(!1)})},[]),G.useEffect(()=>{A&&t(N=>N.some(O=>O.type===A.type&&O.message===A.message)?N:[A,...N])},[A]),G.useEffect(()=>{const N=(y-1)*S;OP(S,N,f,g).then(D=>{Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S)))}).catch(()=>{})},[y,f,g]);const P=G.useCallback(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;M(O=>new Set([...O,D]))},[]),I=e.filter(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;return!T.has(D)});return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading alerts..."})}):c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",c]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx($a,{size:14}),"Active Alerts (",I.length,")"]}),I.length>0?v.jsx("div",{className:"space-y-3",children:I.map((N,D)=>v.jsx(gxe,{alert:N,onAcknowledge:P},`${N.type}-${N.timestamp}-${D}`))}):v.jsxs("div",{className:"flex items-center gap-2 text-slate-500 py-8",children:[v.jsx(EM,{size:20,className:"text-green-500"}),v.jsx("span",{children:"No active alerts — all systems nominal"})]})]}),v.jsxs("div",{children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Iu,{size:14}),"Alert History"]}),v.jsx(mxe,{history:r,typeFilter:f,severityFilter:g,onTypeFilterChange:N=>{d(N),x(1)},onSeverityFilterChange:N=>{m(N),x(1)},page:y,totalPages:_,onPageChange:x})]}),v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Q$,{size:14}),"Mesh Subscriptions (",i.length,")"]}),i.length>0?v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.map(N=>v.jsx(yxe,{subscription:N,nodes:o},N.id))}):v.jsxs("div",{className:"text-slate-500 py-4",children:[v.jsx("p",{children:"No active subscriptions."}),v.jsxs("p",{className:"text-xs mt-2",children:["Manage subscriptions via ",v.jsx("code",{className:"text-blue-400",children:"!subscribe"})," on mesh. Broadcasts arrive with one of three prefixes — ",v.jsx("strong",{children:"New:"})," (first sight), ",v.jsx("strong",{children:"Update:"})," (material change), or ",v.jsx("strong",{children:"Active:"})," (clock-driven reminder while the event is still live). See ",v.jsx("a",{href:"/reference#broadcast-types",className:"text-blue-400 hover:underline",children:"Broadcast Types"})," and ",v.jsx("a",{href:"/reference#reminders",className:"text-blue-400 hover:underline",children:"Reminder System"})," in Reference."]})]})]})]})}const Hy=[{value:"routine",label:"Routine",description:"Informational, no time pressure (ducting, new node, weather advisory, battery declining)"},{value:"priority",label:"Priority",description:"Needs attention soon (severe weather, fire nearby, node offline, HF blackout)"},{value:"immediate",label:"Immediate",description:"Act now, drop everything (fire at infrastructure, extreme weather, region blackout)"}],L3=[{id:"mesh_health",name:"Mesh Health Monitoring",description:"Infrastructure problems - offline nodes, low battery, channel congestion",rule:{name:"Mesh Health Monitoring",enabled:!0,trigger_type:"condition",categories:["infra_offline","critical_node_down","infra_recovery","battery_warning","battery_critical","battery_emergency","high_utilization","packet_flood","mesh_score_low"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"weather_fire",name:"Weather & Fire Alerts",description:"Environmental threats - severe weather, nearby wildfires, new ignitions, flooding",rule:{name:"Weather & Fire Alerts",enabled:!0,trigger_type:"condition",categories:["weather_warning","fire_proximity","new_ignition","stream_flood_warning"],min_severity:"priority",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:15,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"rf_conditions",name:"RF Conditions",description:"Propagation changes - solar events, HF blackouts, tropospheric ducting",rule:{name:"RF Conditions",enabled:!0,trigger_type:"condition",categories:["hf_blackout","tropospheric_ducting","geomagnetic_storm"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:60,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"road_traffic",name:"Road & Traffic",description:"Road closures and severe congestion",rule:{name:"Road & Traffic",enabled:!0,trigger_type:"condition",categories:["road_closure","traffic_congestion"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"everything_critical",name:"Everything Critical",description:"All emergency-level events regardless of type",rule:{name:"Everything Critical",enabled:!0,trigger_type:"condition",categories:[],min_severity:"immediate",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:5,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"morning_briefing",name:"Morning Briefing",description:"Daily health and conditions summary at 7am",rule:{name:"Morning Briefing",enabled:!0,trigger_type:"schedule",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"mesh_health_summary",custom_message:"",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}}];function uy(e){if(!e)return"Never";const r=Date.now()/1e3-e;return r<60?"Just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Ai({info:e}){const[t,r]=G.useState(!1);return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),v.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function xs({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o=""}){const[s,l]=G.useState(!1),u=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(Ai,{info:o})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&v.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Mp({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(Ai,{info:s})]}),v.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Lx({label:e,checked:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(Ai,{info:i})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Mv({label:e,value:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(Ai,{info:i})]}),v.jsx("input",{type:"time",value:t,onChange:a=>r(a.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Uy({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:i="",info:a=""}){const[o,s]=G.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(Ai,{info:a})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),v.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:v.jsx(af,{size:16})})]}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,v.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:v.jsx(ca,{size:14})})]},h))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function eU({value:e,onChange:t}){const[r,n]=G.useState(!1),i=Hy.find(a=>a.value===e)||Hy[0];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Severity Threshold",v.jsx(Ai,{info:"Only alerts at or above this severity trigger this rule. ROUTINE = informational, PRIORITY = needs attention, IMMEDIATE = act now."})]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{type:"button",onClick:()=>n(!r),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-left flex items-center justify-between hover:border-accent transition-colors",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-slate-200",children:i.label}),v.jsxs("span",{className:"text-slate-500 ml-2",children:["- ",i.description]})]}),v.jsx(ll,{size:16,className:`text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>n(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-[#0a0e17] border border-[#1e2a3a] rounded-lg shadow-xl overflow-hidden",children:Hy.map(a=>v.jsxs("button",{type:"button",onClick:()=>{t(a.value),n(!1)},className:`w-full px-3 py-2.5 text-left text-sm hover:bg-[#1e2a3a] transition-colors ${e===a.value?"bg-accent/10":""}`,children:[v.jsx("div",{className:"font-medium text-slate-200",children:a.label}),v.jsx("div",{className:"text-xs text-slate-500",children:a.description})]},a.value))})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:'Lower = more notifications. "Warning" recommended for most rules.'})]})}function cy({rule:e}){const[t,r]=G.useState(!1),[n,i]=G.useState(null),a=async()=>{r(!0),i(null);try{let s={type:e.delivery_type};e.delivery_type==="mesh_broadcast"?s.channel_index=e.broadcast_channel:e.delivery_type==="mesh_dm"?s.node_ids=e.node_ids:e.delivery_type==="email"?s={type:"email",smtp_host:e.smtp_host,smtp_port:e.smtp_port,smtp_user:e.smtp_user,smtp_password:e.smtp_password,smtp_tls:e.smtp_tls,from_address:e.from_address,recipients:e.recipients}:e.delivery_type==="webhook"&&(s={type:"webhook",url:e.webhook_url,headers:e.webhook_headers});const u=await(await fetch("/api/notifications/channels/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();i(u)}catch(s){i({success:!1,message:"Test failed",error:s instanceof Error?s.message:"Unknown error",details:{}})}finally{r(!1)}};if(!e.delivery_type)return null;const o={mesh_broadcast:v.jsx(Di,{size:14}),mesh_dm:v.jsx(OM,{size:14}),email:v.jsx(Y$,{size:14}),webhook:v.jsx(Z$,{size:14})}[e.delivery_type]||v.jsx(t_,{size:14});return v.jsxs("div",{className:"space-y-2",children:[v.jsx("button",{type:"button",onClick:a,disabled:t,className:"flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",children:t?v.jsxs(v.Fragment,{children:[v.jsx($v,{size:14,className:"animate-spin"}),"Testing..."]}):v.jsxs(v.Fragment,{children:[o,"Test Channel"]})}),n&&v.jsx("div",{className:`p-2 rounded text-xs ${n.success?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[n.success?v.jsx(Za,{size:14,className:"mt-0.5 flex-shrink-0"}):v.jsx(ca,{size:14,className:"mt-0.5 flex-shrink-0"}),v.jsxs("div",{children:[v.jsx("div",{className:"font-medium",children:n.message}),n.error&&v.jsx("div",{className:"mt-1 text-red-300",children:n.error})]})]})})]})}function _xe({rule:e,ruleIndex:t,categories:r,regions:n,onChange:i,onDelete:a,onDuplicate:o,onTest:s}){var O,R,F,H,W;const[l,u]=G.useState(!e.name),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null);G.useEffect(()=>{var V;e.name&&t>=0&&(fetch(`/api/notifications/rules/${t}/stats`).then(z=>z.json()).then(z=>d(z)).catch(()=>{}),(V=e.categories)!=null&&V.length&&fetch("/api/notifications/rules/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e.categories})}).then(z=>z.json()).then(z=>m(z)).catch(()=>{}))},[e.name,t,e.categories]);const y=[{value:"",label:"(None)",description:"Rule matches but does not deliver"},{value:"mesh_broadcast",label:"Mesh Broadcast",description:"Send to a mesh radio channel"},{value:"mesh_dm",label:"Mesh DM",description:"Direct message to specific nodes"},{value:"email",label:"Email",description:"Send via SMTP"},{value:"webhook",label:"Webhook",description:"POST to any URL"}],x=[{value:"daily",label:"Daily"},{value:"twice_daily",label:"Twice Daily"},{value:"weekly",label:"Weekly"}],_=[{value:"mesh_health_summary",label:"Mesh Health Summary",description:"Current health score, pillar breakdown, problem nodes"},{value:"rf_propagation_report",label:"RF Propagation Report",description:"Solar indices, Kp, ducting conditions"},{value:"alerts_digest",label:"Active Alerts Digest",description:"Summary of all active environmental alerts"},{value:"environmental_conditions",label:"Environmental Conditions",description:"Full conditions: weather, fire, streams, roads"},{value:"custom",label:"Custom Message",description:"Write your own with template tokens"}],w=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],S=V=>{const z=e.categories||[];z.includes(V)?i({...e,categories:z.filter(Z=>Z!==V)}):i({...e,categories:[...z,V]})},T=(V,z)=>{const Z=e.categories||[];if(z==="add"){const U=Array.from(new Set([...Z,...V]));i({...e,categories:U})}else{const U=new Set(V);i({...e,categories:Z.filter($=>!U.has($))})}},M=V=>{const z=e.region_scope||[];z.includes(V)?i({...e,region_scope:z.filter(Z=>Z!==V)}):i({...e,region_scope:[...z,V]})},A=V=>{const z=e.schedule_days||[];z.includes(V)?i({...e,schedule_days:z.filter(Z=>Z!==V)}):i({...e,schedule_days:[...z,V]})},P=async()=>{h(!0),await s(),h(!1)},I=()=>{if(e.trigger_type==="schedule")return"[Scheduled report preview would appear here]";const V=e.categories||[];if(V.length===0&&r.length>0)return r[0].example_message||"Alert notification";const z=r.find(Z=>V.includes(Z.id));return(z==null?void 0:z.example_message)||"Alert notification"},N=()=>{var z,Z,U,$,Y,te,ie,se;const V=[];if(e.trigger_type==="schedule"){const le=((z=x.find(me=>me.value===e.schedule_frequency))==null?void 0:z.label)||e.schedule_frequency,Ee=((Z=_.find(me=>me.value===e.message_type))==null?void 0:Z.label)||e.message_type;V.push(`${le} at ${e.schedule_time||"??:??"}`),V.push(Ee)}else{const le=((U=e.categories)==null?void 0:U.length)||0,Ee=le===0?"All":r.filter(ye=>{var Me;return(Me=e.categories)==null?void 0:Me.includes(ye.id)}).map(ye=>ye.name).slice(0,2).join(", ")+(le>2?` +${le-2}`:""),me=(($=Hy.find(ye=>ye.value===e.min_severity))==null?void 0:$.label)||e.min_severity;V.push(`${Ee} at ${me}+`)}if(!e.delivery_type)V.push("No delivery");else{const le=((Y=y.find(me=>me.value===e.delivery_type))==null?void 0:Y.label)||e.delivery_type;let Ee="";if(e.delivery_type==="mesh_broadcast")Ee=`Ch ${e.broadcast_channel}`;else if(e.delivery_type==="mesh_dm")Ee=`${((te=e.node_ids)==null?void 0:te.length)||0} nodes`;else if(e.delivery_type==="email")Ee=(ie=e.recipients)!=null&&ie.length?e.recipients[0]+(e.recipients.length>1?` +${e.recipients.length-1}`:""):"no recipients";else if(e.delivery_type==="webhook")try{Ee=new URL(e.webhook_url).hostname}catch{Ee=((se=e.webhook_url)==null?void 0:se.slice(0,20))||"no URL"}V.push(`${le}${Ee?` (${Ee})`:""}`)}return V.join(" -> ")},D=()=>{var z;if(!g||!((z=e.categories)!=null&&z.length))return null;const V=new Map;for(const[,Z]of Object.entries(g)){const U=V.get(Z.source);U?(U.events+=Z.active_events,U.enabled=U.enabled&&Z.enabled):V.set(Z.source,{enabled:Z.enabled,events:Z.active_events})}return Array.from(V.entries()).map(([Z,{enabled:U,events:$}])=>v.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ${U?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,title:U?`${$} active`:"Not enabled",children:[U?v.jsx(t_,{size:10}):v.jsx(mB,{size:10}),Z.toUpperCase(),U&&$>0&&` (${$})`]},Z))};return v.jsxs("div",{className:`border rounded-lg overflow-hidden ${e.enabled?"border-[#1e2a3a]":"border-slate-700 opacity-60"}`,children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>u(!l),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l?v.jsx(ll,{size:16,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:16,className:"text-slate-500 flex-shrink-0"}),v.jsx("button",{onClick:V=>{V.stopPropagation(),i({...e,enabled:!e.enabled})},className:`w-2 h-2 rounded-full flex-shrink-0 ${e.enabled?"bg-green-500":"bg-slate-500"}`,title:e.enabled?"Enabled":"Disabled"}),e.trigger_type==="schedule"?v.jsx(Iu,{size:14,className:"text-blue-400 flex-shrink-0"}):v.jsx(Dh,{size:14,className:"text-yellow-400 flex-shrink-0"}),v.jsx("span",{className:"font-medium text-slate-200 truncate",title:e.name||void 0,children:e.name||"New Rule"}),!l&&v.jsx("span",{className:`text-xs truncate hidden sm:block ${e.delivery_type?"text-slate-500":"text-amber-400"}`,children:N()})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!l&&(()=>{const V="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs mr-2";if(!e.enabled)return v.jsx("span",{className:`${V} bg-slate-800 text-slate-500`,children:"Disabled"});if(!f)return null;const z=f.fire_count||0,Z=f.last_fired,U=Date.now()/1e3-7*86400;return z>0&&Z&&Z>=U?v.jsx("span",{className:`${V} bg-green-500/10 text-green-400`,title:`Last fired ${uy(Z)}`,children:"Active"}):z>0&&Z?v.jsx("span",{className:`${V} bg-yellow-500/10 text-yellow-400`,title:`Last fired ${uy(Z)}`,children:"Idle (no recent activity)"}):v.jsx("span",{className:`${V} bg-slate-800 text-slate-400`,children:"No activity yet"})})(),!l&&v.jsx("div",{className:"hidden md:flex items-center gap-1 mr-2",children:D()}),v.jsx("button",{onClick:V=>{V.stopPropagation(),P()},disabled:c||!e.name,className:"p-1.5 text-blue-400 hover:text-blue-300 hover:bg-blue-500/10 rounded disabled:opacity-50",title:"Test rule",children:v.jsx(_C,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),o()},className:"p-1.5 text-slate-400 hover:text-slate-200 hover:bg-slate-500/10 rounded",title:"Duplicate",children:v.jsx(H$,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),a()},className:"p-1.5 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",title:"Delete",children:v.jsx(Ep,{size:14})})]})]}),!l&&e.name&&v.jsxs("div",{className:"px-3 pb-2 pt-0 bg-[#0a0e17] flex items-center gap-2 flex-wrap text-xs",children:[!e.delivery_type&&v.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:[v.jsx(Vo,{size:10}),"No delivery method"]}),(f==null?void 0:f.fire_count)!==void 0&&f.fire_count>0&&v.jsxs("span",{className:"text-slate-500",children:["Fired ",f.fire_count,"x"]})]}),l&&v.jsxs("div",{className:"p-4 space-y-6 border-t border-[#1e2a3a]",children:[v.jsx(xs,{label:"Rule Name",value:e.name,onChange:V=>i({...e,name:V}),placeholder:"e.g., Emergency Broadcast, Daily Health Report",helper:"A descriptive name for this rule"}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Trigger Type"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"condition"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 rounded-lg border transition-colors ${e.trigger_type!=="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Dh,{size:16}),v.jsx("span",{children:"Condition"})]}),v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"schedule"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 rounded-lg border transition-colors ${e.trigger_type==="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Iu,{size:16}),v.jsx("span",{children:"Schedule"})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:e.trigger_type==="schedule"?"Send reports on a schedule (daily briefings, weekly digests)":"React to alert conditions (fires, outages, weather warnings)"})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx($a,{size:14}),"WHEN (Condition)"]}),v.jsx(eU,{value:e.min_severity,onChange:V=>i({...e,min_severity:V})}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Categories",v.jsx(Ai,{info:"Select which types of alerts trigger this rule. Leave all unchecked to match ALL categories. Categories are grouped by family — use the 'All' / 'Clear' buttons in each header to bulk-toggle."})]}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:(((O=e.categories)==null?void 0:O.length)||0)===0?"All categories (none selected)":`${(R=e.categories)==null?void 0:R.length} selected`}),v.jsx(bxe,{categories:r,selected:e.categories||[],onToggle:S,onSelectMany:T})]}),g&&Object.keys(g).length>0&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Data Sources"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:D()})]})]}),e.trigger_type==="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(B$,{size:14}),"WHEN (Schedule)"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Frequency"}),v.jsx("select",{value:e.schedule_frequency||"daily",onChange:V=>i({...e,schedule_frequency:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:x.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mv,{label:"Time",value:e.schedule_time||"07:00",onChange:V=>i({...e,schedule_time:V})}),e.schedule_frequency==="twice_daily"&&v.jsx(Mv,{label:"Second Time",value:e.schedule_time_2||"19:00",onChange:V=>i({...e,schedule_time_2:V})})]}),e.schedule_frequency==="weekly"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Days"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(V=>{var z;return v.jsx("button",{type:"button",onClick:()=>A(V),className:`px-3 py-1.5 rounded text-sm capitalize transition-colors ${(z=e.schedule_days)!=null&&z.includes(V)?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:V.slice(0,3)},V)})})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Report Type"}),v.jsx("select",{value:e.message_type||"mesh_health_summary",onChange:V=>i({...e,message_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:_.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(F=_.find(V=>V.value===e.message_type))==null?void 0:F.description})]}),e.message_type==="custom"&&v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Message",v.jsx(Ai,{info:"Available tokens: {MESH_SCORE}, {NODE_COUNT}, {NODES_ONLINE}, {ACTIVE_ALERTS}, {KP}, {SFI}, {DATE}, {TIME}"})]}),v.jsx("textarea",{value:e.custom_message||"",onChange:V=>i({...e,custom_message:V.target.value}),rows:4,placeholder:"Good morning! Mesh health: {MESH_SCORE}/100 with {NODE_COUNT} nodes online.",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"})]})]}),v.jsxs("div",{className:"space-y-2 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(nf,{size:14}),"REGIONS",v.jsx(Ai,{info:"Limit this rule to alerts from specific regions. Empty selection = all regions (backward compatible). Region names come from /api/regions."})]}),v.jsx("div",{className:"text-xs text-slate-500",children:(((H=e.region_scope)==null?void 0:H.length)||0)===0?"All regions (none selected)":`${e.region_scope.length} of ${n.length} selected`}),n.length===0?v.jsx("div",{className:"text-xs text-slate-600 italic",children:"No regions configured."}):v.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(V=>{const z=(e.region_scope||[]).includes(V.name);return v.jsx("button",{type:"button",onClick:()=>M(V.name),className:`px-3 py-1.5 rounded text-sm transition-colors ${z?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,title:V.local_name||V.name,children:V.local_name||V.name},V.name)})})]}),v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(_C,{size:14}),"SEND VIA"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Delivery Method",v.jsx(Ai,{info:"Where this notification gets delivered. Select (None) to save the rule without delivery - it will match conditions but won't send until you configure a delivery method."})]}),v.jsx("select",{value:e.delivery_type||"",onChange:V=>i({...e,delivery_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:y.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(W=y.find(V=>V.value===(e.delivery_type||"")))==null?void 0:W.description})]}),!e.delivery_type&&v.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg",children:[v.jsx(Vo,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),v.jsx("div",{className:"text-sm text-amber-300",children:"Rule will log matches but not deliver until a delivery method is configured."})]}),e.delivery_type==="mesh_broadcast"&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Broadcast Channel",value:e.broadcast_channel??0,onChange:V=>i({...e,broadcast_channel:V}),helper:"Select the mesh radio channel",mode:"single"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="mesh_dm"&&v.jsxs(v.Fragment,{children:[v.jsx(kL,{label:"Recipient Nodes",value:e.node_ids||[],onChange:V=>i({...e,node_ids:V}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="email"&&v.jsxs("div",{className:"space-y-4",children:[v.jsx(Uy,{label:"Recipients",value:e.recipients||[],onChange:V=>i({...e,recipients:V}),placeholder:"email@example.com",helper:"Email addresses to receive alerts"}),v.jsxs("details",{className:"group",children:[v.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[v.jsx(Js,{size:14,className:"group-open:rotate-90 transition-transform"}),"SMTP Configuration"]}),v.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"SMTP Host",value:e.smtp_host||"",onChange:V=>i({...e,smtp_host:V}),placeholder:"smtp.gmail.com"}),v.jsx(Mp,{label:"SMTP Port",value:e.smtp_port??587,onChange:V=>i({...e,smtp_port:V}),min:1,max:65535})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"Username",value:e.smtp_user||"",onChange:V=>i({...e,smtp_user:V})}),v.jsx(xs,{label:"Password",value:e.smtp_password||"",onChange:V=>i({...e,smtp_password:V}),type:"password",info:"Gmail users: use an App Password from myaccount.google.com/apppasswords"})]}),v.jsx(Lx,{label:"Use TLS",checked:e.smtp_tls??!0,onChange:V=>i({...e,smtp_tls:V})}),v.jsx(xs,{label:"From Address",value:e.from_address||"",onChange:V=>i({...e,from_address:V}),placeholder:"alerts@yourdomain.com"})]})]}),v.jsx(cy,{rule:e})]}),e.delivery_type==="webhook"&&v.jsxs(v.Fragment,{children:[v.jsx(xs,{label:"Webhook URL",value:e.webhook_url||"",onChange:V=>i({...e,webhook_url:V}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON",info:"Works with Discord webhooks, ntfy.sh, Slack, Home Assistant, Pushover, or any HTTP POST endpoint."}),v.jsx(cy,{rule:e})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mp,{label:"Cooldown (minutes)",value:e.cooldown_minutes??10,onChange:V=>i({...e,cooldown_minutes:V}),min:0,helper:"Min time between repeat sends",info:"Prevents alert spam. Same condition won't re-trigger this rule within this window."})," "]}),f&&v.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[v.jsxs("span",{children:["Last fired: ",uy(f.last_fired)]}),v.jsxs("span",{children:["Last tested: ",uy(f.last_test)]}),v.jsxs("span",{children:["Total fires: ",f.fire_count]})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Example Message"}),v.jsx("div",{className:"p-3 bg-[#1e2a3a]/50 rounded-lg border border-[#1e2a3a]",children:v.jsx("p",{className:"text-sm text-slate-300 font-mono",children:I()})}),v.jsx("p",{className:"text-xs text-slate-600",children:"This is an example of what this rule would send."})]})]})]})}const Zy=[{key:"mesh_health",label:"Mesh Health",Icon:rf},{key:"weather",label:"Weather",Icon:Du},{key:"fire",label:"Fire",Icon:Xx},{key:"rf_propagation",label:"RF Propagation",Icon:Di},{key:"roads",label:"Roads",Icon:$x},{key:"avalanche",label:"Avalanche",Icon:J$},{key:"seismic",label:"Seismic",Icon:Kx},{key:"tracking",label:"Tracking",Icon:nf}];function bxe({categories:e,selected:t,onToggle:r,onSelectMany:n}){const i=new Set(Zy.map(f=>f.key)),a=new Map;Zy.forEach(f=>a.set(f.key,[]));const o=[];for(const f of e){const d=f.toggle;d&&i.has(d)?a.get(d).push(f):o.push(f)}const s=new Set;for(const[f,d]of a)d.some(g=>t.includes(g.id))&&s.add(f);o.some(f=>t.includes(f.id))&&s.add("other");const[l,u]=G.useState(s),c=f=>{u(d=>{const g=new Set(d);return g.has(f)?g.delete(f):g.add(f),g})},h=(f,d,g,m)=>{if(!m.length)return null;const y=l.has(f),x=m.map(w=>w.id),_=x.filter(w=>t.includes(w)).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded",children:[v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-[#0d1420]",children:[v.jsxs("button",{type:"button",onClick:()=>c(f),className:"flex items-center gap-2 text-sm text-slate-200 flex-1 min-w-0",children:[y?v.jsx(ll,{size:14,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:14,className:"text-slate-500 flex-shrink-0"}),g&&v.jsx(g,{size:14,className:"text-slate-400 flex-shrink-0"}),v.jsxs("span",{className:"truncate",children:[d," (",m.length,")"]}),_>0&&v.jsxs("span",{className:"ml-1 text-xs text-accent",children:[_," selected"]})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"add")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-accent hover:bg-accent/10",title:"Select all in family",children:"All"}),v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"remove")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-red-400 hover:bg-red-500/10",title:"Clear family",children:"Clear"})]})]}),y&&v.jsx("div",{className:"p-1 space-y-1",children:m.map(w=>v.jsxs("label",{onClick:()=>r(w.id),className:"flex items-start gap-2 p-2 rounded hover:bg-[#1e2a3a]/50 cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 mt-0.5 rounded border flex items-center justify-center flex-shrink-0 ${t.includes(w.id)?"bg-accent border-accent":"border-slate-600"}`,children:t.includes(w.id)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200",children:w.name}),v.jsx("div",{className:"text-xs text-slate-500",children:w.description})]})]},w.id))})]},f)};return v.jsxs("div",{className:"max-h-96 overflow-y-auto border border-[#1e2a3a] rounded-lg p-2 space-y-2",children:[Zy.map(f=>h(f.key,f.label,f.Icon,a.get(f.key)||[])),h("other","Other",null,o)]})}const N3=["digest","mesh_broadcast","mesh_dm","email","webhook"],wxe=["routine","priority","immediate"];function Sxe({toggles:e,onChange:t}){const[r,n]=G.useState(null),i=(a,o)=>t({...e,[a]:{...e[a]||{},name:a,...o}});return v.jsxs("div",{className:"space-y-3 mb-8",children:[v.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Master Toggles",v.jsx(Ai,{info:"Per-family notification policy: enable a family, set its severity threshold, choose which channels fire at each severity, and scope to regions (PagerDuty/Grafana-style)."})]}),v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Zy.map(({key:a,label:o,Icon:s})=>{const l=e[a]||{},u=r===a,c=Object.values(l.severity_channels||{}).reduce((f,d)=>f+((d==null?void 0:d.length)||0),0),h=(l.regions||[]).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("button",{type:"button",onClick:()=>n(u?null:a),className:"flex items-center gap-2 text-sm text-slate-200",children:[v.jsx(s,{size:15})," ",o,u?v.jsx(ll,{size:14}):v.jsx(Js,{size:14})]}),v.jsx(Lx,{label:"",checked:!!l.enabled,onChange:f=>i(a,{enabled:f})})]}),!u&&v.jsx("div",{className:"text-xs text-slate-600 mt-1",children:l.enabled?`${h||"all"} region${h===1?"":"s"}, ${c} channel${c===1?"":"s"} at ${l.min_severity||"priority"}+`:"OFF"}),u&&v.jsxs("div",{className:`mt-3 space-y-3 ${l.enabled?"":"opacity-40 pointer-events-none select-none"}`,children:[v.jsx(eU,{value:l.min_severity||"priority",onChange:f=>i(a,{min_severity:f})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Severity → channels"}),v.jsxs("table",{className:"text-xs w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{}),N3.map(f=>v.jsx("th",{className:"text-slate-500 font-normal px-1",children:f.replace("_"," ")},f))]})}),v.jsx("tbody",{children:wxe.map(f=>v.jsxs("tr",{children:[v.jsx("td",{className:"text-slate-400 pr-2",children:f}),N3.map(d=>{var m;const g=(((m=l.severity_channels)==null?void 0:m[f])||[]).includes(d);return v.jsx("td",{className:"text-center",children:v.jsx("input",{type:"checkbox",checked:g,onChange:y=>{const x={...l.severity_channels||{}},_=new Set(x[f]||[]);y.target.checked?_.add(d):_.delete(d),x[f]=Array.from(_),i(a,{severity_channels:x})}})},d)})]},f))})]}),v.jsx(Uy,{label:"Regions (empty = all)",value:l.regions||[],onChange:f=>i(a,{regions:f}),placeholder:"Add region..."})," ",v.jsx("div",{className:"text-xs text-slate-500 pt-1",children:"Channel config"}),v.jsx(Mp,{label:"Broadcast channel",value:l.broadcast_channel??0,onChange:f=>i(a,{broadcast_channel:f})}),v.jsx(Uy,{label:"DM node IDs",value:l.node_ids||[],onChange:f=>i(a,{node_ids:f}),placeholder:"!nodeid"}),v.jsx(Uy,{label:"Email recipients",value:l.recipients||[],onChange:f=>i(a,{recipients:f}),placeholder:"ops@example.com"}),v.jsx(xs,{label:"SMTP host",value:l.smtp_host||"",onChange:f=>i(a,{smtp_host:f}),placeholder:"smtp.example.com"}),v.jsx(Mp,{label:"SMTP port",value:l.smtp_port??587,onChange:f=>i(a,{smtp_port:f})}),v.jsx(xs,{label:"Webhook URL",value:l.webhook_url||"",onChange:f=>i(a,{webhook_url:f}),placeholder:"https://..."})]})]},a)})})]})}function Cxe(){var z,Z,U;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(null),[_,w]=G.useState({open:!1,ruleIndex:-1,loading:!1,action:""}),[S,T]=G.useState(!1),[M,A]=G.useState(!1),P=G.useCallback(async()=>{try{const[$,Y,te]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/categories"),fetch("/api/regions")]);if(!$.ok)throw new Error("Failed to fetch notifications config");const ie=await $.json(),se=await Y.json(),le=te.ok?await te.json():[];t(ie),n(JSON.parse(JSON.stringify(ie))),a(se),s(Array.isArray(le)?le:[]),A(!1),d(null)}catch($){d($ instanceof Error?$.message:"Unknown error")}finally{u(!1)}},[]);G.useEffect(()=>{document.title="Notifications - MeshAI",P()},[P]),G.useEffect(()=>{e&&r&&A(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const I=async()=>{if(e){h(!0),d(null),m(null);try{const $=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Y=await $.json();if(!$.ok)throw new Error(Y.detail||"Save failed");m("Notifications config saved successfully"),n(JSON.parse(JSON.stringify(e))),A(!1),setTimeout(()=>m(null),3e3)}catch($){d($ instanceof Error?$.message:"Save failed")}finally{h(!1)}}},N=()=>{r&&(t(JSON.parse(JSON.stringify(r))),A(!1))},D=()=>({name:"",enabled:!0,trigger_type:"condition",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"19:00",schedule_days:["monday"],message_type:"mesh_health_summary",custom_message:"",delivery_type:"",broadcast_channel:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{},cooldown_minutes:10,region_scope:[]}),O=()=>{e&&t({...e,rules:[...e.rules||[],D()]})},R=$=>{if(!e)return;const Y=L3.find(te=>te.id===$);Y&&(t({...e,rules:[...e.rules||[],{...D(),...Y.rule}]}),T(!1))},F=$=>{if(!e)return;const Y=e.rules[$],te={...JSON.parse(JSON.stringify(Y)),name:`${Y.name} (copy)`},ie=[...e.rules];ie.splice($+1,0,te),t({...e,rules:ie})},H=async $=>{w({open:!0,ruleIndex:$,loading:!0,action:""});try{const te=await(await fetch(`/api/notifications/rules/${$}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})})).json();x(te),w(ie=>({...ie,loading:!1}))}catch{x({success:!1,message:"Failed to get preview"}),w(Y=>({...Y,loading:!1}))}},W=async $=>{const Y=_.ruleIndex;w(te=>({...te,loading:!0,action:$}));try{const ie=await(await fetch(`/api/notifications/rules/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:$})})).json();x(ie),w(se=>({...se,loading:!1}))}catch{x({success:!1,message:`Failed to ${$}`}),w(te=>({...te,loading:!1}))}},V=()=>{w({open:!1,ruleIndex:-1,loading:!1,action:""}),x(null)};return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):e?v.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[_.open&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:v.jsxs("div",{className:"bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] overflow-auto",children:[v.jsxs("div",{className:"p-4 border-b border-[#2a3a4a] flex items-center justify-between sticky top-0 bg-[#1a2332]",children:[v.jsx("h3",{className:"text-lg font-semibold",children:"Test Notification Rule"}),v.jsx("button",{onClick:V,className:"text-slate-500 hover:text-slate-300",children:v.jsx(ca,{size:20})})]}),v.jsx("div",{className:"p-4 space-y-4",children:_.loading?v.jsxs("div",{className:"flex items-center justify-center py-8",children:[v.jsx($v,{size:20,className:"animate-spin text-slate-400 mr-2"}),v.jsx("div",{className:"text-slate-400",children:_.action?`${_.action.replace("_"," ").replace("send ","Sending ")}...`:"Loading current data..."})]}):y?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Current Data"}),y.live_data_summary&&y.live_data_summary.length>0?v.jsx("div",{className:"p-3 bg-slate-800/50 rounded space-y-1",children:y.live_data_summary.map(($,Y)=>v.jsx("div",{className:`text-sm font-mono ${$.startsWith("[!]")?"text-amber-400":""}`,children:$},Y))}):v.jsx("div",{className:"p-3 bg-slate-800/50 rounded text-sm text-slate-500",children:"No live data available for this rule's categories"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Rule Matching"}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.conditions_matched&&y.conditions_matched>0?v.jsxs("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 rounded text-sm",children:[y.conditions_matched," condition",y.conditions_matched!==1?"s":""," match - this rule WOULD fire"]}):v.jsx("span",{className:"px-2 py-1 bg-slate-700 text-slate-400 rounded text-sm",children:"No conditions trigger this rule right now"}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded text-sm",children:[y.conditions_below_threshold," below threshold"]})]}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-sm space-y-2",children:[v.jsx("div",{className:"text-yellow-300",children:y.below_threshold_summary}),y.below_threshold_events&&y.below_threshold_events.length>0&&v.jsx("div",{className:"space-y-1 text-yellow-200/80",children:y.below_threshold_events.slice(0,3).map(($,Y)=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 rounded",children:$.severity}),v.jsx("span",{children:$.headline})]},Y))}),y.suggestion&&v.jsxs("div",{className:"text-yellow-400 text-xs mt-2",children:["Tip: ",y.suggestion]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:y.is_example?"Example Messages":"Messages That Would Fire"}),(z=y.preview_messages)==null?void 0:z.map(($,Y)=>v.jsx("div",{className:"p-3 bg-slate-800 rounded text-sm font-mono break-words",children:$},Y))]}),y.delivered!==void 0&&y.delivery_result&&v.jsx("div",{className:`p-3 rounded text-sm ${y.delivered?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[y.delivered?v.jsx(Za,{size:16,className:"mt-0.5"}):v.jsx(ca,{size:16,className:"mt-0.5"}),v.jsxs("div",{children:[v.jsx("div",{children:y.delivery_result}),y.delivery_error&&v.jsx("div",{className:"mt-1 text-red-300",children:y.delivery_error})]})]})}),y.message&&!y.preview_messages&&v.jsx("div",{className:`p-3 rounded text-sm ${y.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:y.message})]}):null}),v.jsxs("div",{className:"p-4 border-t border-[#2a3a4a] flex justify-between sticky bottom-0 bg-[#1a2332]",children:[v.jsx("button",{onClick:V,className:"px-4 py-2 text-slate-400 hover:text-slate-200",children:"Close"}),y&&!y.delivered&&v.jsx("div",{className:"flex gap-2",children:y.delivery_method?v.jsxs(v.Fragment,{children:[y.live_data_summary&&y.live_data_summary.length>0&&v.jsx("button",{onClick:()=>W("send_status"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send current conditions summary",children:"Send Current Conditions"}),v.jsx("button",{onClick:()=>W("send_test"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send example alert message",children:"Send Example Alert"}),y.can_send_live&&v.jsx("button",{onClick:()=>W("send_live"),disabled:_.loading,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm disabled:opacity-50",title:"Send actual live alert",children:"Send Live Alert"})]}):v.jsx("span",{className:"px-3 py-2 text-amber-400 text-sm",children:"Configure a delivery method to send test messages"})})]})]})}),v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{children:v.jsx("p",{className:"text-sm text-slate-500",children:"Alert delivery and scheduled reports. Rules define what triggers a notification and where it gets sent."})}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:P,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:v.jsx($v,{size:18})}),v.jsxs("button",{onClick:N,disabled:!M,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[v.jsx(Jx,{size:16}),"Discard"]}),v.jsxs("button",{onClick:I,disabled:c||!M,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[v.jsx(zM,{size:16}),c?"Saving...":"Save"]})]})]}),f&&v.jsx("div",{className:"p-3 rounded-lg text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&v.jsxs("div",{className:"p-3 rounded-lg text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[v.jsx(Za,{size:14,className:"inline mr-2"}),g]}),v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6 space-y-6",children:[v.jsx(Lx,{label:"Enable Notifications",checked:e.enabled,onChange:$=>t({...e,enabled:$}),helper:"Master switch for all notification delivery",info:"When disabled, no alerts or scheduled messages will be delivered. Alerts still get recorded to history."}),e.enabled&&v.jsxs(v.Fragment,{children:[" ",v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),v.jsx(Mp,{label:"Grace period (seconds)",value:e.cold_start_grace_seconds??60,onChange:$=>t({...e,cold_start_grace_seconds:$}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),v.jsx(Lx,{label:"Enable scheduled band-conditions broadcasts",checked:e.band_conditions_enabled??!0,onChange:$=>t({...e,band_conditions_enabled:$}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(e.band_conditions_enabled??!0)&&v.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[v.jsx(Mv,{label:"Slot 1",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[0]=$,t({...e,band_conditions_schedule:Y})},helper:"Morning (default 06:00 MT)"}),v.jsx(Mv,{label:"Slot 2",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[1]=$,t({...e,band_conditions_schedule:Y})},helper:"Afternoon (default 14:00 MT)"}),v.jsx(Mv,{label:"Slot 3",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[2]=$,t({...e,band_conditions_schedule:Y})},helper:"Night (default 22:00 MT)"})]}),v.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),e.toggles&&v.jsx(Sxe,{toggles:e.toggles,onChange:$=>t({...e,toggles:$})}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Notification Rules",v.jsx(Ai,{info:"Each rule is self-contained: define what triggers it (condition or schedule), where to send it (mesh, email, webhook), and behavior settings."})]}),v.jsxs("span",{className:"text-xs text-slate-500",children:[((Z=e.rules)==null?void 0:Z.length)||0," rule",(((U=e.rules)==null?void 0:U.length)||0)!==1?"s":""]})]}),(e.rules||[]).map(($,Y)=>v.jsx(_xe,{rule:$,ruleIndex:Y,categories:i,regions:o,onChange:te=>{const ie=[...e.rules||[]];ie[Y]=te,t({...e,rules:ie})},onDelete:()=>{confirm(`Delete rule "${$.name||"New Rule"}"?`)&&t({...e,rules:(e.rules||[]).filter((te,ie)=>ie!==Y)})},onDuplicate:()=>F(Y),onTest:()=>H(Y)},Y)),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{onClick:O,className:"flex-1 py-3 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Rule"]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>T(!S),className:"py-3 px-4 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center gap-2 transition-colors",children:[v.jsx(hB,{size:16})," Add from Template"]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(!1)}),v.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-80 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl overflow-hidden",children:[v.jsx("div",{className:"p-2 border-b border-[#2a3a4a] text-xs text-slate-500 uppercase",children:"Rule Templates"}),L3.map($=>v.jsxs("button",{onClick:()=>R($.id),className:"w-full p-3 text-left hover:bg-[#2a3a4a] transition-colors",children:[v.jsx("div",{className:"font-medium text-slate-200",children:$.name}),v.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:$.description})]},$.id))]})]})]})]})]})]})]})]}):v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const P3=[{id:"stream-gauges",label:"Stream Gauges",icon:Yx},{id:"wildfire",label:"Wildfire",icon:Xx},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:Qx},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:U$},{id:"weather-alerts",label:"Weather Alerts",icon:G$},{id:"solar",label:"Solar & Geomagnetic",icon:pB},{id:"ducting",label:"Tropospheric Ducting",icon:Di},{id:"avalanche",label:"Avalanche Danger",icon:Kx},{id:"traffic",label:"Traffic Flow",icon:$x},{id:"roads-511",label:"Road Conditions (511)",icon:sB},{id:"mesh-health",label:"Mesh Health",icon:rf},{id:"broadcast-types",label:"Broadcast Types",icon:_C},{id:"reminders",label:"Reminder System",icon:Iu},{id:"notifications",label:"Notifications",icon:Zv},{id:"commands",label:"Commands",icon:gB},{id:"llm-dm",label:"LLM DM Queries",icon:OM},{id:"or-not-and",label:"OR-not-AND Architecture",icon:dB},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:BM},{id:"curation",label:"Curation: Gauges & Towns",icon:uB},{id:"schema",label:"Schema Migrations",icon:$$},{id:"api",label:"API Reference",icon:W$}];function $t({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return v.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function yt({headers:e,rows:t}){return v.jsx("div",{className:"overflow-x-auto my-4",children:v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>v.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),v.jsx("tbody",{children:t.map((r,n)=>v.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((i,a)=>v.jsx("td",{className:"px-4 py-2 text-slate-300",children:i},a))},n))})]})})}function Pt({href:e,children:t}){return v.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",v.jsx(Ih,{size:12})]})}function de({children:e}){return v.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function fs({children:e}){return v.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function oe({children:e}){return v.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function hr({id:e,title:t,children:r}){return v.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[v.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),v.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function Txe(){const e=tf(),[t,r]=G.useState(""),[n,i]=G.useState("stream-gauges"),a=G.useRef(null);G.useEffect(()=>{const l=e.hash.replace("#","");if(l&&P3.find(u=>u.id===l)){i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=P3.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return v.jsxs("div",{className:"flex h-full -m-6",children:[v.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[v.jsx("div",{className:"p-4 border-b border-border",children:v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),v.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return v.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[v.jsx(u,{size:16}),l.label]},l.id)})})]}),v.jsx("div",{ref:a,className:"flex-1 overflow-y-auto p-6",children:v.jsxs("div",{className:"max-w-4xl",children:[v.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),v.jsxs(hr,{id:"stream-gauges",title:"Stream Gauges",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"A small creek: 50-200 CFS"}),v.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),v.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),v.jsx(de,{children:"When Does It Flood?"}),v.jsxs("p",{children:["Flood levels are set by the ",v.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),v.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),v.jsx(de,{children:"Low Water / Drought"}),v.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Find your gauge at ",v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),v.jsxs("li",{children:["Copy the site number (like ",v.jsx(oe,{children:"13090500"}),")"]}),v.jsx("li",{children:"Add it in Config → Environmental → USGS"}),v.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),v.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),v.jsxs(hr,{id:"wildfire",title:"Wildfire",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),v.jsx(de,{children:"Fire Size — How Big Is It?"}),v.jsx(yt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),v.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),v.jsx(de,{children:"Containment — Is It Under Control?"}),v.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),v.jsx(de,{children:"How Far Away Should I Worry?"}),v.jsx(yt,{headers:["Distance","What To Do"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Under 5 km (3 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 5-15 km (3-10 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 15-30 km (10-20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Over 30 km (20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),v.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),v.jsx(de,{children:"Which Matters More — Size or Distance?"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("p",{children:["Just configure your state code (like ",v.jsx(oe,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),v.jsxs(hr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),v.jsxs("p",{children:[v.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",v.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),v.jsx(de,{children:"Confidence — Is It Really a Fire?"}),v.jsx("p",{children:"Each detection gets a confidence rating:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),v.jsx(de,{children:"FRP — How Intense Is It?"}),v.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),v.jsx(yt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),v.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),v.jsx(de,{children:"New Ignition Detection"}),v.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",v.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),v.jsx(de,{children:"Timing"}),v.jsxs("p",{children:["Satellite data arrives ",v.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",v.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),v.jsx("li",{children:'Click "Get MAP_KEY"'}),v.jsx("li",{children:"Register for a free Earthdata account"}),v.jsx("li",{children:"Your key arrives by email"}),v.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),v.jsxs(hr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[v.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),v.jsx(de,{children:"What you'll see on the mesh"}),v.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),v.jsx(yt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[v.jsx(oe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[v.jsx(oe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",v.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[v.jsx(oe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[v.jsx(oe,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[v.jsx(oe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",v.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[v.jsx(oe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),v.jsx(de,{children:"Daily LLM digest"}),v.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",v.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",v.jsx(oe,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),v.jsx(de,{children:"How attribution works"}),v.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",v.jsx(oe,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),v.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",v.jsx(oe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",v.jsx(oe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",v.jsx(oe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",v.jsx(oe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),v.jsx(de,{children:"How movement is computed"}),v.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",v.jsx(oe,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",v.jsx(oe,{children:"growth_drift_threshold_mi"})," the"," ",v.jsx(oe,{children:"wildfire_growth"})," broadcast fires."]}),v.jsx(de,{children:"How spotting is detected"}),v.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",v.jsx(oe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",v.jsx(oe,{children:"wildfire_spotting"})," broadcast at ",v.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",v.jsx(oe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),v.jsx(de,{children:"Tunable knobs (Adapter Config → fires)"}),v.jsx(yt,{headers:["Key","Default","What it does"],rows:[[v.jsx(oe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[v.jsx(oe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[v.jsx(oe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[v.jsx(oe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[v.jsx(oe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[v.jsx(oe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[v.jsx(oe,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[v.jsx(oe,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[v.jsx(oe,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[v.jsx(oe,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),v.jsxs(hr,{id:"weather-alerts",title:"Weather Alerts",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),v.jsx(de,{children:"Alert Severity — How Serious Is It?"}),v.jsx(yt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),v.jsx(de,{children:"When Should I Act? (Urgency)"}),v.jsx(yt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),v.jsx(de,{children:"How Sure Are They? (Certainty)"}),v.jsx(yt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),v.jsx(de,{children:"These Are Separate Scales"}),v.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),v.jsx(de,{children:"What Minimum Severity Should I Set?"}),v.jsx(yt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),v.jsx(de,{children:"Finding Your NWS Zone"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://www.weather.gov",children:"weather.gov"})]}),v.jsx("li",{children:"Enter your location"}),v.jsxs("li",{children:["Find your zone code at ",v.jsx(Pt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),v.jsxs("li",{children:["Zone codes look like: ",v.jsx(oe,{children:"IDZ016"}),", ",v.jsx(oe,{children:"UTZ040"}),", etc."]})]}),v.jsx(de,{children:"The User-Agent Field"}),v.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),v.jsx("p",{children:v.jsx(oe,{children:"(meshai, you@email.com)"})}),v.jsx("p",{children:"No registration. No waiting. Just type it in."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),v.jsxs(hr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),v.jsx(de,{children:"Solar Flux Index (SFI)"}),v.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),v.jsx(yt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),v.jsx(de,{children:"Kp Index"}),v.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),v.jsx(yt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[v.jsx("strong",{children:"5"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[v.jsx("strong",{children:"6"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[v.jsx("strong",{children:"7"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[v.jsx("strong",{children:"8-9"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),v.jsx(de,{children:"R / S / G Scales"}),v.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),v.jsx(fs,{children:"R (Radio Blackouts) — from solar flares:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),v.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),v.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),v.jsx(fs,{children:"S (Solar Radiation Storms) — from energetic particles:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Mostly affects polar regions and satellites"}),v.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),v.jsx(fs,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),v.jsx(de,{children:"Bz — The Storm Predictor"}),v.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),v.jsx(yt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),v.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),v.jsxs(hr,{id:"ducting",title:"Tropospheric Ducting",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),v.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),v.jsx(de,{children:"How Do I Know If Ducting Is Happening?"}),v.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),v.jsx(yt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),v.jsx(de,{children:"What You'll Actually Notice"}),v.jsx("p",{children:"When ducting happens on your mesh:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),v.jsx("li",{children:"Nodes appear from far outside your normal range"}),v.jsx("li",{children:"You hear FM radio stations from other cities"}),v.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),v.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),v.jsx(de,{children:"The dM/dz Number"}),v.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),v.jsx(de,{children:"When Does Ducting Happen?"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),v.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),v.jsx("li",{children:"Most common in late summer and early fall"}),v.jsx("li",{children:"Strongest along coastlines and over water"}),v.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),v.jsxs(hr,{id:"avalanche",title:"Avalanche Danger",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),v.jsx(de,{children:"The Danger Scale"}),v.jsx(yt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",v.jsx($t,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",v.jsx($t,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",v.jsx($t,{color:"orange"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",v.jsx($t,{color:"red"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",v.jsx($t,{color:"black"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),v.jsx(de,{children:"The Most Important Thing to Know"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),v.jsx(de,{children:"Seasonal"}),v.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),v.jsx(de,{children:"Finding Your Avalanche Center"}),v.jsxs("p",{children:["Go to ",v.jsx(Pt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"UAC"})," — Utah"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"CAIC"})," — Colorado"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"SAC"})," — Sierra Nevada (CA)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),v.jsxs(hr,{id:"traffic",title:"Traffic Flow",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),v.jsx(de,{children:"Speed Ratio — The Key Number"}),v.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),v.jsx(yt,{headers:["Ratio","What It Means"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),v.jsx(de,{children:"Confidence — Can You Trust the Data?"}),v.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),v.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),v.jsx(de,{children:"Setting Up Corridors"}),v.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Go to Google Maps, find the road"}),v.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),v.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),v.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Sign up at ",v.jsx(Pt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),v.jsx("li",{children:"Create an app → get your API key"}),v.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),v.jsxs(hr,{id:"roads-511",title:"Road Conditions (511)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),v.jsx("p",{children:"Configure in Config → Environmental → 511:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"API Key"})," — if required by your state"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),v.jsxs(hr,{id:"mesh-health",title:"Mesh Health",children:[v.jsx(de,{children:"Health Score"}),v.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),v.jsx(yt,{headers:["Pillar","Weight","What It Measures"],rows:[[v.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[v.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[v.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[v.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[v.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),v.jsx("p",{children:"The overall score is the weighted sum:"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),v.jsx(de,{children:"How Each Pillar Is Calculated"}),v.jsx(fs,{children:"Infrastructure (30%)"}),v.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),v.jsxs("p",{children:["Only nodes with the ",v.jsx(oe,{children:"ROUTER"}),", ",v.jsx(oe,{children:"ROUTER_LATE"}),", or ",v.jsx(oe,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),v.jsx(fs,{children:"Utilization (25%)"}),v.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",v.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),v.jsx("p",{children:v.jsx("strong",{children:"How it works:"})}),v.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[v.jsxs("li",{children:["Collect ",v.jsx(oe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),v.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),v.jsxs("li",{children:["Use the ",v.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),v.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),v.jsxs("p",{className:"mt-4",children:[v.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),v.jsx(yt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),v.jsx(fs,{children:"Coverage (20%)"}),v.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),v.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",v.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),v.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),v.jsx(yt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),v.jsx(fs,{children:"Behavior (15%)"}),v.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),v.jsxs("p",{children:[v.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),v.jsx(yt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),v.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),v.jsx(fs,{children:"Power (10%)"}),v.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),v.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),v.jsxs("p",{children:[v.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),v.jsx(de,{children:"Health Tiers"}),v.jsx(yt,{headers:["Score","Tier","What It Means"],rows:[["90-100",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),v.jsx(de,{children:"Channel Utilization — Is the Radio Channel Full?"}),v.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),v.jsx(yt,{headers:["Utilization","What's Happening"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),v.jsx(de,{children:"Packet Flooding"}),v.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:v.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),v.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),v.jsx(yt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),v.jsx(de,{children:"Battery Levels"}),v.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),v.jsx(yt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[v.jsx("strong",{children:"3.60V"}),v.jsx("strong",{children:"~30%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[v.jsx("strong",{children:"3.50V"}),v.jsx("strong",{children:"~15%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"🔴 Low — charge it now"})})],[v.jsx("strong",{children:"3.40V"}),v.jsx("strong",{children:"~7%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),v.jsx(de,{children:"Node Offline Detection"}),v.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),v.jsx(yt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",v.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),v.jsxs(hr,{id:"broadcast-types",title:"Broadcast Types",children:[v.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),v.jsx(yt,{headers:["Prefix","What it means","When you see it"],rows:[[v.jsx(oe,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[v.jsx(oe,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[v.jsx(oe,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),v.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),v.jsxs(hr,{id:"reminders",title:"Reminder System",children:[v.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",v.jsx(oe,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),v.jsx(de,{children:"Cadences"}),v.jsx(yt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[v.jsx(oe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),v.jsx(de,{children:"The tombstone"}),v.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",v.jsx(oe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",v.jsx(oe,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),v.jsx(de,{children:"Turning reminders off"}),v.jsxs("p",{children:["Per-adapter on/off lives in ",v.jsx(oe,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),v.jsxs(hr,{id:"notifications",title:"Notifications",children:[v.jsx(de,{children:"How It Works"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),v.jsx(de,{children:"Building Rules"}),v.jsx("p",{children:"Each rule answers three questions:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),v.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),v.jsx(de,{children:"Severity Levels — What Should I Set?"}),v.jsx(yt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),v.jsx(de,{children:"Webhook — The Swiss Army Knife"}),v.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"ntfy.sh"})," — POST to ",v.jsx(oe,{children:"https://ntfy.sh/your-topic"})]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),v.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),v.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),v.jsxs(hr,{id:"commands",title:"Commands",children:[v.jsxs("p",{children:["All commands use the ",v.jsx(oe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),v.jsx(de,{children:"Basic Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!help"}),"Shows all available commands"],[v.jsx(oe,{children:"!ping"}),"Tests if the bot is alive"],[v.jsx(oe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[v.jsx(oe,{children:"!health"}),"Detailed health report with pillar scores"],[v.jsx(oe,{children:"!weather"}),"Current weather for your area"]]}),v.jsx(de,{children:"Environmental Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!solar"})," (or ",v.jsx(oe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[v.jsx(oe,{children:"!fire"}),"Active wildfires near your mesh"],[v.jsx(oe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!streams"})," (or ",v.jsx(oe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!roads"})," (or ",v.jsx(oe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[v.jsx(oe,{children:"!hotspots"}),"Satellite fire detections"]]}),v.jsx(de,{children:"Subscription Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!subscribe"}),"Lists all alert categories you can subscribe to"],[v.jsx(oe,{children:"!subscribe fire_proximity"}),"Subscribe to a specific category"],[v.jsx(oe,{children:"!subscribe all"}),"Subscribe to everything"],[v.jsx(oe,{children:"!unsubscribe fire_proximity"}),"Unsubscribe from a category"],[v.jsx(oe,{children:"!subscriptions"}),"Shows what you're currently subscribed to"]]}),v.jsx(de,{children:"Conversational"}),v.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",v.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),v.jsxs(hr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[v.jsxs("p",{children:["Bang commands like ",v.jsx(oe,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),v.jsx(de,{children:"What it can answer"}),v.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),v.jsx(yt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[v.jsx(oe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[v.jsx(oe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[v.jsx(oe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[v.jsx(oe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[v.jsx(oe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[v.jsx(oe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[v.jsx(oe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),v.jsx(de,{children:"The grounding rule"}),v.jsxs("p",{children:["The bot is told to answer ",v.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),v.jsx(de,{children:"Excluding an adapter from LLM context"}),v.jsxs("p",{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",v.jsx(oe,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),v.jsx(de,{children:"What it can't answer"}),v.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),v.jsxs(hr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[v.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),v.jsx(de,{children:"Why mutually exclusive"}),v.jsxs("p",{children:["An adapter is set to ",v.jsx("strong",{children:"either"})," Central ",v.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",v.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),v.jsx(de,{children:"The per-adapter source toggle"}),v.jsxs("p",{children:["Set ",v.jsx(oe,{children:"feed_source"})," on each adapter's row in Environment:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),v.jsxs("li",{children:[v.jsx(oe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),v.jsxs("p",{children:["On the GUI, adapters with ",v.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),v.jsx(de,{children:"Where this surfaces in tooltips"}),v.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",v.jsxs(oe,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),v.jsxs(hr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[v.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),v.jsx(de,{children:"The CONFIG-vs-CODE rule"}),v.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),v.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),v.jsx(de,{children:"Restart-required vs live"}),v.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Anything under the ",v.jsx(oe,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),v.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),v.jsx("li",{children:"The dispatcher cold-start grace window."})]}),v.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),v.jsxs(de,{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle"]}),v.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,v.jsx(oe,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),v.jsxs(hr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[v.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),v.jsx(de,{children:"Gauge Sites"}),v.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),v.jsxs("p",{children:[v.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",v.jsx(oe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),v.jsx(de,{children:"Town Anchors"}),v.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),v.jsx("li",{children:"Town Anchors table (your curated list)"}),v.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),v.jsx("li",{children:"County + state fallback"}),v.jsx("li",{children:"Bare lat/lon coords"})]}),v.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),v.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",v.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),v.jsxs(hr,{id:"schema",title:"Schema Migrations",children:[v.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",v.jsx(oe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",v.jsx(oe,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",v.jsx(oe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),v.jsx(de,{children:"v0.6 + v0.7 additions"}),v.jsx(yt,{headers:["Migration","What it added"],rows:[[v.jsx(oe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[v.jsx(oe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[v.jsx(oe,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[v.jsx(oe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[v.jsx(oe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[v.jsx(oe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),v.jsx(de,{children:"When migrations fail"}),v.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",v.jsx(oe,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),v.jsxs(hr,{id:"api",title:"API Reference",children:[v.jsxs("p",{children:["MeshAI's REST API is available at ",v.jsx(oe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),v.jsx(de,{children:"System"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/status"})," — version, uptime, node count"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/channels"})," — radio channel list"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"POST /api/restart"})," — restart the bot"]})]}),v.jsx(de,{children:"Mesh Data"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/health"})," — health score and pillars"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/regions"})," — region summaries"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/sources"})," — data source health"]})]}),v.jsx(de,{children:"Configuration"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/config"})," — full config"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["GET /api/config/","{section}"]})," — one section"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),v.jsx(de,{children:"Environmental"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/status"})," — per-feed health"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/active"})," — all active events"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),v.jsx(de,{children:"Alerts"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/active"})," — current alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/history"})," — past alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),v.jsx(de,{children:"Real-time"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(oe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const Mxe=1500;function Axe(){const[e,t]=G.useState({}),[r,n]=G.useState({}),[i,a]=G.useState(!0),[o,s]=G.useState(null),[l,u]=G.useState({}),[c,h]=G.useState({}),[f,d]=G.useState({}),g=G.useCallback(async()=>{a(!0),s(null);try{const[S,T]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!S.ok)throw new Error(`GET /adapter-config: ${S.status}`);if(!T.ok)throw new Error(`GET /adapter-meta: ${T.status}`);t(await S.json()),n(await T.json())}catch(S){s(String(S))}finally{a(!1)}},[]);G.useEffect(()=>{g()},[g]);const m=G.useCallback((S,T,M)=>{h(A=>({...A,[S]:T})),M&&d(A=>({...A,[S]:M})),T==="saved"&&setTimeout(()=>{h(A=>A[S]==="saved"?{...A,[S]:"idle"}:A)},Mxe)},[]),y=G.useCallback(async(S,T,M)=>{const A=`${S}.${T}`;m(A,"saving");try{const P=await fetch(`/api/adapter-config/${S}/${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:M})});if(!P.ok){const D=(await P.json().catch(()=>({}))).detail||P.statusText;m(A,"error",String(D));return}const I=await P.json();t(N=>({...N,[S]:(N[S]||[]).map(D=>D.key===T?I:D)})),m(A,"saved")}catch(P){m(A,"error",String(P))}},[m]),x=G.useCallback(async(S,T)=>{const M=`${S}.${T}`;m(M,"saving");try{const A=await fetch(`/api/adapter-config/${S}/${T}/reset`,{method:"POST"});if(!A.ok){m(M,"error",`reset failed (${A.status})`);return}const P=await A.json();t(I=>({...I,[S]:(I[S]||[]).map(N=>N.key===T?P:N)})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]),_=G.useCallback(async(S,T)=>{const M=`meta:${S}`;m(M,"saving");try{const A=await fetch(`/api/adapter-meta/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const I=await A.json().catch(()=>({}));m(M,"error",String(I.detail||A.statusText));return}const P=await A.json();n(I=>({...I,[S]:P})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]);if(i)return v.jsxs("div",{className:"p-6 flex items-center gap-2 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(o)return v.jsxs("div",{className:"p-6 text-red-400",children:[v.jsx(Vo,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",o]});const w=Array.from(new Set([...Object.keys(r),...Object.keys(e)])).sort();return v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 text-slate-200",children:[v.jsx(BM,{className:"w-5 h-5"}),v.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[Object.values(e).reduce((S,T)=>S+T.length,0)," settings across ",w.length," adapters"]})]}),v.jsxs("p",{className:"text-xs text-slate-400 max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",v.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",v.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),w.map(S=>{const T=r[S]||{display_name:S,include_in_llm_context:!0,description:""},M=e[S]||[],A=l[S]??!1,P=`meta:${S}`,I=c[P]||"idle";return v.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg",children:[v.jsxs("div",{className:"p-4 flex items-start gap-4",children:[v.jsx("button",{onClick:()=>u(N=>({...N,[S]:!N[S]})),className:"text-slate-400 hover:text-white","aria-label":"toggle expand",children:A?v.jsx(ll,{className:"w-5 h-5"}):v.jsx(Js,{className:"w-5 h-5"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"text-base font-semibold text-slate-100",children:T.display_name}),v.jsx("code",{className:"text-xs text-slate-500",children:S}),M.length>0&&v.jsxs("span",{className:"text-xs text-slate-400 ml-1",children:["(",M.length," settings)"]}),M.length===0&&v.jsx("span",{className:"text-xs text-slate-500 ml-1 italic",children:"(meta only)"})]}),T.description&&v.jsx("p",{className:"text-xs text-slate-400 mt-1",children:T.description})]}),v.jsxs("label",{className:"flex items-center gap-2 text-xs text-slate-300 select-none",children:[v.jsx("input",{type:"checkbox",checked:T.include_in_llm_context,onChange:N=>_(S,{include_in_llm_context:N.target.checked}),className:"w-4 h-4 accent-cyan-500"}),"LLM context",v.jsx(tU,{status:I,error:f[P]})]})]}),A&&M.length>0&&v.jsx("div",{className:"border-t border-slate-700 divide-y divide-slate-700/60",children:M.map(N=>v.jsx(kxe,{row:N,status:c[`${S}.${N.key}`]||"idle",error:f[`${S}.${N.key}`],onCommit:D=>y(S,N.key,D),onReset:()=>x(S,N.key)},N.key))})]},S)})]})}function kxe({row:e,status:t,error:r,onCommit:n,onReset:i}){const[a,o]=G.useState(bS(e));G.useEffect(()=>{o(bS(e))},[e.value,e.type]);const s=a!==bS(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=Lxe(a,e.type);c.error||c.changed(e.value)&&n(c.value)};return v.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("code",{className:"text-sm font-mono text-cyan-300",children:e.key}),v.jsxs("span",{className:"text-xs text-slate-500",children:["[",e.type,"]"]}),!l&&v.jsx("span",{className:"text-xs text-amber-400",children:"edited"})]}),e.description&&v.jsx("p",{className:"text-xs text-slate-400 mt-1",children:e.description})]}),v.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?v.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-cyan-500"}):e.type==="json"?v.jsx("textarea",{className:"w-72 h-20 bg-slate-900 border border-slate-700 rounded px-2 py-1 text-xs font-mono text-slate-100",value:a,onChange:c=>o(c.target.value),onBlur:u}):v.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-slate-900 border border-slate-700 rounded px-2 py-1 text-sm text-slate-100",value:a,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),v.jsx(tU,{status:t,error:r,dirty:s}),v.jsx("button",{onClick:i,disabled:l,className:"text-slate-400 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:v.jsx(Jx,{className:"w-4 h-4"})})]})]})}function tU({status:e,error:t,dirty:r}){return e==="saving"?v.jsx(Dp,{className:"w-4 h-4 text-cyan-400 animate-spin"}):e==="saved"?v.jsx(Za,{className:"w-4 h-4 text-emerald-400"}):e==="error"?v.jsx("span",{title:t,className:"text-red-400 cursor-help",children:v.jsx(Vo,{className:"w-4 h-4"})}):r?v.jsx("span",{className:"w-2 h-2 bg-amber-400 rounded-full",title:"unsaved"}):v.jsx("span",{className:"w-4 h-4"})}function bS(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function Lxe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const wS={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function Nxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(wS),[c,h]=G.useState(!1),[f,d]=G.useState("unknown"),g=G.useCallback(async()=>{n(!0),a(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){a(String(S))}finally{n(!1)}},[]);G.useEffect(()=>{g()},[g]),G.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var T;return d(((T=S==null?void 0:S.usgs)==null?void 0:T.feed_source)||"unknown")}).catch(()=>d("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...wS})},x=()=>{s(null),h(!1),u(wS)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const T=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!T.ok){alert(`delete failed: ${T.status}`);return}g()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Yx,{className:"w-5 h-5 text-cyan-400"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),v.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-cyan-700 hover:bg-cyan-600 rounded text-white text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add site"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-slate-900 text-xs text-slate-400 uppercase",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 text-left",children:"Site ID"}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lat,Lon"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Action"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Minor"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Moderate"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Major"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(S=>o===S.site_id?v.jsx("tr",{className:"bg-slate-900/40",children:v.jsx("td",{colSpan:9,className:"px-3 py-2",children:v.jsx(I3,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),v.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),v.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>m(S),className:"text-cyan-400 hover:text-cyan-300 text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function I3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i,feedSource:a}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=G.useState(!1),[u,c]=G.useState(null),h=a!=="native"||!e.site_id.trim(),f=a!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",d=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-slate-900/50 rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",v.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[v.jsx("input",{className:"flex-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!i}),v.jsxs("button",{type:"button",onClick:d,disabled:h||s,title:f,className:"px-2 py-1 bg-slate-700 hover:bg-slate-600 disabled:opacity-30 disabled:cursor-not-allowed rounded text-xs text-slate-100 flex items-center gap-1",children:[s?v.jsx(Dp,{className:"w-3 h-3 animate-spin"}):v.jsx(e_,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&v.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-cyan-500"}),"Enabled"]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm",children:"Save"})]})]})}const SS={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function Pxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(!1),[c,h]=G.useState(SS),f=G.useCallback(async()=>{n(!0),a(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){a(String(_))}finally{n(!1)}},[]);G.useEffect(()=>{f()},[f]);const d=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...SS})},m=()=>{s(null),u(!1),h(SS)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const T=await S.json().catch(()=>({}));alert(`save failed: ${T.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nf,{className:"w-5 h-5 text-cyan-400"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),v.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-cyan-700 hover:bg-cyan-600 rounded text-white text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add town"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-slate-900 text-xs text-slate-400 uppercase",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lat"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lon"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"State"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(_=>o===_.anchor_id?v.jsx("tr",{className:"bg-slate-900/40",children:v.jsx("td",{colSpan:6,className:"px-3 py-2",children:v.jsx(D3,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>d(_),className:"text-cyan-400 hover:text-cyan-300 text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function D3({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i}){const a=(o,s)=>t({...e,[o]:s});return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-slate-900/50 rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.name,onChange:o=>a("name",o.target.value),disabled:!i})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["State",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>a("state",o.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>a("enabled",o.target.checked),className:"accent-cyan-500 mt-4"}),"Enabled"]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:o=>a("lat",parseFloat(o.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:o=>a("lon",parseFloat(o.target.value))})]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm",children:"Save"})]})]})}function Ixe(){return v.jsx(cY,{children:v.jsx(pY,{children:v.jsxs(b$,{children:[v.jsx($i,{path:"/",element:v.jsx(CY,{})}),v.jsx($i,{path:"/mesh",element:v.jsx(V0e,{})}),v.jsx($i,{path:"/environment",element:v.jsx(hxe,{})}),v.jsx($i,{path:"/config",element:v.jsx(sxe,{})}),v.jsx($i,{path:"/alerts",element:v.jsx(xxe,{})}),v.jsx($i,{path:"/notifications",element:v.jsx(Cxe,{})}),v.jsx($i,{path:"/reference",element:v.jsx(Txe,{})}),v.jsx($i,{path:"/adapter-config",element:v.jsx(Axe,{})}),v.jsx($i,{path:"/gauge-sites",element:v.jsx(Nxe,{})}),v.jsx($i,{path:"/town-anchors",element:v.jsx(Pxe,{})})]})})})}CS.createRoot(document.getElementById("root")).render(v.jsx(Ch.StrictMode,{children:v.jsx(k$,{children:v.jsx(Ixe,{})})})); + */(function(e,t){(function(r,n){n(t)})(n7,function(r){var n="1.9.4";function i(p){var b,C,k,E;for(C=1,k=arguments.length;C"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(p){return this.clone()._add(U(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract(U(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new z(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new z(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Z(this.x),this.y=Z(this.y),this},distanceTo:function(p){p=U(p);var b=p.x-this.x,C=p.y-this.y;return Math.sqrt(b*b+C*C)},equals:function(p){return p=U(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=U(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+f(this.x)+", "+f(this.y)+")"}};function U(p,b,C){return p instanceof z?p:w(p)?new z(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new z(p.x,p.y):new z(p,b,C)}function $(p,b){if(p)for(var C=b?[p,b]:p,k=0,E=C.length;k=this.min.x&&C.x<=this.max.x&&b.y>=this.min.y&&C.y<=this.max.y},intersects:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>=b.x&&k.x<=C.x,X=E.y>=b.y&&k.y<=C.y;return B&&X},overlaps:function(p){p=Y(p);var b=this.min,C=this.max,k=p.min,E=p.max,B=E.x>b.x&&k.xb.y&&k.y=b.lat&&E.lat<=C.lat&&k.lng>=b.lng&&E.lng<=C.lng},intersects:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>=b.lat&&k.lat<=C.lat,X=E.lng>=b.lng&&k.lng<=C.lng;return B&&X},overlaps:function(p){p=ie(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),E=p.getNorthEast(),B=E.lat>b.lat&&k.latb.lng&&k.lng1,gl=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),ee=function(){return!!document.createElement("canvas").getContext}(),xt=!!(document.createElementNS&&et("svg").createSVGRect),pt=!!xt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),dt=!xt&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),ur=navigator.platform.indexOf("Mac")===0,oo=navigator.platform.indexOf("Linux")===0;function rn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var Be={ie:lr,ielt9:Mr,edge:Gn,webkit:Wn,android:io,android23:Af,androidStock:ig,opera:ac,chrome:ag,gecko:jt,safari:$_,phantom:og,opera12:sg,win:Ue,ie3d:lg,webkit3d:kf,gecko3d:ao,any3d:tn,mobile:pl,mobileWebkit:ug,mobileWebkit3d:cg,msPointer:Lf,pointer:Nf,touch:Ut,touchNative:xe,mobileOpera:Hn,mobileGecko:ui,retina:Gi,passiveEvents:gl,canvas:ee,svg:xt,vml:dt,inlineSvg:pt,mac:ur,linux:oo},Pf=Be.msPointer?"MSPointerDown":"pointerdown",If=Be.msPointer?"MSPointerMove":"pointermove",Df=Be.msPointer?"MSPointerUp":"pointerup",Ef=Be.msPointer?"MSPointerCancel":"pointercancel",oc={touchstart:Pf,touchmove:If,touchend:Df,touchcancel:Ef},jf={touchstart:rU,touchmove:dg,touchend:dg,touchcancel:dg},so={},Rf=!1;function hg(p,b,C){return b==="touchstart"&&Ft(),jf[b]?(C=jf[b].bind(this,C),p.addEventListener(oc[b],C,!1),C):(console.warn("wrong event specified:",b),h)}function Of(p,b,C){if(!oc[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(oc[b],C,!1)}function fg(p){so[p.pointerId]=p}function Bt(p){so[p.pointerId]&&(so[p.pointerId]=p)}function wt(p){delete so[p.pointerId]}function Ft(){Rf||(document.addEventListener(Pf,fg,!0),document.addEventListener(If,Bt,!0),document.addEventListener(Df,wt,!0),document.addEventListener(Ef,wt,!0),Rf=!0)}function dg(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var C in so)b.touches.push(so[C]);b.changedTouches=[b],p(b)}}function rU(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&Hr(b),dg(p,b)}function nU(p){var b={},C,k;for(k in p)C=p[k],b[k]=C&&C.bind?C.bind(p):C;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var iU=200;function aU(p,b){p.addEventListener("dblclick",b);var C=0,k;function E(B){if(B.detail!==1){k=B.detail;return}if(!(B.pointerType==="mouse"||B.sourceCapabilities&&!B.sourceCapabilities.firesTouchEvents)){var X=EL(B);if(!(X.some(function(ne){return ne instanceof HTMLLabelElement&&ne.attributes.for})&&!X.some(function(ne){return ne instanceof HTMLInputElement||ne instanceof HTMLSelectElement}))){var J=Date.now();J-C<=iU?(k++,k===2&&b(nU(B))):k=1,C=J}}}return p.addEventListener("click",E),{dblclick:b,simDblclick:E}}function oU(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Y_=gg(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),zf=gg(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),NL=zf==="webkitTransition"||zf==="OTransition"?zf+"End":"transitionend";function PL(p){return typeof p=="string"?document.getElementById(p):p}function Bf(p,b){var C=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!C||C==="auto")&&document.defaultView){var k=document.defaultView.getComputedStyle(p,null);C=k?k[b]:null}return C==="auto"?null:C}function St(p,b,C){var k=document.createElement(p);return k.className=b||"",C&&C.appendChild(k),k}function Zt(p){var b=p.parentNode;b&&b.removeChild(p)}function vg(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function sc(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function lc(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function X_(p,b){if(p.classList!==void 0)return p.classList.contains(b);var C=pg(p);return C.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(C)}function at(p,b){if(p.classList!==void 0)for(var C=g(b),k=0,E=C.length;k0?2*window.devicePixelRatio:1;function RL(p){return Be.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/uU:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function s1(p,b){var C=b.relatedTarget;if(!C)return!0;try{for(;C&&C!==p;)C=C.parentNode}catch{return!1}return C!==p}var cU={__proto__:null,on:nt,off:Rt,stopPropagation:xl,disableScrollPropagation:o1,disableClickPropagation:Wf,preventDefault:Hr,stop:_l,getPropagationPath:EL,getMousePosition:jL,getWheelDelta:RL,isExternalTarget:s1,addListener:nt,removeListener:Rt},OL=V.extend({run:function(p,b,C,k){this.stop(),this._el=p,this._inProgress=!0,this._duration=C||.25,this._easeOutPower=1/Math.max(k||.5,.2),this._startPos=yl(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,C=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var C=this.getCenter(),k=this._limitCenter(C,this._zoom,ie(p));return C.equals(k)||this.panTo(k,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var C=U(b.paddingTopLeft||b.padding||[0,0]),k=U(b.paddingBottomRight||b.padding||[0,0]),E=this.project(this.getCenter()),B=this.project(p),X=this.getPixelBounds(),J=Y([X.min.add(C),X.max.subtract(k)]),ne=J.getSize();if(!J.contains(B)){this._enforcingBounds=!0;var ue=B.subtract(J.getCenter()),Ie=J.extend(B).getSize().subtract(ne);E.x+=ue.x<0?-Ie.x:Ie.x,E.y+=ue.y<0?-Ie.y:Ie.y,this.panTo(this.unproject(E),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=i({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var C=this.getSize(),k=b.divideBy(2).round(),E=C.divideBy(2).round(),B=k.subtract(E);return!B.x&&!B.y?this:(p.animate&&p.pan?this.panBy(B):(p.pan&&this._rawPanBy(B),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:C}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=i({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),C=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,C,p):navigator.geolocation.getCurrentPosition(b,C,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,C=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+C+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,C=p.coords.longitude,k=new se(b,C),E=k.toBounds(p.coords.accuracy*2),B=this._locateOptions;if(B.setView){var X=this.getBoundsZoom(E);this.setView(k,B.maxZoom?Math.min(X,B.maxZoom):X)}var J={latlng:k,bounds:E,timestamp:p.timestamp};for(var ne in p.coords)typeof p.coords[ne]=="number"&&(J[ne]=p.coords[ne]);this.fire("locationfound",J)}},addHandler:function(p,b){if(!b)return this;var C=this[p]=new b(this);return this._handlers.push(C),this.options[p]&&C.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Zt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)Zt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var C="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),k=St("div",C,b||this._mapPane);return p&&(this._panes[p]=k),k},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),C=this.unproject(p.getTopRight());return new te(b,C)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,C){p=ie(p),C=U(C||[0,0]);var k=this.getZoom()||0,E=this.getMinZoom(),B=this.getMaxZoom(),X=p.getNorthWest(),J=p.getSouthEast(),ne=this.getSize().subtract(C),ue=Y(this.project(J,k),this.project(X,k)).getSize(),Ie=Be.any3d?this.options.zoomSnap:1,Xe=ne.x/ue.x,ut=ne.y/ue.y,pn=b?Math.max(Xe,ut):Math.min(Xe,ut);return k=this.getScaleZoom(pn,k),Ie&&(k=Math.round(k/(Ie/100))*(Ie/100),k=b?Math.ceil(k/Ie)*Ie:Math.floor(k/Ie)*Ie),Math.max(E,Math.min(B,k))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var C=this._getTopLeftPoint(p,b);return new $(C,C.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var C=this.options.crs;return b=b===void 0?this._zoom:b,C.scale(p)/C.scale(b)},getScaleZoom:function(p,b){var C=this.options.crs;b=b===void 0?this._zoom:b;var k=C.zoom(p*C.scale(b));return isNaN(k)?1/0:k},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(le(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng(U(p),b)},layerPointToLatLng:function(p){var b=U(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(le(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(le(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(ie(p))},distance:function(p,b){return this.options.crs.distance(le(p),le(b))},containerPointToLayerPoint:function(p){return U(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return U(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint(U(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(le(p)))},mouseEventToContainerPoint:function(p){return jL(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=PL(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");nt(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&Be.any3d,at(p,"leaflet-container"+(Be.touch?" leaflet-touch":"")+(Be.retina?" leaflet-retina":"")+(Be.ielt9?" leaflet-oldie":"")+(Be.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=Bf(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),mr(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(at(p.markerPane,"leaflet-zoom-hide"),at(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,C){mr(this._mapPane,new z(0,0));var k=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var E=this._zoom!==b;this._moveStart(E,C)._move(p,b)._moveEnd(E),this.fire("viewreset"),k&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,C,k){b===void 0&&(b=this._zoom);var E=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),k?C&&C.pinch&&this.fire("zoom",C):((E||C&&C.pinch)&&this.fire("zoom",C),this.fire("move",C)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){mr(this._mapPane,this._getMapPanePos().subtract(p))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Rt:nt;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),Be.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var C=[],k,E=b==="mouseout"||b==="mouseover",B=p.target||p.srcElement,X=!1;B;){if(k=this._targets[l(B)],k&&(b==="click"||b==="preclick")&&this._draggableMoved(k)){X=!0;break}if(k&&k.listens(b,!0)&&(E&&!s1(B,p)||(C.push(k),E))||B===this._container)break;B=B.parentNode}return!C.length&&!X&&!E&&this.listens(b,!0)&&(C=[this]),C},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var C=p.type;C==="mousedown"&&t1(b),this._fireDOMEvent(p,C)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,C){if(p.type==="click"){var k=i({},p);k.type="preclick",this._fireDOMEvent(k,k.type,C)}var E=this._findEventTargets(p,b);if(C){for(var B=[],X=0;X0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),C=this.getMaxZoom(),k=Be.any3d?this.options.zoomSnap:1;return k&&(p=Math.round(p/k)*k),Math.max(b,Math.min(C,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){cr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var C=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(C)?!1:(this.panBy(C,b),!0)},_createAnimProxy:function(){var p=this._proxy=St("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var C=Y_,k=this._proxy.style[C];ml(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),k===this._proxy.style[C]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Zt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();ml(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,C){if(this._animatingZoom)return!0;if(C=C||{},!this._zoomAnimated||C.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var k=this.getZoomScale(b),E=this._getCenterOffset(p)._divideBy(1-1/k);return C.animate!==!0&&!this.getSize().contains(E)?!1:(D(function(){this._moveStart(!0,C.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,C,k){this._mapPane&&(C&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,at(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:k}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&cr(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function hU(p,b){return new mt(p,b)}var Wi=F.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),C=this.getPosition(),k=p._controlCorners[C];return at(b,"leaflet-control"),C.indexOf("bottom")!==-1?k.insertBefore(b,k.firstChild):k.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Zt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),Hf=function(p){return new Wi(p)};mt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",C=this._controlContainer=St("div",b+"control-container",this._container);function k(E,B){var X=b+E+" "+b+B;p[E+B]=St("div",X,C)}k("top","left"),k("top","right"),k("bottom","left"),k("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)Zt(this._controlCorners[p]);Zt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var zL=Wi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,C,k){return C1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),C=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;C&&this._map.fire(C,b)},_createRadioElement:function(p,b){var C='",k=document.createElement("div");return k.innerHTML=C,k.firstChild},_addItem:function(p){var b=document.createElement("label"),C=this._map.hasLayer(p.layer),k;p.overlay?(k=document.createElement("input"),k.type="checkbox",k.className="leaflet-control-layers-selector",k.defaultChecked=C):k=this._createRadioElement("leaflet-base-layers_"+l(this),C),this._layerControlInputs.push(k),k.layerId=l(p.layer),nt(k,"click",this._onInputClick,this);var E=document.createElement("span");E.innerHTML=" "+p.name;var B=document.createElement("span");b.appendChild(B),B.appendChild(k),B.appendChild(E);var X=p.overlay?this._overlaysList:this._baseLayersList;return X.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,C,k=[],E=[];this._handlingClick=!0;for(var B=p.length-1;B>=0;B--)b=p[B],C=this._getLayer(b.layerId).layer,b.checked?k.push(C):b.checked||E.push(C);for(B=0;B=0;E--)b=p[E],C=this._getLayer(b.layerId).layer,b.disabled=C.options.minZoom!==void 0&&kC.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,nt(p,"click",Hr),this.expand();var b=this;setTimeout(function(){Rt(p,"click",Hr),b._preventClick=!1})}}),fU=function(p,b,C){return new zL(p,b,C)},l1=Wi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",C=St("div",b+" leaflet-bar"),k=this.options;return this._zoomInButton=this._createButton(k.zoomInText,k.zoomInTitle,b+"-in",C,this._zoomIn),this._zoomOutButton=this._createButton(k.zoomOutText,k.zoomOutTitle,b+"-out",C,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),C},onRemove:function(p){p.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,C,k,E){var B=St("a",C,k);return B.innerHTML=p,B.href="#",B.title=b,B.setAttribute("role","button"),B.setAttribute("aria-label",b),Wf(B),nt(B,"click",_l),nt(B,"click",E,this),nt(B,"click",this._refocusOnMap,this),B},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";cr(this._zoomInButton,b),cr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(at(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(at(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});mt.mergeOptions({zoomControl:!0}),mt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new l1,this.addControl(this.zoomControl))});var dU=function(p){return new l1(p)},BL=Wi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",C=St("div",b),k=this.options;return this._addScales(k,b+"-line",C),p.on(k.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),C},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,C){p.metric&&(this._mScale=St("div",b,C)),p.imperial&&(this._iScale=St("div",b,C))},_update:function(){var p=this._map,b=p.getSize().y/2,C=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(C)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),C=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,C,b/p)},_updateImperial:function(p){var b=p*3.2808399,C,k,E;b>5280?(C=b/5280,k=this._getRoundNum(C),this._updateScale(this._iScale,k+" mi",k/C)):(E=this._getRoundNum(b),this._updateScale(this._iScale,E+" ft",E/b))},_updateScale:function(p,b,C){p.style.width=Math.round(this.options.maxWidth*C)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),C=p/b;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:1,b*C}}),vU=function(p){return new BL(p)},pU='',u1=Wi.extend({options:{position:"bottomright",prefix:''+(Be.inlineSvg?pU+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=St("div","leaflet-control-attribution"),Wf(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var C=[];this.options.prefix&&C.push(this.options.prefix),p.length&&C.push(p.join(", ")),this._container.innerHTML=C.join(' ')}}});mt.mergeOptions({attributionControl:!0}),mt.addInitHook(function(){this.options.attributionControl&&new u1().addTo(this)});var gU=function(p){return new u1(p)};Wi.Layers=zL,Wi.Zoom=l1,Wi.Scale=BL,Wi.Attribution=u1,Hf.layers=fU,Hf.zoom=dU,Hf.scale=vU,Hf.attribution=gU;var ma=F.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ma.addTo=function(p,b){return p.addHandler(b,this),this};var mU={Events:W},FL=Be.touch?"touchstart mousedown":"mousedown",es=V.extend({options:{clickTolerance:3},initialize:function(p,b,C,k){m(this,k),this._element=p,this._dragStartTarget=b||p,this._preventOutline=C},enable:function(){this._enabled||(nt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(es._dragging===this&&this.finishDrag(!0),Rt(this._dragStartTarget,FL,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!X_(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){es._dragging===this&&this.finishDrag();return}if(!(es._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(es._dragging=this,this._preventOutline&&t1(this._element),J_(),Ff(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,C=IL(this._element);this._startPoint=new z(b.clientX,b.clientY),this._startPos=yl(this._element),this._parentScale=r1(C);var k=p.type==="mousedown";nt(document,k?"mousemove":"touchmove",this._onMove,this),nt(document,k?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,C=new z(b.clientX,b.clientY)._subtract(this._startPoint);!C.x&&!C.y||Math.abs(C.x)+Math.abs(C.y)B&&(X=J,B=ne);B>C&&(b[X]=1,h1(p,b,C,k,X),h1(p,b,C,X,E))}function bU(p,b){for(var C=[p[0]],k=1,E=0,B=p.length;kb&&(C.push(p[k]),E=k);return Eb.max.x&&(C|=2),p.yb.max.y&&(C|=8),C}function wU(p,b){var C=b.x-p.x,k=b.y-p.y;return C*C+k*k}function Uf(p,b,C,k){var E=b.x,B=b.y,X=C.x-E,J=C.y-B,ne=X*X+J*J,ue;return ne>0&&(ue=((p.x-E)*X+(p.y-B)*J)/ne,ue>1?(E=C.x,B=C.y):ue>0&&(E+=X*ue,B+=J*ue)),X=p.x-E,J=p.y-B,k?X*X+J*J:new z(E,B)}function hi(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function $L(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),hi(p)}function YL(p,b){var C,k,E,B,X,J,ne,ue;if(!p||p.length===0)throw new Error("latlngs not passed");hi(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var Ie=le([0,0]),Xe=ie(p),ut=Xe.getNorthWest().distanceTo(Xe.getSouthWest())*Xe.getNorthEast().distanceTo(Xe.getNorthWest());ut<1700&&(Ie=c1(p));var pn=p.length,jr=[];for(C=0;Ck){ne=(B-k)/E,ue=[J.x-ne*(J.x-X.x),J.y-ne*(J.y-X.y)];break}var An=b.unproject(U(ue));return le([An.lat+Ie.lat,An.lng+Ie.lng])}var SU={__proto__:null,simplify:WL,pointToSegmentDistance:HL,closestPointOnSegment:xU,clipSegment:ZL,_getEdgeIntersection:xg,_getBitCode:bl,_sqClosestPointOnSegment:Uf,isFlat:hi,_flat:$L,polylineCenter:YL},f1={project:function(p){return new z(p.lng,p.lat)},unproject:function(p){return new se(p.y,p.x)},bounds:new $([-180,-90],[180,90])},d1={R:6378137,R_MINOR:6356752314245179e-9,bounds:new $([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,C=this.R,k=p.lat*b,E=this.R_MINOR/C,B=Math.sqrt(1-E*E),X=B*Math.sin(k),J=Math.tan(Math.PI/4-k/2)/Math.pow((1-X)/(1+X),B/2);return k=-C*Math.log(Math.max(J,1e-10)),new z(p.lng*b*C,k)},unproject:function(p){for(var b=180/Math.PI,C=this.R,k=this.R_MINOR/C,E=Math.sqrt(1-k*k),B=Math.exp(-p.y/C),X=Math.PI/2-2*Math.atan(B),J=0,ne=.1,ue;J<15&&Math.abs(ne)>1e-7;J++)ue=E*Math.sin(X),ue=Math.pow((1-ue)/(1+ue),E/2),ne=Math.PI/2-2*Math.atan(B*ue)-X,X+=ne;return new se(X*b,p.x*b/C)}},CU={__proto__:null,LonLat:f1,Mercator:d1,SphericalMercator:Me},TU=i({},me,{code:"EPSG:3395",projection:d1,transformation:function(){var p=.5/(Math.PI*d1.R);return Te(p,.5,-p,.5)}()}),XL=i({},me,{code:"EPSG:4326",projection:f1,transformation:Te(1/180,1,-1/180,.5)}),MU=i({},Ee,{projection:f1,transformation:Te(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var C=b.lng-p.lng,k=b.lat-p.lat;return Math.sqrt(C*C+k*k)},infinite:!0});Ee.Earth=me,Ee.EPSG3395=TU,Ee.EPSG3857=st,Ee.EPSG900913=ze,Ee.EPSG4326=XL,Ee.Simple=MU;var Hi=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var C=this.getEvents();b.on(C,this),this.once("remove",function(){b.off(C,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});mt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var C in this._layers)p.call(b,this._layers[C]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,C=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof se&&b[0].equals(b[C-1])&&b.pop(),b},_setLatLngs:function(p){uo.prototype._setLatLngs.call(this,p),hi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return hi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,C=new z(b,b);if(p=new $(p.min.subtract(C),p.max.add(C)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var k=0,E=this._rings.length,B;kp.y!=E.y>p.y&&p.x<(E.x-k.x)*(p.y-k.y)/(E.y-k.y)+k.x&&(b=!b);return b||uo.prototype._containsPoint.call(this,p,!0)}});function EU(p,b){return new hc(p,b)}var co=lo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,C,k,E;if(b){for(C=0,k=b.length;C0&&E.push(E[0].slice()),E}function fc(p,b){return p.feature?i({},p.feature,{geometry:b}):Tg(b)}function Tg(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var m1={toGeoJSON:function(p){return fc(this,{type:"Point",coordinates:g1(this.getLatLng(),p)})}};_g.include(m1),v1.include(m1),bg.include(m1),uo.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=Cg(this._latlngs,b?1:0,!1,p);return fc(this,{type:(b?"Multi":"")+"LineString",coordinates:C})}}),hc.include({toGeoJSON:function(p){var b=!hi(this._latlngs),C=b&&!hi(this._latlngs[0]),k=Cg(this._latlngs,C?2:b?1:0,!0,p);return b||(k=[k]),fc(this,{type:(C?"Multi":"")+"Polygon",coordinates:k})}}),uc.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(C){b.push(C.toGeoJSON(p).geometry.coordinates)}),fc(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var C=b==="GeometryCollection",k=[];return this.eachLayer(function(E){if(E.toGeoJSON){var B=E.toGeoJSON(p);if(C)k.push(B.geometry);else{var X=Tg(B);X.type==="FeatureCollection"?k.push.apply(k,X.features):k.push(X)}}}),C?fc(this,{geometries:k,type:"GeometryCollection"}):{type:"FeatureCollection",features:k}}});function JL(p,b){return new co(p,b)}var jU=JL,Mg=Hi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,C){this._url=p,this._bounds=ie(b),m(this,C)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(at(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Zt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&sc(this._image),this},bringToBack:function(){return this._map&&lc(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=ie(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:St("img");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),C=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;ml(this._image,C,b)},_reset:function(){var p=this._image,b=new $(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),C=b.getSize();mr(p,b.min),p.style.width=C.x+"px",p.style.height=C.y+"px"},_updateOpacity:function(){ci(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),RU=function(p,b,C){return new Mg(p,b,C)},QL=Mg.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:St("video");if(at(b,"leaflet-image-layer"),this._zoomAnimated&&at(b,"leaflet-zoom-animated"),this.options.className&&at(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var C=b.getElementsByTagName("source"),k=[],E=0;E0?k:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var B=0;BE?(b.height=E+"px",at(p,B)):cr(p,B),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),C=this._getAnchor();mr(this._container,b.add(C))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(Bf(this._container,"marginBottom"),10)||0,C=this._container.offsetHeight+b,k=this._containerWidth,E=new z(this._containerLeft,-C-this._containerBottom);E._add(yl(this._container));var B=p.layerPointToContainerPoint(E),X=U(this.options.autoPanPadding),J=U(this.options.autoPanPaddingTopLeft||X),ne=U(this.options.autoPanPaddingBottomRight||X),ue=p.getSize(),Ie=0,Xe=0;B.x+k+ne.x>ue.x&&(Ie=B.x+k-ue.x+ne.x),B.x-Ie-J.x<0&&(Ie=B.x-J.x),B.y+C+ne.y>ue.y&&(Xe=B.y+C-ue.y+ne.y),B.y-Xe-J.y<0&&(Xe=B.y-J.y),(Ie||Xe)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([Ie,Xe]))}},_getAnchor:function(){return U(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),BU=function(p,b){return new Ag(p,b)};mt.mergeOptions({closePopupOnClick:!0}),mt.include({openPopup:function(p,b,C){return this._initOverlay(Ag,p,b,C).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Hi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Ag,this._popup,p,b),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(p){return this._popup&&(this instanceof lo||(this._popup._source=this),this._popup._prepareOpen(p||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){_l(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ts)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var kg=ya.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){ya.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){ya.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=ya.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=St("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,C,k=this._map,E=this._container,B=k.latLngToContainerPoint(k.getCenter()),X=k.layerPointToContainerPoint(p),J=this.options.direction,ne=E.offsetWidth,ue=E.offsetHeight,Ie=U(this.options.offset),Xe=this._getAnchor();J==="top"?(b=ne/2,C=ue):J==="bottom"?(b=ne/2,C=0):J==="center"?(b=ne/2,C=ue/2):J==="right"?(b=0,C=ue/2):J==="left"?(b=ne,C=ue/2):X.xthis.options.maxZoom||Ck?this._retainParent(E,B,X,k):!1)},_retainChildren:function(p,b,C,k){for(var E=2*p;E<2*p+2;E++)for(var B=2*b;B<2*b+2;B++){var X=new z(E,B);X.z=C+1;var J=this._tileCoordsToKey(X),ne=this._tiles[J];if(ne&&ne.active){ne.retain=!0;continue}else ne&&ne.loaded&&(ne.retain=!0);C+1this.options.maxZoom||this.options.minZoom!==void 0&&E1){this._setView(p,C);return}for(var Xe=E.min.y;Xe<=E.max.y;Xe++)for(var ut=E.min.x;ut<=E.max.x;ut++){var pn=new z(ut,Xe);if(pn.z=this._tileZoom,!!this._isValidTile(pn)){var jr=this._tiles[this._tileCoordsToKey(pn)];jr?jr.current=!0:X.push(pn)}}if(X.sort(function(An,vc){return An.distanceTo(B)-vc.distanceTo(B)}),X.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var fi=document.createDocumentFragment();for(ut=0;utC.max.x)||!b.wrapLat&&(p.yC.max.y))return!1}if(!this.options.bounds)return!0;var k=this._tileCoordsToBounds(p);return ie(this.options.bounds).overlaps(k)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,C=this.getTileSize(),k=p.scaleBy(C),E=k.add(C),B=b.unproject(k,p.z),X=b.unproject(E,p.z);return[B,X]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),C=new te(b[0],b[1]);return this.options.noWrap||(C=this._map.wrapLatLngBounds(C)),C},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),C=new z(+b[0],+b[1]);return C.z=+b[2],C},_removeTile:function(p){var b=this._tiles[p];b&&(Zt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){at(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,Be.ielt9&&this.options.opacity<1&&ci(p,this.options.opacity)},_addTile:function(p,b){var C=this._getTilePos(p),k=this._tileCoordsToKey(p),E=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(E),this.createTile.length<2&&D(o(this._tileReady,this,p,null,E)),mr(E,C),this._tiles[k]={el:E,coords:p,current:!0},b.appendChild(E),this.fire("tileloadstart",{tile:E,coords:p})},_tileReady:function(p,b,C){b&&this.fire("tileerror",{error:b,tile:C,coords:p});var k=this._tileCoordsToKey(p);C=this._tiles[k],C&&(C.loaded=+new Date,this._map._fadeAnimated?(ci(C.el,0),O(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(C.active=!0,this._pruneTiles()),b||(at(C.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:C.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Be.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new z(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new $(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function GU(p){return new $f(p)}var dc=$f.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&Be.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var C=document.createElement("img");return nt(C,"load",o(this._tileOnLoad,this,b,C)),nt(C,"error",o(this._tileOnError,this,b,C)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(C.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(C.referrerPolicy=this.options.referrerPolicy),C.alt="",C.src=this.getTileUrl(p),C},getTileUrl:function(p){var b={r:Be.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var C=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=C),b["-y"]=C}return _(this._url,i(b,this.options))},_tileOnLoad:function(p,b){Be.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,C){var k=this.options.errorTileUrl;k&&b.getAttribute("src")!==k&&(b.src=k),p(C,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,C=this.options.zoomReverse,k=this.options.zoomOffset;return C&&(p=b-p),p+k},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=T;var C=this._tiles[p].coords;Zt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:C})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",T),$f.prototype._removeTile.call(this,p)},_tileReady:function(p,b,C){if(!(!this._map||C&&C.getAttribute("src")===T))return $f.prototype._tileReady.call(this,p,b,C)}});function rN(p,b){return new dc(p,b)}var nN=dc.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var C=i({},this.defaultWmsParams);for(var k in b)k in this.options||(C[k]=b[k]);b=m(this,b);var E=b.detectRetina&&Be.retina?2:1,B=this.getTileSize();C.width=B.x*E,C.height=B.y*E,this.wmsParams=C},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,dc.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),C=this._crs,k=Y(C.project(b[0]),C.project(b[1])),E=k.min,B=k.max,X=(this._wmsVersion>=1.3&&this._crs===XL?[E.y,E.x,B.y,B.x]:[E.x,E.y,B.x,B.y]).join(","),J=dc.prototype.getTileUrl.call(this,p);return J+y(this.wmsParams,J,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+X},setParams:function(p,b){return i(this.wmsParams,p),b||this.redraw(),this}});function WU(p,b){return new nN(p,b)}dc.WMS=nN,rN.wms=WU;var ho=Hi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),at(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var C=this._map.getZoomScale(b,this._zoom),k=this._map.getSize().multiplyBy(.5+this.options.padding),E=this._map.project(this._center,b),B=k.multiplyBy(-C).add(E).subtract(this._map._getNewPixelOrigin(p,b));Be.any3d?ml(this._container,B,C):mr(this._container,B)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),C=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new $(C,C.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iN=ho.extend({options:{tolerance:0},getEvents:function(){var p=ho.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ho.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");nt(p,"mousemove",this._onMouseMove,this),nt(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),nt(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,Zt(this._container),Rt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=this._container,C=p.getSize(),k=Be.retina?2:1;mr(b,p.min),b.width=k*C.x,b.height=k*C.y,b.style.width=C.x+"px",b.style.height=C.y+"px",Be.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){ho.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,C=b.next,k=b.prev;C?C.prev=k:this._drawLast=k,k?k.next=C:this._drawFirst=C,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),C=[],k,E;for(E=0;E')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),HU={_initContainer:function(){this._container=St("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ho.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Yf("shape");at(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Yf("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;Zt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,C=p._fill,k=p.options,E=p._container;E.stroked=!!k.stroke,E.filled=!!k.fill,k.stroke?(b||(b=p._stroke=Yf("stroke")),E.appendChild(b),b.weight=k.weight+"px",b.color=k.color,b.opacity=k.opacity,k.dashArray?b.dashStyle=w(k.dashArray)?k.dashArray.join(" "):k.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=k.lineCap.replace("butt","flat"),b.joinstyle=k.lineJoin):b&&(E.removeChild(b),p._stroke=null),k.fill?(C||(C=p._fill=Yf("fill")),E.appendChild(C),C.color=k.fillColor||k.color,C.opacity=k.fillOpacity):C&&(E.removeChild(C),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),C=Math.round(p._radius),k=Math.round(p._radiusY||C);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+C+","+k+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){sc(p._container)},_bringToBack:function(p){lc(p._container)}},Lg=Be.vml?Yf:et,Xf=ho.extend({_initContainer:function(){this._container=Lg("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Lg("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Zt(this._container),Rt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ho.prototype._update.call(this);var p=this._bounds,b=p.getSize(),C=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,C.setAttribute("width",b.x),C.setAttribute("height",b.y)),mr(C,p.min),C.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Lg("path");p.options.className&&at(b,p.options.className),p.options.interactive&&at(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){Zt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,C=p.options;b&&(C.stroke?(b.setAttribute("stroke",C.color),b.setAttribute("stroke-opacity",C.opacity),b.setAttribute("stroke-width",C.weight),b.setAttribute("stroke-linecap",C.lineCap),b.setAttribute("stroke-linejoin",C.lineJoin),C.dashArray?b.setAttribute("stroke-dasharray",C.dashArray):b.removeAttribute("stroke-dasharray"),C.dashOffset?b.setAttribute("stroke-dashoffset",C.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),C.fill?(b.setAttribute("fill",C.fillColor||C.color),b.setAttribute("fill-opacity",C.fillOpacity),b.setAttribute("fill-rule",C.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,lt(p._parts,b))},_updateCircle:function(p){var b=p._point,C=Math.max(Math.round(p._radius),1),k=Math.max(Math.round(p._radiusY),1)||C,E="a"+C+","+k+" 0 1,0 ",B=p._empty()?"M0 0":"M"+(b.x-C)+","+b.y+E+C*2+",0 "+E+-C*2+",0 ";this._setPath(p,B)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){sc(p._path)},_bringToBack:function(p){lc(p._path)}});Be.vml&&Xf.include(HU);function oN(p){return Be.svg||Be.vml?new Xf(p):null}mt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&aN(p)||oN(p)}});var sN=hc.extend({initialize:function(p,b){hc.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=ie(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function UU(p,b){return new sN(p,b)}Xf.create=Lg,Xf.pointsToPath=lt,co.geometryToLayer=wg,co.coordsToLatLng=p1,co.coordsToLatLngs=Sg,co.latLngToCoords=g1,co.latLngsToCoords=Cg,co.getFeature=fc,co.asFeature=Tg,mt.mergeOptions({boxZoom:!0});var lN=ma.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){nt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Rt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Zt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Ff(),J_(),this._startPoint=this._map.mouseEventToContainerPoint(p),nt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=St("div","leaflet-zoom-box",this._container),at(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new $(this._point,this._startPoint),C=b.getSize();mr(this._box,b.min),this._box.style.width=C.x+"px",this._box.style.height=C.y+"px"},_finish:function(){this._moved&&(Zt(this._box),cr(this._container,"leaflet-crosshair")),Vf(),Q_(),Rt(document,{contextmenu:_l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new te(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});mt.addInitHook("addHandler","boxZoom",lN),mt.mergeOptions({doubleClickZoom:!0});var uN=ma.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,C=b.getZoom(),k=b.options.zoomDelta,E=p.originalEvent.shiftKey?C-k:C+k;b.options.doubleClickZoom==="center"?b.setZoom(E):b.setZoomAround(p.containerPoint,E)}});mt.addInitHook("addHandler","doubleClickZoom",uN),mt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var cN=ma.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new es(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}at(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){cr(this._map._container,"leaflet-grab"),cr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=ie(this._map.options.maxBounds);this._offsetLimit=Y(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,C=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(C),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),C=this._initialWorldOffset,k=this._draggable._newPos.x,E=(k-b+C)%p+b-C,B=(k+b+C)%p-b-C,X=Math.abs(E+C)0?B:-B))-b;this._delta=0,this._startTime=null,X&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+X):p.setZoomAround(this._lastMousePos,b+X))}});mt.addInitHook("addHandler","scrollWheelZoom",fN);var ZU=600;mt.mergeOptions({tapHold:Be.touchNative&&Be.safari&&Be.mobile,tapTolerance:15});var dN=ma.extend({addHooks:function(){nt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Rt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new z(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(nt(document,"touchend",Hr),nt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),ZU),nt(document,"touchend touchcancel contextmenu",this._cancel,this),nt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Rt(document,"touchend",Hr),Rt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Rt(document,"touchend touchcancel contextmenu",this._cancel,this),Rt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new z(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var C=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});C._simulated=!0,b.target.dispatchEvent(C)}});mt.addInitHook("addHandler","tapHold",dN),mt.mergeOptions({touchZoom:Be.touch,bounceAtZoomLimits:!0});var vN=ma.extend({addHooks:function(){at(this._map._container,"leaflet-touch-zoom"),nt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){cr(this._map._container,"leaflet-touch-zoom"),Rt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(C.add(k)._divideBy(2))),this._startDist=C.distanceTo(k),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),nt(document,"touchmove",this._onTouchMove,this),nt(document,"touchend touchcancel",this._onTouchEnd,this),Hr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]),E=C.distanceTo(k)/this._startDist;if(this._zoom=b.getScaleZoom(E,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&E>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,E===1)return}else{var B=C._add(k)._divideBy(2)._subtract(this._centerPoint);if(E===1&&B.x===0&&B.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(B),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var X=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(X,this,!0),Hr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Rt(document,"touchmove",this._onTouchMove,this),Rt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});mt.addInitHook("addHandler","touchZoom",vN),mt.BoxZoom=lN,mt.DoubleClickZoom=uN,mt.Drag=cN,mt.Keyboard=hN,mt.ScrollWheelZoom=fN,mt.TapHold=dN,mt.TouchZoom=vN,r.Bounds=$,r.Browser=Be,r.CRS=Ee,r.Canvas=iN,r.Circle=v1,r.CircleMarker=bg,r.Class=F,r.Control=Wi,r.DivIcon=tN,r.DivOverlay=ya,r.DomEvent=cU,r.DomUtil=lU,r.Draggable=es,r.Evented=V,r.FeatureGroup=lo,r.GeoJSON=co,r.GridLayer=$f,r.Handler=ma,r.Icon=cc,r.ImageOverlay=Mg,r.LatLng=se,r.LatLngBounds=te,r.Layer=Hi,r.LayerGroup=uc,r.LineUtil=SU,r.Map=mt,r.Marker=_g,r.Mixin=mU,r.Path=ts,r.Point=z,r.PolyUtil=yU,r.Polygon=hc,r.Polyline=uo,r.Popup=Ag,r.PosAnimation=OL,r.Projection=CU,r.Rectangle=sN,r.Renderer=ho,r.SVG=Xf,r.SVGOverlay=eN,r.TileLayer=dc,r.Tooltip=kg,r.Transformation=pe,r.Util=R,r.VideoOverlay=QL,r.bind=o,r.bounds=Y,r.canvas=aN,r.circle=IU,r.circleMarker=PU,r.control=Hf,r.divIcon=VU,r.extend=i,r.featureGroup=kU,r.geoJSON=JL,r.geoJson=jU,r.gridLayer=GU,r.icon=LU,r.imageOverlay=RU,r.latLng=le,r.latLngBounds=ie,r.layerGroup=AU,r.map=hU,r.marker=NU,r.point=U,r.polygon=EU,r.polyline=DU,r.popup=BU,r.rectangle=UU,r.setOptions=m,r.stamp=l,r.svg=oN,r.svgOverlay=zU,r.tileLayer=rN,r.tooltip=FU,r.transformation=Te,r.version=n,r.videoOverlay=OU;var $U=window.L;r.noConflict=function(){return window.L=$U,this},window.L=r})})(E2,E2.exports);var ic=E2.exports;const YH=R2(ic);function rg(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function AL(e,t){return t==null?function(n,i){const a=G.useRef();return a.current||(a.current=e(n,i)),a}:function(n,i){const a=G.useRef();a.current||(a.current=e(n,i));const o=G.useRef(n),{instance:s}=a.current;return G.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,i]),a}}function XH(e,t){G.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function s0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return HH(n.map,r.attribution),ML(i.current,r.eventHandlers),XH(i.current,n),i}}function l0e(e,t){const r=G.useRef();G.useEffect(function(){if(t.pathOptions!==r.current){const i=t.pathOptions??{};e.instance.setStyle(i),r.current=i}},[e,t])}function u0e(e){return function(r){const n=U_(),i=e(Z_(r,n),n);return ML(i.current,r.eventHandlers),XH(i.current,n),l0e(i.current,r),i}}function qH(e,t){const r=AL(e),n=o0e(r,t);return i0e(n)}function KH(e,t){const r=AL(e,t),n=u0e(r);return n0e(n)}function c0e(e,t){const r=AL(e,t),n=s0e(r);return a0e(n)}function h0e(e,t,r){const{opacity:n,zIndex:i}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function f0e(){return U_().map}const d0e=KH(function({center:t,children:r,...n},i){const a=new ic.CircleMarker(t,n);return rg(a,UH(i,{overlayContainer:a}))},e0e);function j2(){return j2=Object.assign||function(e){for(var t=1;t(d==null?void 0:d.map)??null,[d]);const m=G.useCallback(x=>{if(x!==null&&d===null){const _=new ic.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(r0e(_))}},[]);G.useEffect(()=>()=>{d==null||d.map.remove()},[d]);const y=d?Ch.createElement($H,{value:d},n):o??null;return Ch.createElement("div",j2({},f,{ref:m}),y)}const p0e=G.forwardRef(v0e),g0e=KH(function({positions:t,...r},n){const i=new ic.Polyline(t,r);return rg(i,UH(n,{overlayContainer:i}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),m0e=qH(function(t,r){const n=new ic.Popup(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),i(!0))}function l(u){u.popup===o&&i(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,i,n])}),y0e=c0e(function({url:t,...r},n){const i=new ic.TileLayer(t,Z_(r,n));return rg(i,n)},function(t,r,n){h0e(t,r,n);const{url:i}=r;i!=null&&i!==n.url&&t.setUrl(i)}),x0e=qH(function(t,r){const n=new ic.Tooltip(t,r.overlayContainer);return rg(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),i(!0))},u=c=>{c.tooltip===s&&i(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,i,n])}),_0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",b0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",w0e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete YH.Icon.Default.prototype._getIconUrl;YH.Icon.Default.mergeOptions({iconUrl:_0e,iconRetinaUrl:b0e,shadowUrl:w0e});const w5=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],S0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C0e(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function T0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function M0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function A0e({bounds:e}){const t=f0e();return G.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function k0e({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return v.jsxs("div",{className:"min-w-[200px]",children:[v.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),v.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[v.jsx("div",{className:"text-slate-500",children:"Role"}),v.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),v.jsx("div",{className:"text-slate-500",children:"Hardware"}),v.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),v.jsx("div",{className:"text-slate-500",children:"Battery"}),v.jsx("div",{className:"text-slate-700",children:r}),v.jsx("div",{className:"text-slate-500",children:"Last Heard"}),v.jsx("div",{className:"text-slate-700",children:M0e(e.last_heard)})]}),t&&v.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Ih,{size:10}),"OSM"]})]})]})}function L0e({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),a=e.length-i.length,o=G.useMemo(()=>new Map(i.map(h=>[h.node_num,h])),[i]),s=G.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=G.useMemo(()=>{if(i.length===0)return null;const h=i.map(d=>d.latitude),f=i.map(d=>d.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[i]),u=[43.6,-114.4],c=G.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return v.jsxs("div",{className:"relative bg-bg-card rounded-lg border border-border overflow-hidden",children:[v.jsxs(p0e,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[v.jsx(y0e,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),v.jsx(A0e,{bounds:l}),s.map((h,f)=>{const d=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return v.jsx(g0e,{positions:[[d.latitude,d.longitude],[g.latitude,g.longitude]],color:C0e(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),i.map(h=>{const f=h.node_num===r,d=c.has(h.node_num),g=r===null||f||d,m=S0e.includes(h.role),y=T0e(h.latitude),x=w5[y%w5.length];return v.jsxs(d0e,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[v.jsx(x0e,{direction:"top",offset:[0,-8],children:v.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),v.jsx(m0e,{children:v.jsx(k0e,{node:h})})]},h.node_num)})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[v.jsx(nf,{size:12}),v.jsxs("span",{children:["Showing ",i.length," of ",e.length," nodes",a>0&&v.jsxs("span",{className:"text-slate-500",children:[" (",a," without coordinates)"]})]})]})]})}const S5=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],N0e=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function C5(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function P0e(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function I0e(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function D0e(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function E0e(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function j0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function R0e({node:e,edges:t,nodes:r,onSelectNode:n}){const i=G.useMemo(()=>{if(!e)return[];const h=new Map(r.map(d=>[d.node_num,d])),f=[];return t.forEach(d=>{if(d.from_node===e.node_num){const g=h.get(d.to_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}else if(d.to_node===e.node_num){const g=h.get(d.from_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}}),f.sort((d,g)=>g.snr-d.snr)},[e,t,r]);if(!e)return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:v.jsx(Di,{size:24,className:"text-slate-500"})}),v.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const a=N0e.includes(e.role),o=I0e(e.latitude),s=S5[o%S5.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[v.jsxs("div",{className:"p-4 border-b border-border",children:[v.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),v.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),v.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),v.jsx("div",{className:`text-sm font-medium ${a?"text-cyan-400":"text-slate-300"}`,children:e.role})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),v.jsx("div",{className:"text-sm text-slate-300",children:D0e(o)})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),v.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&v.jsx(Dh,{size:12,className:"text-amber-400"}),u]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${j0e(e.last_heard)}`}),v.jsx("span",{className:"text-sm text-slate-300",children:E0e(e.last_heard)})]})]}),v.jsxs("div",{className:"col-span-2",children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),v.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&v.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300",children:[v.jsx(Ih,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300",children:[v.jsx(Ih,{size:10}),"OSM"]})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",i.length,")"]}),i.length>0?v.jsx("div",{className:"divide-y divide-border",children:i.map(h=>v.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:C5(h.snr)},children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),v.jsxs("div",{className:"text-right flex-shrink-0",children:[v.jsxs("div",{className:"text-xs font-mono",style:{color:C5(h.snr)},children:[h.snr.toFixed(1)," dB"]}),v.jsx("div",{className:"text-xs text-slate-500",children:P0e(h.snr)})]})]},h.node.node_num))}):v.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const T5=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function O0e(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function z0e(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function B0e(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function M5(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function F0e({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,i]=G.useState(""),[a,o]=G.useState("short_name"),[s,l]=G.useState("asc"),[u,c]=G.useState("all"),h=G.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>T5.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||M5(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(a){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,a,s,u]),f=g=>{a===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},d=({field:g})=>a!==g?null:s==="asc"?v.jsx(V$,{size:14,className:"inline ml-1"}):v.jsx(ll,{size:14,className:"inline ml-1"});return v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[v.jsxs("div",{className:"relative flex-1 max-w-xs",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>i(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(RM,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>v.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),v.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),v.jsxs("div",{className:"overflow-x-auto",children:[v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[v.jsx("th",{className:"w-8 px-3 py-2"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",v.jsx(d,{field:"short_name"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",v.jsx(d,{field:"role"})]}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[v.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",v.jsx(d,{field:"battery_level"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[v.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",v.jsx(d,{field:"last_heard"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",v.jsx(d,{field:"hardware"})]})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=T5.includes(g.role),y=g.node_num===t;return v.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[v.jsx("td",{className:"px-3 py-2",children:v.jsx("div",{className:`w-2 h-2 rounded-full ${O0e(g.last_heard)}`})}),v.jsxs("td",{className:"px-3 py-2",children:[v.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),v.jsx("td",{className:"px-3 py-2",children:v.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-cyan-400":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:M5(g.latitude)}),v.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:B0e(g)}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:z0e(g.last_heard)}),v.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&v.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&v.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function V0e(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState("topo"),[c,h]=G.useState(!0),[f,d]=G.useState(null);G.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([tY(),rY(),oY()]).then(([y,x,_])=>{t(y),n(x),a(_),h(!1)}).catch(y=>{d(y.message),h(!1)})},[]);const g=G.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=G.useCallback(y=>{s(y)},[]);return c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),v.jsxs("div",{className:"flex items-center bg-bg-card border border-border rounded-lg p-1",children:[v.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(dB,{size:14}),v.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),v.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(X$,{size:14}),v.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),v.jsxs("div",{className:"flex gap-0",children:[v.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?v.jsx(Qye,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):v.jsx(L0e,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),v.jsx(R0e,{node:g,edges:r,nodes:e,onSelectNode:m})]}),v.jsx(F0e,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function kL({label:e,value:t,onChange:r,helper:n,info:i,roleFilter:a,valueType:o="short_name"}){const[s,l]=G.useState([]),[u,c]=G.useState(!0),[h,f]=G.useState(""),[d,g]=G.useState(!1);G.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=G.useMemo(()=>{let S=s;if(a&&(S=S.filter(T=>a==="ROUTER"||a==="infrastructure"?T.is_infrastructure||T.role==="ROUTER"||T.role==="ROUTER_CLIENT"||T.role==="REPEATER":T.role===a)),h.trim()){const T=h.toLowerCase();S=S.filter(M=>{var A,P,I,N;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(T))||((P=M.long_name)==null?void 0:P.toLowerCase().includes(T))||((I=M.role)==null?void 0:I.toLowerCase().includes(T))||((N=M.node_id_hex)==null?void 0:N.toLowerCase().includes(T))})}return S.sort((T,M)=>(T.short_name||"").localeCompare(M.short_name||""))},[s,h,a]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const T=y(S);return t.includes(T)},_=S=>{const T=y(S);t.includes(T)?r(t.filter(M=>M!==T)):r([...t,T])},w=S=>{const T=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&T.push(`— ${S.long_name}`),S.role&&T.push(`(${S.role})`),T.join(" ")};return!u&&s.length===0?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),v.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(T=>T.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const T=s.find(M=>y(M)===S);return v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[T?T.short_name:S,v.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:v.jsx(ca,{size:14})})]},S)})}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),d&&!u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] rounded-lg shadow-xl",children:m.length===0?v.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>v.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LL(e){const[t,r]=G.useState([]),[n,i]=G.useState(!0);G.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),i(!1)}).catch(()=>{r([]),i(!1)})},[]);const a=f=>{const d=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${d?` (${d})`:""}`};if(!n&&t.length===0)return e.mode==="single"?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const d=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(d)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:d,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),v.jsxs("select",{value:f,onChange:_=>d(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&v.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>v.jsx("option",{value:_.index,children:a(_)},_.index))]}),m&&v.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(d=>d!==f)):s([...o,f].sort((d,g)=>d-g))};return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-2 space-y-1",children:[c.map(f=>v.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-sm text-slate-200",children:a(f)})]},f.index)),c.length===0&&v.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&v.jsx("p",{className:"text-xs text-slate-600",children:u})]})}const A5=[{key:"bot",label:"Bot",icon:O$},{key:"connection",label:"Connection",icon:t_},{key:"response",label:"Response",icon:OM},{key:"history",label:"History",icon:uB},{key:"memory",label:"Memory",icon:z$},{key:"context",label:"Context",icon:jM},{key:"commands",label:"Commands",icon:gB},{key:"llm",label:"LLM",icon:lB},{key:"weather",label:"Weather",icon:Du},{key:"meshmonitor",label:"MeshMonitor",icon:Di},{key:"knowledge",label:"Knowledge",icon:oB},{key:"mesh_sources",label:"Mesh Sources",icon:hB},{key:"mesh_intelligence",label:"Intelligence",icon:rf},{key:"dashboard",label:"Dashboard",icon:fB}],Fn={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},G0e=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"sub",description:"Subscribe to scheduled reports or alerts"},{name:"unsub",description:"Remove a subscription"},{name:"mysubs",description:"List your active subscriptions"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],W0e=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function eo({info:e,link:t,linkText:r="Learn more"}){const[n,i]=G.useState(!1),a=G.useRef(null);return G.useEffect(()=>{if(!n)return;function o(l){a.current&&!a.current.contains(l.target)&&i(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),v.jsxs("div",{className:"relative inline-block",ref:a,children:[v.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),i(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&v.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl text-xs text-slate-300 leading-relaxed",children:[v.jsx("button",{type:"button",onClick:()=>i(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(ca,{size:12})}),v.jsx("div",{className:"pr-4",children:e}),t&&v.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",v.jsx(Ih,{size:10})]})]})]})}function Vn({text:e}){return v.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function ct({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o="",infoLink:s=""}){const[l,u]=G.useState(!1),c=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(eo,{info:o,link:s})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&v.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function We({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s="",infoLink:l=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(eo,{info:s,link:l})]}),v.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function or({label:e,checked:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Ln({label:e,value:t,onChange:r,options:n,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>v.jsx("option",{value:s.value,children:s.label},s.value))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function H0e({label:e,value:t,onChange:r,rows:n=4,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(eo,{info:a,link:o})]}),v.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function ou({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function U0e({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(eo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function sn({label:e,description:t,checked:r,onChange:n,threshold:i,onThresholdChange:a,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-3 space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("span",{className:"text-sm text-slate-300",children:e}),v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&i!==void 0&&a&&v.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[v.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),v.jsx("input",{type:"number",value:i,onChange:h=>a(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&v.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function Z0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.bot}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),v.jsx(ct,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."})]}),v.jsx(or,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),v.jsx(or,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function $0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.connection}),v.jsx(Ln,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?v.jsx(ct,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),placeholder:"/dev/ttyUSB0",helper:"Device path for your USB radio",info:"Usually /dev/ttyUSB0 on Linux or /dev/ttyACM0. Check with 'ls /dev/tty*' after plugging in your radio."}):v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),v.jsx(We,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]})]})}function Y0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.response}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),v.jsx(We,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),v.jsx(We,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function X0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.history}),v.jsx(ct,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),v.jsx(We,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),v.jsx(or,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),v.jsx(We,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.memory}),v.jsx(or,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),v.jsx(We,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function K0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.context}),v.jsx(or,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Observe Channels",value:e.observe_channels,onChange:r=>t({...e,observe_channels:r}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),v.jsx(kL,{label:"Ignore Nodes",value:e.ignore_nodes,onChange:r=>t({...e,ignore_nodes:r}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Max Age (sec)",value:e.max_age,onChange:r=>t({...e,max_age:r}),min:0,helper:"Ignore messages older than this"}),v.jsx(We,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})]})]})}function J0e({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(i=>i.toLowerCase())),n=i=>{const a=i.toLowerCase();r.has(a)?t({...e,disabled_commands:e.disabled_commands.filter(o=>o.toLowerCase()!==a)}):t({...e,disabled_commands:[...e.disabled_commands,i]})};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.commands}),v.jsx(or,{label:"Enable Commands",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Allow !commands on the mesh"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Command Prefix",value:e.prefix,onChange:i=>t({...e,prefix:i}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",v.jsx(eo,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),v.jsx("div",{className:"grid gap-1",children:G0e.map(i=>{const a=!r.has(i.name.toLowerCase());return v.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("code",{className:"text-accent text-sm",children:["!",i.name]}),v.jsx("span",{className:"text-xs text-slate-500",children:i.description})]}),v.jsx("button",{type:"button",onClick:()=>n(i.name),className:`relative w-9 h-5 rounded-full transition-colors ${a?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${a?"translate-x-4":""}`})})]},i.name)})})]})]})]})}function Q0e({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.llm}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),v.jsx(ct,{label:"Model",value:e.model,onChange:r=>t({...e,model:r}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),v.jsx(ct,{label:"API Key",value:e.api_key,onChange:r=>t({...e,api_key:r}),type:"password",helper:"Supports ${ENV_VAR} syntax",info:"Your API key from the provider. You can also use ${ENV_VAR} syntax to read from an environment variable instead of storing the key in the config file."}),v.jsx(ct,{label:"Base URL",value:e.base_url,onChange:r=>t({...e,base_url:r}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Timeout (sec)",value:e.timeout,onChange:r=>t({...e,timeout:r}),min:5,max:120,helper:"Maximum seconds to wait for response"}),v.jsx(We,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:r=>t({...e,max_response_tokens:r}),min:100,helper:"Token limit for LLM responses"})]}),v.jsx(or,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:r=>t({...e,use_system_prompt:r}),helper:"Enable custom system instructions"}),e.use_system_prompt&&v.jsx(H0e,{label:"System Prompt",value:e.system_prompt,onChange:r=>t({...e,system_prompt:r}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),v.jsx(or,{label:"Web Search",checked:e.web_search,onChange:r=>t({...e,web_search:r}),helper:"Enable web search tool (Open WebUI feature)"}),v.jsx(or,{label:"Google Grounding",checked:e.google_grounding,onChange:r=>t({...e,google_grounding:r}),helper:"Ground responses in web search (Gemini only)"})]})}function exe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.weather}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ln,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),v.jsx(Ln,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),v.jsx(ct,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"})]})}function txe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.meshmonitor}),v.jsx(or,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),v.jsx(or,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function rxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.knowledge}),v.jsx(or,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(Ln,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),v.jsx(We,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),v.jsx(ct,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),v.jsx(We,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),v.jsx(or,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),v.jsx(ct,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),v.jsx(We,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function nxe({source:e,onChange:t,onDelete:r}){const[n,i]=G.useState(!1),a={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>i(!n),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[n?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),v.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),v.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),v.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),n&&v.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),v.jsx(Ln,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:a[e.type]||""})]}),e.type!=="mqtt"&&v.jsx(ct,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&v.jsx(ct,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),v.jsx(We,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),v.jsx(ct,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),v.jsx(ct,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),v.jsx(or,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),v.jsx(We,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),v.jsx(or,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),v.jsx(or,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function ixe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.mesh_sources}),e.map((n,i)=>v.jsx(nxe,{source:n,onChange:a=>{const o=[...e];o[i]=a,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((a,o)=>o!==i))}},i)),v.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Source"]})]})}function axe({data:e,onChange:t}){const[r,n]=G.useState(null);return v.jsxs("div",{className:"space-y-6",children:[v.jsx(Vn,{text:Fn.mesh_intelligence}),v.jsx(or,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Activate health scoring and alerting"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:i=>t({...e,locality_radius_miles:i}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),v.jsx(We,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:i=>t({...e,offline_threshold_hours:i}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Packet Threshold",value:e.packet_threshold,onChange:i=>t({...e,packet_threshold:i}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),v.jsx(We,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:i=>t({...e,battery_warning_percent:i}),min:1,max:100,helper:"Global battery warning level"})]}),v.jsx(kL,{label:"Critical Nodes",value:e.critical_nodes,onChange:i=>t({...e,critical_nodes:i}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(LL,{label:"Alert Channel",value:e.alert_channel,onChange:i=>t({...e,alert_channel:i}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),v.jsx(We,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:i=>t({...e,alert_cooldown_minutes:i}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",v.jsx(eo,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((i,a)=>v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===a?null:a),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[r===a?v.jsx(ll,{size:16}):v.jsx(Js,{size:16}),v.jsx("span",{className:"font-medium text-slate-200",children:i.name||"Unnamed Region"}),v.jsx("span",{className:"text-xs text-slate-500",children:i.local_name})]}),v.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${i.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==a);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Ep,{size:14})})]}),r===a&&v.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Name",value:i.name,onChange:o=>{const s=[...e.regions];s[a]={...i,name:o},t({...e,regions:s})}}),v.jsx(ct,{label:"Local Name",value:i.local_name,onChange:o=>{const s=[...e.regions];s[a]={...i,local_name:o},t({...e,regions:s})}})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Latitude",value:i.lat,onChange:o=>{const s=[...e.regions];s[a]={...i,lat:o},t({...e,regions:s})},step:1e-4}),v.jsx(We,{label:"Longitude",value:i.lon,onChange:o=>{const s=[...e.regions];s[a]={...i,lon:o},t({...e,regions:s})},step:1e-4})]}),v.jsx(ct,{label:"Description",value:i.description,onChange:o=>{const s=[...e.regions];s[a]={...i,description:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Aliases",value:i.aliases,onChange:o=>{const s=[...e.regions];s[a]={...i,aliases:o},t({...e,regions:s})}}),v.jsx(ou,{label:"Cities",value:i.cities,onChange:o=>{const s=[...e.regions];s[a]={...i,cities:o},t({...e,regions:s})}})]})]},a)),v.jsxs("button",{onClick:()=>{const i={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,i]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Region"]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",v.jsx(eo,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),v.jsx(sn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_offline:i}})}),v.jsx(sn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:i}})}),v.jsx(sn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:i=>t({...e,alert_rules:{...e.alert_rules,new_router:i}})}),v.jsx(sn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:i}})}),v.jsx(sn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:i}})}),v.jsx(sn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),v.jsx(sn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning:i}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:i}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical:i}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:i}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:i}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:i}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),v.jsx(sn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:i}})}),v.jsx(sn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:i=>t({...e,alert_rules:{...e.alert_rules,power_source_change:i}})}),v.jsx(sn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:i=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),v.jsx(sn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:i=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:i}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:i}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),v.jsx(sn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood:i}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:i}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),v.jsx(sn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:i}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),v.jsx(sn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:i}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function oxe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Vn,{text:Fn.dashboard}),v.jsx(or,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(ct,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),v.jsx(We,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function sxe(){var I;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState("bot"),[o,s]=G.useState(!0),[l,u]=G.useState(!1),[c,h]=G.useState(null),[f,d]=G.useState(null),[g,m]=G.useState(!1),[y,x]=G.useState(!1),_=G.useCallback(async()=>{try{const N=await fetch("/api/config");if(!N.ok)throw new Error("Failed to fetch config");const D=await N.json();t(D),n(JSON.parse(JSON.stringify(D))),x(!1),h(null)}catch(N){h(N instanceof Error?N.message:"Unknown error")}finally{s(!1)}},[]);G.useEffect(()=>{document.title="Config — MeshAI",_()},[_]),G.useEffect(()=>{e&&r&&x(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const w=async()=>{if(e){u(!0),h(null),d(null);try{const N=e[i],D=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),O=await D.json();if(!D.ok)throw new Error(O.detail||"Save failed");d(`${i} saved successfully`),n(JSON.parse(JSON.stringify(e))),x(!1),O.restart_required&&(m(!0),hY(Array.isArray(O.changed_keys)?O.changed_keys:[])),setTimeout(()=>d(null),3e3)}catch(N){h(N instanceof Error?N.message:"Save failed")}finally{u(!1)}}},S=()=>{r&&(t(JSON.parse(JSON.stringify(r))),x(!1))},T=async()=>{try{await fetch("/api/restart",{method:"POST"}),m(!1),d("Restart initiated")}catch{h("Restart failed")}},M=(N,D)=>{e&&t({...e,[N]:D})};if(o)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const A=()=>{switch(i){case"bot":return v.jsx(Z0e,{data:e.bot,onChange:N=>M("bot",N)});case"connection":return v.jsx($0e,{data:e.connection,onChange:N=>M("connection",N)});case"response":return v.jsx(Y0e,{data:e.response,onChange:N=>M("response",N)});case"history":return v.jsx(X0e,{data:e.history,onChange:N=>M("history",N)});case"memory":return v.jsx(q0e,{data:e.memory,onChange:N=>M("memory",N)});case"context":return v.jsx(K0e,{data:e.context,onChange:N=>M("context",N)});case"commands":return v.jsx(J0e,{data:e.commands,onChange:N=>M("commands",N)});case"llm":return v.jsx(Q0e,{data:e.llm,onChange:N=>M("llm",N)});case"weather":return v.jsx(exe,{data:e.weather,onChange:N=>M("weather",N)});case"meshmonitor":return v.jsx(txe,{data:e.meshmonitor,onChange:N=>M("meshmonitor",N)});case"knowledge":return v.jsx(rxe,{data:e.knowledge,onChange:N=>M("knowledge",N)});case"mesh_sources":return v.jsx(ixe,{data:e.mesh_sources,onChange:N=>M("mesh_sources",N)});case"mesh_intelligence":return v.jsx(axe,{data:e.mesh_intelligence,onChange:N=>M("mesh_intelligence",N)});case"dashboard":return v.jsx(oxe,{data:e.dashboard,onChange:N=>M("dashboard",N)});default:return null}},P=((I=A5.find(N=>N.key===i))==null?void 0:I.label)||i;return v.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[v.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:A5.map(({key:N,label:D,icon:O})=>v.jsxs("button",{onClick:()=>a(N),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===N?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[v.jsx(O,{size:16}),v.jsx("span",{children:D}),y&&i===N&&v.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},N))}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center justify-between mb-6",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(vB,{size:20,className:"text-slate-500"}),v.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:P})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[y&&v.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[v.jsx(Jx,{size:14}),"Discard"]}),v.jsxs("button",{onClick:w,disabled:l||!y,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[l?v.jsx($v,{size:14,className:"animate-spin"}):v.jsx(zM,{size:14}),"Save"]})]})]}),g&&v.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30 rounded-lg",children:[v.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[v.jsx($a,{size:16}),v.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),v.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),c&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400",children:[v.jsx(ca,{size:16}),v.jsx("span",{className:"text-sm",children:c})]}),f&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 rounded-lg text-green-400",children:[v.jsx(Za,{size:16}),v.jsx("span",{className:"text-sm",children:f})]}),v.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:v.jsx("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:A()})})]})]})}function lxe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return v.jsxs("div",{className:"bg-bg-hover rounded-lg p-4",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),v.jsx("span",{className:"text-sm font-medium text-slate-200 uppercase",children:e.source})]}),v.jsx("span",{className:"text-xs text-slate-400",children:r})]}),v.jsxs("div",{className:"text-xs text-slate-500 space-y-1",children:[v.jsxs("div",{children:["Events: ",e.event_count]}),v.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&v.jsx("div",{className:"text-amber-500 truncate",children:e.last_error})]})]})}function uxe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Vo,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-amber-500/10",border:"border-amber-500",Icon:$a,color:"text-amber-500"}:{bg:"bg-blue-500/10",border:"border-blue-500",Icon:qx,color:"text-blue-500"},n=r.Icon;return v.jsx("div",{className:`p-3 rounded-lg ${r.bg} border-l-2 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:16,className:r.color}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-sm font-medium text-slate-200",children:e.event_type}),v.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${r.bg} ${r.color}`,children:e.severity})]}),v.jsx("div",{className:"text-sm text-slate-300",children:e.headline})]})]})})}function JH({value:e,onChange:t,disabled:r,centralDisabled:n}){const i="px-2 py-1 text-xs transition-colors";return v.jsxs("div",{className:`flex rounded border border-[#1e2a3a] overflow-hidden ${r?"opacity-40":""}`,children:[v.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${i} ${e==="native"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:"native"}),v.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${i} ${n?"text-slate-600 cursor-not-allowed":e==="central"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:"central"})]})}function cxe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:i,onFeedSource:a,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h}){const f=s||!o;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:e}),t&&v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"source"}),v.jsx(JH,{value:i,onChange:a,disabled:!r,centralDisabled:f})]}),v.jsx(or,{label:"",checked:r,onChange:n})]})]}),!l&&v.jsx("div",{className:"text-xs text-amber-400 bg-amber-500/10 rounded p-2",children:"API key not configured — contact admin"}),s&&v.jsx("div",{className:"text-[11px] text-slate-600",children:"Central not available for this adapter — native only"}),v.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&v.jsxs("div",{className:"pt-2 border-t border-[#1e2a3a] space-y-3",children:[v.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"Live status"}),u?v.jsx(lxe,{feed:u}):v.jsx("div",{className:"text-xs text-slate-600",children:"No status reported."}),c&&c.length>0&&v.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((d,g)=>v.jsx(uxe,{event:d},g))})]})]})}const hs={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0}},_S=[{key:"central",label:"Central",icon:K$,adapters:[]},{key:"weather",label:"Weather",icon:Du,adapters:["nws"]},{key:"fire",label:"Fire",icon:Xx,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:Di,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:$x,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:Kx,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:Qx,adapters:[]},{key:"mesh",label:"Mesh Health",icon:rf,adapters:[]}];function hxe(){var Lf,Nf;const[e,t]=G.useState(null),[r,n]=G.useState(""),[i,a]=G.useState(null),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(!1),[_,w]=G.useState("weather"),[S,T]=G.useState("nws"),[M,A]=G.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[P,I]=G.useState(""),[N,D]=G.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[O,R]=G.useState(""),[F,H]=G.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[W,V]=G.useState(""),[z,Z]=G.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[U,$]=G.useState(""),[Y,te]=G.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[ie,se]=G.useState(""),[le,Ee]=G.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[me,ye]=G.useState(""),[Me,pe]=G.useState({min_danger_level:3}),[Te,st]=G.useState(""),[ze,et]=G.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[lt,Et]=G.useState("");G.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var xe,Ut,Hn,ui,Gi,gl,ee,xt,pt,dt,ur,oo,rn,Be,Pf,If,Df,Ef,oc,jf,so,Rf,hg;try{const fg=await(await fetch("/api/config/environmental")).json();t(fg),n(JSON.stringify(fg));try{const Bt=await fetch("/api/adapter-config/wfigs");if(Bt.ok){const wt=await Bt.json(),Ft={allowed_incident_types:((xe=wt.allowed_incident_types)==null?void 0:xe.value)??["WF"],freshness_seconds:((Ut=wt.freshness_seconds)==null?void 0:Ut.value)??0,cooldown_seconds:((Hn=wt.cooldown_seconds)==null?void 0:Hn.value)??28800,broadcast_on_acres:((ui=wt.broadcast_on_acres)==null?void 0:ui.value)??!0,broadcast_on_contained:((Gi=wt.broadcast_on_contained)==null?void 0:Gi.value)??!0};A(Ft),I(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/fires");if(Bt.ok){const wt=await Bt.json(),Ft={digest_enabled:((gl=wt.digest_enabled)==null?void 0:gl.value)??!0,digest_schedule:((ee=wt.digest_schedule)==null?void 0:ee.value)??["06:00","18:00"],digest_timezone:((xt=wt.digest_timezone)==null?void 0:xt.value)??"America/Boise"};D(Ft),R(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/tomtom_incidents");if(Bt.ok){const wt=await Bt.json(),Ft={min_magnitude:((pt=wt.min_magnitude)==null?void 0:pt.value)??4,drop_non_present:((dt=wt.drop_non_present)==null?void 0:dt.value)??!0,drop_zero_magnitude:((ur=wt.drop_zero_magnitude)==null?void 0:ur.value)??!0};H(Ft),V(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/itd_511");if(Bt.ok){const wt=await Bt.json(),Ft={min_severity:((oo=wt.min_severity)==null?void 0:oo.value)??"None",enabled_categories:((rn=wt.enabled_categories)==null?void 0:rn.value)??["incident","closure"],enabled_sub_types:((Be=wt.enabled_sub_types)==null?void 0:Be.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ft),$(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/wzdx");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast:((Pf=wt.broadcast)==null?void 0:Pf.value)??!1,min_severity:((If=wt.min_severity)==null?void 0:If.value)??"Minor",sub_types:((Df=wt.sub_types)==null?void 0:Df.value)??["road_works","lane_closed","road_closed"]};te(Ft),se(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/nws");if(Bt.ok){const wt=await Bt.json(),Ft={broadcast_severities:((Ef=wt.broadcast_severities)==null?void 0:Ef.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((oc=wt.duplicate_allowed_after_seconds)==null?void 0:oc.value)??3600};Ee(Ft),ye(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/avalanche");if(Bt.ok){const Ft={min_danger_level:((jf=(await Bt.json()).min_danger_level)==null?void 0:jf.value)??3};pe(Ft),st(JSON.stringify(Ft))}}catch{}try{const Bt=await fetch("/api/adapter-config/swpc");if(Bt.ok){const wt=await Bt.json(),Ft={geomag_kp_floor:((so=wt.geomag_kp_floor)==null?void 0:so.value)??7,flare_class_floor:((Rf=wt.flare_class_floor)==null?void 0:Rf.value)??"X1",proton_pfu_floor:((hg=wt.proton_pfu_floor)==null?void 0:hg.value)??10};et(Ft),Et(JSON.stringify(Ft))}}catch{}}catch(Of){d(Of instanceof Error?Of.message:"Failed to load config")}finally{u(!1)}})()},[]),G.useEffect(()=>{const xe=async()=>{try{a(await xB()),s(await _B())}catch{}};xe();const Ut=setInterval(xe,3e4);return()=>clearInterval(Ut)},[]);const lr=e!==null&&JSON.stringify(e)!==r,Mr=JSON.stringify(M)!==P,Gn=JSON.stringify(N)!==O,Wn=JSON.stringify(F)!==W,io=JSON.stringify(z)!==U,Af=JSON.stringify(Y)!==ie,ng=JSON.stringify(le)!==me,ig=JSON.stringify(Me)!==Te,ac=JSON.stringify(ze)!==lt,ag=lr||Mr||Gn||Wn||io||Af||ng||ig||ac,jt=async(xe,Ut,Hn)=>{const ui=await fetch(`/api/adapter-config/${xe}/${Ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Hn})});if(!ui.ok){const Gi=await ui.json().catch(()=>({}));throw new Error(Gi.detail||`Failed to save ${xe}.${Ut}`)}},$_=async()=>{if(e){h(!0),d(null),m(null);try{if(lr){const xe=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Ut=await xe.json();if(!xe.ok)throw new Error(Ut.detail||"Save failed");n(JSON.stringify(e)),Ut.restart_required&&x(!0)}if(Mr){const xe=JSON.parse(P);M.freshness_seconds!==xe.freshness_seconds&&await jt("wfigs","freshness_seconds",M.freshness_seconds),JSON.stringify(M.allowed_incident_types)!==JSON.stringify(xe.allowed_incident_types)&&await jt("wfigs","allowed_incident_types",M.allowed_incident_types),M.cooldown_seconds!==xe.cooldown_seconds&&await jt("wfigs","cooldown_seconds",M.cooldown_seconds),M.broadcast_on_acres!==xe.broadcast_on_acres&&await jt("wfigs","broadcast_on_acres",M.broadcast_on_acres),M.broadcast_on_contained!==xe.broadcast_on_contained&&await jt("wfigs","broadcast_on_contained",M.broadcast_on_contained),I(JSON.stringify(M))}if(Gn){const xe=JSON.parse(O);N.digest_enabled!==xe.digest_enabled&&await jt("fires","digest_enabled",N.digest_enabled),JSON.stringify(N.digest_schedule)!==JSON.stringify(xe.digest_schedule)&&await jt("fires","digest_schedule",N.digest_schedule),N.digest_timezone!==xe.digest_timezone&&await jt("fires","digest_timezone",N.digest_timezone),R(JSON.stringify(N))}if(Wn){const xe=JSON.parse(W);F.min_magnitude!==xe.min_magnitude&&await jt("tomtom_incidents","min_magnitude",F.min_magnitude),F.drop_non_present!==xe.drop_non_present&&await jt("tomtom_incidents","drop_non_present",F.drop_non_present),F.drop_zero_magnitude!==xe.drop_zero_magnitude&&await jt("tomtom_incidents","drop_zero_magnitude",F.drop_zero_magnitude),V(JSON.stringify(F))}if(io){const xe=JSON.parse(U);z.min_severity!==xe.min_severity&&await jt("itd_511","min_severity",z.min_severity),JSON.stringify(z.enabled_categories)!==JSON.stringify(xe.enabled_categories)&&await jt("itd_511","enabled_categories",z.enabled_categories),JSON.stringify(z.enabled_sub_types)!==JSON.stringify(xe.enabled_sub_types)&&await jt("itd_511","enabled_sub_types",z.enabled_sub_types),$(JSON.stringify(z))}if(Af){const xe=JSON.parse(ie);Y.broadcast!==xe.broadcast&&await jt("wzdx","broadcast",Y.broadcast),Y.min_severity!==xe.min_severity&&await jt("wzdx","min_severity",Y.min_severity),JSON.stringify(Y.sub_types)!==JSON.stringify(xe.sub_types)&&await jt("wzdx","sub_types",Y.sub_types),se(JSON.stringify(Y))}if(ng){const xe=JSON.parse(me);JSON.stringify(le.broadcast_severities)!==JSON.stringify(xe.broadcast_severities)&&await jt("nws","broadcast_severities",le.broadcast_severities),le.duplicate_allowed_after_seconds!==xe.duplicate_allowed_after_seconds&&await jt("nws","duplicate_allowed_after_seconds",le.duplicate_allowed_after_seconds),ye(JSON.stringify(le))}if(ig){const xe=JSON.parse(Te);Me.min_danger_level!==xe.min_danger_level&&await jt("avalanche","min_danger_level",Me.min_danger_level),st(JSON.stringify(Me))}if(ac){const xe=JSON.parse(lt);ze.geomag_kp_floor!==xe.geomag_kp_floor&&await jt("swpc","geomag_kp_floor",ze.geomag_kp_floor),ze.flare_class_floor!==xe.flare_class_floor&&await jt("swpc","flare_class_floor",ze.flare_class_floor),ze.proton_pfu_floor!==xe.proton_pfu_floor&&await jt("swpc","proton_pfu_floor",ze.proton_pfu_floor),Et(JSON.stringify(ze))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(xe){d(xe instanceof Error?xe.message:"Save failed")}finally{h(!1)}}},og=()=>{e&&t(JSON.parse(r)),A(JSON.parse(P||JSON.stringify(M))),D(JSON.parse(O||JSON.stringify(N))),H(JSON.parse(W||JSON.stringify(F))),Z(JSON.parse(U||JSON.stringify(z))),te(JSON.parse(ie||JSON.stringify(Y))),Ee(JSON.parse(me||JSON.stringify(le))),pe(JSON.parse(Te||JSON.stringify(Me))),et(JSON.parse(lt||JSON.stringify(ze)))},sg=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{d("Restart failed")}},Ue=xe=>e&&t({...e,...xe});if(l)return v.jsx("div",{className:"flex items-center justify-center h-64 text-slate-400",children:"Loading environmental config…"});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const lg=xe=>i==null?void 0:i.feeds.find(Ut=>Ut.source===hs[xe].health),kf=xe=>o.filter(Ut=>Ut.source===hs[xe].health),ao=_S.find(xe=>xe.key===_),tn=ao.adapters.length===0?null:S&&ao.adapters.includes(S)?S:ao.adapters[0],pl=xe=>{var Ut,Hn,ui,Gi,gl;switch(xe){case"nws":return v.jsxs(v.Fragment,{children:[v.jsx(ou,{label:"NWS Zones",value:e.nws_zones,onChange:ee=>Ue({nws_zones:ee}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),e.nws.feed_source!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"User Agent",value:e.nws.user_agent,onChange:ee=>Ue({nws:{...e.nws,user_agent:ee}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:ee=>Ue({nws:{...e.nws,tick_seconds:ee}}),min:30}),v.jsx(Ln,{label:"Min Severity",value:e.nws.severity_min,onChange:ee=>Ue({nws:{...e.nws,severity_min:ee}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsxs("div",{className:"mb-3",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Severities to broadcast"}),v.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:le.broadcast_severities.includes(ee),onChange:xt=>{const pt=le.broadcast_severities;Ee({...le,broadcast_severities:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:ee})]},ee))})]}),v.jsx(We,{label:"Re-broadcast Cooldown (seconds)",value:le.duplicate_allowed_after_seconds,onChange:ee=>Ee({...le,duplicate_allowed_after_seconds:ee}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return v.jsx("div",{className:"space-y-6",children:v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Thresholds"}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ln,{label:"Geomag Kp Floor",value:String(ze.geomag_kp_floor),onChange:ee=>et({...ze,geomag_kp_floor:Number(ee)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),v.jsx(Ln,{label:"Flare Class Floor",value:ze.flare_class_floor,onChange:ee=>et({...ze,flare_class_floor:ee}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),v.jsx(Ln,{label:"Proton pfu Floor",value:String(ze.proton_pfu_floor),onChange:ee=>et({...ze,proton_pfu_floor:Number(ee)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:ee=>Ue({ducting:{...e.ducting,tick_seconds:ee}}),min:60}),v.jsx(We,{label:"Latitude",value:e.ducting.latitude,onChange:ee=>Ue({ducting:{...e.ducting,latitude:ee}}),step:.01}),v.jsx(We,{label:"Longitude",value:e.ducting.longitude,onChange:ee=>Ue({ducting:{...e.ducting,longitude:ee}}),step:.01})]});case"fires":return v.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:ee=>Ue({fires:{...e.fires,tick_seconds:ee}}),min:60}),v.jsx(Ln,{label:"State",value:e.fires.state,onChange:ee=>Ue({fires:{...e.fires,state:ee}}),options:W0e})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Incident Types"}),v.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([ee,xt])=>{var pt;return v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:((pt=M.allowed_incident_types)==null?void 0:pt.includes(ee))??ee==="WF",onChange:dt=>{const ur=M.allowed_incident_types??["WF"];A({...M,allowed_incident_types:dt.target.checked?[...ur,ee]:ur.filter(oo=>oo!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee)})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Triggers"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast on acres increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_acres,onChange:ee=>A({...M,broadcast_on_acres:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast on containment increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_contained,onChange:ee=>A({...M,broadcast_on_contained:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Update Cooldown (hours)",value:Math.round(M.cooldown_seconds/3600),onChange:ee=>A({...M,cooldown_seconds:ee*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),v.jsx(We,{label:"Freshness Window (hours)",value:Math.round(M.freshness_seconds/3600),onChange:ee=>A({...M,freshness_seconds:ee*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return v.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:ee=>Ue({avalanche:{...e.avalanche,tick_seconds:ee}}),min:60}),v.jsx(U0e,{label:"Season Months",value:e.avalanche.season_months,onChange:ee=>Ue({avalanche:{...e.avalanche,season_months:ee}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),v.jsx(ou,{label:"Center IDs",value:e.avalanche.center_ids,onChange:ee=>Ue({avalanche:{...e.avalanche,center_ids:ee}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Settings"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Ln,{label:"Min Danger Level",value:String(Me.min_danger_level),onChange:ee=>pe({...Me,min_danger_level:Number(ee)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return v.jsxs(v.Fragment,{children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:ee=>Ue({usgs:{...e.usgs,tick_seconds:ee}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),v.jsx(ou,{label:"Site IDs",value:e.usgs.sites,onChange:ee=>Ue({usgs:{...e.usgs,sites:ee}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"})]});case"usgs_quake":return v.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,tick_seconds:ee}}),min:60}),v.jsx(ct,{label:"Region Tag",value:e.usgs_quake.region,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,region:ee}})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Magnitude Thresholds"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(We,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,global_mag_floor:ee}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),v.jsx(We,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_mag_floor:ee}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),v.jsx(We,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,regional_radius_mi:ee}}),min:50,helper:"Radius around region centroid for reduced floor"}),v.jsx(We,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:ee=>Ue({usgs_quake:{...e.usgs_quake,escalate_mag_floor:ee}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"PAGER Alert Levels"}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),v.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(ee=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(ee),onChange:xt=>{const pt=e.usgs_quake.broadcast_pager_alerts??[];Ue({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:xt.target.checked?[...pt,ee]:pt.filter(dt=>dt!==ee)}})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300 capitalize",children:ee})]},ee))})]})]});case"traffic":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"API Key",value:e.traffic.api_key,onChange:ee=>Ue({traffic:{...e.traffic,api_key:ee}}),type:"password",helper:"developer.tomtom.com"}),v.jsx(We,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:ee=>Ue({traffic:{...e.traffic,tick_seconds:ee}}),min:60}),v.jsx("div",{className:"text-xs text-slate-500 mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((ee,xt)=>v.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[v.jsx(ct,{label:"Name",value:ee.name,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,name:pt},Ue({traffic:{...e.traffic,corridors:dt}})}}),v.jsx(We,{label:"Lat",value:ee.lat,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lat:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx(We,{label:"Lon",value:ee.lon,onChange:pt=>{const dt=[...e.traffic.corridors];dt[xt]={...ee,lon:pt},Ue({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((pt,dt)=>dt!==xt)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30 rounded",children:"Remove"})]},xt)),v.jsx("button",{onClick:()=>Ue({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Minimum Magnitude"}),v.jsxs("select",{value:F.min_magnitude,onChange:ee=>H({...F,min_magnitude:parseInt(ee.target.value)}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:1,children:"1 — Minor (all)"}),v.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),v.jsx("option",{value:3,children:"3 — Major (orange+)"}),v.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),v.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Drop TomTom incidents below this severity level"})]})}),v.jsxs("div",{className:"mt-3 space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Drop non-present time validity"}),v.jsx("input",{type:"checkbox",checked:F.drop_non_present,onChange:ee=>H({...F,drop_non_present:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Drop zero-magnitude events"}),v.jsx("input",{type:"checkbox",checked:F.drop_zero_magnitude,onChange:ee=>H({...F,drop_zero_magnitude:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]})]})]})]});case"roads511":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:e.roads511.base_url,onChange:ee=>Ue({roads511:{...e.roads511,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:e.roads511.api_key,onChange:ee=>Ue({roads511:{...e.roads511,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:ee=>Ue({roads511:{...e.roads511,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:e.roads511.endpoints,onChange:ee=>Ue({roads511:{...e.roads511,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.roads511.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.roads511.bbox||[0,0,0,0]];ur[xt]=dt,Ue({roads511:{...e.roads511,bbox:ur}})},step:.01},ee)})}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Minimum Severity"}),v.jsxs("select",{value:z.min_severity,onChange:ee=>Z({...z,min_severity:ee.target.value}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]}),v.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Drop ITD 511 events below this severity"})]})}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Categories"}),v.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_categories.includes(ee),onChange:pt=>{const dt=z.enabled_categories;Z({...z,enabled_categories:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Sub-types"}),v.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_sub_types.includes(ee),onChange:pt=>{const dt=z.enabled_sub_types;Z({...z,enabled_sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]})]})]});case"wzdx":return v.jsxs(v.Fragment,{children:[((Ut=e.wzdx)==null?void 0:Ut.feed_source)!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"Base URL",value:((Hn=e.wzdx)==null?void 0:Hn.base_url)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,base_url:ee}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(ct,{label:"API Key",value:((ui=e.wzdx)==null?void 0:ui.api_key)??"",onChange:ee=>Ue({wzdx:{...e.wzdx,api_key:ee}}),type:"password",helper:"Leave empty if not required"}),v.jsx(We,{label:"Tick Seconds",value:((Gi=e.wzdx)==null?void 0:Gi.tick_seconds)??300,onChange:ee=>Ue({wzdx:{...e.wzdx,tick_seconds:ee}}),min:60}),v.jsx(ou,{label:"Endpoints",value:((gl=e.wzdx)==null?void 0:gl.endpoints)??["/get/event"],onChange:ee=>Ue({wzdx:{...e.wzdx,endpoints:ee}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt,dt;return v.jsx(We,{label:ee,value:((dt=(pt=e.wzdx)==null?void 0:pt.bbox)==null?void 0:dt[xt])??0,onChange:ur=>{var rn;const oo=[...((rn=e.wzdx)==null?void 0:rn.bbox)||[0,0,0,0]];oo[xt]=ur,Ue({wzdx:{...e.wzdx,bbox:oo}})},step:.01},ee)})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Bounding box [W,S,E,N] geographic filter"})]}),v.jsxs("div",{className:"border-t border-slate-700/50 pt-4 mt-4",children:[v.jsx("div",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider mb-3",children:"Broadcast Settings"}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm text-slate-300",children:"Broadcast work zone events"}),v.jsx("input",{type:"checkbox",checked:Y.broadcast,onChange:ee=>te({...Y,broadcast:ee.target.checked}),className:"w-4 h-4 rounded accent-blue-500"})]}),Y.broadcast?v.jsxs("div",{className:"space-y-3 mt-3",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Min Severity"}),v.jsxs("select",{value:Y.min_severity,onChange:ee=>te({...Y,min_severity:ee.target.value}),className:"w-full bg-slate-900 border border-slate-700 rounded px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-400 mb-2",children:"Sub-types"}),v.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([ee,xt])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:Y.sub_types.includes(ee),onChange:pt=>{const dt=Y.sub_types;te({...Y,sub_types:pt.target.checked?[...dt,ee]:dt.filter(ur=>ur!==ee)})},className:"w-4 h-4 rounded accent-blue-500"}),v.jsx("span",{className:"text-sm text-slate-300",children:xt})]},ee))})]})]}):v.jsxs("p",{className:"text-xs text-slate-500 mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return v.jsxs(v.Fragment,{children:[v.jsx(ct,{label:"MAP Key",value:e.firms.map_key,onChange:ee=>Ue({firms:{...e.firms,map_key:ee}}),type:"password",helper:"firms.modaps.eosdis.nasa.gov/api/area/",infoLink:"https://firms.modaps.eosdis.nasa.gov/api/area/"}),v.jsx(We,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:ee=>Ue({firms:{...e.firms,tick_seconds:ee}}),min:300}),v.jsx(Ln,{label:"Satellite Source",value:e.firms.source,onChange:ee=>Ue({firms:{...e.firms,source:ee}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(We,{label:"Day Range",value:e.firms.day_range,onChange:ee=>Ue({firms:{...e.firms,day_range:ee}}),min:1,max:10}),v.jsx(Ln,{label:"Min Confidence",value:e.firms.confidence_min,onChange:ee=>Ue({firms:{...e.firms,confidence_min:ee}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),v.jsx(We,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:ee=>Ue({firms:{...e.firms,proximity_km:ee}}),step:.5})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((ee,xt)=>{var pt;return v.jsx(We,{label:ee,value:((pt=e.firms.bbox)==null?void 0:pt[xt])??0,onChange:dt=>{const ur=[...e.firms.bbox||[0,0,0,0]];ur[xt]=dt,Ue({firms:{...e.firms,bbox:ur}})},step:.01},ee)})})]})}},ug=e,cg=(xe,Ut)=>{const Hn=e[xe]||{};Ue({[xe]:{...Hn,...Ut}})};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h1",{className:"text-xl font-semibold text-slate-200",children:"Environment"}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(or,{label:"Feeds Enabled",checked:e.enabled,onChange:xe=>Ue({enabled:xe})}),ag&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:og,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 border border-border rounded",children:[v.jsx(Jx,{size:14})," Discard"]}),v.jsxs("button",{onClick:$_,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white rounded disabled:opacity-50",children:[v.jsx(zM,{size:14})," ",c?"Saving…":"Save"]})]})]})]}),f&&v.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3",children:f}),g&&v.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 rounded p-3",children:g}),y&&v.jsxs("div",{className:"flex items-center justify-between text-sm text-amber-400 bg-amber-500/10 border border-amber-500/30 rounded p-3",children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx($v,{size:14})," A restart is required for some changes to take effect."]}),v.jsx("button",{onClick:sg,className:"px-3 py-1 bg-amber-500/20 hover:bg-amber-500/30 rounded",children:"Restart now"})]}),v.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:_S.map(({key:xe,label:Ut,icon:Hn})=>v.jsxs("button",{onClick:()=>{w(xe);const ui=_S.find(Gi=>Gi.key===xe);T(ui.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===xe?"border-accent text-accent":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Hn,{size:15})," ",Ut]},xe))}),_==="central"&&e.central&&v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Central Connection"}),v.jsx("p",{className:"text-xs text-slate-600",children:'NATS JetStream source for any adapter set to "central"'})]}),v.jsx(or,{label:"",checked:!!e.central.enabled,onChange:xe=>Ue({central:{...e.central,enabled:xe}})})]}),v.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[v.jsx(ct,{label:"URL",value:e.central.url||"",onChange:xe=>Ue({central:{...e.central,url:xe}}),placeholder:"nats://central.echo6.mesh:4222"}),v.jsx(ct,{label:"Durable",value:e.central.durable||"",onChange:xe=>Ue({central:{...e.central,durable:xe}}),placeholder:"meshai-v04"}),v.jsx(ct,{label:"Region",value:e.central.region||"",onChange:xe=>Ue({central:{...e.central,region:xe}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="tracking"&&v.jsxs("div",{className:"flex flex-col items-center justify-center h-[40vh] text-center",children:[v.jsx(Qx,{size:32,className:"text-slate-600 mb-4"}),v.jsx("p",{className:"text-slate-500 max-w-md",children:"No adapters yet. ADS-B / AIS / satellite passes are planned for v0.5."})]}),_==="mesh"&&v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Mesh Health"}),v.jsx("p",{className:"text-xs text-slate-600",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-600",children:"source"}),v.jsx(JH,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),v.jsx("div",{className:"text-[11px] text-slate-600",children:"Central not available — reserved for a future migration."})]}),ao.adapters.length>0&&tn&&v.jsxs(v.Fragment,{children:[ao.adapters.length>1&&v.jsx("div",{className:"flex gap-1",children:ao.adapters.map(xe=>v.jsx("button",{onClick:()=>T(xe),className:`px-3 py-1.5 text-sm rounded ${tn===xe?"bg-bg-hover text-slate-100":"text-slate-400 hover:text-slate-200"}`,children:hs[xe].label},xe))}),v.jsx(cxe,{title:hs[tn].label,subtitle:hs[tn].subtitle,enabled:((Lf=ug[tn])==null?void 0:Lf.enabled)??!1,onEnabled:xe=>cg(tn,{enabled:xe}),feedSource:((Nf=ug[tn])==null?void 0:Nf.feed_source)??"native",onFeedSource:xe=>cg(tn,{feed_source:xe}),hasCentral:hs[tn].hasCentral,nativeOnly:hs[tn].nativeOnly,hasKey:hs[tn].hasKey,health:lg(tn),events:kf(tn),children:pl(tn)})]})]})}const k5={infra_offline:mB,infra_recovery:t_,battery_warning:Z1,battery_critical:Z1,battery_emergency:Z1,hf_blackout:Dh,uhf_ducting:Di,weather_warning:Du,weather_watch:Du,new_router:Di,packet_flood:$a,sustained_high_util:$a,region_blackout:Vo,default:Zv};function fxe(e){return k5[e]||k5.default}function QH(e){switch(e==null?void 0:e.toLowerCase()){case"immediate":return{bg:"bg-red-500/10",border:"border-red-500",badge:"bg-red-500/20 text-red-400",iconColor:"text-red-500"};case"priority":return{bg:"bg-amber-500/10",border:"border-amber-500",badge:"bg-amber-500/20 text-amber-400",iconColor:"text-amber-500"};case"routine":default:return{bg:"bg-blue-500/10",border:"border-blue-500",badge:"bg-blue-500/20 text-blue-400",iconColor:"text-blue-500"}}}function dxe(e){const t=typeof e=="number"?new Date(e*1e3):new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24);return i<60?"Just now":a<60?`${a}m ago`:o<24?`${o}h ago`:`${s}d ago`}function vxe(e){return(typeof e=="number"?new Date(e*1e3):new Date(e)).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function pxe(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d`}function gxe({alert:e,onAcknowledge:t}){var i;const r=QH(e.severity),n=fxe(e.type);return v.jsx("div",{className:`p-4 rounded-lg ${r.bg} border-l-4 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:20,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.badge}`,children:(i=e.severity)==null?void 0:i.toUpperCase()}),v.jsx("span",{className:"text-xs text-slate-500",children:e.type})]}),v.jsx("div",{className:"text-sm text-slate-200",children:e.message}),v.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(Iu,{size:12}),e.timestamp?dxe(e.timestamp):"Just now"]}),e.scope_value&&v.jsxs("span",{children:[e.scope_type,": ",e.scope_value]})]})]}),v.jsx("button",{onClick:()=>t(e),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200 border border-border rounded hover:bg-bg-hover transition-colors",children:"Acknowledge"})]})})}function mxe({history:e,typeFilter:t,severityFilter:r,onTypeFilterChange:n,onSeverityFilterChange:i,page:a,totalPages:o,onPageChange:s}){const l=["all","infra_offline","infra_recovery","battery_warning","battery_critical","hf_blackout","uhf_ducting","weather_warning","new_router","packet_flood"],u=["all","immediate","priority","routine"];return v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg",children:[v.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(RM,{size:14,className:"text-slate-400"}),v.jsx("span",{className:"text-sm text-slate-400",children:"Filter:"})]}),v.jsx("select",{value:t,onChange:c=>n(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-blue-500",children:l.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Types":c.replace(/_/g," ")},c))}),v.jsx("select",{value:r,onChange:c=>i(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-blue-500",children:u.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Severities":c.charAt(0).toUpperCase()+c.slice(1)},c))})]}),v.jsx("div",{className:"overflow-x-auto",children:v.jsxs("table",{className:"w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"border-b border-border",children:[v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Time"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Type"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Severity"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Message"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Duration"})]})}),v.jsx("tbody",{children:e.length>0?e.map((c,h)=>{const f=QH(c.severity);return v.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover",children:[v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono whitespace-nowrap",children:vxe(c.timestamp)}),v.jsx("td",{className:"p-4 text-sm text-slate-300",children:c.type.replace(/_/g," ")}),v.jsx("td",{className:"p-4",children:v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f.badge}`,children:c.severity})}),v.jsx("td",{className:"p-4 text-sm text-slate-200 max-w-md truncate",children:c.message}),v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono",children:c.duration?pxe(c.duration):"-"})]},c.id||h)}):v.jsx("tr",{children:v.jsx("td",{colSpan:5,className:"p-8 text-center text-slate-500",children:"No alert history available"})})})]})}),o>1&&v.jsxs("div",{className:"p-4 border-t border-border flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm text-slate-400",children:["Page ",a," of ",o]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:()=>s(a-1),disabled:a<=1,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(F$,{size:16})}),v.jsx("button",{onClick:()=>s(a+1),disabled:a>=o,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(Js,{size:16})})]})]})]})}function yxe({subscription:e,nodes:t}){const r=o=>{const s=t.find(l=>l.node_id_hex===o||String(l.node_num)===o||l.short_name===o);return s?s.long_name&&s.long_name!==s.short_name?`${s.short_name} (${s.long_name})`:s.short_name:o},n=()=>{if(e.sub_type==="alerts")return"Real-time";const o=e.schedule_time||"0000",s=parseInt(o.slice(0,2)),l=o.slice(2),u=s>=12?"PM":"AM";let h=`${s%12||12}:${l} ${u}`;return e.sub_type==="weekly"&&e.schedule_day&&(h+=` ${e.schedule_day.charAt(0).toUpperCase()}${e.schedule_day.slice(1)}`),h},a=(()=>{switch(e.sub_type){case"alerts":return Zv;case"daily":return Iu;case"weekly":return Iu;default:return Zv}})();return v.jsx("div",{className:"p-4 rounded-lg bg-bg-hover border border-border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:v.jsx(a,{size:18,className:"text-blue-400"})}),v.jsxs("div",{className:"flex-1",children:[v.jsxs("div",{className:"text-sm text-slate-200 font-medium",children:[e.sub_type.charAt(0).toUpperCase()+e.sub_type.slice(1),e.scope_type!=="mesh"&&e.scope_value&&v.jsxs("span",{className:"text-slate-400 font-normal ml-2",children:["(",e.scope_type,": ",e.scope_value,")"]})]}),v.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[n()," • ",r(e.user_id)]})]}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`})]})})}function xxe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(null),[f,d]=G.useState("all"),[g,m]=G.useState("all"),[y,x]=G.useState(1),[_,w]=G.useState(1),S=20,[T,M]=G.useState(new Set),{lastAlert:A}=FM();G.useEffect(()=>{document.title="Alerts — MeshAI"},[]),G.useEffect(()=>{Promise.all([yB().catch(()=>[]),OP(S,0).catch(()=>({items:[],total:0})),iY().catch(()=>[]),fetch("/api/nodes").then(N=>N.json()).catch(()=>[])]).then(([N,D,O,R])=>{t(N),Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S))),a(O),s(R),u(!1)}).catch(N=>{h(N.message),u(!1)})},[]),G.useEffect(()=>{A&&t(N=>N.some(O=>O.type===A.type&&O.message===A.message)?N:[A,...N])},[A]),G.useEffect(()=>{const N=(y-1)*S;OP(S,N,f,g).then(D=>{Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S)))}).catch(()=>{})},[y,f,g]);const P=G.useCallback(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;M(O=>new Set([...O,D]))},[]),I=e.filter(N=>{const D=`${N.type}-${N.message}-${N.timestamp}`;return!T.has(D)});return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading alerts..."})}):c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",c]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx($a,{size:14}),"Active Alerts (",I.length,")"]}),I.length>0?v.jsx("div",{className:"space-y-3",children:I.map((N,D)=>v.jsx(gxe,{alert:N,onAcknowledge:P},`${N.type}-${N.timestamp}-${D}`))}):v.jsxs("div",{className:"flex items-center gap-2 text-slate-500 py-8",children:[v.jsx(EM,{size:20,className:"text-green-500"}),v.jsx("span",{children:"No active alerts — all systems nominal"})]})]}),v.jsxs("div",{children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Iu,{size:14}),"Alert History"]}),v.jsx(mxe,{history:r,typeFilter:f,severityFilter:g,onTypeFilterChange:N=>{d(N),x(1)},onSeverityFilterChange:N=>{m(N),x(1)},page:y,totalPages:_,onPageChange:x})]}),v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(Q$,{size:14}),"Mesh Subscriptions (",i.length,")"]}),i.length>0?v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.map(N=>v.jsx(yxe,{subscription:N,nodes:o},N.id))}):v.jsxs("div",{className:"text-slate-500 py-4",children:[v.jsx("p",{children:"No active subscriptions."}),v.jsxs("p",{className:"text-xs mt-2",children:["Manage subscriptions via ",v.jsx("code",{className:"text-blue-400",children:"!subscribe"})," on mesh. Broadcasts arrive with one of three prefixes — ",v.jsx("strong",{children:"New:"})," (first sight), ",v.jsx("strong",{children:"Update:"})," (material change), or ",v.jsx("strong",{children:"Active:"})," (clock-driven reminder while the event is still live). See ",v.jsx("a",{href:"/reference#broadcast-types",className:"text-blue-400 hover:underline",children:"Broadcast Types"})," and ",v.jsx("a",{href:"/reference#reminders",className:"text-blue-400 hover:underline",children:"Reminder System"})," in Reference."]})]})]})]})}const Hy=[{value:"routine",label:"Routine",description:"Informational, no time pressure (ducting, new node, weather advisory, battery declining)"},{value:"priority",label:"Priority",description:"Needs attention soon (severe weather, fire nearby, node offline, HF blackout)"},{value:"immediate",label:"Immediate",description:"Act now, drop everything (fire at infrastructure, extreme weather, region blackout)"}],L5=[{id:"mesh_health",name:"Mesh Health Monitoring",description:"Infrastructure problems - offline nodes, low battery, channel congestion",rule:{name:"Mesh Health Monitoring",enabled:!0,trigger_type:"condition",categories:["infra_offline","critical_node_down","infra_recovery","battery_warning","battery_critical","battery_emergency","high_utilization","packet_flood","mesh_score_low"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"weather_fire",name:"Weather & Fire Alerts",description:"Environmental threats - severe weather, nearby wildfires, new ignitions, flooding",rule:{name:"Weather & Fire Alerts",enabled:!0,trigger_type:"condition",categories:["weather_warning","fire_proximity","new_ignition","stream_flood_warning"],min_severity:"priority",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:15,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"rf_conditions",name:"RF Conditions",description:"Propagation changes - solar events, HF blackouts, tropospheric ducting",rule:{name:"RF Conditions",enabled:!0,trigger_type:"condition",categories:["hf_blackout","tropospheric_ducting","geomagnetic_storm"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:60,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"road_traffic",name:"Road & Traffic",description:"Road closures and severe congestion",rule:{name:"Road & Traffic",enabled:!0,trigger_type:"condition",categories:["road_closure","traffic_congestion"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"everything_critical",name:"Everything Critical",description:"All emergency-level events regardless of type",rule:{name:"Everything Critical",enabled:!0,trigger_type:"condition",categories:[],min_severity:"immediate",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:5,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"morning_briefing",name:"Morning Briefing",description:"Daily health and conditions summary at 7am",rule:{name:"Morning Briefing",enabled:!0,trigger_type:"schedule",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"mesh_health_summary",custom_message:"",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}}];function uy(e){if(!e)return"Never";const r=Date.now()/1e3-e;return r<60?"Just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Ai({info:e}){const[t,r]=G.useState(!1);return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),v.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function xs({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o=""}){const[s,l]=G.useState(!1),u=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(Ai,{info:o})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&v.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?v.jsx(cB,{size:16}):v.jsx(jM,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Mp({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(Ai,{info:s})]}),v.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Lx({label:e,checked:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(Ai,{info:i})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Mv({label:e,value:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(Ai,{info:i})]}),v.jsx("input",{type:"time",value:t,onChange:a=>r(a.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Uy({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:i="",info:a=""}){const[o,s]=G.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(Ai,{info:a})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),v.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:v.jsx(af,{size:16})})]}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,v.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:v.jsx(ca,{size:14})})]},h))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function eU({value:e,onChange:t}){const[r,n]=G.useState(!1),i=Hy.find(a=>a.value===e)||Hy[0];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Severity Threshold",v.jsx(Ai,{info:"Only alerts at or above this severity trigger this rule. ROUTINE = informational, PRIORITY = needs attention, IMMEDIATE = act now."})]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{type:"button",onClick:()=>n(!r),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-left flex items-center justify-between hover:border-accent transition-colors",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-slate-200",children:i.label}),v.jsxs("span",{className:"text-slate-500 ml-2",children:["- ",i.description]})]}),v.jsx(ll,{size:16,className:`text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>n(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-[#0a0e17] border border-[#1e2a3a] rounded-lg shadow-xl overflow-hidden",children:Hy.map(a=>v.jsxs("button",{type:"button",onClick:()=>{t(a.value),n(!1)},className:`w-full px-3 py-2.5 text-left text-sm hover:bg-[#1e2a3a] transition-colors ${e===a.value?"bg-accent/10":""}`,children:[v.jsx("div",{className:"font-medium text-slate-200",children:a.label}),v.jsx("div",{className:"text-xs text-slate-500",children:a.description})]},a.value))})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:'Lower = more notifications. "Warning" recommended for most rules.'})]})}function cy({rule:e}){const[t,r]=G.useState(!1),[n,i]=G.useState(null),a=async()=>{r(!0),i(null);try{let s={type:e.delivery_type};e.delivery_type==="mesh_broadcast"?s.channel_index=e.broadcast_channel:e.delivery_type==="mesh_dm"?s.node_ids=e.node_ids:e.delivery_type==="email"?s={type:"email",smtp_host:e.smtp_host,smtp_port:e.smtp_port,smtp_user:e.smtp_user,smtp_password:e.smtp_password,smtp_tls:e.smtp_tls,from_address:e.from_address,recipients:e.recipients}:e.delivery_type==="webhook"&&(s={type:"webhook",url:e.webhook_url,headers:e.webhook_headers});const u=await(await fetch("/api/notifications/channels/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();i(u)}catch(s){i({success:!1,message:"Test failed",error:s instanceof Error?s.message:"Unknown error",details:{}})}finally{r(!1)}};if(!e.delivery_type)return null;const o={mesh_broadcast:v.jsx(Di,{size:14}),mesh_dm:v.jsx(OM,{size:14}),email:v.jsx(Y$,{size:14}),webhook:v.jsx(Z$,{size:14})}[e.delivery_type]||v.jsx(t_,{size:14});return v.jsxs("div",{className:"space-y-2",children:[v.jsx("button",{type:"button",onClick:a,disabled:t,className:"flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",children:t?v.jsxs(v.Fragment,{children:[v.jsx($v,{size:14,className:"animate-spin"}),"Testing..."]}):v.jsxs(v.Fragment,{children:[o,"Test Channel"]})}),n&&v.jsx("div",{className:`p-2 rounded text-xs ${n.success?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[n.success?v.jsx(Za,{size:14,className:"mt-0.5 flex-shrink-0"}):v.jsx(ca,{size:14,className:"mt-0.5 flex-shrink-0"}),v.jsxs("div",{children:[v.jsx("div",{className:"font-medium",children:n.message}),n.error&&v.jsx("div",{className:"mt-1 text-red-300",children:n.error})]})]})})]})}function _xe({rule:e,ruleIndex:t,categories:r,regions:n,onChange:i,onDelete:a,onDuplicate:o,onTest:s}){var O,R,F,H,W;const[l,u]=G.useState(!e.name),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null);G.useEffect(()=>{var V;e.name&&t>=0&&(fetch(`/api/notifications/rules/${t}/stats`).then(z=>z.json()).then(z=>d(z)).catch(()=>{}),(V=e.categories)!=null&&V.length&&fetch("/api/notifications/rules/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e.categories})}).then(z=>z.json()).then(z=>m(z)).catch(()=>{}))},[e.name,t,e.categories]);const y=[{value:"",label:"(None)",description:"Rule matches but does not deliver"},{value:"mesh_broadcast",label:"Mesh Broadcast",description:"Send to a mesh radio channel"},{value:"mesh_dm",label:"Mesh DM",description:"Direct message to specific nodes"},{value:"email",label:"Email",description:"Send via SMTP"},{value:"webhook",label:"Webhook",description:"POST to any URL"}],x=[{value:"daily",label:"Daily"},{value:"twice_daily",label:"Twice Daily"},{value:"weekly",label:"Weekly"}],_=[{value:"mesh_health_summary",label:"Mesh Health Summary",description:"Current health score, pillar breakdown, problem nodes"},{value:"rf_propagation_report",label:"RF Propagation Report",description:"Solar indices, Kp, ducting conditions"},{value:"alerts_digest",label:"Active Alerts Digest",description:"Summary of all active environmental alerts"},{value:"environmental_conditions",label:"Environmental Conditions",description:"Full conditions: weather, fire, streams, roads"},{value:"custom",label:"Custom Message",description:"Write your own with template tokens"}],w=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],S=V=>{const z=e.categories||[];z.includes(V)?i({...e,categories:z.filter(Z=>Z!==V)}):i({...e,categories:[...z,V]})},T=(V,z)=>{const Z=e.categories||[];if(z==="add"){const U=Array.from(new Set([...Z,...V]));i({...e,categories:U})}else{const U=new Set(V);i({...e,categories:Z.filter($=>!U.has($))})}},M=V=>{const z=e.region_scope||[];z.includes(V)?i({...e,region_scope:z.filter(Z=>Z!==V)}):i({...e,region_scope:[...z,V]})},A=V=>{const z=e.schedule_days||[];z.includes(V)?i({...e,schedule_days:z.filter(Z=>Z!==V)}):i({...e,schedule_days:[...z,V]})},P=async()=>{h(!0),await s(),h(!1)},I=()=>{if(e.trigger_type==="schedule")return"[Scheduled report preview would appear here]";const V=e.categories||[];if(V.length===0&&r.length>0)return r[0].example_message||"Alert notification";const z=r.find(Z=>V.includes(Z.id));return(z==null?void 0:z.example_message)||"Alert notification"},N=()=>{var z,Z,U,$,Y,te,ie,se;const V=[];if(e.trigger_type==="schedule"){const le=((z=x.find(me=>me.value===e.schedule_frequency))==null?void 0:z.label)||e.schedule_frequency,Ee=((Z=_.find(me=>me.value===e.message_type))==null?void 0:Z.label)||e.message_type;V.push(`${le} at ${e.schedule_time||"??:??"}`),V.push(Ee)}else{const le=((U=e.categories)==null?void 0:U.length)||0,Ee=le===0?"All":r.filter(ye=>{var Me;return(Me=e.categories)==null?void 0:Me.includes(ye.id)}).map(ye=>ye.name).slice(0,2).join(", ")+(le>2?` +${le-2}`:""),me=(($=Hy.find(ye=>ye.value===e.min_severity))==null?void 0:$.label)||e.min_severity;V.push(`${Ee} at ${me}+`)}if(!e.delivery_type)V.push("No delivery");else{const le=((Y=y.find(me=>me.value===e.delivery_type))==null?void 0:Y.label)||e.delivery_type;let Ee="";if(e.delivery_type==="mesh_broadcast")Ee=`Ch ${e.broadcast_channel}`;else if(e.delivery_type==="mesh_dm")Ee=`${((te=e.node_ids)==null?void 0:te.length)||0} nodes`;else if(e.delivery_type==="email")Ee=(ie=e.recipients)!=null&&ie.length?e.recipients[0]+(e.recipients.length>1?` +${e.recipients.length-1}`:""):"no recipients";else if(e.delivery_type==="webhook")try{Ee=new URL(e.webhook_url).hostname}catch{Ee=((se=e.webhook_url)==null?void 0:se.slice(0,20))||"no URL"}V.push(`${le}${Ee?` (${Ee})`:""}`)}return V.join(" -> ")},D=()=>{var z;if(!g||!((z=e.categories)!=null&&z.length))return null;const V=new Map;for(const[,Z]of Object.entries(g)){const U=V.get(Z.source);U?(U.events+=Z.active_events,U.enabled=U.enabled&&Z.enabled):V.set(Z.source,{enabled:Z.enabled,events:Z.active_events})}return Array.from(V.entries()).map(([Z,{enabled:U,events:$}])=>v.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ${U?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,title:U?`${$} active`:"Not enabled",children:[U?v.jsx(t_,{size:10}):v.jsx(mB,{size:10}),Z.toUpperCase(),U&&$>0&&` (${$})`]},Z))};return v.jsxs("div",{className:`border rounded-lg overflow-hidden ${e.enabled?"border-[#1e2a3a]":"border-slate-700 opacity-60"}`,children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>u(!l),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l?v.jsx(ll,{size:16,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:16,className:"text-slate-500 flex-shrink-0"}),v.jsx("button",{onClick:V=>{V.stopPropagation(),i({...e,enabled:!e.enabled})},className:`w-2 h-2 rounded-full flex-shrink-0 ${e.enabled?"bg-green-500":"bg-slate-500"}`,title:e.enabled?"Enabled":"Disabled"}),e.trigger_type==="schedule"?v.jsx(Iu,{size:14,className:"text-blue-400 flex-shrink-0"}):v.jsx(Dh,{size:14,className:"text-yellow-400 flex-shrink-0"}),v.jsx("span",{className:"font-medium text-slate-200 truncate",title:e.name||void 0,children:e.name||"New Rule"}),!l&&v.jsx("span",{className:`text-xs truncate hidden sm:block ${e.delivery_type?"text-slate-500":"text-amber-400"}`,children:N()})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!l&&(()=>{const V="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs mr-2";if(!e.enabled)return v.jsx("span",{className:`${V} bg-slate-800 text-slate-500`,children:"Disabled"});if(!f)return null;const z=f.fire_count||0,Z=f.last_fired,U=Date.now()/1e3-7*86400;return z>0&&Z&&Z>=U?v.jsx("span",{className:`${V} bg-green-500/10 text-green-400`,title:`Last fired ${uy(Z)}`,children:"Active"}):z>0&&Z?v.jsx("span",{className:`${V} bg-yellow-500/10 text-yellow-400`,title:`Last fired ${uy(Z)}`,children:"Idle (no recent activity)"}):v.jsx("span",{className:`${V} bg-slate-800 text-slate-400`,children:"No activity yet"})})(),!l&&v.jsx("div",{className:"hidden md:flex items-center gap-1 mr-2",children:D()}),v.jsx("button",{onClick:V=>{V.stopPropagation(),P()},disabled:c||!e.name,className:"p-1.5 text-blue-400 hover:text-blue-300 hover:bg-blue-500/10 rounded disabled:opacity-50",title:"Test rule",children:v.jsx(_C,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),o()},className:"p-1.5 text-slate-400 hover:text-slate-200 hover:bg-slate-500/10 rounded",title:"Duplicate",children:v.jsx(H$,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),a()},className:"p-1.5 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",title:"Delete",children:v.jsx(Ep,{size:14})})]})]}),!l&&e.name&&v.jsxs("div",{className:"px-3 pb-2 pt-0 bg-[#0a0e17] flex items-center gap-2 flex-wrap text-xs",children:[!e.delivery_type&&v.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:[v.jsx(Vo,{size:10}),"No delivery method"]}),(f==null?void 0:f.fire_count)!==void 0&&f.fire_count>0&&v.jsxs("span",{className:"text-slate-500",children:["Fired ",f.fire_count,"x"]})]}),l&&v.jsxs("div",{className:"p-4 space-y-6 border-t border-[#1e2a3a]",children:[v.jsx(xs,{label:"Rule Name",value:e.name,onChange:V=>i({...e,name:V}),placeholder:"e.g., Emergency Broadcast, Daily Health Report",helper:"A descriptive name for this rule"}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Trigger Type"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"condition"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 rounded-lg border transition-colors ${e.trigger_type!=="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Dh,{size:16}),v.jsx("span",{children:"Condition"})]}),v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"schedule"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 rounded-lg border transition-colors ${e.trigger_type==="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Iu,{size:16}),v.jsx("span",{children:"Schedule"})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:e.trigger_type==="schedule"?"Send reports on a schedule (daily briefings, weekly digests)":"React to alert conditions (fires, outages, weather warnings)"})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx($a,{size:14}),"WHEN (Condition)"]}),v.jsx(eU,{value:e.min_severity,onChange:V=>i({...e,min_severity:V})}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Categories",v.jsx(Ai,{info:"Select which types of alerts trigger this rule. Leave all unchecked to match ALL categories. Categories are grouped by family — use the 'All' / 'Clear' buttons in each header to bulk-toggle."})]}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:(((O=e.categories)==null?void 0:O.length)||0)===0?"All categories (none selected)":`${(R=e.categories)==null?void 0:R.length} selected`}),v.jsx(bxe,{categories:r,selected:e.categories||[],onToggle:S,onSelectMany:T})]}),g&&Object.keys(g).length>0&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Data Sources"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:D()})]})]}),e.trigger_type==="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(B$,{size:14}),"WHEN (Schedule)"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Frequency"}),v.jsx("select",{value:e.schedule_frequency||"daily",onChange:V=>i({...e,schedule_frequency:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:x.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mv,{label:"Time",value:e.schedule_time||"07:00",onChange:V=>i({...e,schedule_time:V})}),e.schedule_frequency==="twice_daily"&&v.jsx(Mv,{label:"Second Time",value:e.schedule_time_2||"19:00",onChange:V=>i({...e,schedule_time_2:V})})]}),e.schedule_frequency==="weekly"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Days"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(V=>{var z;return v.jsx("button",{type:"button",onClick:()=>A(V),className:`px-3 py-1.5 rounded text-sm capitalize transition-colors ${(z=e.schedule_days)!=null&&z.includes(V)?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:V.slice(0,3)},V)})})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Report Type"}),v.jsx("select",{value:e.message_type||"mesh_health_summary",onChange:V=>i({...e,message_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:_.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(F=_.find(V=>V.value===e.message_type))==null?void 0:F.description})]}),e.message_type==="custom"&&v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Message",v.jsx(Ai,{info:"Available tokens: {MESH_SCORE}, {NODE_COUNT}, {NODES_ONLINE}, {ACTIVE_ALERTS}, {KP}, {SFI}, {DATE}, {TIME}"})]}),v.jsx("textarea",{value:e.custom_message||"",onChange:V=>i({...e,custom_message:V.target.value}),rows:4,placeholder:"Good morning! Mesh health: {MESH_SCORE}/100 with {NODE_COUNT} nodes online.",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"})]})]}),v.jsxs("div",{className:"space-y-2 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(nf,{size:14}),"REGIONS",v.jsx(Ai,{info:"Limit this rule to alerts from specific regions. Empty selection = all regions (backward compatible). Region names come from /api/regions."})]}),v.jsx("div",{className:"text-xs text-slate-500",children:(((H=e.region_scope)==null?void 0:H.length)||0)===0?"All regions (none selected)":`${e.region_scope.length} of ${n.length} selected`}),n.length===0?v.jsx("div",{className:"text-xs text-slate-600 italic",children:"No regions configured."}):v.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(V=>{const z=(e.region_scope||[]).includes(V.name);return v.jsx("button",{type:"button",onClick:()=>M(V.name),className:`px-3 py-1.5 rounded text-sm transition-colors ${z?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,title:V.local_name||V.name,children:V.local_name||V.name},V.name)})})]}),v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(_C,{size:14}),"SEND VIA"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Delivery Method",v.jsx(Ai,{info:"Where this notification gets delivered. Select (None) to save the rule without delivery - it will match conditions but won't send until you configure a delivery method."})]}),v.jsx("select",{value:e.delivery_type||"",onChange:V=>i({...e,delivery_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:y.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(W=y.find(V=>V.value===(e.delivery_type||"")))==null?void 0:W.description})]}),!e.delivery_type&&v.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg",children:[v.jsx(Vo,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),v.jsx("div",{className:"text-sm text-amber-300",children:"Rule will log matches but not deliver until a delivery method is configured."})]}),e.delivery_type==="mesh_broadcast"&&v.jsxs(v.Fragment,{children:[v.jsx(LL,{label:"Broadcast Channel",value:e.broadcast_channel??0,onChange:V=>i({...e,broadcast_channel:V}),helper:"Select the mesh radio channel",mode:"single"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="mesh_dm"&&v.jsxs(v.Fragment,{children:[v.jsx(kL,{label:"Recipient Nodes",value:e.node_ids||[],onChange:V=>i({...e,node_ids:V}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),v.jsx(cy,{rule:e})]}),e.delivery_type==="email"&&v.jsxs("div",{className:"space-y-4",children:[v.jsx(Uy,{label:"Recipients",value:e.recipients||[],onChange:V=>i({...e,recipients:V}),placeholder:"email@example.com",helper:"Email addresses to receive alerts"}),v.jsxs("details",{className:"group",children:[v.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[v.jsx(Js,{size:14,className:"group-open:rotate-90 transition-transform"}),"SMTP Configuration"]}),v.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"SMTP Host",value:e.smtp_host||"",onChange:V=>i({...e,smtp_host:V}),placeholder:"smtp.gmail.com"}),v.jsx(Mp,{label:"SMTP Port",value:e.smtp_port??587,onChange:V=>i({...e,smtp_port:V}),min:1,max:65535})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(xs,{label:"Username",value:e.smtp_user||"",onChange:V=>i({...e,smtp_user:V})}),v.jsx(xs,{label:"Password",value:e.smtp_password||"",onChange:V=>i({...e,smtp_password:V}),type:"password",info:"Gmail users: use an App Password from myaccount.google.com/apppasswords"})]}),v.jsx(Lx,{label:"Use TLS",checked:e.smtp_tls??!0,onChange:V=>i({...e,smtp_tls:V})}),v.jsx(xs,{label:"From Address",value:e.from_address||"",onChange:V=>i({...e,from_address:V}),placeholder:"alerts@yourdomain.com"})]})]}),v.jsx(cy,{rule:e})]}),e.delivery_type==="webhook"&&v.jsxs(v.Fragment,{children:[v.jsx(xs,{label:"Webhook URL",value:e.webhook_url||"",onChange:V=>i({...e,webhook_url:V}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON",info:"Works with Discord webhooks, ntfy.sh, Slack, Home Assistant, Pushover, or any HTTP POST endpoint."}),v.jsx(cy,{rule:e})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Mp,{label:"Cooldown (minutes)",value:e.cooldown_minutes??10,onChange:V=>i({...e,cooldown_minutes:V}),min:0,helper:"Min time between repeat sends",info:"Prevents alert spam. Same condition won't re-trigger this rule within this window."})," "]}),f&&v.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[v.jsxs("span",{children:["Last fired: ",uy(f.last_fired)]}),v.jsxs("span",{children:["Last tested: ",uy(f.last_test)]}),v.jsxs("span",{children:["Total fires: ",f.fire_count]})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Example Message"}),v.jsx("div",{className:"p-3 bg-[#1e2a3a]/50 rounded-lg border border-[#1e2a3a]",children:v.jsx("p",{className:"text-sm text-slate-300 font-mono",children:I()})}),v.jsx("p",{className:"text-xs text-slate-600",children:"This is an example of what this rule would send."})]})]})]})}const Zy=[{key:"mesh_health",label:"Mesh Health",Icon:rf},{key:"weather",label:"Weather",Icon:Du},{key:"fire",label:"Fire",Icon:Xx},{key:"rf_propagation",label:"RF Propagation",Icon:Di},{key:"roads",label:"Roads",Icon:$x},{key:"avalanche",label:"Avalanche",Icon:J$},{key:"seismic",label:"Seismic",Icon:Kx},{key:"tracking",label:"Tracking",Icon:nf}];function bxe({categories:e,selected:t,onToggle:r,onSelectMany:n}){const i=new Set(Zy.map(f=>f.key)),a=new Map;Zy.forEach(f=>a.set(f.key,[]));const o=[];for(const f of e){const d=f.toggle;d&&i.has(d)?a.get(d).push(f):o.push(f)}const s=new Set;for(const[f,d]of a)d.some(g=>t.includes(g.id))&&s.add(f);o.some(f=>t.includes(f.id))&&s.add("other");const[l,u]=G.useState(s),c=f=>{u(d=>{const g=new Set(d);return g.has(f)?g.delete(f):g.add(f),g})},h=(f,d,g,m)=>{if(!m.length)return null;const y=l.has(f),x=m.map(w=>w.id),_=x.filter(w=>t.includes(w)).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded",children:[v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-[#0d1420]",children:[v.jsxs("button",{type:"button",onClick:()=>c(f),className:"flex items-center gap-2 text-sm text-slate-200 flex-1 min-w-0",children:[y?v.jsx(ll,{size:14,className:"text-slate-500 flex-shrink-0"}):v.jsx(Js,{size:14,className:"text-slate-500 flex-shrink-0"}),g&&v.jsx(g,{size:14,className:"text-slate-400 flex-shrink-0"}),v.jsxs("span",{className:"truncate",children:[d," (",m.length,")"]}),_>0&&v.jsxs("span",{className:"ml-1 text-xs text-accent",children:[_," selected"]})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"add")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-accent hover:bg-accent/10",title:"Select all in family",children:"All"}),v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(x,"remove")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-red-400 hover:bg-red-500/10",title:"Clear family",children:"Clear"})]})]}),y&&v.jsx("div",{className:"p-1 space-y-1",children:m.map(w=>v.jsxs("label",{onClick:()=>r(w.id),className:"flex items-start gap-2 p-2 rounded hover:bg-[#1e2a3a]/50 cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 mt-0.5 rounded border flex items-center justify-center flex-shrink-0 ${t.includes(w.id)?"bg-accent border-accent":"border-slate-600"}`,children:t.includes(w.id)&&v.jsx(Za,{size:12,className:"text-white"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200",children:w.name}),v.jsx("div",{className:"text-xs text-slate-500",children:w.description})]})]},w.id))})]},f)};return v.jsxs("div",{className:"max-h-96 overflow-y-auto border border-[#1e2a3a] rounded-lg p-2 space-y-2",children:[Zy.map(f=>h(f.key,f.label,f.Icon,a.get(f.key)||[])),h("other","Other",null,o)]})}const N5=["digest","mesh_broadcast","mesh_dm","email","webhook"],wxe=["routine","priority","immediate"];function Sxe({toggles:e,onChange:t}){const[r,n]=G.useState(null),i=(a,o)=>t({...e,[a]:{...e[a]||{},name:a,...o}});return v.jsxs("div",{className:"space-y-3 mb-8",children:[v.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Master Toggles",v.jsx(Ai,{info:"Per-family notification policy: enable a family, set its severity threshold, choose which channels fire at each severity, and scope to regions (PagerDuty/Grafana-style)."})]}),v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Zy.map(({key:a,label:o,Icon:s})=>{const l=e[a]||{},u=r===a,c=Object.values(l.severity_channels||{}).reduce((f,d)=>f+((d==null?void 0:d.length)||0),0),h=(l.regions||[]).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded-lg p-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("button",{type:"button",onClick:()=>n(u?null:a),className:"flex items-center gap-2 text-sm text-slate-200",children:[v.jsx(s,{size:15})," ",o,u?v.jsx(ll,{size:14}):v.jsx(Js,{size:14})]}),v.jsx(Lx,{label:"",checked:!!l.enabled,onChange:f=>i(a,{enabled:f})})]}),!u&&v.jsx("div",{className:"text-xs text-slate-600 mt-1",children:l.enabled?`${h||"all"} region${h===1?"":"s"}, ${c} channel${c===1?"":"s"} at ${l.min_severity||"priority"}+`:"OFF"}),u&&v.jsxs("div",{className:`mt-3 space-y-3 ${l.enabled?"":"opacity-40 pointer-events-none select-none"}`,children:[v.jsx(eU,{value:l.min_severity||"priority",onChange:f=>i(a,{min_severity:f})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Severity → channels"}),v.jsxs("table",{className:"text-xs w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{}),N5.map(f=>v.jsx("th",{className:"text-slate-500 font-normal px-1",children:f.replace("_"," ")},f))]})}),v.jsx("tbody",{children:wxe.map(f=>v.jsxs("tr",{children:[v.jsx("td",{className:"text-slate-400 pr-2",children:f}),N5.map(d=>{var m;const g=(((m=l.severity_channels)==null?void 0:m[f])||[]).includes(d);return v.jsx("td",{className:"text-center",children:v.jsx("input",{type:"checkbox",checked:g,onChange:y=>{const x={...l.severity_channels||{}},_=new Set(x[f]||[]);y.target.checked?_.add(d):_.delete(d),x[f]=Array.from(_),i(a,{severity_channels:x})}})},d)})]},f))})]}),v.jsx(Uy,{label:"Regions (empty = all)",value:l.regions||[],onChange:f=>i(a,{regions:f}),placeholder:"Add region..."})," ",v.jsx("div",{className:"text-xs text-slate-500 pt-1",children:"Channel config"}),v.jsx(Mp,{label:"Broadcast channel",value:l.broadcast_channel??0,onChange:f=>i(a,{broadcast_channel:f})}),v.jsx(Uy,{label:"DM node IDs",value:l.node_ids||[],onChange:f=>i(a,{node_ids:f}),placeholder:"!nodeid"}),v.jsx(Uy,{label:"Email recipients",value:l.recipients||[],onChange:f=>i(a,{recipients:f}),placeholder:"ops@example.com"}),v.jsx(xs,{label:"SMTP host",value:l.smtp_host||"",onChange:f=>i(a,{smtp_host:f}),placeholder:"smtp.example.com"}),v.jsx(Mp,{label:"SMTP port",value:l.smtp_port??587,onChange:f=>i(a,{smtp_port:f})}),v.jsx(xs,{label:"Webhook URL",value:l.webhook_url||"",onChange:f=>i(a,{webhook_url:f}),placeholder:"https://..."})]})]},a)})})]})}function Cxe(){var z,Z,U;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,x]=G.useState(null),[_,w]=G.useState({open:!1,ruleIndex:-1,loading:!1,action:""}),[S,T]=G.useState(!1),[M,A]=G.useState(!1),P=G.useCallback(async()=>{try{const[$,Y,te]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/categories"),fetch("/api/regions")]);if(!$.ok)throw new Error("Failed to fetch notifications config");const ie=await $.json(),se=await Y.json(),le=te.ok?await te.json():[];t(ie),n(JSON.parse(JSON.stringify(ie))),a(se),s(Array.isArray(le)?le:[]),A(!1),d(null)}catch($){d($ instanceof Error?$.message:"Unknown error")}finally{u(!1)}},[]);G.useEffect(()=>{document.title="Notifications - MeshAI",P()},[P]),G.useEffect(()=>{e&&r&&A(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const I=async()=>{if(e){h(!0),d(null),m(null);try{const $=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Y=await $.json();if(!$.ok)throw new Error(Y.detail||"Save failed");m("Notifications config saved successfully"),n(JSON.parse(JSON.stringify(e))),A(!1),setTimeout(()=>m(null),3e3)}catch($){d($ instanceof Error?$.message:"Save failed")}finally{h(!1)}}},N=()=>{r&&(t(JSON.parse(JSON.stringify(r))),A(!1))},D=()=>({name:"",enabled:!0,trigger_type:"condition",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"19:00",schedule_days:["monday"],message_type:"mesh_health_summary",custom_message:"",delivery_type:"",broadcast_channel:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{},cooldown_minutes:10,region_scope:[]}),O=()=>{e&&t({...e,rules:[...e.rules||[],D()]})},R=$=>{if(!e)return;const Y=L5.find(te=>te.id===$);Y&&(t({...e,rules:[...e.rules||[],{...D(),...Y.rule}]}),T(!1))},F=$=>{if(!e)return;const Y=e.rules[$],te={...JSON.parse(JSON.stringify(Y)),name:`${Y.name} (copy)`},ie=[...e.rules];ie.splice($+1,0,te),t({...e,rules:ie})},H=async $=>{w({open:!0,ruleIndex:$,loading:!0,action:""});try{const te=await(await fetch(`/api/notifications/rules/${$}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})})).json();x(te),w(ie=>({...ie,loading:!1}))}catch{x({success:!1,message:"Failed to get preview"}),w(Y=>({...Y,loading:!1}))}},W=async $=>{const Y=_.ruleIndex;w(te=>({...te,loading:!0,action:$}));try{const ie=await(await fetch(`/api/notifications/rules/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:$})})).json();x(ie),w(se=>({...se,loading:!1}))}catch{x({success:!1,message:`Failed to ${$}`}),w(te=>({...te,loading:!1}))}},V=()=>{w({open:!1,ruleIndex:-1,loading:!1,action:""}),x(null)};return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):e?v.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[_.open&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:v.jsxs("div",{className:"bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] overflow-auto",children:[v.jsxs("div",{className:"p-4 border-b border-[#2a3a4a] flex items-center justify-between sticky top-0 bg-[#1a2332]",children:[v.jsx("h3",{className:"text-lg font-semibold",children:"Test Notification Rule"}),v.jsx("button",{onClick:V,className:"text-slate-500 hover:text-slate-300",children:v.jsx(ca,{size:20})})]}),v.jsx("div",{className:"p-4 space-y-4",children:_.loading?v.jsxs("div",{className:"flex items-center justify-center py-8",children:[v.jsx($v,{size:20,className:"animate-spin text-slate-400 mr-2"}),v.jsx("div",{className:"text-slate-400",children:_.action?`${_.action.replace("_"," ").replace("send ","Sending ")}...`:"Loading current data..."})]}):y?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Current Data"}),y.live_data_summary&&y.live_data_summary.length>0?v.jsx("div",{className:"p-3 bg-slate-800/50 rounded space-y-1",children:y.live_data_summary.map(($,Y)=>v.jsx("div",{className:`text-sm font-mono ${$.startsWith("[!]")?"text-amber-400":""}`,children:$},Y))}):v.jsx("div",{className:"p-3 bg-slate-800/50 rounded text-sm text-slate-500",children:"No live data available for this rule's categories"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Rule Matching"}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.conditions_matched&&y.conditions_matched>0?v.jsxs("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 rounded text-sm",children:[y.conditions_matched," condition",y.conditions_matched!==1?"s":""," match - this rule WOULD fire"]}):v.jsx("span",{className:"px-2 py-1 bg-slate-700 text-slate-400 rounded text-sm",children:"No conditions trigger this rule right now"}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded text-sm",children:[y.conditions_below_threshold," below threshold"]})]}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-sm space-y-2",children:[v.jsx("div",{className:"text-yellow-300",children:y.below_threshold_summary}),y.below_threshold_events&&y.below_threshold_events.length>0&&v.jsx("div",{className:"space-y-1 text-yellow-200/80",children:y.below_threshold_events.slice(0,3).map(($,Y)=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 rounded",children:$.severity}),v.jsx("span",{children:$.headline})]},Y))}),y.suggestion&&v.jsxs("div",{className:"text-yellow-400 text-xs mt-2",children:["Tip: ",y.suggestion]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:y.is_example?"Example Messages":"Messages That Would Fire"}),(z=y.preview_messages)==null?void 0:z.map(($,Y)=>v.jsx("div",{className:"p-3 bg-slate-800 rounded text-sm font-mono break-words",children:$},Y))]}),y.delivered!==void 0&&y.delivery_result&&v.jsx("div",{className:`p-3 rounded text-sm ${y.delivered?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[y.delivered?v.jsx(Za,{size:16,className:"mt-0.5"}):v.jsx(ca,{size:16,className:"mt-0.5"}),v.jsxs("div",{children:[v.jsx("div",{children:y.delivery_result}),y.delivery_error&&v.jsx("div",{className:"mt-1 text-red-300",children:y.delivery_error})]})]})}),y.message&&!y.preview_messages&&v.jsx("div",{className:`p-3 rounded text-sm ${y.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:y.message})]}):null}),v.jsxs("div",{className:"p-4 border-t border-[#2a3a4a] flex justify-between sticky bottom-0 bg-[#1a2332]",children:[v.jsx("button",{onClick:V,className:"px-4 py-2 text-slate-400 hover:text-slate-200",children:"Close"}),y&&!y.delivered&&v.jsx("div",{className:"flex gap-2",children:y.delivery_method?v.jsxs(v.Fragment,{children:[y.live_data_summary&&y.live_data_summary.length>0&&v.jsx("button",{onClick:()=>W("send_status"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send current conditions summary",children:"Send Current Conditions"}),v.jsx("button",{onClick:()=>W("send_test"),disabled:_.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send example alert message",children:"Send Example Alert"}),y.can_send_live&&v.jsx("button",{onClick:()=>W("send_live"),disabled:_.loading,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm disabled:opacity-50",title:"Send actual live alert",children:"Send Live Alert"})]}):v.jsx("span",{className:"px-3 py-2 text-amber-400 text-sm",children:"Configure a delivery method to send test messages"})})]})]})}),v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{children:v.jsx("p",{className:"text-sm text-slate-500",children:"Alert delivery and scheduled reports. Rules define what triggers a notification and where it gets sent."})}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:P,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:v.jsx($v,{size:18})}),v.jsxs("button",{onClick:N,disabled:!M,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[v.jsx(Jx,{size:16}),"Discard"]}),v.jsxs("button",{onClick:I,disabled:c||!M,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[v.jsx(zM,{size:16}),c?"Saving...":"Save"]})]})]}),f&&v.jsx("div",{className:"p-3 rounded-lg text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&v.jsxs("div",{className:"p-3 rounded-lg text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[v.jsx(Za,{size:14,className:"inline mr-2"}),g]}),v.jsxs("div",{className:"bg-bg-card border border-border rounded-lg p-6 space-y-6",children:[v.jsx(Lx,{label:"Enable Notifications",checked:e.enabled,onChange:$=>t({...e,enabled:$}),helper:"Master switch for all notification delivery",info:"When disabled, no alerts or scheduled messages will be delivered. Alerts still get recorded to history."}),e.enabled&&v.jsxs(v.Fragment,{children:[" ",v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),v.jsx(Mp,{label:"Grace period (seconds)",value:e.cold_start_grace_seconds??60,onChange:$=>t({...e,cold_start_grace_seconds:$}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] rounded-lg border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),v.jsx(Lx,{label:"Enable scheduled band-conditions broadcasts",checked:e.band_conditions_enabled??!0,onChange:$=>t({...e,band_conditions_enabled:$}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(e.band_conditions_enabled??!0)&&v.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[v.jsx(Mv,{label:"Slot 1",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[0]=$,t({...e,band_conditions_schedule:Y})},helper:"Morning (default 06:00 MT)"}),v.jsx(Mv,{label:"Slot 2",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[1]=$,t({...e,band_conditions_schedule:Y})},helper:"Afternoon (default 14:00 MT)"}),v.jsx(Mv,{label:"Slot 3",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:$=>{const Y=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];Y[2]=$,t({...e,band_conditions_schedule:Y})},helper:"Night (default 22:00 MT)"})]}),v.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),e.toggles&&v.jsx(Sxe,{toggles:e.toggles,onChange:$=>t({...e,toggles:$})}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Notification Rules",v.jsx(Ai,{info:"Each rule is self-contained: define what triggers it (condition or schedule), where to send it (mesh, email, webhook), and behavior settings."})]}),v.jsxs("span",{className:"text-xs text-slate-500",children:[((Z=e.rules)==null?void 0:Z.length)||0," rule",(((U=e.rules)==null?void 0:U.length)||0)!==1?"s":""]})]}),(e.rules||[]).map(($,Y)=>v.jsx(_xe,{rule:$,ruleIndex:Y,categories:i,regions:o,onChange:te=>{const ie=[...e.rules||[]];ie[Y]=te,t({...e,rules:ie})},onDelete:()=>{confirm(`Delete rule "${$.name||"New Rule"}"?`)&&t({...e,rules:(e.rules||[]).filter((te,ie)=>ie!==Y)})},onDuplicate:()=>F(Y),onTest:()=>H(Y)},Y)),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{onClick:O,className:"flex-1 py-3 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(af,{size:16})," Add Rule"]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>T(!S),className:"py-3 px-4 border border-dashed border-[#1e2a3a] rounded-lg text-slate-500 hover:text-slate-300 hover:border-accent flex items-center gap-2 transition-colors",children:[v.jsx(hB,{size:16})," Add from Template"]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(!1)}),v.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-80 bg-[#1a2332] border border-[#2a3a4a] rounded-lg shadow-xl overflow-hidden",children:[v.jsx("div",{className:"p-2 border-b border-[#2a3a4a] text-xs text-slate-500 uppercase",children:"Rule Templates"}),L5.map($=>v.jsxs("button",{onClick:()=>R($.id),className:"w-full p-3 text-left hover:bg-[#2a3a4a] transition-colors",children:[v.jsx("div",{className:"font-medium text-slate-200",children:$.name}),v.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:$.description})]},$.id))]})]})]})]})]})]})]})]}):v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const P5=[{id:"stream-gauges",label:"Stream Gauges",icon:Yx},{id:"wildfire",label:"Wildfire",icon:Xx},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:Qx},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:U$},{id:"weather-alerts",label:"Weather Alerts",icon:G$},{id:"solar",label:"Solar & Geomagnetic",icon:pB},{id:"ducting",label:"Tropospheric Ducting",icon:Di},{id:"avalanche",label:"Avalanche Danger",icon:Kx},{id:"traffic",label:"Traffic Flow",icon:$x},{id:"roads-511",label:"Road Conditions (511)",icon:sB},{id:"mesh-health",label:"Mesh Health",icon:rf},{id:"broadcast-types",label:"Broadcast Types",icon:_C},{id:"reminders",label:"Reminder System",icon:Iu},{id:"notifications",label:"Notifications",icon:Zv},{id:"commands",label:"Commands",icon:gB},{id:"llm-dm",label:"LLM DM Queries",icon:OM},{id:"or-not-and",label:"OR-not-AND Architecture",icon:dB},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:BM},{id:"curation",label:"Curation: Gauges & Towns",icon:uB},{id:"schema",label:"Schema Migrations",icon:$$},{id:"api",label:"API Reference",icon:W$}];function $t({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return v.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function yt({headers:e,rows:t}){return v.jsx("div",{className:"overflow-x-auto my-4",children:v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>v.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),v.jsx("tbody",{children:t.map((r,n)=>v.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((i,a)=>v.jsx("td",{className:"px-4 py-2 text-slate-300",children:i},a))},n))})]})})}function Pt({href:e,children:t}){return v.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",v.jsx(Ih,{size:12})]})}function de({children:e}){return v.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function fs({children:e}){return v.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function oe({children:e}){return v.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function hr({id:e,title:t,children:r}){return v.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[v.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),v.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function Txe(){const e=tf(),[t,r]=G.useState(""),[n,i]=G.useState("stream-gauges"),a=G.useRef(null);G.useEffect(()=>{const l=e.hash.replace("#","");if(l&&P5.find(u=>u.id===l)){i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=P5.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return v.jsxs("div",{className:"flex h-full -m-6",children:[v.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[v.jsx("div",{className:"p-4 border-b border-border",children:v.jsxs("div",{className:"relative",children:[v.jsx(e_,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),v.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return v.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[v.jsx(u,{size:16}),l.label]},l.id)})})]}),v.jsx("div",{ref:a,className:"flex-1 overflow-y-auto p-6",children:v.jsxs("div",{className:"max-w-4xl",children:[v.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),v.jsxs(hr,{id:"stream-gauges",title:"Stream Gauges",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"A small creek: 50-200 CFS"}),v.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),v.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),v.jsx(de,{children:"When Does It Flood?"}),v.jsxs("p",{children:["Flood levels are set by the ",v.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),v.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),v.jsx(de,{children:"Low Water / Drought"}),v.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Find your gauge at ",v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),v.jsxs("li",{children:["Copy the site number (like ",v.jsx(oe,{children:"13090500"}),")"]}),v.jsx("li",{children:"Add it in Config → Environmental → USGS"}),v.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),v.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),v.jsxs(hr,{id:"wildfire",title:"Wildfire",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),v.jsx(de,{children:"Fire Size — How Big Is It?"}),v.jsx(yt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),v.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),v.jsx(de,{children:"Containment — Is It Under Control?"}),v.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),v.jsx(de,{children:"How Far Away Should I Worry?"}),v.jsx(yt,{headers:["Distance","What To Do"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Under 5 km (3 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 5-15 km (3-10 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 15-30 km (10-20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Over 30 km (20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),v.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),v.jsx(de,{children:"Which Matters More — Size or Distance?"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),v.jsx(de,{children:"Setting It Up"}),v.jsxs("p",{children:["Just configure your state code (like ",v.jsx(oe,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),v.jsxs(hr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),v.jsxs("p",{children:[v.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",v.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),v.jsx(de,{children:"Confidence — Is It Really a Fire?"}),v.jsx("p",{children:"Each detection gets a confidence rating:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),v.jsx(de,{children:"FRP — How Intense Is It?"}),v.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),v.jsx(yt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),v.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),v.jsx(de,{children:"New Ignition Detection"}),v.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",v.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),v.jsx(de,{children:"Timing"}),v.jsxs("p",{children:["Satellite data arrives ",v.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",v.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),v.jsx("li",{children:'Click "Get MAP_KEY"'}),v.jsx("li",{children:"Register for a free Earthdata account"}),v.jsx("li",{children:"Your key arrives by email"}),v.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),v.jsxs(hr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[v.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),v.jsx(de,{children:"What you'll see on the mesh"}),v.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),v.jsx(yt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[v.jsx(oe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[v.jsx(oe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",v.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[v.jsx(oe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[v.jsx(oe,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[v.jsx(oe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",v.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[v.jsx(oe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),v.jsx(de,{children:"Daily LLM digest"}),v.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",v.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",v.jsx(oe,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),v.jsx(de,{children:"How attribution works"}),v.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",v.jsx(oe,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),v.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",v.jsx(oe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",v.jsx(oe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",v.jsx(oe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",v.jsx(oe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),v.jsx(de,{children:"How movement is computed"}),v.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",v.jsx(oe,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",v.jsx(oe,{children:"growth_drift_threshold_mi"})," the"," ",v.jsx(oe,{children:"wildfire_growth"})," broadcast fires."]}),v.jsx(de,{children:"How spotting is detected"}),v.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",v.jsx(oe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",v.jsx(oe,{children:"wildfire_spotting"})," broadcast at ",v.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",v.jsx(oe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),v.jsx(de,{children:"Tunable knobs (Adapter Config → fires)"}),v.jsx(yt,{headers:["Key","Default","What it does"],rows:[[v.jsx(oe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[v.jsx(oe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[v.jsx(oe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[v.jsx(oe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[v.jsx(oe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[v.jsx(oe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[v.jsx(oe,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[v.jsx(oe,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[v.jsx(oe,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[v.jsx(oe,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),v.jsxs(hr,{id:"weather-alerts",title:"Weather Alerts",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),v.jsx(de,{children:"Alert Severity — How Serious Is It?"}),v.jsx(yt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),v.jsx(de,{children:"When Should I Act? (Urgency)"}),v.jsx(yt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),v.jsx(de,{children:"How Sure Are They? (Certainty)"}),v.jsx(yt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),v.jsx(de,{children:"These Are Separate Scales"}),v.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),v.jsx(de,{children:"What Minimum Severity Should I Set?"}),v.jsx(yt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),v.jsx(de,{children:"Finding Your NWS Zone"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(Pt,{href:"https://www.weather.gov",children:"weather.gov"})]}),v.jsx("li",{children:"Enter your location"}),v.jsxs("li",{children:["Find your zone code at ",v.jsx(Pt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),v.jsxs("li",{children:["Zone codes look like: ",v.jsx(oe,{children:"IDZ016"}),", ",v.jsx(oe,{children:"UTZ040"}),", etc."]})]}),v.jsx(de,{children:"The User-Agent Field"}),v.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),v.jsx("p",{children:v.jsx(oe,{children:"(meshai, you@email.com)"})}),v.jsx("p",{children:"No registration. No waiting. Just type it in."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),v.jsxs(hr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),v.jsx(de,{children:"Solar Flux Index (SFI)"}),v.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),v.jsx(yt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),v.jsx(de,{children:"Kp Index"}),v.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),v.jsx(yt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[v.jsx("strong",{children:"5"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[v.jsx("strong",{children:"6"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[v.jsx("strong",{children:"7"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[v.jsx("strong",{children:"8-9"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),v.jsx(de,{children:"R / S / G Scales"}),v.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),v.jsx(fs,{children:"R (Radio Blackouts) — from solar flares:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),v.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),v.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),v.jsx(fs,{children:"S (Solar Radiation Storms) — from energetic particles:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Mostly affects polar regions and satellites"}),v.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),v.jsx(fs,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),v.jsx(de,{children:"Bz — The Storm Predictor"}),v.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),v.jsx(yt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),v.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),v.jsxs(hr,{id:"ducting",title:"Tropospheric Ducting",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),v.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),v.jsx(de,{children:"How Do I Know If Ducting Is Happening?"}),v.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),v.jsx(yt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),v.jsx(de,{children:"What You'll Actually Notice"}),v.jsx("p",{children:"When ducting happens on your mesh:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),v.jsx("li",{children:"Nodes appear from far outside your normal range"}),v.jsx("li",{children:"You hear FM radio stations from other cities"}),v.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),v.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),v.jsx(de,{children:"The dM/dz Number"}),v.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),v.jsx(de,{children:"When Does Ducting Happen?"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),v.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),v.jsx("li",{children:"Most common in late summer and early fall"}),v.jsx("li",{children:"Strongest along coastlines and over water"}),v.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),v.jsxs(hr,{id:"avalanche",title:"Avalanche Danger",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),v.jsx(de,{children:"The Danger Scale"}),v.jsx(yt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",v.jsx($t,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",v.jsx($t,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",v.jsx($t,{color:"orange"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",v.jsx($t,{color:"red"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",v.jsx($t,{color:"black"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),v.jsx(de,{children:"The Most Important Thing to Know"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),v.jsx(de,{children:"Seasonal"}),v.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),v.jsx(de,{children:"Finding Your Avalanche Center"}),v.jsxs("p",{children:["Go to ",v.jsx(Pt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"UAC"})," — Utah"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"CAIC"})," — Colorado"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"SAC"})," — Sierra Nevada (CA)"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),v.jsxs(hr,{id:"traffic",title:"Traffic Flow",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),v.jsx(de,{children:"Speed Ratio — The Key Number"}),v.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),v.jsx(yt,{headers:["Ratio","What It Means"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),v.jsx(de,{children:"Confidence — Can You Trust the Data?"}),v.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),v.jsx(yt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),v.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),v.jsx(de,{children:"Setting Up Corridors"}),v.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Go to Google Maps, find the road"}),v.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),v.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),v.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),v.jsx(de,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Sign up at ",v.jsx(Pt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),v.jsx("li",{children:"Create an app → get your API key"}),v.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),v.jsx(de,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(Pt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),v.jsxs("li",{children:[v.jsx(Pt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),v.jsxs(hr,{id:"roads-511",title:"Road Conditions (511)",children:[v.jsx(de,{children:"What You're Looking At"}),v.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),v.jsx(de,{children:"Setting It Up"}),v.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),v.jsx("p",{children:"Configure in Config → Environmental → 511:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"API Key"})," — if required by your state"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),v.jsx(de,{children:"Learn More"}),v.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),v.jsxs(hr,{id:"mesh-health",title:"Mesh Health",children:[v.jsx(de,{children:"Health Score"}),v.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),v.jsx(yt,{headers:["Pillar","Weight","What It Measures"],rows:[[v.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[v.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[v.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[v.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[v.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),v.jsx("p",{children:"The overall score is the weighted sum:"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),v.jsx(de,{children:"How Each Pillar Is Calculated"}),v.jsx(fs,{children:"Infrastructure (30%)"}),v.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),v.jsxs("p",{children:["Only nodes with the ",v.jsx(oe,{children:"ROUTER"}),", ",v.jsx(oe,{children:"ROUTER_LATE"}),", or ",v.jsx(oe,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),v.jsx(fs,{children:"Utilization (25%)"}),v.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",v.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),v.jsx("p",{children:v.jsx("strong",{children:"How it works:"})}),v.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[v.jsxs("li",{children:["Collect ",v.jsx(oe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),v.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),v.jsxs("li",{children:["Use the ",v.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),v.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),v.jsxs("p",{className:"mt-4",children:[v.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),v.jsx(yt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),v.jsx(fs,{children:"Coverage (20%)"}),v.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),v.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",v.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),v.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),v.jsx(yt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),v.jsx(fs,{children:"Behavior (15%)"}),v.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),v.jsxs("p",{children:[v.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),v.jsx(yt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),v.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),v.jsx(fs,{children:"Power (10%)"}),v.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),v.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),v.jsxs("p",{children:[v.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),v.jsx(de,{children:"Health Tiers"}),v.jsx(yt,{headers:["Score","Tier","What It Means"],rows:[["90-100",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),v.jsx(de,{children:"Channel Utilization — Is the Radio Channel Full?"}),v.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),v.jsx(yt,{headers:["Utilization","What's Happening"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[v.jsxs(v.Fragment,{children:[v.jsx($t,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),v.jsx(de,{children:"Packet Flooding"}),v.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:v.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),v.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),v.jsx(yt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),v.jsx(de,{children:"Battery Levels"}),v.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),v.jsx(yt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[v.jsx("strong",{children:"3.60V"}),v.jsx("strong",{children:"~30%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[v.jsx("strong",{children:"3.50V"}),v.jsx("strong",{children:"~15%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"🔴 Low — charge it now"})})],[v.jsx("strong",{children:"3.40V"}),v.jsx("strong",{children:"~7%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),v.jsx(de,{children:"Node Offline Detection"}),v.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),v.jsx(yt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",v.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),v.jsxs(hr,{id:"broadcast-types",title:"Broadcast Types",children:[v.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),v.jsx(yt,{headers:["Prefix","What it means","When you see it"],rows:[[v.jsx(oe,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[v.jsx(oe,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[v.jsx(oe,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),v.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),v.jsxs(hr,{id:"reminders",title:"Reminder System",children:[v.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",v.jsx(oe,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),v.jsx(de,{children:"Cadences"}),v.jsx(yt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[v.jsx(oe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),v.jsx(de,{children:"The tombstone"}),v.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",v.jsx(oe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",v.jsx(oe,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),v.jsx(de,{children:"Turning reminders off"}),v.jsxs("p",{children:["Per-adapter on/off lives in ",v.jsx(oe,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),v.jsxs(hr,{id:"notifications",title:"Notifications",children:[v.jsx(de,{children:"How It Works"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),v.jsx(de,{children:"Building Rules"}),v.jsx("p",{children:"Each rule answers three questions:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),v.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),v.jsx(de,{children:"Severity Levels — What Should I Set?"}),v.jsx(yt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),v.jsx(de,{children:"Webhook — The Swiss Army Knife"}),v.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"ntfy.sh"})," — POST to ",v.jsx(oe,{children:"https://ntfy.sh/your-topic"})]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),v.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),v.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),v.jsxs(hr,{id:"commands",title:"Commands",children:[v.jsxs("p",{children:["All commands use the ",v.jsx(oe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),v.jsx(de,{children:"Basic Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!help"}),"Shows all available commands"],[v.jsx(oe,{children:"!ping"}),"Tests if the bot is alive"],[v.jsx(oe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[v.jsx(oe,{children:"!health"}),"Detailed health report with pillar scores"],[v.jsx(oe,{children:"!weather"}),"Current weather for your area"]]}),v.jsx(de,{children:"Environmental Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!solar"})," (or ",v.jsx(oe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[v.jsx(oe,{children:"!fire"}),"Active wildfires near your mesh"],[v.jsx(oe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!streams"})," (or ",v.jsx(oe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[v.jsxs(v.Fragment,{children:[v.jsx(oe,{children:"!roads"})," (or ",v.jsx(oe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[v.jsx(oe,{children:"!hotspots"}),"Satellite fire detections"]]}),v.jsx(de,{children:"Subscription Commands"}),v.jsx(yt,{headers:["Command","What It Does"],rows:[[v.jsx(oe,{children:"!subscribe"}),"Lists all alert categories you can subscribe to"],[v.jsx(oe,{children:"!subscribe fire_proximity"}),"Subscribe to a specific category"],[v.jsx(oe,{children:"!subscribe all"}),"Subscribe to everything"],[v.jsx(oe,{children:"!unsubscribe fire_proximity"}),"Unsubscribe from a category"],[v.jsx(oe,{children:"!subscriptions"}),"Shows what you're currently subscribed to"]]}),v.jsx(de,{children:"Conversational"}),v.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",v.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),v.jsxs(hr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[v.jsxs("p",{children:["Bang commands like ",v.jsx(oe,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),v.jsx(de,{children:"What it can answer"}),v.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),v.jsx(yt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[v.jsx(oe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[v.jsx(oe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[v.jsx(oe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[v.jsx(oe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[v.jsx(oe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[v.jsx(oe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[v.jsx(oe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),v.jsx(de,{children:"The grounding rule"}),v.jsxs("p",{children:["The bot is told to answer ",v.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),v.jsx(de,{children:"Excluding an adapter from LLM context"}),v.jsxs("p",{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",v.jsx(oe,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),v.jsx(de,{children:"What it can't answer"}),v.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),v.jsxs(hr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[v.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),v.jsx(de,{children:"Why mutually exclusive"}),v.jsxs("p",{children:["An adapter is set to ",v.jsx("strong",{children:"either"})," Central ",v.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",v.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),v.jsx(de,{children:"The per-adapter source toggle"}),v.jsxs("p",{children:["Set ",v.jsx(oe,{children:"feed_source"})," on each adapter's row in Environment:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),v.jsxs("li",{children:[v.jsx(oe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),v.jsxs("p",{children:["On the GUI, adapters with ",v.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),v.jsx(de,{children:"Where this surfaces in tooltips"}),v.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",v.jsxs(oe,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),v.jsxs(hr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[v.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),v.jsx(de,{children:"The CONFIG-vs-CODE rule"}),v.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),v.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),v.jsx(de,{children:"Restart-required vs live"}),v.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Anything under the ",v.jsx(oe,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),v.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),v.jsx("li",{children:"The dispatcher cold-start grace window."})]}),v.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),v.jsxs(de,{children:["The ",v.jsx(oe,{children:"include_in_llm_context"})," toggle"]}),v.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,v.jsx(oe,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),v.jsxs(hr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[v.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),v.jsx(de,{children:"Gauge Sites"}),v.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),v.jsxs("p",{children:[v.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",v.jsx(oe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),v.jsx(de,{children:"Town Anchors"}),v.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),v.jsx("li",{children:"Town Anchors table (your curated list)"}),v.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),v.jsx("li",{children:"County + state fallback"}),v.jsx("li",{children:"Bare lat/lon coords"})]}),v.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),v.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",v.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),v.jsxs(hr,{id:"schema",title:"Schema Migrations",children:[v.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",v.jsx(oe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",v.jsx(oe,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",v.jsx(oe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),v.jsx(de,{children:"v0.6 + v0.7 additions"}),v.jsx(yt,{headers:["Migration","What it added"],rows:[[v.jsx(oe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[v.jsx(oe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[v.jsx(oe,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[v.jsx(oe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[v.jsx(oe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[v.jsx(oe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),v.jsx(de,{children:"When migrations fail"}),v.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",v.jsx(oe,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),v.jsxs(hr,{id:"api",title:"API Reference",children:[v.jsxs("p",{children:["MeshAI's REST API is available at ",v.jsx(oe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),v.jsx(de,{children:"System"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/status"})," — version, uptime, node count"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/channels"})," — radio channel list"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"POST /api/restart"})," — restart the bot"]})]}),v.jsx(de,{children:"Mesh Data"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/health"})," — health score and pillars"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/regions"})," — region summaries"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/sources"})," — data source health"]})]}),v.jsx(de,{children:"Configuration"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/config"})," — full config"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["GET /api/config/","{section}"]})," — one section"]}),v.jsxs("li",{children:[v.jsxs(oe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),v.jsx(de,{children:"Environmental"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/status"})," — per-feed health"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/active"})," — all active events"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),v.jsx(de,{children:"Alerts"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/active"})," — current alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/alerts/history"})," — past alerts"]}),v.jsxs("li",{children:[v.jsx(oe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),v.jsx(de,{children:"Real-time"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(oe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const Mxe=1500;function Axe(){const[e,t]=G.useState({}),[r,n]=G.useState({}),[i,a]=G.useState(!0),[o,s]=G.useState(null),[l,u]=G.useState({}),[c,h]=G.useState({}),[f,d]=G.useState({}),g=G.useCallback(async()=>{a(!0),s(null);try{const[S,T]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!S.ok)throw new Error(`GET /adapter-config: ${S.status}`);if(!T.ok)throw new Error(`GET /adapter-meta: ${T.status}`);t(await S.json()),n(await T.json())}catch(S){s(String(S))}finally{a(!1)}},[]);G.useEffect(()=>{g()},[g]);const m=G.useCallback((S,T,M)=>{h(A=>({...A,[S]:T})),M&&d(A=>({...A,[S]:M})),T==="saved"&&setTimeout(()=>{h(A=>A[S]==="saved"?{...A,[S]:"idle"}:A)},Mxe)},[]),y=G.useCallback(async(S,T,M)=>{const A=`${S}.${T}`;m(A,"saving");try{const P=await fetch(`/api/adapter-config/${S}/${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:M})});if(!P.ok){const D=(await P.json().catch(()=>({}))).detail||P.statusText;m(A,"error",String(D));return}const I=await P.json();t(N=>({...N,[S]:(N[S]||[]).map(D=>D.key===T?I:D)})),m(A,"saved")}catch(P){m(A,"error",String(P))}},[m]),x=G.useCallback(async(S,T)=>{const M=`${S}.${T}`;m(M,"saving");try{const A=await fetch(`/api/adapter-config/${S}/${T}/reset`,{method:"POST"});if(!A.ok){m(M,"error",`reset failed (${A.status})`);return}const P=await A.json();t(I=>({...I,[S]:(I[S]||[]).map(N=>N.key===T?P:N)})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]),_=G.useCallback(async(S,T)=>{const M=`meta:${S}`;m(M,"saving");try{const A=await fetch(`/api/adapter-meta/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const I=await A.json().catch(()=>({}));m(M,"error",String(I.detail||A.statusText));return}const P=await A.json();n(I=>({...I,[S]:P})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]);if(i)return v.jsxs("div",{className:"p-6 flex items-center gap-2 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(o)return v.jsxs("div",{className:"p-6 text-red-400",children:[v.jsx(Vo,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",o]});const w=Array.from(new Set([...Object.keys(r),...Object.keys(e)])).sort();return v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 text-slate-200",children:[v.jsx(BM,{className:"w-5 h-5"}),v.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[Object.values(e).reduce((S,T)=>S+T.length,0)," settings across ",w.length," adapters"]})]}),v.jsxs("p",{className:"text-xs text-slate-400 max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",v.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",v.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),w.map(S=>{const T=r[S]||{display_name:S,include_in_llm_context:!0,description:""},M=e[S]||[],A=l[S]??!1,P=`meta:${S}`,I=c[P]||"idle";return v.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg",children:[v.jsxs("div",{className:"p-4 flex items-start gap-4",children:[v.jsx("button",{onClick:()=>u(N=>({...N,[S]:!N[S]})),className:"text-slate-400 hover:text-white","aria-label":"toggle expand",children:A?v.jsx(ll,{className:"w-5 h-5"}):v.jsx(Js,{className:"w-5 h-5"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"text-base font-semibold text-slate-100",children:T.display_name}),v.jsx("code",{className:"text-xs text-slate-500",children:S}),M.length>0&&v.jsxs("span",{className:"text-xs text-slate-400 ml-1",children:["(",M.length," settings)"]}),M.length===0&&v.jsx("span",{className:"text-xs text-slate-500 ml-1 italic",children:"(meta only)"})]}),T.description&&v.jsx("p",{className:"text-xs text-slate-400 mt-1",children:T.description})]}),v.jsxs("label",{className:"flex items-center gap-2 text-xs text-slate-300 select-none",children:[v.jsx("input",{type:"checkbox",checked:T.include_in_llm_context,onChange:N=>_(S,{include_in_llm_context:N.target.checked}),className:"w-4 h-4 accent-cyan-500"}),"LLM context",v.jsx(tU,{status:I,error:f[P]})]})]}),A&&M.length>0&&v.jsx("div",{className:"border-t border-slate-700 divide-y divide-slate-700/60",children:M.map(N=>v.jsx(kxe,{row:N,status:c[`${S}.${N.key}`]||"idle",error:f[`${S}.${N.key}`],onCommit:D=>y(S,N.key,D),onReset:()=>x(S,N.key)},N.key))})]},S)})]})}function kxe({row:e,status:t,error:r,onCommit:n,onReset:i}){const[a,o]=G.useState(bS(e));G.useEffect(()=>{o(bS(e))},[e.value,e.type]);const s=a!==bS(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=Lxe(a,e.type);c.error||c.changed(e.value)&&n(c.value)};return v.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("code",{className:"text-sm font-mono text-cyan-300",children:e.key}),v.jsxs("span",{className:"text-xs text-slate-500",children:["[",e.type,"]"]}),!l&&v.jsx("span",{className:"text-xs text-amber-400",children:"edited"})]}),e.description&&v.jsx("p",{className:"text-xs text-slate-400 mt-1",children:e.description})]}),v.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?v.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-cyan-500"}):e.type==="json"?v.jsx("textarea",{className:"w-72 h-20 bg-slate-900 border border-slate-700 rounded px-2 py-1 text-xs font-mono text-slate-100",value:a,onChange:c=>o(c.target.value),onBlur:u}):v.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-slate-900 border border-slate-700 rounded px-2 py-1 text-sm text-slate-100",value:a,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),v.jsx(tU,{status:t,error:r,dirty:s}),v.jsx("button",{onClick:i,disabled:l,className:"text-slate-400 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:v.jsx(Jx,{className:"w-4 h-4"})})]})]})}function tU({status:e,error:t,dirty:r}){return e==="saving"?v.jsx(Dp,{className:"w-4 h-4 text-cyan-400 animate-spin"}):e==="saved"?v.jsx(Za,{className:"w-4 h-4 text-emerald-400"}):e==="error"?v.jsx("span",{title:t,className:"text-red-400 cursor-help",children:v.jsx(Vo,{className:"w-4 h-4"})}):r?v.jsx("span",{className:"w-2 h-2 bg-amber-400 rounded-full",title:"unsaved"}):v.jsx("span",{className:"w-4 h-4"})}function bS(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function Lxe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const wS={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function Nxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(wS),[c,h]=G.useState(!1),[f,d]=G.useState("unknown"),g=G.useCallback(async()=>{n(!0),a(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){a(String(S))}finally{n(!1)}},[]);G.useEffect(()=>{g()},[g]),G.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var T;return d(((T=S==null?void 0:S.usgs)==null?void 0:T.feed_source)||"unknown")}).catch(()=>d("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...wS})},x=()=>{s(null),h(!1),u(wS)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const T=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!T.ok){alert(`delete failed: ${T.status}`);return}g()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Yx,{className:"w-5 h-5 text-cyan-400"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),v.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-cyan-700 hover:bg-cyan-600 rounded text-white text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add site"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&v.jsx(I5,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-slate-900 text-xs text-slate-400 uppercase",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 text-left",children:"Site ID"}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lat,Lon"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Action"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Minor"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Moderate"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Major"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(S=>o===S.site_id?v.jsx("tr",{className:"bg-slate-900/40",children:v.jsx("td",{colSpan:9,className:"px-3 py-2",children:v.jsx(I5,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),v.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),v.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>m(S),className:"text-cyan-400 hover:text-cyan-300 text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function I5({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i,feedSource:a}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=G.useState(!1),[u,c]=G.useState(null),h=a!=="native"||!e.site_id.trim(),f=a!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",d=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-slate-900/50 rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",v.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[v.jsx("input",{className:"flex-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!i}),v.jsxs("button",{type:"button",onClick:d,disabled:h||s,title:f,className:"px-2 py-1 bg-slate-700 hover:bg-slate-600 disabled:opacity-30 disabled:cursor-not-allowed rounded text-xs text-slate-100 flex items-center gap-1",children:[s?v.jsx(Dp,{className:"w-3 h-3 animate-spin"}):v.jsx(e_,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&v.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-cyan-500"}),"Enabled"]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm",children:"Save"})]})]})}const SS={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function Pxe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(!1),[c,h]=G.useState(SS),f=G.useCallback(async()=>{n(!0),a(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){a(String(_))}finally{n(!1)}},[]);G.useEffect(()=>{f()},[f]);const d=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...SS})},m=()=>{s(null),u(!1),h(SS)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const T=await S.json().catch(()=>({}));alert(`save failed: ${T.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx(Dp,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nf,{className:"w-5 h-5 text-cyan-400"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),v.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-cyan-700 hover:bg-cyan-600 rounded text-white text-sm",children:[v.jsx(af,{className:"w-4 h-4"})," Add town"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&v.jsx(D5,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),v.jsx("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-slate-900 text-xs text-slate-400 uppercase",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lat"}),v.jsx("th",{className:"px-3 py-2 text-right",children:"Lon"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"State"}),v.jsx("th",{className:"px-3 py-2 text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2"})]})}),v.jsx("tbody",{className:"divide-y divide-slate-700/60",children:e.map(_=>o===_.anchor_id?v.jsx("tr",{className:"bg-slate-900/40",children:v.jsx("td",{colSpan:6,className:"px-3 py-2",children:v.jsx(D5,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):v.jsxs("tr",{className:"hover:bg-slate-800/50",children:[v.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?v.jsx(Za,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ca,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>d(_),className:"text-cyan-400 hover:text-cyan-300 text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Ep,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function D5({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i}){const a=(o,s)=>t({...e,[o]:s});return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-slate-900/50 rounded",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.name,onChange:o=>a("name",o.target.value),disabled:!i})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["State",v.jsx("input",{className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>a("state",o.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>a("enabled",o.target.checked),className:"accent-cyan-500 mt-4"}),"Enabled"]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lat,onChange:o=>a("lat",parseFloat(o.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100",value:e.lon,onChange:o=>a("lon",parseFloat(o.target.value))})]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-slate-700 rounded text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm",children:"Save"})]})]})}function Ixe(){return v.jsx(cY,{children:v.jsx(pY,{children:v.jsxs(b$,{children:[v.jsx($i,{path:"/",element:v.jsx(CY,{})}),v.jsx($i,{path:"/mesh",element:v.jsx(V0e,{})}),v.jsx($i,{path:"/environment",element:v.jsx(hxe,{})}),v.jsx($i,{path:"/config",element:v.jsx(sxe,{})}),v.jsx($i,{path:"/alerts",element:v.jsx(xxe,{})}),v.jsx($i,{path:"/notifications",element:v.jsx(Cxe,{})}),v.jsx($i,{path:"/reference",element:v.jsx(Txe,{})}),v.jsx($i,{path:"/adapter-config",element:v.jsx(Axe,{})}),v.jsx($i,{path:"/gauge-sites",element:v.jsx(Nxe,{})}),v.jsx($i,{path:"/town-anchors",element:v.jsx(Pxe,{})})]})})})}CS.createRoot(document.getElementById("root")).render(v.jsx(Ch.StrictMode,{children:v.jsx(k$,{children:v.jsx(Ixe,{})})})); diff --git a/meshai/dashboard/static/assets/index-DSQXC5BZ.css b/meshai/dashboard/static/assets/index-DSQXC5BZ.css new file mode 100644 index 0000000..417cd08 --- /dev/null +++ b/meshai/dashboard/static/assets/index-DSQXC5BZ.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-m-6{margin:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[40vh\]{height:40vh}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[85vh\]{max-height:85vh}.min-h-\[36px\]{min-height:36px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(28 42 58 / var(--tw-divide-opacity, 1))}.divide-slate-700\/60>:not([hidden])~:not([hidden]){border-color:#33415599}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-amber,.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-dim\/30{border-color:#d977064d}.border-amber\/30{border-color:#f59e0b4d}.border-blue{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue\/30{border-color:#38bdf84d}.border-border{--tw-border-opacity: 1;border-color:rgb(28 42 58 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1c2a3a80}.border-danger{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.border-danger\/30{border-color:#f973164d}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/30{border-color:#4755694d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-amber{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1420\]{--tw-bg-opacity: 1;background-color:rgb(13 20 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]\/50{background-color:#1e2a3a80}.bg-amber{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-muted{background-color:#f59e0b26}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(15 21 32 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0f1520e6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 32 48 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-muted{background-color:#38bdf81f}.bg-border{--tw-bg-opacity: 1;background-color:rgb(28 42 58 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity, 1))}.bg-danger{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-danger-muted{background-color:#f9731626}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/40{background-color:#33415566}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-700{--tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-amber{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-blue{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-dim{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-danger{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-danger-dim{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-200\/80{color:#fef08acc}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-blue-500{accent-color:#3b82f6}.accent-cyan-500{accent-color:#06b6d4}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#0a0e17;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#0a0e17}::-webkit-scrollbar-thumb{background:#2d3a4d;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#3b4a5d}.bg-bg-card{background-image:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(255,255,255,.008) 2px,rgba(255,255,255,.008) 3px)}.amber-glow{box-shadow:0 0 12px #f59e0b40}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]\/50:hover{background-color:#1e2a3a80}.hover\:bg-\[\#2a3a4a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 58 74 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 32 48 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-cyan-600:hover{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-500\/10:hover{background-color:#64748b1a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-blue-dim:hover{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-amber:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/meshai/dashboard/static/assets/index-LGjCLdSa.css b/meshai/dashboard/static/assets/index-LGjCLdSa.css deleted file mode 100644 index 10378e7..0000000 --- a/meshai/dashboard/static/assets/index-LGjCLdSa.css +++ /dev/null @@ -1 +0,0 @@ -.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-m-6{margin:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[40vh\]{height:40vh}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[85vh\]{max-height:85vh}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 42 58 / var(--tw-divide-opacity, 1))}.divide-slate-700\/60>:not([hidden])~:not([hidden]){border-color:#33415599}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-accent{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/30{border-color:#3b82f64d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e2a3a80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-600\/30{border-color:#dc26264d}.border-red-700\/30{border-color:#b91c1c4d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-blue-500{--tw-border-opacity: 1;border-left-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1420\]{--tw-bg-opacity: 1;background-color:rgb(13 20 32 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]\/50{background-color:#1e2a3a80}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#3b82f61a}.bg-accent\/20{background-color:#3b82f633}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#111827e6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600\/20{background-color:#dc262633}.bg-red-700\/20{background-color:#b91c1c33}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-700{--tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position)}.fill-slate-100{fill:#f1f5f9}.fill-slate-400{fill:#94a3b8}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-accent{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-200\/80{color:#fef08acc}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-blue-500{accent-color:#3b82f6}.accent-cyan-500{accent-color:#06b6d4}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#0a0e17;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#0a0e17}::-webkit-scrollbar-thumb{background:#2d3a4d;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#3b4a5d}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]\/50:hover{background-color:#1e2a3a80}.hover\:bg-\[\#2a3a4a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 58 74 / var(--tw-bg-opacity, 1))}.hover\:bg-accent\/10:hover{background-color:#3b82f61a}.hover\:bg-accent\/80:hover{background-color:#3b82f6cc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-cyan-600:hover{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-500\/10:hover{background-color:#64748b1a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-slate-500:focus{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/meshai/dashboard/static/index.html b/meshai/dashboard/static/index.html index c7c582f..0924684 100644 --- a/meshai/dashboard/static/index.html +++ b/meshai/dashboard/static/index.html @@ -8,8 +8,8 @@ - - + +