diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION
index 35023f4d..6ed642d1 100644
--- a/frontend/dist/VERSION
+++ b/frontend/dist/VERSION
@@ -1 +1 @@
-0.9.191
+0.9.192
diff --git a/frontend/dist/assets/BasemapLayer-CVTB3HoG.js b/frontend/dist/assets/BasemapLayer-CVTB3HoG.js
deleted file mode 100644
index 9b411313..00000000
--- a/frontend/dist/assets/BasemapLayer-CVTB3HoG.js
+++ /dev/null
@@ -1 +0,0 @@
-import{i as t,bM as e,r}from"./vendor-react-DWFolw7W.js";const a="pymc-basemap-mode",o="light";function s(){if("undefined"==typeof window)return o;try{const t=localStorage.getItem(a);if("light"===t||"dark"===t)return t}catch{}return o}function n(t){if("undefined"!=typeof window)try{localStorage.setItem(a,t)}catch{}}const c=t(t=>({mode:s(),toggle:()=>t(t=>{const e="light"===t.mode?"dark":"light";return n(e),{mode:e}}),setMode:e=>{n(e),t({mode:e})}})),i=()=>c(t=>t.mode),l=()=>c(t=>t.toggle),u={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},d={light:"basemap-light-",dark:"basemap-dark-"},f={};function y({mode:t}){const{current:a}=e(),[o,s]=r.useState(null),n=r.useRef({light:!1,dark:!1}),c=r.useRef({light:[],dark:[]});r.useEffect(()=>{const t=()=>{var t;const e=null==(t=null==a?void 0:a.getMap)?void 0:t.call(a);e&&!o&&s(e)};t();const e=setInterval(t,50),r=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(r)}},[a,o]);const i=r.useCallback(async(t,e,r)=>{var a,o;if(n.current[e])return;const s=d[e],i=await async function(t){if(f[t])return f[t];const e=await fetch(u[t]),r=await e.json();return f[t]=r,r}(e),l=[];for(const[n,c]of Object.entries(i.sources||{})){const e=s+n;t.getSource(e)||t.addSource(e,c)}const y=null==(o=((null==(a=t.getStyle())?void 0:a.layers)||[]).find(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-")))?void 0:o.id;for(const n of i.layers||[]){const e=s+n.id;if(l.push(e),t.getLayer(e))continue;const a={...n,id:e};"source"in a&&"string"==typeof a.source&&(a.source=s+a.source),a.layout||(a.layout={}),a.layout.visibility=r?"visible":"none";try{t.addLayer(a,y)}catch(g){}}c.current[e]=l,n.current[e]=!0},[]),l=r.useCallback((t,e,r)=>{const a=c.current[e],o=r?"visible":"none";for(const s of a)if(t.getLayer(s))try{t.setLayoutProperty(s,"visibility",o)}catch{}},[]),y=r.useCallback(t=>{var e;const r=((null==(e=t.getStyle())?void 0:e.layers)||[]).filter(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-"));for(const a of r)try{t.moveLayer(a.id)}catch{}},[]);return r.useEffect(()=>{if(!o)return;let e=!1;const r=async()=>{if(!e)try{await Promise.all([i(o,"light","light"===t),i(o,"dark","dark"===t)]),e||y(o)}catch(r){}};o.isStyleLoaded()?r():(o.once("style.load",r),o.once("load",()=>{e||n.current.light||r()}));const a=()=>{e||setTimeout(()=>{!e&&n.current.light&&n.current.dark&&y(o)},100)};return o.on("styledata",a),()=>{e=!0,o.off("styledata",a)}},[o,i,y,t]),r.useEffect(()=>{o&&n.current.light&&n.current.dark&&(l(o,"light","light"===t),l(o,"dark","dark"===t))},[o,t,l]),null}export{y as B,l as a,i as u};
diff --git a/frontend/dist/assets/BasemapLayer-D6Rvk89s.js b/frontend/dist/assets/BasemapLayer-D6Rvk89s.js
new file mode 100644
index 00000000..0f1f087a
--- /dev/null
+++ b/frontend/dist/assets/BasemapLayer-D6Rvk89s.js
@@ -0,0 +1 @@
+import{i as t,bR as e,r}from"./vendor-react-LAbPDfrQ.js";const a="pymc-basemap-mode",o="dark";function s(){if("undefined"==typeof window)return o;try{const t=localStorage.getItem(a);if("light"===t||"dark"===t)return t}catch{}return o}function n(t){if("undefined"!=typeof window)try{localStorage.setItem(a,t)}catch{}}const c=t(t=>({mode:s(),toggle:()=>t(t=>{const e="light"===t.mode?"dark":"light";return n(e),{mode:e}}),setMode:e=>{n(e),t({mode:e})}})),i=()=>c(t=>t.mode),l=()=>c(t=>t.toggle),u={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},d={light:"basemap-light-",dark:"basemap-dark-"},f={};function y({mode:t}){const{current:a}=e(),[o,s]=r.useState(null),n=r.useRef({light:!1,dark:!1}),c=r.useRef({light:[],dark:[]});r.useEffect(()=>{const t=()=>{var t;const e=null==(t=null==a?void 0:a.getMap)?void 0:t.call(a);e&&!o&&s(e)};t();const e=setInterval(t,50),r=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(r)}},[a,o]);const i=r.useCallback(async(t,e,r)=>{var a,o;if(n.current[e])return;const s=d[e],i=await async function(t){if(f[t])return f[t];const e=await fetch(u[t]),r=await e.json();return f[t]=r,r}(e),l=[];for(const[n,c]of Object.entries(i.sources||{})){const e=s+n;t.getSource(e)||t.addSource(e,c)}const y=null==(o=((null==(a=t.getStyle())?void 0:a.layers)||[]).find(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-")))?void 0:o.id;for(const n of i.layers||[]){const e=s+n.id;if(l.push(e),t.getLayer(e))continue;const a={...n,id:e};"source"in a&&"string"==typeof a.source&&(a.source=s+a.source),a.layout||(a.layout={}),a.layout.visibility=r?"visible":"none";try{t.addLayer(a,y)}catch(g){}}c.current[e]=l,n.current[e]=!0},[]),l=r.useCallback((t,e,r)=>{const a=c.current[e],o=r?"visible":"none";for(const s of a)if(t.getLayer(s))try{t.setLayoutProperty(s,"visibility",o)}catch{}},[]),y=r.useCallback(t=>{var e;const r=((null==(e=t.getStyle())?void 0:e.layers)||[]).filter(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-"));for(const a of r)try{t.moveLayer(a.id)}catch{}},[]);return r.useEffect(()=>{if(!o)return;let e=!1;const r=async()=>{if(!e)try{await Promise.all([i(o,"light","light"===t),i(o,"dark","dark"===t)]),e||y(o)}catch(r){}};o.isStyleLoaded()?r():(o.once("style.load",r),o.once("load",()=>{e||n.current.light||r()}));const a=()=>{e||setTimeout(()=>{!e&&n.current.light&&n.current.dark&&y(o)},100)};return o.on("styledata",a),()=>{e=!0,o.off("styledata",a)}},[o,i,y,t]),r.useEffect(()=>{o&&n.current.light&&n.current.dark&&(l(o,"light","light"===t),l(o,"dark","dark"===t))},[o,t,l]),null}export{y as B,l as a,i as u};
diff --git a/frontend/dist/assets/Card-G6bVQsoG.js b/frontend/dist/assets/Card-DecEDgdl.js
similarity index 92%
rename from frontend/dist/assets/Card-G6bVQsoG.js
rename to frontend/dist/assets/Card-DecEDgdl.js
index 38009c6c..a061246d 100644
--- a/frontend/dist/assets/Card-G6bVQsoG.js
+++ b/frontend/dist/assets/Card-DecEDgdl.js
@@ -1 +1 @@
-import{j as e}from"./vendor-react-DWFolw7W.js";import{c as s}from"./recharts-BfwfJFmd.js";import{B as t}from"./index-Bqom4285.js";function l({title:l,icon:r,badge:i,subtitle:a,actions:c,iconColor:n="text-icon-card-title",largeTitle:x=!1,listHeader:m=!1,stackActionsOnMobile:d=!1}){return d&&c?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),c&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]})}function r({children:t,centered:l,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",l&&"flex items-center justify-center",r),children:t})}export{l as C,r as a};
+import{j as e}from"./vendor-react-LAbPDfrQ.js";import{c as s}from"./recharts-D38YBQhj.js";import{B as t}from"./index-DSST4Vwq.js";function l({title:l,icon:r,badge:i,subtitle:a,actions:c,iconColor:n="text-icon-card-title",largeTitle:x=!1,listHeader:m=!1,stackActionsOnMobile:d=!1}){return d&&c?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),c&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]})}function r({children:t,centered:l,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",l&&"flex items-center justify-center",r),children:t})}export{l as C,r as a};
diff --git a/frontend/dist/assets/CollisionExplorerModal-B1RIpIqW.js b/frontend/dist/assets/CollisionExplorerModal-B1RIpIqW.js
new file mode 100644
index 00000000..4910cd6f
--- /dev/null
+++ b/frontend/dist/assets/CollisionExplorerModal-B1RIpIqW.js
@@ -0,0 +1 @@
+import{r as e,b as t,j as o,as as s,X as n,aq as r,bh as a,aR as l,aS as i,aT as c,ag as d,ai as u}from"./vendor-react-LAbPDfrQ.js";import{L as m}from"./leaflet-D_ckmI2R.js";import{c as h}from"./recharts-D38YBQhj.js";import{c as x,H as p,d as f}from"./index-DSST4Vwq.js";const y={DEFAULT:"#4338CA",AMBER:"#F59E0B",NEIGHBOR:"#39D98A",MUTED:"#6B7280",HIGHLIGHT:"#FBBF24"};function b(){if("undefined"==typeof document)return y;const e=document.documentElement,t=getComputedStyle(e);return{DEFAULT:t.getPropertyValue("--map-hub-color").trim()||y.DEFAULT,AMBER:t.getPropertyValue("--pkt-txt-msg").trim()||y.AMBER,NEIGHBOR:t.getPropertyValue("--accent-success").trim()||y.NEIGHBOR,MUTED:t.getPropertyValue("--text-muted").trim()||y.MUTED,HIGHLIGHT:t.getPropertyValue("--accent-secondary").trim()||y.HIGHLIGHT}}function v({hash:t,highlighted:s}){const[n,r]=e.useState(!1),a=e.useCallback(e=>{e.preventDefault(),e.stopPropagation(),function(e){if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const t=window.scrollX,o=window.scrollY,s=document.createElement("textarea");s.value=e,s.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",s.setAttribute("readonly",""),document.body.appendChild(s),s.focus({preventScroll:!0}),s.select(),s.setSelectionRange(0,e.length);const n=document.execCommand("copy");return document.body.removeChild(s),window.scrollTo(t,o),n}catch{return!1}}(t),r(!0),setTimeout(()=>r(!1),2e3)},[t]),l=t.length>12?`${t.slice(0,12)}…`:t;return o.jsxs("button",{type:"button",onClick:a,className:h("inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-mono rounded transition-all","border border-border-subtle hover:border-border-strong cursor-pointer select-none",s?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${t}`,children:[o.jsx("span",{className:h("transition-colors",n?"text-accent-success":"text-text-secondary"),children:l}),n?o.jsx(d,{className:"w-2.5 h-2.5 text-accent-success"}):o.jsx(u,{className:"w-2.5 h-2.5 opacity-40"})]})}function g({node:e,className:t}){const s=b(),n=e.contactType.toLowerCase(),r="room server"===n||"room_server"===n||"room"===n||"server"===n,d="companion"===n||"client"===n||"cli"===n;return r&&e.isRepeater?o.jsxs("div",{className:h("relative",t),children:[o.jsx(a,{className:"w-full h-full",style:{color:s.AMBER}}),o.jsx(l,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:s.DEFAULT}})]}):r?o.jsx(a,{className:t,style:{color:s.AMBER}}):d?o.jsx(i,{className:h(t,"text-text-secondary")}):e.isRepeater?e.isNeighbor?o.jsx(c,{className:t,style:{color:s.NEIGHBOR}}):o.jsx(l,{className:t,style:{color:s.DEFAULT}}):o.jsx(i,{className:h(t,"text-text-secondary")})}function w({node:e,isHovered:t,onMouseEnter:s,onMouseLeave:n,onTouchStart:r}){return o.jsxs("div",{className:h("flex items-center gap-3 px-3 py-2.5 transition-colors rounded-lg",t?"bg-accent-secondary/10":"hover:bg-white/[0.03]"),onMouseEnter:s,onMouseLeave:n,onTouchStart:r,children:[o.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:o.jsx(g,{node:e,className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-accent-success/20 text-accent-success",children:"NBR"}),e.isRepeater&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-secondary font-medium",children:"RPT"})]}),o.jsx("div",{className:"mt-1",children:o.jsx(v,{hash:e.hash,highlighted:t})})]})]})}function N({nodes:t,hoveredHash:s,onNodeHover:n,onNodeLeave:a}){const l=e.useRef(null),i=e.useRef(null),c=e.useRef(new Map),d=e.useMemo(()=>t.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[t]);return e.useEffect(()=>{if(!i.current||l.current)return;const e=m.map(i.current,{zoomControl:!0,attributionControl:!0});return m.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),l.current=e,()=>{e.remove(),l.current=null}},[]),e.useEffect(()=>{const e=l.current;if(!e)return;if(c.current.forEach(e=>e.remove()),c.current.clear(),0===d.length)return;const t=m.latLngBounds([]);for(const o of d){if(!o.latitude||!o.longitude)continue;const s=m.latLng(o.latitude,o.longitude);t.extend(s);const r=b(),l=o.isNeighbor?r.NEIGHBOR:r.DEFAULT,i=m.circleMarker(s,{radius:8,fillColor:l,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});i.bindTooltip(o.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),i.on("mouseover",()=>n(o.hash)),i.on("mouseout",()=>a()),i.addTo(e),c.current.set(o.hash,i)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,n,a]),e.useEffect(()=>{c.current.forEach((e,t)=>{const o=d.find(e=>e.hash===t);if(!o)return;const n=b(),r=t===s,a=o.isNeighbor?n.NEIGHBOR:n.DEFAULT;e.setStyle({radius:r?12:8,fillColor:r?n.HIGHLIGHT:a,weight:r?3:2}),r?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[s,d]),0===d.length?o.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:o.jsxs("div",{className:"text-center text-text-secondary p-4",children:[o.jsx(r,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),o.jsx("p",{className:"text-sm",children:"No location data available"}),o.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):o.jsx("div",{ref:i,className:"h-full w-full rounded-lg overflow-hidden"})}const j=e.memo(function({isOpen:r,prefix:a,candidateHashes:l,onClose:i}){const c=x(),d=p(),u=f(),[m,y]=e.useState(null),b=e.useMemo(()=>new Set(u.map(e=>e.hash)),[u]),v=null==c?void 0:c.neighbors,g=e.useMemo(()=>v?l.map(e=>{var t,o;const s=v[e];return{hash:e,name:(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==s?void 0:s.contact_type)||"",isRepeater:(null==s?void 0:s.is_repeater)||"repeater"===(null==(t=null==s?void 0:s.contact_type)?void 0:t.toLowerCase())||"rep"===(null==(o=null==s?void 0:s.contact_type)?void 0:o.toLowerCase())||!1,isNeighbor:b.has(e),isHub:d.has(e),latitude:null==s?void 0:s.latitude,longitude:null==s?void 0:s.longitude,lastSeen:null==s?void 0:s.last_seen}}).sort((e,t)=>e.isNeighbor!==t.isNeighbor?e.isNeighbor?-1:1:e.name.localeCompare(t.name)):[],[l,v,b,d]),j=e.useCallback(e=>y(e),[]),E=e.useCallback(()=>y(null),[]);return e.useEffect(()=>{if(!r)return;const e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);const t=window.scrollY,o={overflow:document.body.style.overflow,position:document.body.style.position,width:document.body.style.width,top:document.body.style.top};return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${t}px`,()=>{window.removeEventListener("keydown",e),document.body.style.overflow=o.overflow,document.body.style.position=o.position,document.body.style.width=o.width,document.body.style.top=o.top,window.scrollTo(0,t)}},[r,i]),r?t.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:i,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:o.jsxs("div",{className:h("glass-card-elevated w-full flex flex-col","max-h-[85vh] rounded-t-2xl rounded-b-none","sm:max-w-2xl sm:mx-4 sm:rounded-xl sm:max-h-[80vh]","pb-safe"),onClick:e=>e.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:o.jsx(s,{className:"w-5 h-5 text-signal-fair"})}),o.jsxs("div",{children:[o.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",o.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),o.jsxs("p",{className:"text-xs text-text-secondary",children:[g.length," nodes share this prefix"]})]})]}),o.jsx("button",{onClick:i,className:"p-2 rounded-lg text-text-secondary hover:text-text-primary hover:bg-bg-subtle transition-colors",children:o.jsx(n,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:o.jsx("div",{className:"p-2",children:g.map(e=>o.jsx(w,{node:e,isHovered:m===e.hash,onMouseEnter:()=>j(e.hash),onMouseLeave:E,onTouchStart:()=>j(e.hash)},e.hash))})}),o.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:o.jsx(N,{nodes:g,hoveredHash:m,onNodeHover:j,onNodeLeave:E})})]})]})}),document.body):null});export{j as C};
diff --git a/frontend/dist/assets/CollisionExplorerModal-DIUOoEai.js b/frontend/dist/assets/CollisionExplorerModal-DIUOoEai.js
deleted file mode 100644
index f647b7e1..00000000
--- a/frontend/dist/assets/CollisionExplorerModal-DIUOoEai.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as e,b as t,j as o,ar as s,X as n,ap as r,bf as a,aP as l,aQ as i,aR as c,af as d,ah as u}from"./vendor-react-DWFolw7W.js";import{L as m}from"./leaflet-D_ckmI2R.js";import{c as h}from"./recharts-BfwfJFmd.js";import{c as x,H as p,f}from"./index-Bqom4285.js";const y={DEFAULT:"#4338CA",AMBER:"#F59E0B",NEIGHBOR:"#39D98A",MUTED:"#6B7280",HIGHLIGHT:"#FBBF24"};function b(){if("undefined"==typeof document)return y;const e=document.documentElement,t=getComputedStyle(e);return{DEFAULT:t.getPropertyValue("--map-hub-color").trim()||y.DEFAULT,AMBER:t.getPropertyValue("--pkt-txt-msg").trim()||y.AMBER,NEIGHBOR:t.getPropertyValue("--accent-success").trim()||y.NEIGHBOR,MUTED:t.getPropertyValue("--text-muted").trim()||y.MUTED,HIGHLIGHT:t.getPropertyValue("--accent-secondary").trim()||y.HIGHLIGHT}}function v({hash:t,highlighted:s}){const[n,r]=e.useState(!1),a=e.useCallback(e=>{e.preventDefault(),e.stopPropagation(),function(e){if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const t=window.scrollX,o=window.scrollY,s=document.createElement("textarea");s.value=e,s.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",s.setAttribute("readonly",""),document.body.appendChild(s),s.focus({preventScroll:!0}),s.select(),s.setSelectionRange(0,e.length);const n=document.execCommand("copy");return document.body.removeChild(s),window.scrollTo(t,o),n}catch{return!1}}(t),r(!0),setTimeout(()=>r(!1),2e3)},[t]),l=t.length>12?`${t.slice(0,12)}…`:t;return o.jsxs("button",{type:"button",onClick:a,className:h("inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-mono rounded transition-all","border border-border-subtle hover:border-border-strong cursor-pointer select-none",s?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${t}`,children:[o.jsx("span",{className:h("transition-colors",n?"text-accent-success":"text-text-secondary"),children:l}),n?o.jsx(d,{className:"w-2.5 h-2.5 text-accent-success"}):o.jsx(u,{className:"w-2.5 h-2.5 opacity-40"})]})}function g({node:e,className:t}){const s=b(),n=e.contactType.toLowerCase(),r="room server"===n||"room_server"===n||"room"===n||"server"===n,d="companion"===n||"client"===n||"cli"===n;return r&&e.isRepeater?o.jsxs("div",{className:h("relative",t),children:[o.jsx(a,{className:"w-full h-full",style:{color:s.AMBER}}),o.jsx(l,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:s.DEFAULT}})]}):r?o.jsx(a,{className:t,style:{color:s.AMBER}}):d?o.jsx(i,{className:h(t,"text-text-secondary")}):e.isRepeater?e.isNeighbor?o.jsx(c,{className:t,style:{color:s.NEIGHBOR}}):o.jsx(l,{className:t,style:{color:s.DEFAULT}}):o.jsx(i,{className:h(t,"text-text-secondary")})}function w({node:e,isHovered:t,onMouseEnter:s,onMouseLeave:n,onTouchStart:r}){return o.jsxs("div",{className:h("flex items-center gap-3 px-3 py-2.5 transition-colors rounded-lg",t?"bg-accent-secondary/10":"hover:bg-white/[0.03]"),onMouseEnter:s,onMouseLeave:n,onTouchStart:r,children:[o.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:o.jsx(g,{node:e,className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-accent-success/20 text-accent-success",children:"NBR"}),e.isRepeater&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-secondary font-medium",children:"RPT"})]}),o.jsx("div",{className:"mt-1",children:o.jsx(v,{hash:e.hash,highlighted:t})})]})]})}function N({nodes:t,hoveredHash:s,onNodeHover:n,onNodeLeave:a}){const l=e.useRef(null),i=e.useRef(null),c=e.useRef(new Map),d=e.useMemo(()=>t.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[t]);return e.useEffect(()=>{if(!i.current||l.current)return;const e=m.map(i.current,{zoomControl:!0,attributionControl:!0});return m.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),l.current=e,()=>{e.remove(),l.current=null}},[]),e.useEffect(()=>{const e=l.current;if(!e)return;if(c.current.forEach(e=>e.remove()),c.current.clear(),0===d.length)return;const t=m.latLngBounds([]);for(const o of d){if(!o.latitude||!o.longitude)continue;const s=m.latLng(o.latitude,o.longitude);t.extend(s);const r=b(),l=o.isNeighbor?r.NEIGHBOR:r.DEFAULT,i=m.circleMarker(s,{radius:8,fillColor:l,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});i.bindTooltip(o.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),i.on("mouseover",()=>n(o.hash)),i.on("mouseout",()=>a()),i.addTo(e),c.current.set(o.hash,i)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,n,a]),e.useEffect(()=>{c.current.forEach((e,t)=>{const o=d.find(e=>e.hash===t);if(!o)return;const n=b(),r=t===s,a=o.isNeighbor?n.NEIGHBOR:n.DEFAULT;e.setStyle({radius:r?12:8,fillColor:r?n.HIGHLIGHT:a,weight:r?3:2}),r?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[s,d]),0===d.length?o.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:o.jsxs("div",{className:"text-center text-text-secondary p-4",children:[o.jsx(r,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),o.jsx("p",{className:"text-sm",children:"No location data available"}),o.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):o.jsx("div",{ref:i,className:"h-full w-full rounded-lg overflow-hidden"})}const j=e.memo(function({isOpen:r,prefix:a,candidateHashes:l,onClose:i}){const c=x(),d=p(),u=f(),[m,y]=e.useState(null),b=e.useMemo(()=>new Set(u.map(e=>e.hash)),[u]),v=null==c?void 0:c.neighbors,g=e.useMemo(()=>v?l.map(e=>{var t,o;const s=v[e];return{hash:e,name:(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==s?void 0:s.contact_type)||"",isRepeater:(null==s?void 0:s.is_repeater)||"repeater"===(null==(t=null==s?void 0:s.contact_type)?void 0:t.toLowerCase())||"rep"===(null==(o=null==s?void 0:s.contact_type)?void 0:o.toLowerCase())||!1,isNeighbor:b.has(e),isHub:d.has(e),latitude:null==s?void 0:s.latitude,longitude:null==s?void 0:s.longitude,lastSeen:null==s?void 0:s.last_seen}}).sort((e,t)=>e.isNeighbor!==t.isNeighbor?e.isNeighbor?-1:1:e.name.localeCompare(t.name)):[],[l,v,b,d]),j=e.useCallback(e=>y(e),[]),E=e.useCallback(()=>y(null),[]);return e.useEffect(()=>{if(!r)return;const e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);const t=window.scrollY,o={overflow:document.body.style.overflow,position:document.body.style.position,width:document.body.style.width,top:document.body.style.top};return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${t}px`,()=>{window.removeEventListener("keydown",e),document.body.style.overflow=o.overflow,document.body.style.position=o.position,document.body.style.width=o.width,document.body.style.top=o.top,window.scrollTo(0,t)}},[r,i]),r?t.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:i,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:o.jsxs("div",{className:h("glass-card-elevated w-full flex flex-col","max-h-[85vh] rounded-t-2xl rounded-b-none","sm:max-w-2xl sm:mx-4 sm:rounded-xl sm:max-h-[80vh]","pb-safe"),onClick:e=>e.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:o.jsx(s,{className:"w-5 h-5 text-signal-fair"})}),o.jsxs("div",{children:[o.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",o.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),o.jsxs("p",{className:"text-xs text-text-secondary",children:[g.length," nodes share this prefix"]})]})]}),o.jsx("button",{onClick:i,className:"p-2 rounded-lg text-text-secondary hover:text-text-primary hover:bg-bg-subtle transition-colors",children:o.jsx(n,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:o.jsx("div",{className:"p-2",children:g.map(e=>o.jsx(w,{node:e,isHovered:m===e.hash,onMouseEnter:()=>j(e.hash),onMouseLeave:E,onTouchStart:()=>j(e.hash)},e.hash))})}),o.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:o.jsx(N,{nodes:g,hoveredHash:m,onNodeHover:j,onNodeLeave:E})})]})]})}),document.body):null});export{j as C};
diff --git a/frontend/dist/assets/Configuration-B4Cl-Ydc.js b/frontend/dist/assets/Configuration-B4Cl-Ydc.js
deleted file mode 100644
index 6730ef51..00000000
--- a/frontend/dist/assets/Configuration-B4Cl-Ydc.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as e,j as t,bl as s,aU as a,X as r,ao as l,af as n,bm as c,b9 as i,p as o,B as d,bn as u,C as m,E as x,bo as p,aG as b,bp as h,bq as g,br as y,bs as f,ax as j,bt as v,ar as N,ak as w,ah as k,an as C,bu as S}from"./vendor-react-DWFolw7W.js";import{c as _}from"./recharts-BfwfJFmd.js";import{au as T,a8 as F,av as E,aw as L,ax as P,X as R,ay as D,az as M,as as A}from"./index-Bqom4285.js";import{C as I}from"./ConfirmModal-eh_HUzgW.js";import{l as z}from"./font-loader-jlbdh9Fw.js";import{N as O}from"./NodeInformationCard-Dog0xCnl.js";import{a as K,P as q,b as H}from"./PageLayout-Ddo-4Uor.js";import{C as $}from"./Card-G6bVQsoG.js";import{R as Y,C as U}from"./Grid-DaxbQBT5.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./dialog-BxW5aXUD.js";import"./DataBox-DmFkSY6u.js";async function V(e){return T("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const B=e.memo(function(){const{theme:e}=F(),{colorScheme:s}=e,a=E.find(e=>e.colorScheme===s)??E[0],r=a.displaySize,l=`clamp(${.8*r}rem, ${.6*r}rem + 1.5vw, ${1.4*r}rem)`;return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsxs("span",{className:"font-medium transition-all duration-300 leading-none text-center",style:{fontFamily:a.displayFont,color:a.displayColor,fontSize:l,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:["Theme: ",a.displayName]})})}),X=e.memo(function(){const{theme:s,setThemePreset:a,setBrightness:r}=F(),{colorScheme:l,brightness:n}=s,[c,i]=e.useState(!1),[o,d]=e.useState(!1),u=e.useRef(null),m=e.useRef(null),x=(E.find(e=>e.colorScheme===l)??E[0]).id,p=e.useCallback((e,t)=>{if(!m.current)return n;const s=(m.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,m.current.brightness+s)))},[n]),b=e.useCallback(e=>{a(e),i(!0)},[a]),h=e.useCallback(e=>{r(e)},[r]),g=e.useCallback(e=>{const t=E.find(t=>t.id===e);t&&L(t.backgroundImage)},[]);return t.jsx("div",{className:"grid grid-cols-4 gap-[3%] w-full",children:E.map(e=>{const s=x===e.id,a=!e.backgroundImage,r=s&&!a&&(c||o);return t.jsxs("div",{ref:s?u:void 0,title:e.displayName,className:_("flex flex-col items-stretch rounded-sm transition-all duration-300 ease-out overflow-hidden",s?"ring-2 ring-accent-primary scale-105 "+(a?"cursor-pointer":"cursor-ns-resize"):"cursor-pointer"),onMouseEnter:()=>{s&&!a?i(!0):s||g(e.id)},onMouseLeave:()=>!o&&i(!1),onClick:()=>!s&&b(e.id),onTouchStart:e=>{if(!s||a)return;e.preventDefault();const t=e.touches[0];m.current={y:t.clientY,brightness:n},d(!0),i(!0);const r=e=>{e.preventDefault();const t=e.touches[0];h(p(t.clientY,!0))},l=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",l),m.current=null,d(!1),setTimeout(()=>i(!1),1500)};document.addEventListener("touchmove",r,{passive:!1}),document.addEventListener("touchend",l)},onMouseDown:e=>{if(!s||a)return;e.preventDefault(),m.current={y:e.clientY,brightness:n},d(!0),i(!0);const t=e=>{h(p(e.clientY,!1))},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),m.current=null,d(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},children:[t.jsxs("div",{className:"glass-thumbnail w-full aspect-square sm:aspect-[4/3] lg:aspect-video relative !rounded-b-none",children:["kde breeze"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#242627]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#58b99d] text-[1.5em] font-bold font-mono",children:">"})}):"ribbon"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#F5F5F5]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#2D2D2D] text-[1.5em] font-bold font-mono",children:"R"})}):t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:r?.4:1,filter:"brightness(var(--thumbnail-brightness, 1.5))"}}),s&&t.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",r?"opacity-100":"opacity-0"),children:[t.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-n+"%"}}),t.jsx("div",{className:"absolute inset-x-[8%] h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-n+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[0.6em] font-mono font-bold text-white drop-shadow-lg",children:[n,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex",children:e.map((e,s)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),G=e.memo(function({layout:s="horizontal"}){return e.useEffect(()=>{z()},[]),"logo-only"===s?t.jsx(B,{}):"thumbnails-only"===s?t.jsx(X,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(B,{}),t.jsx(X,{})]})});function J(){const{latitude:o,longitude:d,enabled:u,setLocation:m,enable:x,disable:p,clear:b}=P(),[h,g]=e.useState(!1),[y,f]=e.useState(""),[j,v]=e.useState(""),[N,w]=e.useState("idle"),[k,C]=e.useState(null),S=e.useRef(null),T=e.useRef(null),F=e.useRef(!0);e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const E=()=>{g(!1),C(null)};e.useEffect(()=>{if(!h)return;const e=e=>{"loading"!==N&&S.current&&!S.current.contains(e.target)&&E()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[h,N]);const L=null!==o&&null!==d;return t.jsx(K,{children:t.jsxs("div",{ref:S,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx($,{icon:t.jsx(s,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[L&&!h&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{u?p():x()},className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",u?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:u?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",u?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{b(),g(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(a,{className:"w-4 h-4"})})]}),h?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:E,disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===N)return;T.current&&clearTimeout(T.current);const e=((e,t)=>{const s=parseFloat(e),a=parseFloat(t);return isNaN(s)||isNaN(a)?"Please enter valid numbers":s<-90||s>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===s&&0===a?"Coordinates (0, 0) are invalid":null})(y,j);if(e)return void C(e);w("loading"),C(null);const t=parseFloat(y),s=parseFloat(j);m(t,s),u||x(),w("success"),T.current=setTimeout(()=>{F.current&&(w("idle"),g(!1))},1e3)},disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-accent-primary cursor-wait":"success"===N?"text-accent-success":"error"===N?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===N?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===N?t.jsx(n,{className:"w-4 h-4"}):"error"===N?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{f((null==o?void 0:o.toFixed(6))??""),v((null==d?void 0:d.toFixed(6))??""),C(null),g(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:L?"Edit stealth location":"Set stealth location",children:t.jsx(c,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(i,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),k&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:k}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:y,onChange:e=>f(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?o.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:j,onChange:e=>v(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?d.toFixed(6):"Not set"})})]})]}),L&&!h&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:_("w-2 h-2 rounded-full",u?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:u?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const W=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Q=[5,6,7,8,9,10,11,12],Z=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ee="radioConfig",te="repeaterSettings",se="operatingMode";function ae({node:e,level:s,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c}){const i=a.has(e.id),o=r===e.id,d=e.children&&e.children.length>0,u="allow"===l;return t.jsxs("div",{children:[t.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",o?"bg-accent-primary/15":"hover:bg-subtle-fill",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&n(e.id),children:[d?t.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(C,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",i&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(S,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:_("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),d&&i&&t.jsx("div",{children:e.children.map(e=>t.jsx(ae,{node:e,level:s+1,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c},e.id))})]})}function re(){var s,C,S,F,E,L;const{stats:P,setMode:z,clearModeMutation:B,setDutyCycleConfig:X,clearDutyCycleMutation:re,fetchStats:le,startMutation:ne,clearMutation:ce}=R(),ie=null==(s=null==P?void 0:P.config)?void 0:s.radio,oe=null==(C=null==P?void 0:P.config)?void 0:C.repeater,de=null==(S=null==P?void 0:P.config)?void 0:S.duty_cycle,ue=(null==P?void 0:P.node_name)||(null==(F=null==P?void 0:P.config)?void 0:F.node_name)||"Unknown Node",me=(null==oe?void 0:oe.mode)??"forward",xe=(null==de?void 0:de.enforcement_enabled)??!1,pe=null==(E=null==P?void 0:P.config)?void 0:E.delays,[be,he]=e.useState(!1),[ge,ye]=e.useState(""),[fe,je]=e.useState(62.5),[ve,Ne]=e.useState(7),[we,ke]=e.useState(5),[Ce,Se]=e.useState(""),[_e,Te]=e.useState("idle"),[Fe,Ee]=e.useState(null),Le=e.useRef(null),Pe=e.useRef(null),[Re,De]=e.useState(!1),[Me,Ae]=e.useState(""),[Ie,ze]=e.useState(""),[Oe,Ke]=e.useState(""),[qe,He]=e.useState("idle"),$e=e.useRef(null),Ye=e.useRef(null),[Ue,Ve]=e.useState(!1),[Be,Xe]=e.useState(""),[Ge,Je]=e.useState(""),[We,Qe]=e.useState(""),[Ze,et]=e.useState(""),[tt,st]=e.useState("idle"),[at,rt]=e.useState(null),lt=e.useRef(null),nt=e.useRef(null),[ct,it]=e.useState("idle"),[ot,dt]=e.useState("idle"),[ut,mt]=e.useState(null),[xt,pt]=e.useState(null),bt=e.useRef(!0),ht=e.useRef(null),gt=e.useRef(null),yt=e.useRef(null),ft=e.useRef(null),jt=e.useRef(!1),vt=e.useRef(!1);e.useEffect(()=>(bt.current=!0,()=>{bt.current=!1,ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Pe.current&&clearTimeout(Pe.current),$e.current&&clearTimeout($e.current),nt.current&&clearTimeout(nt.current)}),[]),e.useEffect(()=>{const e=e=>{if(be||Ue||Re)return e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to leave?",e.returnValue};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[be,Ue,Re]);const Nt=null==(L=null==P?void 0:P.config)?void 0:L.web,[wt,kt]=e.useState("idle"),[Ct,St]=e.useState(null),_t=e.useRef(null),Tt=e.useRef(null),Ft=e.useRef(!1),[Et,Lt]=e.useState([]),[Pt,Rt]=e.useState(!1),[Dt,Mt]=e.useState(null),[At,It]=e.useState(!1),[zt,Ot]=e.useState(""),[Kt,qt]=e.useState(null),[Ht,$t]=e.useState(!1),[Yt,Ut]=e.useState(null),[Vt,Bt]=e.useState(!1),[Xt,Gt]=e.useState(!1),[Jt,Wt]=e.useState(!1),[Qt,Zt]=e.useState([]),[es,ts]=e.useState(!1),[ss,as]=e.useState(null),[rs,ls]=e.useState("deny"),[ns,cs]=e.useState(!1),[is,os]=e.useState(null),[ds,us]=e.useState(new Set),[ms,xs]=e.useState(!1),[ps,bs]=e.useState(!1),[hs,gs]=e.useState(!1),[ys,fs]=e.useState(null),[js,vs]=e.useState(null),[Ns,ws]=e.useState(""),[ks,Cs]=e.useState("deny"),[Ss,_s]=e.useState(!1),[Ts,Fs]=e.useState(!0),[Es,Ls]=e.useState(!1),[Ps,Rs]=e.useState(!0),[Ds,Ms]=e.useState("idle"),[As,Is]=e.useState(!1),[zs,Os]=e.useState(!1),Ks=e.useRef(!1);e.useEffect(()=>{const e=be&&!Ks.current;Ks.current=be,ie&&e&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie,be]);const qs=e.useMemo(()=>{if(!ie||!be)return!1;const e=ie.frequency/1e6,t=ie.bandwidth/1e3,s=parseFloat(ge)||0;return Math.abs(s-e)>1e-4||fe!==t||ve!==ie.spreading_factor||we!==ie.coding_rate||parseInt(Ce)!==ie.tx_power},[ie,be,ge,fe,ve,we,Ce]),Hs=e.useCallback(()=>{he(!1),Ee(null),ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie]);e.useEffect(()=>{if(!be)return;const e=e=>{"loading"!==_e&&Le.current&&!Le.current.contains(e.target)&&Hs()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[be,Hs,_e]);const $s=e.useCallback(()=>{const e=null==pe?void 0:pe.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[pe]),Ys=e.useCallback(()=>{const e=null==pe?void 0:pe.direct_tx_delay_factor;return"number"==typeof e?e:.5},[pe]),Us=e.useCallback(()=>{const e=null==de?void 0:de.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[de]),Vs=e.useCallback(()=>{Ae($s().toFixed(2)),ze(Ys().toFixed(2)),Ke(Us().toFixed(1)),De(!0)},[$s,Ys,Us]),Bs=e.useCallback(()=>{De(!1)},[]);e.useEffect(()=>{if(!Re)return;const e=e=>{"loading"!==qe&&Ye.current&&!Ye.current.contains(e.target)&&Bs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Re,Bs,qe]);const Xs=e.useCallback(()=>{var e,t,s;Xe(ue),Je((null==(e=null==oe?void 0:oe.latitude)?void 0:e.toString())||"0"),Qe((null==(t=null==oe?void 0:oe.longitude)?void 0:t.toString())||"0"),et((null==(s=null==oe?void 0:oe.send_advert_interval_hours)?void 0:s.toString())||"0"),rt(null),Ve(!0)},[ue,oe]),Gs=e.useCallback(()=>{Ve(!1),rt(null)},[]);e.useEffect(()=>{if(!Ue)return;const e=e=>{"loading"!==tt&<.current&&!lt.current.contains(e.target)&&Gs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ue,Gs,tt]);const Js=async()=>{var e;if("loading"===wt)return;const t=(null==Nt?void 0:Nt.cors_enabled)??!1,s=!t,a=t;_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Ft.current=!1,St(s),kt("loading"),_t.current=setTimeout(()=>{Ft.current||bt.current&&(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))},1e4);try{const t=await V({web:{cors_enabled:s}});if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await le(),kt("success"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)):(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)}};e.useEffect(()=>{(async()=>{Rs(!0);try{const e=await async function(){return T("/api/check_pymc_console")}();e.success&&e.data?Ls(e.data.exists):Ls(!1);const t=null==Nt?void 0:Nt.web_path;Fs(!t||""===t)}catch{Ls(!1)}finally{Rs(!1)}})()},[null==Nt?void 0:Nt.web_path]);const Ws=async e=>{var t;if("loading"!==Ds){Ms("loading");try{const s=await V({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!bt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Fs(e),Ms("success"),Is(!0),setTimeout(()=>{bt.current&&Ms("idle")},2e3)):(Ms("error"),setTimeout(()=>{bt.current&&Ms("idle")},2e3))}catch{if(!bt.current)return;Ms("error"),setTimeout(()=>{bt.current&&Ms("idle")},2e3)}}},Qs=e.useCallback(async()=>{Rt(!0),Mt(null);try{const e=await async function(){return T("/auth/tokens")}();Lt(e.tokens||[])}catch(e){Mt(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Rt(!1)}},[]);e.useEffect(()=>{Qs()},[Qs]);const Zs=async()=>{if(zt.trim()){Bt(!0),Mt(null);try{const e=await async function(e){return T("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(zt.trim());qt(e.token||null),It(!1),$t(!0),Ot(""),await Qs()}catch(e){Mt(e instanceof Error?e.message:"Failed to create token")}finally{Bt(!1)}}else Mt("Token name is required")},ea=e=>e?new Date(1e3*e).toLocaleString():"Never",ta=e.useCallback(e=>{const t=new Map,s=[];return e.forEach(e=>{const s={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};t.set(e.id,s)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):s.push(e)}),s},[]),sa=e.useCallback(async()=>{ts(!0),as(null);try{const e=await async function(){return T("/api/transport_keys")}();e.success&&e.data?Zt(ta(e.data)):as(e.error||"Failed to load transport keys")}catch(e){as(e instanceof Error?e.message:"Unknown error occurred")}finally{ts(!1)}},[ta]);e.useEffect(()=>{sa()},[sa]);const aa=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=aa(s.children,t);if(e)return e}}return null},[]),ra=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);return null==e?void 0:e.name},[is,Qt,aa]),la=e.useCallback(e=>{us(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),na=async e=>{cs(!0),as(null);try{const t=await async function(e){return T("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:e})})}("allow"===e);t.success?ls(e):as(t.error||"Failed to update global flood policy")}catch(t){as(t instanceof Error?t.message:"Failed to update global flood policy")}finally{cs(!1)}},ca=async()=>{if(Ns.trim()){_s(!0),as(null);try{const e=await async function(e){return T("/api/transport_keys",{method:"POST",body:JSON.stringify(e)})}({name:Ns.trim(),flood_policy:ks,parent_id:is??void 0});e.success?(await sa(),xs(!1),ws(""),Cs("deny")):as(e.error||"Failed to add transport key")}catch(e){as(e instanceof Error?e.message:"Failed to add transport key")}finally{_s(!1)}}else as("Key name is required")},ia=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(fs({...e}),bs(!0))},[is,Qt,aa]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ms&&(xs(!1),ws(""),Cs("deny")),ps&&(bs(!1),fs(null)),hs&&(gs(!1),vs(null)),At&&(It(!1),Ot("")),Ht&&($t(!1),qt(null)))};if(ms||ps||hs||At||Ht)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ms,ps,hs,At,Ht]);const oa=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(vs(e),gs(!0))},[is,Qt,aa]);return t.jsxs(q,{children:[t.jsx(H,{title:"Configuration",icon:t.jsx(o,{})}),t.jsxs(Y,{template:"standard",children:[t.jsx(U,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:lt,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:oe&&(Ue?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Gs,disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==tt){nt.current&&clearTimeout(nt.current),ne(te),st("loading"),rt(null);try{const e={};Be&&Be!==ue&&(e.node_name=Be);const t=parseFloat(Ge);isNaN(t)||t===(null==oe?void 0:oe.latitude)||(e.latitude=t);const s=parseFloat(We);isNaN(s)||s===(null==oe?void 0:oe.longitude)||(e.longitude=s);const a=parseInt(Ze);if(isNaN(a)||a===(null==oe?void 0:oe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return rt({success:!0,message:"No changes to save"}),st("idle"),void ce(te);const r=await A(e);if(!bt.current)return void ce(te);if(r.success&&r.data){const e=r.data.applied.join(", ");rt({success:!0,message:`Updated: ${e}`}),await le({force:!0}),st("success"),nt.current=setTimeout(()=>{bt.current&&(st("idle"),Ve(!1),rt(null),ce(te))},1500)}else rt({success:!1,message:r.error||"Failed to save"}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}catch(e){if(!bt.current)return void ce(te);rt({success:!1,message:String(e)}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}}},disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-accent-primary cursor-wait":"success"===tt?"text-accent-success":"error"===tt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===tt?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===tt?t.jsx(n,{className:"w-4 h-4"}):"error"===tt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Xs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),at&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",at.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:at.message}),oe?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Ue?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ue?t.jsx("input",{type:"text",value:Be,onChange:e=>Xe(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):t.jsx("span",{className:"type-data text-text-primary",children:ue})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ue?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Ue?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ue?t.jsx("input",{type:"number",value:Ge,onChange:e=>Je(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.latitude?oe.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ue?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Ue?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ue?t.jsx("input",{type:"number",value:We,onChange:e=>Qe(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.longitude?oe.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ue?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Ue?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ue?t.jsx("input",{type:"number",value:Ze,onChange:e=>et(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:oe.send_advert_interval_hours>0?`${oe.send_advert_interval_hours}h`:"Disabled"})}),Ue&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsx("span",{className:"type-data text-text-primary",children:oe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(U,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Le,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(u,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:ie&&(be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Hs,disabled:"loading"===_e,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==_e){Pe.current&&clearTimeout(Pe.current),ne(ee),Te("loading"),Ee(null);try{const e={},t=parseFloat(ge),s=ie?ie.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=ie?ie.bandwidth/1e3:0;fe!==a&&(e.bandwidth_khz=fe),ve!==(null==ie?void 0:ie.spreading_factor)&&(e.spreading_factor=ve),we!==(null==ie?void 0:ie.coding_rate)&&(e.coding_rate=we);const r=parseInt(Ce);if(r!==(null==ie?void 0:ie.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Ee({success:!0,message:"No changes to save"}),Te("idle"),void ce(ee);const l=await A(e);if(!bt.current)return void ce(ee);if(l.success&&l.data){const e=l.data.applied.join(", "),t=l.data.live_update?" (applied live)":" (restart required)";Ee({success:!0,message:`Updated: ${e}${t}`}),await le({force:!0}),Te("success"),Pe.current=setTimeout(()=>{bt.current&&(Te("idle"),he(!1),Ee(null),ce(ee))},1500)}else Ee({success:!1,message:l.error||"Failed to save"}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}catch(e){if(!bt.current)return void ce(ee);Ee({success:!1,message:String(e)}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}}},disabled:"loading"===_e||!qs,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-accent-primary cursor-wait":"success"===_e?"text-accent-success":"error"===_e?"text-accent-danger":qs?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:qs?"Save changes":"No changes to save",children:"loading"===_e?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===_e?t.jsx(n,{className:"w-4 h-4"}):"error"===_e?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power))),Ee(null),he(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),Fe&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Fe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Fe.message}),ie?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:ge,onChange:e=>ye(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:D(ie.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:Ce,onChange:e=>Se(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsxs("span",{className:"type-data text-text-primary",children:[ie.tx_power," dBm"]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:fe,onChange:e=>je(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:W.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsx("span",{className:"type-data text-text-primary",children:M(ie.bandwidth)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:ve,onChange:e=>Ne(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Q.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["SF",ie.spreading_factor]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:we,onChange:e=>ke(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Z.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["4/",ie.coding_rate]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsxs("span",{className:"type-data text-text-primary",children:[ie.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(Y,{template:"standard",children:[t.jsx(U,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Ye,children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[t.jsx(x,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:Re?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==qe){$e.current&&clearTimeout($e.current),ne(se),He("loading");try{const e=await A({tx_delay_factor:parseFloat(Me),direct_tx_delay_factor:parseFloat(Ie)});if(await X({max_airtime_percent:parseFloat(Oe),enforcement_enabled:xe}),!bt.current)return void ce(se);e.success&&e.data?(await le({force:!0}),He("success"),$e.current=setTimeout(()=>{bt.current&&(He("idle"),De(!1),ce(se))},1500)):(He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3))}catch{if(!bt.current)return void ce(se);He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3)}}},disabled:"loading"===qe,className:_("p-2 rounded-lg transition-colors","loading"===qe?"text-accent-primary cursor-wait":"success"===qe?"text-accent-success":"error"===qe?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===qe?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===qe?t.jsx(n,{className:"w-4 h-4"}):"error"===qe?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})}),t.jsx("button",{onClick:Bs,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Vs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:t.jsx(c,{className:"w-4 h-4"})})})]}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==ut?ut:"forward"===me;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ct)return;const t=!e,s="forward"===me;ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),jt.current=!1,mt(t),it("loading"),ht.current=setTimeout(()=>{jt.current||bt.current&&(mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3))},1e4);try{if(await z(t?"forward":"monitor"),jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;it("success"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null),B())},2e3)}catch{if(jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3)}},disabled:"loading"===ct,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ct&&"opacity-70"),"aria-label":"Toggle forward mode",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ct&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ct&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ct&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==xt?xt:xe;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ot)return;const t=!e,s=xe;yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),vt.current=!1,pt(t),dt("loading"),yt.current=setTimeout(()=>{vt.current||bt.current&&(pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3))},1e4);try{if(await X({max_airtime_percent:Us(),enforcement_enabled:t}),vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;dt("success"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null),re())},2e3)}catch{if(vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3)}},disabled:"loading"===ot,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ot&&"opacity-70"),"aria-label":"Toggle duty cycle",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ot&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ot&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ot&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Oe,onChange:e=>Ke(e.target.value),step:"0.5",min:"0.1",max:"100",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Us().toFixed(1),"%"]})})]})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Me,onChange:e=>Ae(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[$s().toFixed(2),"x"]})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ie,onChange:e=>ze(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Ys().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(U,{span:12,md:6,children:t.jsxs(K,{children:[t.jsx($,{icon:t.jsx(o,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ct?Ct:(null==Nt?void 0:Nt.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Js,disabled:"loading"===wt,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===wt&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),"loading"===wt&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===wt&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===wt&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsx("div",{children:t.jsx(G,{})})]})]})})]}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(p,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>xs(!0),disabled:"allow"===rs,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(b,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ia,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:oa,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===rs?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===rs?t.jsx(h,{className:"w-5 h-5 text-accent-success"}):t.jsx(g,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>na("deny"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===rs?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>na("allow"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Allow"})]}),ns&&t.jsx(l,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ss&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ss}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 min-h-[120px]",children:es?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Qt.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(p,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Qt.map(e=>t.jsx(ae,{node:e,level:0,expandedKeys:ds,selectedKeyId:is,globalFloodPolicy:rs,onSelect:os,onToggle:la},e.id))})})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(y,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>It(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(b,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),Pt&&0===Et.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Et.length>0?t.jsx("div",{className:"space-y-2",children:Et.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong rounded-2xl p-4 transition-colors",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(y,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",ea(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ea(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Ut({id:e.id,name:e.name}),disabled:Xt,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(a,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(y,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>It(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(f,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ts,onChange:()=>Ws(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ts,onChange:()=>Ws(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ps&&t.jsx("div",{className:_("bg-subtle-fill rounded-2xl p-4",Es?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Es?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Es?t.jsx(j,{className:"w-4 h-4 text-accent-success"}):t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:Es?"PyMC Console has been detected":"PyMC Console Not Installed"}),Es?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(v,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),As&&t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(N,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!zs){Os(!0);try{await async function(){return T("/api/restart_service",{method:"POST",body:"{}"})}(),Is(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Is(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:zs,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:zs?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(w,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),P&&t.jsx(Y,{template:"auto",children:t.jsx(O,{nodeName:ue,repeaterVersion:P.version,coreVersion:P.core_version,localHash:P.local_hash,publicKey:P.public_key})}),P&&(0===(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.latitude))&&(0===(null==oe?void 0:oe.longitude)||!(null==oe?void 0:oe.longitude))&&t.jsx(Y,{template:"auto",children:t.jsx(J,{})}),At&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&It(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),t.jsx("input",{type:"text",value:zt,onChange:e=>Ot(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&Zs(),autoFocus:!0}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{It(!1),Ot(""),Mt(null)},disabled:Vt,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Zs,disabled:Vt||!zt.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Vt?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ht&&Kt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&$t(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{value:Kt,readOnly:!0,className:"flex-1 px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary font-mono text-sm"}),t.jsxs("button",{onClick:()=>{Kt&&(navigator.clipboard.writeText(Kt),Wt(!0),setTimeout(()=>Wt(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard",children:[Jt?t.jsx(n,{className:"w-4 h-4 text-accent-success"}):t.jsx(k,{className:"w-4 h-4"}),Jt?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',Kt.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{$t(!1),qt(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors",children:"Done"})})]})]})}),t.jsx(I,{isOpen:!!Yt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Yt?void 0:Yt.name}'? This action cannot be undone.`,confirmLabel:Xt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Yt){Gt(!0),Mt(null);try{await async function(e){return T(`/auth/tokens/${e}`,{method:"DELETE"})}(Yt.id),await Qs(),Ut(null)}catch(e){Mt(e instanceof Error?e.message:"Failed to revoke token")}finally{Gt(!1)}}},onCancel:()=>Ut(null)}),ms&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[is&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:ra()})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:Ns,onChange:e=>ws(e.target.value),placeholder:"e.g., Region Name, Group Key",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&ca(),autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>Cs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ks?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>Cs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ks?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{xs(!1),ws(""),Cs("deny")},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:ca,disabled:Ss||!Ns.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ps&&ys&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&bs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:ys.name,onChange:e=>fs({...ys,name:e.target.value}),className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ys.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ys.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),ys.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:ys.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{bs(!1),vs(ys),gs(!0),fs(null)},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{bs(!1),fs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(ys){_s(!0),as(null);try{const e=await async function(e,t){return T(`/api/transport_key/${e}`,{method:"PUT",body:JSON.stringify(t)})}(ys.id,{name:ys.name,flood_policy:ys.floodPolicy});e.success?(await sa(),bs(!1),fs(null)):as(e.error||"Failed to update transport key")}catch(e){as(e instanceof Error?e.message:"Failed to update transport key")}finally{_s(!1)}}},disabled:Ss||!ys.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&js&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&gs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",js.name,"'"]}),"?"]}),js.children&&js.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",js.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{gs(!1),vs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(js){_s(!0),as(null);try{const e=await async function(e){return T(`/api/transport_key/${e}`,{method:"DELETE"})}(js.id);e.success?(await sa(),gs(!1),vs(null),os(null)):as(e.error||"Failed to delete transport key")}catch(e){as(e instanceof Error?e.message:"Failed to delete transport key")}finally{_s(!1)}}},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default};
diff --git a/frontend/dist/assets/Configuration-BaSuNyZn.js b/frontend/dist/assets/Configuration-BaSuNyZn.js
new file mode 100644
index 00000000..1c3e0a23
--- /dev/null
+++ b/frontend/dist/assets/Configuration-BaSuNyZn.js
@@ -0,0 +1 @@
+import{r as e,j as t,bn as s,aW as a,X as r,ap as l,ag as n,bo as c,bb as i,p as o,B as d,bp as u,C as m,E as x,bq as p,aI as b,br as h,bs as g,bt as y,bu as f,ay as j,bv as v,as as N,al as w,ai as k,ao as C,bw as S}from"./vendor-react-LAbPDfrQ.js";import{c as _}from"./recharts-D38YBQhj.js";import{ay as T,ac as F,az as E,aA as L,aB as P,$ as R,aC as D,aD as A,aw as I}from"./index-DSST4Vwq.js";import{C as M}from"./ConfirmModal-Dq2G5qRN.js";import{l as z}from"./font-loader-jlbdh9Fw.js";import{N as O}from"./NodeInformationCard-CHXdu7Yi.js";import{a as K,P as q,b as H}from"./PageLayout-CPPEYuG6.js";import{C as $}from"./Card-DecEDgdl.js";import{R as Y,C as B}from"./Grid-B2Gaisvn.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./DataBox-ChCyaBc1.js";async function V(e){return T("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const U=e.memo(function(){const{theme:e}=F(),{colorScheme:s}=e,a=E.find(e=>e.colorScheme===s)??E[0],r=a.displaySize,l=`clamp(${.8*r}rem, ${.6*r}rem + 1.5vw, ${1.4*r}rem)`;return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsxs("span",{className:"font-medium transition-all duration-300 leading-none text-center",style:{fontFamily:a.displayFont,color:a.displayColor,fontSize:l,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:["Theme: ",a.displayName]})})}),X=e.memo(function(){const{theme:s,setThemePreset:a,setBrightness:r}=F(),{colorScheme:l,brightness:n}=s,[c,i]=e.useState(!1),[o,d]=e.useState(!1),u=e.useRef(null),m=e.useRef(null),x=(E.find(e=>e.colorScheme===l)??E[0]).id,p=e.useCallback((e,t)=>{if(!m.current)return n;const s=(m.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,m.current.brightness+s)))},[n]),b=e.useCallback(e=>{a(e),i(!0)},[a]),h=e.useCallback(e=>{r(e)},[r]),g=e.useCallback(e=>{const t=E.find(t=>t.id===e);t&&L(t.backgroundImage)},[]);return t.jsx("div",{className:"grid grid-cols-4 gap-[3%] w-full",children:E.map(e=>{const s=x===e.id,a=!e.backgroundImage,r=s&&!a&&(c||o);return t.jsxs("div",{ref:s?u:void 0,title:e.displayName,className:_("flex flex-col items-stretch rounded-sm transition-all duration-300 ease-out overflow-hidden",s?"ring-2 ring-accent-primary scale-105 "+(a?"cursor-pointer":"cursor-ns-resize"):"cursor-pointer"),onMouseEnter:()=>{s&&!a?i(!0):s||g(e.id)},onMouseLeave:()=>!o&&i(!1),onClick:()=>!s&&b(e.id),onTouchStart:e=>{if(!s||a)return;e.preventDefault();const t=e.touches[0];m.current={y:t.clientY,brightness:n},d(!0),i(!0);const r=e=>{e.preventDefault();const t=e.touches[0];h(p(t.clientY,!0))},l=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",l),m.current=null,d(!1),setTimeout(()=>i(!1),1500)};document.addEventListener("touchmove",r,{passive:!1}),document.addEventListener("touchend",l)},onMouseDown:e=>{if(!s||a)return;e.preventDefault(),m.current={y:e.clientY,brightness:n},d(!0),i(!0);const t=e=>{h(p(e.clientY,!1))},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),m.current=null,d(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},children:[t.jsxs("div",{className:"glass-thumbnail w-full aspect-square sm:aspect-[4/3] lg:aspect-video relative !rounded-b-none",children:["kde breeze"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#242627]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#58b99d] text-[1.5em] font-bold font-mono",children:">"})}):"ribbon"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#F5F5F5]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#2D2D2D] text-[1.5em] font-bold font-mono",children:"R"})}):t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:r?.4:1,filter:"brightness(var(--thumbnail-brightness, 1.5))"}}),s&&t.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",r?"opacity-100":"opacity-0"),children:[t.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-n+"%"}}),t.jsx("div",{className:"absolute inset-x-[8%] h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-n+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[0.6em] font-mono font-bold text-white drop-shadow-lg",children:[n,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex",children:e.map((e,s)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),J=e.memo(function({layout:s="horizontal"}){return e.useEffect(()=>{z()},[]),"logo-only"===s?t.jsx(U,{}):"thumbnails-only"===s?t.jsx(X,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(U,{}),t.jsx(X,{})]})});function W(){const{latitude:o,longitude:d,enabled:u,setLocation:m,enable:x,disable:p,clear:b}=P(),[h,g]=e.useState(!1),[y,f]=e.useState(""),[j,v]=e.useState(""),[N,w]=e.useState("idle"),[k,C]=e.useState(null),S=e.useRef(null),T=e.useRef(null),F=e.useRef(!0);e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const E=()=>{g(!1),C(null)};e.useEffect(()=>{if(!h)return;const e=e=>{"loading"!==N&&S.current&&!S.current.contains(e.target)&&E()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[h,N]);const L=null!==o&&null!==d;return t.jsx(K,{children:t.jsxs("div",{ref:S,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx($,{icon:t.jsx(s,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[L&&!h&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{u?p():x()},className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",u?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:u?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",u?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{b(),g(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(a,{className:"w-4 h-4"})})]}),h?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:E,disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===N)return;T.current&&clearTimeout(T.current);const e=((e,t)=>{const s=parseFloat(e),a=parseFloat(t);return isNaN(s)||isNaN(a)?"Please enter valid numbers":s<-90||s>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===s&&0===a?"Coordinates (0, 0) are invalid":null})(y,j);if(e)return void C(e);w("loading"),C(null);const t=parseFloat(y),s=parseFloat(j);m(t,s),u||x(),w("success"),T.current=setTimeout(()=>{F.current&&(w("idle"),g(!1))},1e3)},disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-accent-primary cursor-wait":"success"===N?"text-accent-success":"error"===N?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===N?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===N?t.jsx(n,{className:"w-4 h-4"}):"error"===N?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{f((null==o?void 0:o.toFixed(6))??""),v((null==d?void 0:d.toFixed(6))??""),C(null),g(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:L?"Edit stealth location":"Set stealth location",children:t.jsx(c,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(i,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),k&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:k}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:y,onChange:e=>f(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?o.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:j,onChange:e=>v(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?d.toFixed(6):"Not set"})})]})]}),L&&!h&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:_("w-2 h-2 rounded-full",u?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:u?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const G=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Q=[5,6,7,8,9,10,11,12],Z=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ee="radioConfig",te="repeaterSettings",se="operatingMode";function ae({node:e,level:s,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c}){const i=a.has(e.id),o=r===e.id,d=e.children&&e.children.length>0,u="allow"===l;return t.jsxs("div",{children:[t.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",o?"bg-accent-primary/15":"hover:bg-subtle-fill",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&n(e.id),children:[d?t.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(C,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",i&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(S,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:_("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),d&&i&&t.jsx("div",{children:e.children.map(e=>t.jsx(ae,{node:e,level:s+1,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c},e.id))})]})}function re(){var s,C,S,F,E,L;const{stats:P,setMode:z,clearModeMutation:U,setDutyCycleConfig:X,clearDutyCycleMutation:re,fetchStats:le,startMutation:ne,clearMutation:ce}=R(),ie=null==(s=null==P?void 0:P.config)?void 0:s.radio,oe=null==(C=null==P?void 0:P.config)?void 0:C.repeater,de=null==(S=null==P?void 0:P.config)?void 0:S.duty_cycle,ue=(null==P?void 0:P.node_name)||(null==(F=null==P?void 0:P.config)?void 0:F.node_name)||"Unknown Node",me=(null==oe?void 0:oe.mode)??"forward",xe=(null==de?void 0:de.enforcement_enabled)??!1,pe=null==(E=null==P?void 0:P.config)?void 0:E.delays,[be,he]=e.useState(!1),[ge,ye]=e.useState(""),[fe,je]=e.useState(62.5),[ve,Ne]=e.useState(7),[we,ke]=e.useState(5),[Ce,Se]=e.useState(""),[_e,Te]=e.useState("idle"),[Fe,Ee]=e.useState(null),Le=e.useRef(null),Pe=e.useRef(null),[Re,De]=e.useState(!1),[Ae,Ie]=e.useState(""),[Me,ze]=e.useState(""),[Oe,Ke]=e.useState(""),[qe,He]=e.useState("idle"),$e=e.useRef(null),Ye=e.useRef(null),[Be,Ve]=e.useState(!1),[Ue,Xe]=e.useState(""),[Je,We]=e.useState(""),[Ge,Qe]=e.useState(""),[Ze,et]=e.useState(""),[tt,st]=e.useState("idle"),[at,rt]=e.useState(null),lt=e.useRef(null),nt=e.useRef(null),[ct,it]=e.useState("idle"),[ot,dt]=e.useState("idle"),[ut,mt]=e.useState(null),[xt,pt]=e.useState(null),bt=e.useRef(!0),ht=e.useRef(null),gt=e.useRef(null),yt=e.useRef(null),ft=e.useRef(null),jt=e.useRef(!1),vt=e.useRef(!1);e.useEffect(()=>(bt.current=!0,()=>{bt.current=!1,ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Pe.current&&clearTimeout(Pe.current),$e.current&&clearTimeout($e.current),nt.current&&clearTimeout(nt.current)}),[]),e.useEffect(()=>{const e=e=>{if(be||Be||Re)return e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to leave?",e.returnValue};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[be,Be,Re]);const Nt=null==(L=null==P?void 0:P.config)?void 0:L.web,[wt,kt]=e.useState("idle"),[Ct,St]=e.useState(null),_t=e.useRef(null),Tt=e.useRef(null),Ft=e.useRef(!1),[Et,Lt]=e.useState([]),[Pt,Rt]=e.useState(!1),[Dt,At]=e.useState(null),[It,Mt]=e.useState(!1),[zt,Ot]=e.useState(""),[Kt,qt]=e.useState(null),[Ht,$t]=e.useState(!1),[Yt,Bt]=e.useState(null),[Vt,Ut]=e.useState(!1),[Xt,Jt]=e.useState(!1),[Wt,Gt]=e.useState(!1),[Qt,Zt]=e.useState([]),[es,ts]=e.useState(!1),[ss,as]=e.useState(null),[rs,ls]=e.useState("deny"),[ns,cs]=e.useState(!1),[is,os]=e.useState(null),[ds,us]=e.useState(new Set),[ms,xs]=e.useState(!1),[ps,bs]=e.useState(!1),[hs,gs]=e.useState(!1),[ys,fs]=e.useState(null),[js,vs]=e.useState(null),[Ns,ws]=e.useState(""),[ks,Cs]=e.useState("deny"),[Ss,_s]=e.useState(!1),[Ts,Fs]=e.useState(!0),[Es,Ls]=e.useState(!1),[Ps,Rs]=e.useState(!0),[Ds,As]=e.useState("idle"),[Is,Ms]=e.useState(!1),[zs,Os]=e.useState(!1),Ks=e.useRef(!1);e.useEffect(()=>{const e=be&&!Ks.current;Ks.current=be,ie&&e&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie,be]);const qs=e.useMemo(()=>{if(!ie||!be)return!1;const e=ie.frequency/1e6,t=ie.bandwidth/1e3,s=parseFloat(ge)||0;return Math.abs(s-e)>1e-4||fe!==t||ve!==ie.spreading_factor||we!==ie.coding_rate||parseInt(Ce)!==ie.tx_power},[ie,be,ge,fe,ve,we,Ce]),Hs=e.useCallback(()=>{he(!1),Ee(null),ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie]);e.useEffect(()=>{if(!be)return;const e=e=>{"loading"!==_e&&Le.current&&!Le.current.contains(e.target)&&Hs()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[be,Hs,_e]);const $s=e.useCallback(()=>{const e=null==pe?void 0:pe.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[pe]),Ys=e.useCallback(()=>{const e=null==pe?void 0:pe.direct_tx_delay_factor;return"number"==typeof e?e:.5},[pe]),Bs=e.useCallback(()=>{const e=null==de?void 0:de.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[de]),Vs=e.useCallback(()=>{Ie($s().toFixed(2)),ze(Ys().toFixed(2)),Ke(Bs().toFixed(1)),De(!0)},[$s,Ys,Bs]),Us=e.useCallback(()=>{De(!1)},[]);e.useEffect(()=>{if(!Re)return;const e=e=>{"loading"!==qe&&Ye.current&&!Ye.current.contains(e.target)&&Us()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Re,Us,qe]);const Xs=e.useCallback(()=>{var e,t,s;Xe(ue),We((null==(e=null==oe?void 0:oe.latitude)?void 0:e.toString())||"0"),Qe((null==(t=null==oe?void 0:oe.longitude)?void 0:t.toString())||"0"),et((null==(s=null==oe?void 0:oe.send_advert_interval_hours)?void 0:s.toString())||"0"),rt(null),Ve(!0)},[ue,oe]),Js=e.useCallback(()=>{Ve(!1),rt(null)},[]);e.useEffect(()=>{if(!Be)return;const e=e=>{"loading"!==tt&<.current&&!lt.current.contains(e.target)&&Js()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Be,Js,tt]);const Ws=async()=>{var e;if("loading"===wt)return;const t=(null==Nt?void 0:Nt.cors_enabled)??!1,s=!t,a=t;_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Ft.current=!1,St(s),kt("loading"),_t.current=setTimeout(()=>{Ft.current||bt.current&&(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))},1e4);try{const t=await V({web:{cors_enabled:s}});if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await le(),kt("success"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)):(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)}};e.useEffect(()=>{(async()=>{Rs(!0);try{const e=await async function(){return T("/api/check_pymc_console")}();e.success&&e.data?Ls(e.data.exists):Ls(!1);const t=null==Nt?void 0:Nt.web_path;Fs(!t||""===t)}catch{Ls(!1)}finally{Rs(!1)}})()},[null==Nt?void 0:Nt.web_path]);const Gs=async e=>{var t;if("loading"!==Ds){As("loading");try{const s=await V({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!bt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Fs(e),As("success"),Ms(!0),setTimeout(()=>{bt.current&&As("idle")},2e3)):(As("error"),setTimeout(()=>{bt.current&&As("idle")},2e3))}catch{if(!bt.current)return;As("error"),setTimeout(()=>{bt.current&&As("idle")},2e3)}}},Qs=e.useCallback(async()=>{Rt(!0),At(null);try{const e=await async function(){return T("/auth/tokens")}();Lt(e.tokens||[])}catch(e){At(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Rt(!1)}},[]);e.useEffect(()=>{Qs()},[Qs]);const Zs=async()=>{if(zt.trim()){Ut(!0),At(null);try{const e=await async function(e){return T("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(zt.trim());qt(e.token||null),Mt(!1),$t(!0),Ot(""),await Qs()}catch(e){At(e instanceof Error?e.message:"Failed to create token")}finally{Ut(!1)}}else At("Token name is required")},ea=e=>e?new Date(1e3*e).toLocaleString():"Never",ta=e.useCallback(e=>{const t=new Map,s=[];return e.forEach(e=>{const s={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};t.set(e.id,s)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):s.push(e)}),s},[]),sa=e.useCallback(async()=>{ts(!0),as(null);try{const e=await async function(){return T("/api/transport_keys")}();e.success&&e.data?Zt(ta(e.data)):as(e.error||"Failed to load transport keys")}catch(e){as(e instanceof Error?e.message:"Unknown error occurred")}finally{ts(!1)}},[ta]);e.useEffect(()=>{sa()},[sa]);const aa=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=aa(s.children,t);if(e)return e}}return null},[]),ra=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);return null==e?void 0:e.name},[is,Qt,aa]),la=e.useCallback(e=>{us(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),na=async e=>{cs(!0),as(null);try{const t=await async function(e){return T("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:e})})}("allow"===e);t.success?ls(e):as(t.error||"Failed to update global flood policy")}catch(t){as(t instanceof Error?t.message:"Failed to update global flood policy")}finally{cs(!1)}},ca=async()=>{if(Ns.trim()){_s(!0),as(null);try{const e=await async function(e){return T("/api/transport_keys",{method:"POST",body:JSON.stringify(e)})}({name:Ns.trim(),flood_policy:ks,parent_id:is??void 0});e.success?(await sa(),xs(!1),ws(""),Cs("deny")):as(e.error||"Failed to add transport key")}catch(e){as(e instanceof Error?e.message:"Failed to add transport key")}finally{_s(!1)}}else as("Key name is required")},ia=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(fs({...e}),bs(!0))},[is,Qt,aa]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ms&&(xs(!1),ws(""),Cs("deny")),ps&&(bs(!1),fs(null)),hs&&(gs(!1),vs(null)),It&&(Mt(!1),Ot("")),Ht&&($t(!1),qt(null)))};if(ms||ps||hs||It||Ht)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ms,ps,hs,It,Ht]);const oa=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(vs(e),gs(!0))},[is,Qt,aa]);return t.jsxs(q,{children:[t.jsx(H,{title:"Configuration",icon:t.jsx(o,{})}),t.jsxs(Y,{template:"standard",children:[t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:lt,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:oe&&(Be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Js,disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==tt){nt.current&&clearTimeout(nt.current),ne(te),st("loading"),rt(null);try{const e={};Ue&&Ue!==ue&&(e.node_name=Ue);const t=parseFloat(Je);isNaN(t)||t===(null==oe?void 0:oe.latitude)||(e.latitude=t);const s=parseFloat(Ge);isNaN(s)||s===(null==oe?void 0:oe.longitude)||(e.longitude=s);const a=parseInt(Ze);if(isNaN(a)||a===(null==oe?void 0:oe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return rt({success:!0,message:"No changes to save"}),st("idle"),void ce(te);const r=await I(e);if(!bt.current)return void ce(te);if(r.success&&r.data){const e=r.data.applied.join(", ");rt({success:!0,message:`Updated: ${e}`}),await le({force:!0}),st("success"),nt.current=setTimeout(()=>{bt.current&&(st("idle"),Ve(!1),rt(null),ce(te))},1500)}else rt({success:!1,message:r.error||"Failed to save"}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}catch(e){if(!bt.current)return void ce(te);rt({success:!1,message:String(e)}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}}},disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-accent-primary cursor-wait":"success"===tt?"text-accent-success":"error"===tt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===tt?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===tt?t.jsx(n,{className:"w-4 h-4"}):"error"===tt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Xs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),at&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",at.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:at.message}),oe?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"text",value:Ue,onChange:e=>Xe(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):t.jsx("span",{className:"type-data text-text-primary",children:ue})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:Je,onChange:e=>We(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.latitude?oe.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:Ge,onChange:e=>Qe(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.longitude?oe.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:Ze,onChange:e=>et(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:oe.send_advert_interval_hours>0?`${oe.send_advert_interval_hours}h`:"Disabled"})}),Be&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsx("span",{className:"type-data text-text-primary",children:oe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Le,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(u,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:ie&&(be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Hs,disabled:"loading"===_e,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==_e){Pe.current&&clearTimeout(Pe.current),ne(ee),Te("loading"),Ee(null);try{const e={},t=parseFloat(ge),s=ie?ie.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=ie?ie.bandwidth/1e3:0;fe!==a&&(e.bandwidth_khz=fe),ve!==(null==ie?void 0:ie.spreading_factor)&&(e.spreading_factor=ve),we!==(null==ie?void 0:ie.coding_rate)&&(e.coding_rate=we);const r=parseInt(Ce);if(r!==(null==ie?void 0:ie.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Ee({success:!0,message:"No changes to save"}),Te("idle"),void ce(ee);const l=await I(e);if(!bt.current)return void ce(ee);if(l.success&&l.data){const e=l.data.applied.join(", "),t=l.data.live_update?" (applied live)":" (restart required)";Ee({success:!0,message:`Updated: ${e}${t}`}),await le({force:!0}),Te("success"),Pe.current=setTimeout(()=>{bt.current&&(Te("idle"),he(!1),Ee(null),ce(ee))},1500)}else Ee({success:!1,message:l.error||"Failed to save"}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}catch(e){if(!bt.current)return void ce(ee);Ee({success:!1,message:String(e)}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}}},disabled:"loading"===_e||!qs,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-accent-primary cursor-wait":"success"===_e?"text-accent-success":"error"===_e?"text-accent-danger":qs?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:qs?"Save changes":"No changes to save",children:"loading"===_e?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===_e?t.jsx(n,{className:"w-4 h-4"}):"error"===_e?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power))),Ee(null),he(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),Fe&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Fe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Fe.message}),ie?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:ge,onChange:e=>ye(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:D(ie.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:Ce,onChange:e=>Se(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsxs("span",{className:"type-data text-text-primary",children:[ie.tx_power," dBm"]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:fe,onChange:e=>je(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:G.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsx("span",{className:"type-data text-text-primary",children:A(ie.bandwidth)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:ve,onChange:e=>Ne(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Q.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["SF",ie.spreading_factor]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:we,onChange:e=>ke(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Z.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["4/",ie.coding_rate]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsxs("span",{className:"type-data text-text-primary",children:[ie.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(Y,{template:"standard",children:[t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Ye,children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[t.jsx(x,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:Re?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==qe){$e.current&&clearTimeout($e.current),ne(se),He("loading");try{const e=await I({tx_delay_factor:parseFloat(Ae),direct_tx_delay_factor:parseFloat(Me)});if(await X({max_airtime_percent:parseFloat(Oe),enforcement_enabled:xe}),!bt.current)return void ce(se);e.success&&e.data?(await le({force:!0}),He("success"),$e.current=setTimeout(()=>{bt.current&&(He("idle"),De(!1),ce(se))},1500)):(He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3))}catch{if(!bt.current)return void ce(se);He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3)}}},disabled:"loading"===qe,className:_("p-2 rounded-lg transition-colors","loading"===qe?"text-accent-primary cursor-wait":"success"===qe?"text-accent-success":"error"===qe?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===qe?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===qe?t.jsx(n,{className:"w-4 h-4"}):"error"===qe?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})}),t.jsx("button",{onClick:Us,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Vs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:t.jsx(c,{className:"w-4 h-4"})})})]}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==ut?ut:"forward"===me;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ct)return;const t=!e,s="forward"===me;ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),jt.current=!1,mt(t),it("loading"),ht.current=setTimeout(()=>{jt.current||bt.current&&(mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3))},1e4);try{if(await z(t?"forward":"monitor"),jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;it("success"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null),U())},2e3)}catch{if(jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3)}},disabled:"loading"===ct,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ct&&"opacity-70"),"aria-label":"Toggle forward mode",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ct&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ct&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ct&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==xt?xt:xe;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ot)return;const t=!e,s=xe;yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),vt.current=!1,pt(t),dt("loading"),yt.current=setTimeout(()=>{vt.current||bt.current&&(pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3))},1e4);try{if(await X({max_airtime_percent:Bs(),enforcement_enabled:t}),vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;dt("success"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null),re())},2e3)}catch{if(vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3)}},disabled:"loading"===ot,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ot&&"opacity-70"),"aria-label":"Toggle duty cycle",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ot&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ot&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ot&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Oe,onChange:e=>Ke(e.target.value),step:"0.5",min:"0.1",max:"100",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Bs().toFixed(1),"%"]})})]})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ae,onChange:e=>Ie(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[$s().toFixed(2),"x"]})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Me,onChange:e=>ze(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Ys().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(B,{span:12,md:6,children:t.jsxs(K,{children:[t.jsx($,{icon:t.jsx(o,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ct?Ct:(null==Nt?void 0:Nt.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Ws,disabled:"loading"===wt,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===wt&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),"loading"===wt&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===wt&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===wt&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsx("div",{children:t.jsx(J,{})})]})]})})]}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(p,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>xs(!0),disabled:"allow"===rs,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(b,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ia,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:oa,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===rs?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===rs?t.jsx(h,{className:"w-5 h-5 text-accent-success"}):t.jsx(g,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>na("deny"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===rs?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>na("allow"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Allow"})]}),ns&&t.jsx(l,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ss&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ss}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 min-h-[120px]",children:es?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Qt.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(p,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Qt.map(e=>t.jsx(ae,{node:e,level:0,expandedKeys:ds,selectedKeyId:is,globalFloodPolicy:rs,onSelect:os,onToggle:la},e.id))})})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(y,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>Mt(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(b,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),Pt&&0===Et.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Et.length>0?t.jsx("div",{className:"space-y-2",children:Et.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong rounded-2xl p-4 transition-colors",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(y,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",ea(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ea(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Bt({id:e.id,name:e.name}),disabled:Xt,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(a,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(y,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>Mt(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(f,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ts,onChange:()=>Gs(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ts,onChange:()=>Gs(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ps&&t.jsx("div",{className:_("bg-subtle-fill rounded-2xl p-4",Es?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Es?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Es?t.jsx(j,{className:"w-4 h-4 text-accent-success"}):t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:Es?"PyMC Console has been detected":"PyMC Console Not Installed"}),Es?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(v,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Is&&t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(N,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!zs){Os(!0);try{await async function(){return T("/api/restart_service",{method:"POST",body:"{}"})}(),Ms(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Ms(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:zs,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:zs?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(w,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),P&&t.jsx(Y,{template:"auto",children:t.jsx(O,{nodeName:ue,repeaterVersion:P.version,coreVersion:P.core_version,localHash:P.local_hash,publicKey:P.public_key})}),P&&(0===(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.latitude))&&(0===(null==oe?void 0:oe.longitude)||!(null==oe?void 0:oe.longitude))&&t.jsx(Y,{template:"auto",children:t.jsx(W,{})}),It&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Mt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),t.jsx("input",{type:"text",value:zt,onChange:e=>Ot(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&Zs(),autoFocus:!0}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{Mt(!1),Ot(""),At(null)},disabled:Vt,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Zs,disabled:Vt||!zt.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Vt?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ht&&Kt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&$t(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{value:Kt,readOnly:!0,className:"flex-1 px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary font-mono text-sm"}),t.jsxs("button",{onClick:()=>{Kt&&(navigator.clipboard.writeText(Kt),Gt(!0),setTimeout(()=>Gt(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard",children:[Wt?t.jsx(n,{className:"w-4 h-4 text-accent-success"}):t.jsx(k,{className:"w-4 h-4"}),Wt?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',Kt.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{$t(!1),qt(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors",children:"Done"})})]})]})}),t.jsx(M,{isOpen:!!Yt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Yt?void 0:Yt.name}'? This action cannot be undone.`,confirmLabel:Xt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Yt){Jt(!0),At(null);try{await async function(e){return T(`/auth/tokens/${e}`,{method:"DELETE"})}(Yt.id),await Qs(),Bt(null)}catch(e){At(e instanceof Error?e.message:"Failed to revoke token")}finally{Jt(!1)}}},onCancel:()=>Bt(null)}),ms&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[is&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:ra()})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:Ns,onChange:e=>ws(e.target.value),placeholder:"e.g., Region Name, Group Key",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&ca(),autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>Cs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ks?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>Cs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ks?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{xs(!1),ws(""),Cs("deny")},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:ca,disabled:Ss||!Ns.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ps&&ys&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&bs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:ys.name,onChange:e=>fs({...ys,name:e.target.value}),className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ys.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ys.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),ys.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:ys.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{bs(!1),vs(ys),gs(!0),fs(null)},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{bs(!1),fs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(ys){_s(!0),as(null);try{const e=await async function(e,t){return T(`/api/transport_key/${e}`,{method:"PUT",body:JSON.stringify(t)})}(ys.id,{name:ys.name,flood_policy:ys.floodPolicy});e.success?(await sa(),bs(!1),fs(null)):as(e.error||"Failed to update transport key")}catch(e){as(e instanceof Error?e.message:"Failed to update transport key")}finally{_s(!1)}}},disabled:Ss||!ys.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&js&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&gs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",js.name,"'"]}),"?"]}),js.children&&js.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",js.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{gs(!1),vs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(js){_s(!0),as(null);try{const e=await async function(e){return T(`/api/transport_key/${e}`,{method:"DELETE"})}(js.id);e.success?(await sa(),gs(!1),vs(null),os(null)):as(e.error||"Failed to delete transport key")}catch(e){as(e instanceof Error?e.message:"Failed to delete transport key")}finally{_s(!1)}}},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default};
diff --git a/frontend/dist/assets/ConfirmModal-Dq2G5qRN.js b/frontend/dist/assets/ConfirmModal-Dq2G5qRN.js
new file mode 100644
index 00000000..9379c7b4
--- /dev/null
+++ b/frontend/dist/assets/ConfirmModal-Dq2G5qRN.js
@@ -0,0 +1 @@
+import{r as e,j as t,as as n}from"./vendor-react-LAbPDfrQ.js";import{c as s}from"./recharts-D38YBQhj.js";import{K as r,aF as o,M as a,aG as c}from"./index-DSST4Vwq.js";const i={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:brightness-110 active:brightness-90"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:brightness-110 active:brightness-90 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:brightness-110 active:brightness-90 text-bg-body"}},l=e.memo(function({isOpen:e,title:l="Confirm",message:b,confirmLabel:d="Confirm",cancelLabel:m="Cancel",variant:x="default",onConfirm:g,onCancel:h}){const u=i[x];return t.jsxs(r,{open:e,onClose:h,size:"sm",children:[t.jsx(o,{icon:t.jsx(n,{className:s("w-5 h-5",u.icon)}),title:l,onClose:h}),t.jsx(a,{children:t.jsx("p",{className:"text-sm text-text-secondary",children:b})}),t.jsxs(c,{children:[t.jsx("button",{onClick:h,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:m}),t.jsx("button",{onClick:g,className:s("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:d})]})]})});export{l as C};
diff --git a/frontend/dist/assets/ConfirmModal-eh_HUzgW.js b/frontend/dist/assets/ConfirmModal-eh_HUzgW.js
deleted file mode 100644
index efe1aa8d..00000000
--- a/frontend/dist/assets/ConfirmModal-eh_HUzgW.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as e,j as t,ar as n}from"./vendor-react-DWFolw7W.js";import{c as s}from"./recharts-BfwfJFmd.js";import"./index-Bqom4285.js";import{D as r,b as o,a,c}from"./dialog-BxW5aXUD.js";const i={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:brightness-110 active:brightness-90"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:brightness-110 active:brightness-90 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:brightness-110 active:brightness-90 text-bg-body"}},l=e.memo(function({isOpen:e,title:l="Confirm",message:b,confirmLabel:d="Confirm",cancelLabel:m="Cancel",variant:x="default",onConfirm:g,onCancel:h}){const u=i[x];return t.jsxs(r,{open:e,onClose:h,size:"sm",children:[t.jsx(o,{icon:t.jsx(n,{className:s("w-5 h-5",u.icon)}),title:l,onClose:h}),t.jsx(a,{children:t.jsx("p",{className:"text-sm text-text-secondary",children:b})}),t.jsxs(c,{children:[t.jsx("button",{onClick:h,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:m}),t.jsx("button",{onClick:g,className:s("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:d})]})]})});export{l as C};
diff --git a/frontend/dist/assets/Contacts-5M0yF8mP.js b/frontend/dist/assets/Contacts-5M0yF8mP.js
deleted file mode 100644
index ab56de4b..00000000
--- a/frontend/dist/assets/Contacts-5M0yF8mP.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-DbKijMVr.js","assets/vendor-react-DWFolw7W.js","assets/vendor-core-WoOfkQwm.js","assets/link-scoring-CDPrlIBa.js","assets/index-Bqom4285.js","assets/ConfirmModal-eh_HUzgW.js","assets/dialog-BxW5aXUD.js","assets/useThemeColors-BvpMB3J1.js","assets/font-loader-jlbdh9Fw.js","assets/BasemapLayer-CVTB3HoG.js","assets/SignalIndicator-3iePFw_K.js","assets/ping-BNDHcn6h.js","assets/PageLayout-Ddo-4Uor.js","assets/DataBox-DmFkSY6u.js","assets/CollisionExplorerModal-DIUOoEai.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-BgEYE-li.css","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]);
-import{j as e,r as s,aD as t,ar as a,W as n,q as l,aE as c,C as i,aF as r,a5 as o,av as d,V as x,Y as m,aj as h,aG as p,aH as u,af as g,aq as j,ai as N,ap as b,aI as v,D as f,aJ as y,ax as w,a9 as C,aK as k,E as S,aL as M,X as L,aM as P,aN as H,aO as F,aP as E,aQ as R,aR as T,aS as $,ao as O,aT as _,aU as A}from"./vendor-react-DWFolw7W.js";import{N as D,O as W,J as G,Q as U,U as z,V as I,q as K,W as V,d as B,X as q,h as J,Y as Q,Z as Y,_ as X,f as Z,o as ee,$ as se,B as te,a0 as ae}from"./index-Bqom4285.js";import{p as ne}from"./ping-BNDHcn6h.js";import{P as le,b as ce}from"./PageLayout-Ddo-4Uor.js";import{_ as ie}from"./deckgl-DTsmDcfs.js";import{c as re,L as oe,T as de,a as xe}from"./recharts-BfwfJFmd.js";import{D as me}from"./DataBox-DmFkSY6u.js";import{C as he,a as pe}from"./SignalIndicator-3iePFw_K.js";import{C as ue}from"./CollisionExplorerModal-DIUOoEai.js";import{C as ge}from"./ConfirmModal-eh_HUzgW.js";class je extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-white/50 p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-white/30",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-white/20 mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const Ne=s.lazy(()=>ie(()=>import("./ContactsMapMapLibre-DbKijMVr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function be({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o}){return e.jsx(je,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(Ne,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o})})})}function ve(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function fe(e){return`${Math.round(100*e)}%`}function ye(e,s){return s.has(e.toUpperCase())}const we=s.memo(function({path:s,isHighlighted:t,onHighlight:c,ghostPrefixes:i}){const r=function(s){return s>.2?{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(n,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(m,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),h=s.weakestLinkKey&&s.weakestLinkConfidence<.5,p=s.hops.some(e=>ye(e,i));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>c(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(u=s.healthScore,u>=.7?"bg-accent-success/10":u>=.5?"bg-accent-secondary/10":u>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${ve(s.healthScore)}`,children:fe(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var n;const c=ye(t,i),r=h&&(null==(n=s.weakestLinkKey)?void 0:n.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(c?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":r?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[c&&e.jsx(l,{className:"w-2.5 h-2.5"}),t]}),anew Set(p.map(e=>e.prefix.toUpperCase())),[p]),N=s.useMemo(()=>m.slice(0,o),[m,o]),b=s.useMemo(()=>0===m.length?null:{avgHealth:m.reduce((e,s)=>e+s.healthScore,0)/m.length,declining:m.filter(e=>e.observationTrend<-.2).length,weakLinks:m.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:m.filter(e=>e.hops.some(e=>j.has(e.toUpperCase()))).length},[m,j]),v=e=>{null==d||d(e)};return 0===m.length?null:e.jsxs("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>g(!u),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(t,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",m.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[b&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${ve(b.avgHealth)}`,children:["Avg: ",fe(b.avgHealth)]}),b.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),b.weakLinks," weak"]}),b.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),b.declining," declining"]}),b.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),b.pathsWithGhosts," ghost"]})]}),u?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]})]}),u&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[h.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:h.totalPaths.toLocaleString()})," Viterbi decoded"]}),h.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(h.observationOverrideCount/h.totalPaths*100),"% observation override"]}),p.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),p.length," ghost",1!==p.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]}),p.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:N.map(s=>e.jsx(we,{path:s,isHighlighted:x===s.weakestLinkKey,onHighlight:v,ghostPrefixes:j},s.pathKey))}),m.length>o&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",o," of ",m.length," paths"]})]})]})});function ke(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Se={confirmed:{label:"Confirmed",icon:e.jsx(u,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(g,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(j,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(a,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function Me({ghost:t,neighbors:n,isExpanded:o,onToggle:x,compact:m}){var h,p;const u=(null==(h=t.classification)?void 0:h.tier)??"noise",g=Se[u],j="clusterId"in(w=t)&&"temporal"in w;var w;const C=s.useMemo(()=>Array.from(t.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=n[e])?void 0:s.name}}),[t.commonNeighbors,n]),k=t.estimatedLocation?t.estimatedLocation.uncertaintyM>=1e3?`±${(t.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(t.estimatedLocation.uncertaintyM)}m`:null,S=j&&t.temporal?(M=t.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:M>=.4?{label:"Regular",color:"text-accent-tertiary"}:M>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var M;const L=j&&t.collisionCandidates&&t.collisionCandidates.length>0,P=L?t.collisionCandidates[0]:null;return m?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:t.observationCount})]}):e.jsxs("div",{className:re("rounded-lg border transition-all duration-150",g.borderClass,g.bgClass),children:[e.jsxs("button",{onClick:x,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[e.jsx(l,{className:re("w-5 h-5 flex-shrink-0",g.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-text-primary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:re("px-1.5 py-0.5 rounded text-sm font-medium",g.badgeClass),children:g.label})]}),e.jsx("div",{className:re("text-sm mt-0.5",g.textClass),children:(null==(p=t.classification)?void 0:p.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3"}),t.observationCount]}),e.jsxs("span",{children:[(100*t.confidence).toFixed(0),"%"]}),t.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(b,{className:"w-3 h-3"}),k]}),S&&e.jsxs("span",{className:re("flex items-center gap-1",S.color),children:[e.jsx(d,{className:"w-3 h-3"}),S.label]}),L&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(v,{className:"w-3 h-3"}),"Collision?"]})]})]}),o?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]}),o&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[L&&P&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(v,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-text-secondary mt-0.5",children:P.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:P.knownNodeName})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(me,{copy:!0,size:"compact",className:"inline",children:P.knownNodeHash})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]})}),P.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[P.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[P.evidence.sharedEdgeCount," shared edges"]}),void 0!==P.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[P.evidence.distanceKm.toFixed(1),"km apart"]}),P.evidence.withinUncertainty&&e.jsx("span",{className:"text-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),t.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[t.estimatedLocation.lat.toFixed(5),", ",t.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",k]}),j&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",ke(t.location.method)]}),t.location.anchors&&t.location.anchors.length>0&&e.jsxs("div",{children:[t.location.anchors.length," anchor",1!==t.location.anchors.length?"s":""," used"," · ",(100*t.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[e.jsx(a,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),j&&t.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(d,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==S?void 0:S.color,children:null==S?void 0:S.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-muted",children:[e.jsxs("span",{children:["Distinct hours: ",t.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",t.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*t.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*t.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",t.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",t.temporal.activeHoursLast24,"/24"]})]})]})]}),!j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(f,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",U(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",U(t.lastSeen)," ago"]})]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(y,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",U(t.firstSeen)," – ",U(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),C.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",C.length," known node",1!==C.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[C.slice(0,5).map(({hash:s})=>e.jsx(me,{copy:!0,size:"compact",children:s},s)),C.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",C.length-5," more"]})]})]})]}),j&&t.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(Le,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(Le,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(Le,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(Le,{label:"Location",passed:t.validationStages.locationPlausible})]})]}),t.classification&&!j&&e.jsx("div",{className:"pt-2 border-t border-border-muted/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),t.classification.criteria.hasHighObservations&&!t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),t.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),t.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),t.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),t.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),j&&t.upgradeRequirements&&t.upgradeRequirements.length>0&&"confirmed"!==u&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-secondary space-y-0.5",children:t.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function Le({label:s,passed:t}){return e.jsxs("span",{className:re("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",t?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[t?e.jsx(w,{className:"w-2.5 h-2.5"}):e.jsx(C,{className:"w-2.5 h-2.5"}),s]})}function Pe({neighbors:t,className:n,onGhostSelect:r}){const o=G(),d=W(),[x,N]=s.useState(new Set),[b,v]=s.useState("actionable"),[f,y]=s.useState(!1),[w,C]=s.useState(!0),[k,S]=s.useState(Date.now);s.useEffect(()=>{S(Date.now())},[o]);const M=s.useMemo(()=>o.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,k)),[o,k]),L=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),P=s.useMemo(()=>L?M.find(e=>e.prefix===L)??null:null,[L,M]);s.useEffect(()=>{r&&r(P&&!w?{prefix:P.prefix,commonNeighbors:Array.from(P.commonNeighbors),estimatedLocation:P.estimatedLocation}:null)},[P,w,r]),s.useEffect(()=>{w&&N(new Set)},[w]);const{confirmed:H,likely:F,possible:E,noise:R,actionableCount:T}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const c of M)switch((null==(e=c.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(c);break;case"likely":t.push(c);break;case"possible":a.push(c);break;case"noise":n.push(c)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[M]);if(0===M.length)return null;const $=e=>{N(s=>s.has(e)?new Set:new Set([e]))},O="all"===b,_=H.length+F.length+(O?E.length:0)+(f?R.length:0);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(l,{className:"chart-title-icon"}),"Ghost Buster",T>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[T," actionable"]}),w&&M.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",M.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!w&&e.jsxs("button",{onClick:()=>v(e=>"actionable"===e?"all":"actionable"),className:re("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===b?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(h,{className:"w-3 h-3"}),"actionable"===b?"Actionable":"All"]}),e.jsx("button",{onClick:()=>C(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:w?"Expand panel":"Minimize panel",children:w?e.jsx(p,{className:"w-3 h-3"}):e.jsx(m,{className:"w-3 h-3"})})]})]}),w?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-white/5 transition-colors",onClick:()=>C(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[H.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(u,{className:"w-3 h-3"}),H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(g,{className:"w-3 h-3"}),F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]}),e.jsx("span",{className:"text-text-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[d.pathsWithGhosts.toLocaleString()," / ",d.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[H.length>0&&e.jsxs("span",{className:"text-accent-success",children:[H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[H.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-success",children:[e.jsx(u,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",H.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:H.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix))})]}),F.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-tertiary",children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",F.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:F.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix))})]}),O&&E.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-secondary",children:[e.jsx(j,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",E.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[E.slice(0,10).map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix)),E.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",E.length-10," more possible nodes"]})]})]}),R.length>0&&"all"===b&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[f?e.jsx(c,{className:"w-3.5 h-3.5"}):e.jsx(i,{className:"w-3.5 h-3.5"}),e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",R.length,")"]})]}),f&&e.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===b&&0===T&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(l,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[E.length+R.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>v("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",M.length," discovered nodes"]})]}),d.observationOverrideCount>0&&_>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:d.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*d.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const He="var(--sparkline-critical)",Fe="var(--sparkline-poor)",Ee="var(--sparkline-fair)",Re="var(--sparkline-good)",Te="var(--sparkline-excellent)";function $e({active:s,payload:t}){if(!s||!t||!t.length)return null;const a=t[0].payload,n=new Date(a.timestamp),l=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return e.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[e.jsx("span",{className:"text-text-muted",children:l}),e.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const Oe=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:i=""}){const r=z(s),o=I(),d=!K().backgroundLoadComplete||o,x=n??(r.length>0?function(e){if(0===e.length)return He;const s=e.slice(-4),t=s.reduce((e,s)=>e+s.count,0),a=t/s.length,n=e.reduce((e,s)=>e+s.count,0)/e.length;if(0===t)return He;if(n>0){const e=a/n;return e>=1.2?Te:e>=.8?Re:e>=.4?Ee:e>=.1?Fe:He}return t>=10?Te:t>=5?Re:t>=2?Ee:t>=1?Fe:He}(r):"var(--text-muted)"),m="number"==typeof t?t:60,h=a;return d&&r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h},children:e.jsx("div",{className:"rounded animate-pulse bg-white/[0.06]",style:{width:m-8,height:h-6}})}):r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h,color:He},children:e.jsx("svg",{width:m,height:h,viewBox:`0 0 ${m} ${h}`,preserveAspectRatio:"none",children:e.jsx("line",{x1:4,y1:h/2,x2:m-4,y2:h/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2"})})}):e.jsx("div",{className:i,style:{width:m,height:h},children:e.jsxs(oe,{data:r,width:m,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(de,{content:e.jsx($e,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(xe,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),_e=s.memo(function({hash:t,className:a="",size:n="sm"}){const l=V(),c=W(),[i,o]=s.useState(!1),d=s.useMemo(()=>B(t),[t]),x=s.useMemo(()=>d?l.find(e=>e.prefix===d)??null:null,[d,l]),m=c.totalPaths>0&&c.avgPathConfidence>=.7,h=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),p=s.useCallback(()=>{o(!1)},[]);if(!x)return null;const u="sm"===n?"w-3.5 h-3.5":"w-4 h-4",j=m?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",N=m?`Prefix conflict resolved by Viterbi HMM (${(100*c.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${x.candidateCount} nodes share prefix "${d}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:h,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${j} ${a}`,title:N,"aria-label":`View prefix conflict for ${d}${m?" (Viterbi resolved)":""}`,children:m?e.jsxs("span",{className:"relative",children:[e.jsx(r,{className:u}),e.jsx(g,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(k,{className:u})}),e.jsx(ue,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Ae(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const De=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=q(),a=J(),n=Q(),l=Y(),c=X(),r=Z(),o=G(),x=ee(),[m,h]=s.useState(null),[p,u]=s.useState("lastHeard"),[j,v]=s.useState("desc"),[y,w]=s.useState(""),[C,k]=s.useState(!1),[D,W]=s.useState(null),[U,z]=s.useState(null),[I,K]=s.useState(null),[V,B]=s.useState(null),[ie,re]=s.useState(new Map),[oe,de]=s.useState(new Map),[xe,ue]=s.useState(25),[je,Ne]=s.useState(25),ve=s.useRef(null),[fe,ye]=s.useState(!1),we=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),ke=s.useMemo(()=>Object.fromEntries(Object.entries(we).filter(([e])=>!a.has(e))),[we,a]),Se=se(),Me=null==t?void 0:t.local_hash,Le=s.useMemo(()=>{const e=new Map;if(!(null==Se?void 0:Se.latitude)||!(null==Se?void 0:Se.longitude))return e;for(const[s,t]of Object.entries(ke))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,Ae(Se.latitude,Se.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[ke,Se]),{neighborHashSet:He,neighborSignalMap:Fe}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of r)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[r]),Ee=s.useMemo(()=>{const e=y.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=C||s;return Object.fromEntries(Object.entries(ke).filter(([a,n])=>{if(t&&!He.has(a))return!1;if(s)return!0;if(!e)return!0;const l=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return l.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[ke,y,C,He]),Re=s.useMemo(()=>Object.entries(Ee).sort(([e,s],[t,a])=>{let n=0;switch(p){case"lastHeard":n=(s.last_seen||0)-(a.last_seen||0);break;case"distance":{const s=Le.get(e)??null,a=Le.get(t)??null;n=null===s&&null===a?0:null===s?1:null===a?-1:s-a;break}case"centrality":n=(c.get(e)||0)-(c.get(t)||0)}return"desc"===j?-n:n}),[Ee,p,j,Le,c]),Te=Re.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,$e=s.useMemo(()=>new Set(l),[l]),De=s.useMemo(()=>0===xe?Re:Re.slice(0,je),[Re,je,xe]);s.useEffect(()=>{Ne(xe||Re.length)},[p,j,y,C,xe,Re.length]),s.useEffect(()=>{if(0===xe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&jeMath.min(e+xe,Re.length))},{threshold:.1,rootMargin:"100px"});return ve.current&&e.observe(ve.current),()=>e.disconnect()},[xe,je,Re.length]);const We=s.useCallback(e=>{ue(e),Ne(e||Re.length),ye(!1)},[Re.length]),Ge=s.useCallback(e=>{p===e?v(e=>"desc"===e?"asc":"desc"):(u(e),v("desc"))},[p]),Ue=s.useCallback(e=>{const s=ke[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&W(e)},[ke]),ze=s.useCallback(()=>{W(null)},[]),Ie=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!V){B(e),re(s=>{const t=new Map(s);return t.delete(e),t}),de(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await ne(s,30);t.success&&t.data?(re(s=>new Map(s).set(e,t.data)),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(de(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";de(t=>new Map(t).set(e,s)),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{B(null)}}},[V]);return e.jsxs(le,{children:[e.jsx(ce,{title:"Contacts",icon:e.jsx(N,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Re.length," node",1!==Re.length?"s":""]}),Te>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(b,{className:"w-3.5 h-3.5 relative top-[2px]"}),Te," with location"]})]})}),x?e.jsx(be,{neighbors:ke,localNode:Se??void 0,localHash:Me,onRemoveNode:n,selectedNodeHash:D,onNodeSelected:ze,highlightedEdgeKey:U,highlightedGhost:I}):e.jsx("div",{className:"glass-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(Ce,{maxPaths:10,highlightedEdge:U,onHighlightEdge:z}),o.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Pe,{neighbors:ke,onGhostSelect:K})}):e.jsxs("div",{className:"glass-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(N,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[He.size>0&&e.jsxs("button",{onClick:()=>k(!C),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm rounded-lg transition-colors "+(C?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover:bg-white/5 border border-transparent"),title:C?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(S,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:He.size})]}),e.jsxs("div",{className:"relative",children:[e.jsx(M,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),e.jsx("input",{type:"text",name:"contact-search",id:"contact-search",autoComplete:"off",value:y,onChange:e=>w(e.target.value),placeholder:"Search...",className:"w-20 sm:w-28 lg:w-32 pl-6 sm:pl-7 pr-6 py-1.5 text-sm bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),y&&e.jsx("button",{onClick:()=>{w(""),"neighbor"!==y.toLowerCase().trim()&&"neighbors"!==y.toLowerCase().trim()||k(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:e.jsx(L,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>Ge("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("lastHeard"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[e.jsx(f,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("distance"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("centrality"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[e.jsx(d,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>ye(!fe),className:"flex items-center gap-1 px-2 py-1.5 text-sm text-text-muted hover:text-text-secondary hover:bg-white/5 rounded-lg transition-colors",title:"Items per page",children:[e.jsx("span",{className:"tabular-nums",children:0===xe?"All":xe}),e.jsx(i,{className:"w-3 h-3 transition-transform "+(fe?"rotate-180":"")})]}),fe&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg-surface border border-border-subtle rounded-lg shadow-lg py-1 min-w-[80px]",children:[25,50,100,0].map(s=>e.jsx("button",{onClick:()=>We(s),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-white/5 transition-colors "+(xe===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Re.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-border-subtle/30",children:De.map(([s,t])=>{var a;const n=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,l=t.node_name||t.name||"Unknown",i=$e.has(s),r=He.has(s),o=Le.get(s),x=c.get(s)||0,m=r?Fe.get(s):void 0,p=r&&m,u=null==(a=t.contact_type)?void 0:a.toLowerCase(),j="room server"===u||"room_server"===u||"room"===u||"server"===u,N="companion"===u,b="client"===u||"cli"===u,v=t.is_repeater||"repeater"===u||"rep"===u,f=r?"direct":"flood",y=r?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${i?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>Ue(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[p&&null!==(null==m?void 0:m.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(C=m.avgSnr,void 0===C?"bg-[var(--signal-unknown)]":C>=5?"bg-[var(--signal-excellent)]":C>=0?"bg-[var(--signal-good)]":C>=-5?"bg-[var(--signal-fair)]":C>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:y,children:j&&v?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(F,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(E,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):j?e.jsx(F,{className:"w-5 h-5 text-sys-pink"}):N?e.jsx(R,{className:"w-5 h-5 text-text-muted"}):v?"direct"===f?e.jsx(T,{className:"w-5 h-5 text-sys-green"}):e.jsx(E,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(R,{className:"w-5 h-5 text-text-muted"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:l,children:l}),r&&e.jsx(te,{color:he.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),i&&e.jsxs(te,{color:he.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx($,{className:"w-3 h-3"}),"HUB"]}),v&&e.jsx(te,{color:he.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),j&&e.jsx(te,{color:he.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),N&&e.jsx(te,{color:he.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),b&&e.jsx(te,{color:he.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(me,{copy:!0,size:"compact",children:s}),e.jsx(_e,{hash:s})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[p&&null!==(null==m?void 0:m.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(pe,{rssi:m.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(m.avgRssi)})]}),p&&null!==(null==m?void 0:m.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[m.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=o&&e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(w=o,w<1e3?`${Math.round(w)}m`:`${(w/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:x>0&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*x).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(Oe,{nodeHash:s,width:48,height:16})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?ae(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:ie.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${ie.get(s).rtt_ms.toFixed(0)}ms`,children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[ie.get(s).snr_db.toFixed(1),"dB"]})]}):oe.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:oe.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ie(s,e),disabled:null!==V,className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:V===s?e.jsx(O,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(_,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),h({hash:s,name:l})},className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove contact",children:e.jsx(A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var w,C})}),xe>0&&je0&&jeNe(e=>Math.min(e+xe,Re.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(N,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})}),e.jsx(ge,{isOpen:!!m,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==m?void 0:m.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{m&&n(m.hash),h(null)},onCancel:()=>h(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{De as C,Oe as N,_e as P};
diff --git a/frontend/dist/assets/Contacts-Dvei3J_b.js b/frontend/dist/assets/Contacts-Dvei3J_b.js
new file mode 100644
index 00000000..9bf80fd5
--- /dev/null
+++ b/frontend/dist/assets/Contacts-Dvei3J_b.js
@@ -0,0 +1,2 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-D6QmRhq9.js","assets/vendor-react-LAbPDfrQ.js","assets/vendor-core-WoOfkQwm.js","assets/link-scoring-BhW7zxO1.js","assets/index-DSST4Vwq.js","assets/ConfirmModal-Dq2G5qRN.js","assets/useThemeColors-BZADUK_r.js","assets/font-loader-jlbdh9Fw.js","assets/BasemapLayer-D6Rvk89s.js","assets/SignalIndicator-C8enCXLL.js","assets/ping-e_wiYAwc.js","assets/PageLayout-CPPEYuG6.js","assets/DataBox-ChCyaBc1.js","assets/CollisionExplorerModal-B1RIpIqW.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CAsRFGLe.css","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]);
+import{j as e,r as s,aF as t,as as a,Y as n,q as l,aG as c,C as i,aH as r,a6 as o,aw as d,W as x,Z as m,ak as h,aI as p,aJ as u,ag as g,ar as j,aj as N,aq as b,aK as v,D as f,aL as y,ay as w,aa as k,aM as C,E as S,aN as M,X as L,aO as P,aP as H,aQ as F,aR as E,aS as R,aT as T,aU as $,ap as _,aV as O,aW as A}from"./vendor-react-LAbPDfrQ.js";import{V as D,W,J as G,X as z,Y as I,Z as U,p as K,_ as V,k as B,$ as q,e as J,a0 as Y,a1 as Z,a2 as Q,d as X,n as ee,a3 as se,B as te,a4 as ae}from"./index-DSST4Vwq.js";import{p as ne}from"./ping-e_wiYAwc.js";import{P as le,b as ce}from"./PageLayout-CPPEYuG6.js";import{_ as ie}from"./deckgl-DTsmDcfs.js";import{c as re,L as oe,T as de,a as xe}from"./recharts-D38YBQhj.js";import{D as me}from"./DataBox-ChCyaBc1.js";import{C as he,a as pe}from"./SignalIndicator-C8enCXLL.js";import{C as ue}from"./CollisionExplorerModal-B1RIpIqW.js";import{C as ge}from"./ConfirmModal-Dq2G5qRN.js";class je extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-white/50 p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-white/30",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-white/20 mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const Ne=s.lazy(()=>ie(()=>import("./ContactsMapMapLibre-D6QmRhq9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function be({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o}){return e.jsx(je,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(Ne,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o})})})}function ve(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function fe(e){return`${Math.round(100*e)}%`}function ye(e,s){return s.has(e.toUpperCase())}const we=s.memo(function({path:s,isHighlighted:t,onHighlight:c,ghostPrefixes:i}){const r=function(s){return s>.2?{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(n,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(m,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),h=s.weakestLinkKey&&s.weakestLinkConfidence<.5,p=s.hops.some(e=>ye(e,i));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>c(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(u=s.healthScore,u>=.7?"bg-accent-success/10":u>=.5?"bg-accent-secondary/10":u>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${ve(s.healthScore)}`,children:fe(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var n;const c=ye(t,i),r=h&&(null==(n=s.weakestLinkKey)?void 0:n.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(c?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":r?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[c&&e.jsx(l,{className:"w-2.5 h-2.5"}),t]}),anew Set(p.map(e=>e.prefix.toUpperCase())),[p]),N=s.useMemo(()=>m.slice(0,o),[m,o]),b=s.useMemo(()=>0===m.length?null:{avgHealth:m.reduce((e,s)=>e+s.healthScore,0)/m.length,declining:m.filter(e=>e.observationTrend<-.2).length,weakLinks:m.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:m.filter(e=>e.hops.some(e=>j.has(e.toUpperCase()))).length},[m,j]),v=e=>{null==d||d(e)};return 0===m.length?null:e.jsxs("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>g(!u),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(t,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",m.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[b&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${ve(b.avgHealth)}`,children:["Avg: ",fe(b.avgHealth)]}),b.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),b.weakLinks," weak"]}),b.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),b.declining," declining"]}),b.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),b.pathsWithGhosts," ghost"]})]}),u?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]})]}),u&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[h.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:h.totalPaths.toLocaleString()})," Viterbi decoded"]}),h.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(h.observationOverrideCount/h.totalPaths*100),"% observation override"]}),p.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),p.length," ghost",1!==p.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]}),p.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:N.map(s=>e.jsx(we,{path:s,isHighlighted:x===s.weakestLinkKey,onHighlight:v,ghostPrefixes:j},s.pathKey))}),m.length>o&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",o," of ",m.length," paths"]})]})]})});function Ce(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Se={confirmed:{label:"Confirmed",icon:e.jsx(u,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(g,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(j,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(a,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function Me({ghost:t,neighbors:n,isExpanded:o,onToggle:x,compact:m}){var h,p;const u=(null==(h=t.classification)?void 0:h.tier)??"noise",g=Se[u],j="clusterId"in(w=t)&&"temporal"in w;var w;const k=s.useMemo(()=>Array.from(t.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=n[e])?void 0:s.name}}),[t.commonNeighbors,n]),C=t.estimatedLocation?t.estimatedLocation.uncertaintyM>=1e3?`±${(t.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(t.estimatedLocation.uncertaintyM)}m`:null,S=j&&t.temporal?(M=t.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:M>=.4?{label:"Regular",color:"text-accent-tertiary"}:M>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var M;const L=j&&t.collisionCandidates&&t.collisionCandidates.length>0,P=L?t.collisionCandidates[0]:null;return m?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:t.observationCount})]}):e.jsxs("div",{className:re("rounded-lg border transition-all duration-150",g.borderClass,g.bgClass),children:[e.jsxs("button",{onClick:x,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[e.jsx(l,{className:re("w-5 h-5 flex-shrink-0",g.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-text-primary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:re("px-1.5 py-0.5 rounded text-sm font-medium",g.badgeClass),children:g.label})]}),e.jsx("div",{className:re("text-sm mt-0.5",g.textClass),children:(null==(p=t.classification)?void 0:p.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3"}),t.observationCount]}),e.jsxs("span",{children:[(100*t.confidence).toFixed(0),"%"]}),t.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(b,{className:"w-3 h-3"}),C]}),S&&e.jsxs("span",{className:re("flex items-center gap-1",S.color),children:[e.jsx(d,{className:"w-3 h-3"}),S.label]}),L&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(v,{className:"w-3 h-3"}),"Collision?"]})]})]}),o?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]}),o&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[L&&P&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(v,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-text-secondary mt-0.5",children:P.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:P.knownNodeName})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(me,{copy:!0,size:"compact",className:"inline",children:P.knownNodeHash})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]})}),P.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[P.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[P.evidence.sharedEdgeCount," shared edges"]}),void 0!==P.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[P.evidence.distanceKm.toFixed(1),"km apart"]}),P.evidence.withinUncertainty&&e.jsx("span",{className:"text-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),t.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[t.estimatedLocation.lat.toFixed(5),", ",t.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",C]}),j&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",Ce(t.location.method)]}),t.location.anchors&&t.location.anchors.length>0&&e.jsxs("div",{children:[t.location.anchors.length," anchor",1!==t.location.anchors.length?"s":""," used"," · ",(100*t.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[e.jsx(a,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),j&&t.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(d,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==S?void 0:S.color,children:null==S?void 0:S.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-muted",children:[e.jsxs("span",{children:["Distinct hours: ",t.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",t.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*t.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*t.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",t.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",t.temporal.activeHoursLast24,"/24"]})]})]})]}),!j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(f,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",z(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",z(t.lastSeen)," ago"]})]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(y,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",z(t.firstSeen)," – ",z(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),k.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",k.length," known node",1!==k.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[k.slice(0,5).map(({hash:s})=>e.jsx(me,{copy:!0,size:"compact",children:s},s)),k.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",k.length-5," more"]})]})]})]}),j&&t.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(Le,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(Le,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(Le,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(Le,{label:"Location",passed:t.validationStages.locationPlausible})]})]}),t.classification&&!j&&e.jsx("div",{className:"pt-2 border-t border-border-muted/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),t.classification.criteria.hasHighObservations&&!t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),t.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),t.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),t.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),t.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),j&&t.upgradeRequirements&&t.upgradeRequirements.length>0&&"confirmed"!==u&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-secondary space-y-0.5",children:t.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function Le({label:s,passed:t}){return e.jsxs("span",{className:re("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",t?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[t?e.jsx(w,{className:"w-2.5 h-2.5"}):e.jsx(k,{className:"w-2.5 h-2.5"}),s]})}function Pe({neighbors:t,className:n,onGhostSelect:r}){const o=G(),d=W(),[x,N]=s.useState(new Set),[b,v]=s.useState("actionable"),[f,y]=s.useState(!1),[w,k]=s.useState(!0),[C,S]=s.useState(Date.now);s.useEffect(()=>{S(Date.now())},[o]);const M=s.useMemo(()=>o.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,C)),[o,C]),L=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),P=s.useMemo(()=>L?M.find(e=>e.prefix===L)??null:null,[L,M]);s.useEffect(()=>{r&&r(P&&!w?{prefix:P.prefix,commonNeighbors:Array.from(P.commonNeighbors),estimatedLocation:P.estimatedLocation}:null)},[P,w,r]),s.useEffect(()=>{w&&N(new Set)},[w]);const{confirmed:H,likely:F,possible:E,noise:R,actionableCount:T}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const c of M)switch((null==(e=c.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(c);break;case"likely":t.push(c);break;case"possible":a.push(c);break;case"noise":n.push(c)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[M]);if(0===M.length)return null;const $=e=>{N(s=>s.has(e)?new Set:new Set([e]))},_="all"===b,O=H.length+F.length+(_?E.length:0)+(f?R.length:0);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(l,{className:"chart-title-icon"}),"Ghost Buster",T>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[T," actionable"]}),w&&M.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",M.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!w&&e.jsxs("button",{onClick:()=>v(e=>"actionable"===e?"all":"actionable"),className:re("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===b?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(h,{className:"w-3 h-3"}),"actionable"===b?"Actionable":"All"]}),e.jsx("button",{onClick:()=>k(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:w?"Expand panel":"Minimize panel",children:w?e.jsx(p,{className:"w-3 h-3"}):e.jsx(m,{className:"w-3 h-3"})})]})]}),w?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-white/5 transition-colors",onClick:()=>k(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[H.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(u,{className:"w-3 h-3"}),H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(g,{className:"w-3 h-3"}),F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]}),e.jsx("span",{className:"text-text-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[d.pathsWithGhosts.toLocaleString()," / ",d.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[H.length>0&&e.jsxs("span",{className:"text-accent-success",children:[H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[H.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-success",children:[e.jsx(u,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",H.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:H.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix))})]}),F.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-tertiary",children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",F.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:F.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix))})]}),_&&E.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-secondary",children:[e.jsx(j,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",E.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[E.slice(0,10).map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>$(s.prefix)},s.prefix)),E.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",E.length-10," more possible nodes"]})]})]}),R.length>0&&"all"===b&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[f?e.jsx(c,{className:"w-3.5 h-3.5"}):e.jsx(i,{className:"w-3.5 h-3.5"}),e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",R.length,")"]})]}),f&&e.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===b&&0===T&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(l,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[E.length+R.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>v("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",M.length," discovered nodes"]})]}),d.observationOverrideCount>0&&O>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:d.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*d.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const He="var(--sparkline-critical)",Fe="var(--sparkline-poor)",Ee="var(--sparkline-fair)",Re="var(--sparkline-good)",Te="var(--sparkline-excellent)";function $e({active:s,payload:t}){if(!s||!t||!t.length)return null;const a=t[0].payload,n=new Date(a.timestamp),l=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return e.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[e.jsx("span",{className:"text-text-muted",children:l}),e.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const _e=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:i=""}){const r=I(s),o=U(),d=!K().backgroundLoadComplete||o,x=n??(r.length>0?function(e){if(0===e.length)return He;const s=e.slice(-4),t=s.reduce((e,s)=>e+s.count,0),a=t/s.length,n=e.reduce((e,s)=>e+s.count,0)/e.length;if(0===t)return He;if(n>0){const e=a/n;return e>=1.2?Te:e>=.8?Re:e>=.4?Ee:e>=.1?Fe:He}return t>=10?Te:t>=5?Re:t>=2?Ee:t>=1?Fe:He}(r):"var(--text-muted)"),m="number"==typeof t?t:60,h=a;return d&&r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h},children:e.jsx("div",{className:"rounded animate-pulse bg-white/[0.06]",style:{width:m-8,height:h-6}})}):r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h,color:He},children:e.jsx("svg",{width:m,height:h,viewBox:`0 0 ${m} ${h}`,preserveAspectRatio:"none",children:e.jsx("line",{x1:4,y1:h/2,x2:m-4,y2:h/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2"})})}):e.jsx("div",{className:i,style:{width:m,height:h},children:e.jsxs(oe,{data:r,width:m,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(de,{content:e.jsx($e,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(xe,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),Oe=s.memo(function({hash:t,className:a="",size:n="sm"}){const l=V(),c=W(),[i,o]=s.useState(!1),d=s.useMemo(()=>B(t),[t]),x=s.useMemo(()=>d?l.find(e=>e.prefix===d)??null:null,[d,l]),m=c.totalPaths>0&&c.avgPathConfidence>=.7,h=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),p=s.useCallback(()=>{o(!1)},[]);if(!x)return null;const u="sm"===n?"w-3.5 h-3.5":"w-4 h-4",j=m?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",N=m?`Prefix conflict resolved by Viterbi HMM (${(100*c.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${x.candidateCount} nodes share prefix "${d}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:h,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${j} ${a}`,title:N,"aria-label":`View prefix conflict for ${d}${m?" (Viterbi resolved)":""}`,children:m?e.jsxs("span",{className:"relative",children:[e.jsx(r,{className:u}),e.jsx(g,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(C,{className:u})}),e.jsx(ue,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Ae(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const De=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=q(),a=J(),n=Y(),l=Z(),c=Q(),r=X(),o=G(),x=ee(),[m,h]=s.useState(null),[p,u]=s.useState("lastHeard"),[j,v]=s.useState("desc"),[y,w]=s.useState(""),[k,C]=s.useState(!1),[D,W]=s.useState(null),[z,I]=s.useState(null),[U,K]=s.useState(null),[V,B]=s.useState(null),[ie,re]=s.useState(new Map),[oe,de]=s.useState(new Map),[xe,ue]=s.useState(25),[je,Ne]=s.useState(25),ve=s.useRef(null),[fe,ye]=s.useState(!1),we=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),Ce=s.useMemo(()=>Object.fromEntries(Object.entries(we).filter(([e])=>!a.has(e))),[we,a]),Se=se(),Me=null==t?void 0:t.local_hash,Le=s.useMemo(()=>{const e=new Map;if(!(null==Se?void 0:Se.latitude)||!(null==Se?void 0:Se.longitude))return e;for(const[s,t]of Object.entries(Ce))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,Ae(Se.latitude,Se.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Ce,Se]),{neighborHashSet:He,neighborSignalMap:Fe}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of r)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[r]),Ee=s.useMemo(()=>{const e=y.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=k||s;return Object.fromEntries(Object.entries(Ce).filter(([a,n])=>{if(t&&!He.has(a))return!1;if(s)return!0;if(!e)return!0;const l=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return l.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[Ce,y,k,He]),Re=s.useMemo(()=>Object.entries(Ee).sort(([e,s],[t,a])=>{let n=0;switch(p){case"lastHeard":n=(s.last_seen||0)-(a.last_seen||0);break;case"distance":{const s=Le.get(e)??null,a=Le.get(t)??null;n=null===s&&null===a?0:null===s?1:null===a?-1:s-a;break}case"centrality":n=(c.get(e)||0)-(c.get(t)||0)}return"desc"===j?-n:n}),[Ee,p,j,Le,c]),Te=Re.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,$e=s.useMemo(()=>new Set(l),[l]),De=s.useMemo(()=>0===xe?Re:Re.slice(0,je),[Re,je,xe]);s.useEffect(()=>{Ne(xe||Re.length)},[p,j,y,k,xe,Re.length]),s.useEffect(()=>{if(0===xe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&jeMath.min(e+xe,Re.length))},{threshold:.1,rootMargin:"100px"});return ve.current&&e.observe(ve.current),()=>e.disconnect()},[xe,je,Re.length]);const We=s.useCallback(e=>{ue(e),Ne(e||Re.length),ye(!1)},[Re.length]),Ge=s.useCallback(e=>{p===e?v(e=>"desc"===e?"asc":"desc"):(u(e),v("desc"))},[p]),ze=s.useCallback(e=>{const s=Ce[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&W(e)},[Ce]),Ie=s.useCallback(()=>{W(null)},[]),Ue=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!V){B(e),re(s=>{const t=new Map(s);return t.delete(e),t}),de(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await ne(s,30);t.success&&t.data?(re(s=>new Map(s).set(e,t.data)),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(de(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";de(t=>new Map(t).set(e,s)),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{B(null)}}},[V]);return e.jsxs(le,{children:[e.jsx(ce,{title:"Contacts",icon:e.jsx(N,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Re.length," node",1!==Re.length?"s":""]}),Te>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(b,{className:"w-3.5 h-3.5 relative top-[2px]"}),Te," with location"]})]})}),x?e.jsx(be,{neighbors:Ce,localNode:Se??void 0,localHash:Me,onRemoveNode:n,selectedNodeHash:D,onNodeSelected:Ie,highlightedEdgeKey:z,highlightedGhost:U}):e.jsx("div",{className:"glass-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(ke,{maxPaths:10,highlightedEdge:z,onHighlightEdge:I}),o.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Pe,{neighbors:Ce,onGhostSelect:K})}):e.jsxs("div",{className:"glass-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(N,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[He.size>0&&e.jsxs("button",{onClick:()=>C(!k),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm rounded-lg transition-colors "+(k?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover:bg-white/5 border border-transparent"),title:k?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(S,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:He.size})]}),e.jsxs("div",{className:"relative",children:[e.jsx(M,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),e.jsx("input",{type:"text",name:"contact-search",id:"contact-search",autoComplete:"off",value:y,onChange:e=>w(e.target.value),placeholder:"Search...",className:"w-20 sm:w-28 lg:w-32 pl-6 sm:pl-7 pr-6 py-1.5 text-sm bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),y&&e.jsx("button",{onClick:()=>{w(""),"neighbor"!==y.toLowerCase().trim()&&"neighbors"!==y.toLowerCase().trim()||C(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:e.jsx(L,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>Ge("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("lastHeard"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[e.jsx(f,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("distance"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("centrality"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[e.jsx(d,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>ye(!fe),className:"flex items-center gap-1 px-2 py-1.5 text-sm text-text-muted hover:text-text-secondary hover:bg-white/5 rounded-lg transition-colors",title:"Items per page",children:[e.jsx("span",{className:"tabular-nums",children:0===xe?"All":xe}),e.jsx(i,{className:"w-3 h-3 transition-transform "+(fe?"rotate-180":"")})]}),fe&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg-surface border border-border-subtle rounded-lg shadow-lg py-1 min-w-[80px]",children:[25,50,100,0].map(s=>e.jsx("button",{onClick:()=>We(s),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-white/5 transition-colors "+(xe===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Re.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-border-subtle/30",children:De.map(([s,t])=>{var a;const n=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,l=t.node_name||t.name||"Unknown",i=$e.has(s),r=He.has(s),o=Le.get(s),x=c.get(s)||0,m=r?Fe.get(s):void 0,p=r&&m,u=null==(a=t.contact_type)?void 0:a.toLowerCase(),j="room server"===u||"room_server"===u||"room"===u||"server"===u,N="companion"===u,b="client"===u||"cli"===u,v=t.is_repeater||"repeater"===u||"rep"===u,f=r?"direct":"flood",y=r?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${i?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>ze(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[p&&null!==(null==m?void 0:m.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(k=m.avgSnr,void 0===k?"bg-[var(--signal-unknown)]":k>=5?"bg-[var(--signal-excellent)]":k>=0?"bg-[var(--signal-good)]":k>=-5?"bg-[var(--signal-fair)]":k>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:y,children:j&&v?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(F,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(E,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):j?e.jsx(F,{className:"w-5 h-5 text-sys-pink"}):N?e.jsx(R,{className:"w-5 h-5 text-text-muted"}):v?"direct"===f?e.jsx(T,{className:"w-5 h-5 text-sys-green"}):e.jsx(E,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(R,{className:"w-5 h-5 text-text-muted"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:l,children:l}),r&&e.jsx(te,{color:he.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),i&&e.jsxs(te,{color:he.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx($,{className:"w-3 h-3"}),"HUB"]}),v&&e.jsx(te,{color:he.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),j&&e.jsx(te,{color:he.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),N&&e.jsx(te,{color:he.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),b&&e.jsx(te,{color:he.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(me,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(Oe,{hash:s})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[p&&null!==(null==m?void 0:m.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(pe,{rssi:m.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(m.avgRssi)})]}),p&&null!==(null==m?void 0:m.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[m.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=o&&e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(w=o,w<1e3?`${Math.round(w)}m`:`${(w/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:x>0&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*x).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(_e,{nodeHash:s,width:48,height:16})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?ae(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:ie.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${ie.get(s).rtt_ms.toFixed(0)}ms`,children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[ie.get(s).snr_db.toFixed(1),"dB"]})]}):oe.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:oe.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ue(s,e),disabled:null!==V,className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:V===s?e.jsx(_,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(O,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),h({hash:s,name:l})},className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove contact",children:e.jsx(A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var w,k})}),xe>0&&je0&&jeNe(e=>Math.min(e+xe,Re.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(N,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})}),e.jsx(ge,{isOpen:!!m,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==m?void 0:m.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{m&&n(m.hash),h(null)},onCancel:()=>h(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{De as C,_e as N,Oe as P};
diff --git a/frontend/dist/assets/ContactsMapMapLibre-D6QmRhq9.js b/frontend/dist/assets/ContactsMapMapLibre-D6QmRhq9.js
new file mode 100644
index 00000000..c620b902
--- /dev/null
+++ b/frontend/dist/assets/ContactsMapMapLibre-D6QmRhq9.js
@@ -0,0 +1 @@
+import{r as A,j as e,m as t,ag as r,aF as n,bC as o,az as i,q as a,ap as s,A as l,aQ as c,a8 as u,al as d,aH as f,C as h,bb as g,bg as m,bD as b,bE as p,bF as v,bG as x,bH as w,bI as y,aI as k,Z as C,b8 as B,a6 as M,bJ as D,i as E,bK as j,X as N,bL as Q,bM as S,bN as F,aW as P,bO as T,bP as L,aj as I,bQ as R,bR as _,by as H,bz as z,ai as G,D as O,aP as U,aq as Y,bS as W,bB as V,bx as Z,bT as K}from"./vendor-react-LAbPDfrQ.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as J,c as X}from"./link-scoring-BhW7zxO1.js";import{K as q,aH as $,M as AA,aI as eA,J as tA,W as rA,T as nA,v as oA,N as iA,j as aA,aJ as sA,aK as lA,k as cA,aL as uA,B as dA,a4 as fA,aM as hA,aN as gA,d as mA,p as bA,aO as pA,aP as vA}from"./index-DSST4Vwq.js";import{C as xA}from"./ConfirmModal-Dq2G5qRN.js";import{c as wA,e as yA}from"./recharts-D38YBQhj.js";import{i as kA,j as CA,k as BA,l as MA}from"./useThemeColors-BZADUK_r.js";import{l as DA}from"./font-loader-jlbdh9Fw.js";import{p as EA,a as jA}from"./vendor-core-WoOfkQwm.js";import{u as NA,a as QA,B as SA}from"./BasemapLayer-D6Rvk89s.js";import{P as FA,N as PA}from"./Contacts-Dvei3J_b.js";import{H as TA,C as LA,N as IA,b as RA}from"./SignalIndicator-C8enCXLL.js";import"./deckgl-DTsmDcfs.js";import"./ping-e_wiYAwc.js";import"./PageLayout-CPPEYuG6.js";import"./DataBox-ChCyaBc1.js";import"./CollisionExplorerModal-B1RIpIqW.js";import"./leaflet-D_ckmI2R.js";function _A(A,e,t,r){const n=(t-A)*Math.PI/180,o=(r-e)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(A*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}function HA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}function zA({label:A,icon:t,status:n,detail:o}){return e.jsxs("div",{className:wA("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===n&&"opacity-40"),children:[e.jsx("div",{className:wA("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-primary/20","pending"===n&&"bg-subtle-fill"),children:"complete"===n?e.jsx(r,{className:"w-4 h-4 text-accent-primary"}):"active"===n?e.jsx(s,{className:"w-4 h-4 animate-spin text-accent-primary"}):e.jsx("span",{className:"text-text-muted",children:t})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:wA("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-primary","pending"===n&&"text-text-muted"),children:A}),o&&"pending"!==n&&e.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:o})]})]})}const GA=A.memo(function({isOpen:A,currentStep:s,packetCount:l,onClose:c}){const u="complete"===s,d=A=>{const e=["fetching","analyzing","building","discovering","complete"],t=e.indexOf(s),r=e.indexOf(A);return r{});return e.jsx(q,{open:A,onClose:f,size:"sm",bottomSheet:!1,children:e.jsx($,{isLoading:!u,borderRadius:16,children:e.jsx(AA,{className:"p-6",children:u?e.jsxs("div",{className:"flex flex-col items-center py-6",children:[e.jsx(t.div,{variants:eA,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:e.jsx(r,{className:"w-8 h-8 text-accent-primary"})}),e.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center bg-accent-primary/15",children:e.jsx(n,{className:"w-5 h-5 text-accent-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(zA,{label:"Fetching Packets",icon:e.jsx(o,{className:"w-4 h-4"}),status:d("fetching"),detail:l>0?`${l.toLocaleString()} packets`:"Loading database..."}),e.jsx(zA,{label:"Analyzing Database",icon:e.jsx(i,{className:"w-4 h-4"}),status:d("analyzing"),detail:"Processing packet paths"}),e.jsx(zA,{label:"Building Topology",icon:e.jsx(n,{className:"w-4 h-4"}),status:d("building"),detail:"Computing mesh edges"}),e.jsx(zA,{label:"Discovering Nodes",icon:e.jsx(a,{className:"w-4 h-4"}),status:d("discovering"),detail:"Viterbi HMM ghost detection"})]}),e.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})}),OA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function UA(){if("undefined"==typeof window)return OA;const A=kA(),e=CA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:OA.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:OA.edges.neighborRest,neighborHover:OA.edges.neighborHover,highlight:e.highlight},edgeOpacity:OA.edgeOpacity}}const YA=2e3,WA={open:{height:"auto",opacity:1,transition:{duration:.2,ease:[.4,0,.2,1]}},closed:{height:0,opacity:0,transition:{duration:.15,ease:[.4,0,1,1]}}};function VA({text:A}){return e.jsx(nA,{content:A,delay:200,children:e.jsx(g,{className:"w-3.5 h-3.5 text-text-muted cursor-help"})})}function ZA({title:A,tooltip:t,isOpen:r,onToggle:n,hasBorder:o=!1}){return e.jsxs("button",{onClick:n,className:"w-full flex items-center justify-between text-text-secondary font-medium py-1 hover:text-text-primary transition-colors "+(o?"mt-2 pt-2 border-t border-white/10":""),children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(VA,{text:t})]}),e.jsx(h,{className:"w-3 h-3 text-text-muted transition-transform duration-200 "+(r?"":"-rotate-90")})]})}function KA({showTopology:r,validatedPolylineCount:n,filteredNeighborCount:o,hasLocalNode:i,meshTopology:s,zeroHopNeighbors:h,neighborsWithLocation:g}){const m=BA(),b=tA(),p=rA(),v=b.filter(A=>A.isLikelyReal).length,x=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(s),[w,y]=A.useState(!0),[k,C]=A.useState(!0),[B,M]=A.useState(!0);return e.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[e.jsx(ZA,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:w,onToggle:()=>y(!w)}),e.jsx(l,{initial:!1,children:w&&e.jsxs(t.div,{variants:WA,initial:"closed",animate:"open",exit:"closed",className:"flex flex-col gap-1 mt-1.5 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:m.nodeFill}}),e.jsx("span",{className:"text-text-secondary",children:"Node"}),e.jsx(VA,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:m.hubColor}}),e.jsx("span",{className:"text-text-secondary",children:"Hub"}),e.jsx(VA,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(D=g,D.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(c,{className:"w-3 h-3 flex-shrink-0",style:{color:m.roomColor},strokeWidth:2.5}),e.jsx("span",{className:"text-text-secondary",children:"Room"}),e.jsx(VA,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{className:"w-3 h-3 flex-shrink-0",style:{color:m.localColor},strokeWidth:2.5}),e.jsx("span",{className:"text-text-secondary",children:"Local"}),e.jsx(VA,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),h.size>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:m.neighborColor}}),e.jsx("span",{className:"text-text-secondary",children:"Neighbor"}),e.jsx(VA,{text:"Zero-hop direct RF contact. Yellow indicates we receive their ADVERTs directly without relays."})]}),s.gatewayNodes.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:m.gatewayColor}}),e.jsx("span",{className:"text-text-secondary",children:"Gateway"}),e.jsx(VA,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),x>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:m.hubColor}}),e.jsx("span",{className:"text-text-secondary",children:"Backbone"}),e.jsx(VA,{text:"Critical relay with 4+ neighbors and high betweenness centrality. Backbone nodes carry the majority of mesh traffic."})]}),s.mobileNodes.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",background:"transparent",border:`4px solid ${m.mobileColor}`,boxSizing:"border-box"}}),e.jsx("span",{className:"text-text-secondary",children:"Mobile"}),e.jsx(VA,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),v>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(a,{className:"w-3 h-3 flex-shrink-0",style:{color:m.ghostColor},strokeWidth:2.5}),e.jsxs("span",{className:"text-text-secondary",children:["Ghost (",v,")"]}),e.jsx(VA,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]})}),h.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ZA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional link balance. 2-Way = balanced. Listener = they hear us. Loud = they route to us.",isOpen:k,onToggle:()=>C(!k),hasBorder:!0}),e.jsx(l,{initial:!1,children:k&&e.jsxs(t.div,{variants:WA,initial:"closed",animate:"open",exit:"closed",className:"flex flex-col gap-1 mt-1.5 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:J.YELLOW}}),e.jsx("span",{className:"text-text-secondary",children:"2-Way"}),e.jsx(VA,{text:"33-67% balanced. Ideal bidirectional link - this neighbor both hears us and routes traffic to us equally well."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:J.GREEN}}),e.jsx("span",{className:"text-text-secondary",children:"Listener"}),e.jsx(VA,{text:">67% listener score. This neighbor hears our transmissions well (good RX from us)."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:J.RED}}),e.jsx("span",{className:"text-text-secondary",children:"Loud"}),e.jsx(VA,{text:"<33% listener score. This neighbor routes more traffic TO us than they hear from us."})]})]})})]}),r&&n>0&&e.jsxs(e.Fragment,{children:[e.jsx(ZA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = relative strength.",isOpen:B,onToggle:()=>M(!B),hasBorder:!0}),e.jsx(l,{initial:!1,children:B&&e.jsxs(t.div,{variants:WA,initial:"closed",animate:"open",exit:"closed",className:"overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted mt-1",children:[e.jsxs("div",{className:"flex justify-between tabular-nums",children:[e.jsx("span",{children:"Nodes"}),e.jsx("span",{className:"text-text-secondary",children:o+(i?1:0)})]}),s.hubNodes.length>0&&e.jsxs("div",{className:"flex justify-between tabular-nums",children:[e.jsx("span",{children:"Hubs"}),e.jsx("span",{style:{color:OA.hubColor},children:s.hubNodes.length})]})]}),s.loops.length>0&&e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(d,{className:"w-3 h-3 flex-shrink-0",style:{color:OA.edges.hoverLoop}}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{style:{color:OA.edges.hoverLoop},className:"font-medium",children:[s.loops.length," ",1===s.loops.length?"Loop":"Loops"]}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),p.totalPaths>0&&e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(f,{className:"w-3 h-3 flex-shrink-0",style:{color:m.ghostColor}}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{style:{color:m.ghostColor},className:"font-medium",children:[p.totalPaths.toLocaleString()," Viterbi"]}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})})]})]});var D}function JA({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,showMinCut:u=!1,onToggleMinCut:d,hasMinCutData:f=!1,show3DTerrain:h,onToggle3DTerrain:g,basemapMode:M,onToggleBasemap:D,isFullscreen:E,onToggleFullscreen:j}){const N="w-4 h-4";return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"map-control-glass flex items-center gap-1 p-1",children:[n&&e.jsx(oA,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide edge lines":"Show edge lines","aria-label":t?"Hide edge lines":"Show edge lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(m,{className:N})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(iA,{color:"all"===o?"green":"zinc",onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(iA,{color:"hubs"===o?"green":"zinc",onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(iA,{color:"direct"===o?"green":"zinc",onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),f&&d&&e.jsx(oA,{plain:!0,color:u?"primary":"muted",onClick:d,title:u?"Hide community partition":"Show community partition","aria-label":u?"Hide community partition":"Show community partition","aria-pressed":u,className:"!p-1.5 !rounded-md",children:e.jsx(b,{className:N})}),e.jsx(oA,{plain:!0,color:"light"===M?"primary":"muted",onClick:D,title:"light"===M?"Switch to dark map":"Switch to light map","aria-label":"light"===M?"Switch to dark map":"Switch to light map","aria-pressed":"light"===M,className:"!p-1.5 !rounded-md",children:"light"===M?e.jsx(p,{className:N}):e.jsx(v,{className:N})}),e.jsx(oA,{plain:!0,color:h?"success":"muted",onClick:g,title:h?"Disable 3D terrain":"Enable 3D terrain","aria-label":h?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":h,className:"!p-1.5 !rounded-md",children:e.jsx(x,{className:N})}),e.jsx(oA,{plain:!0,color:"muted",onClick:j,title:E?"Exit fullscreen":"Fullscreen","aria-label":E?"Exit fullscreen":"Enter fullscreen","aria-pressed":E,className:"!p-1.5 !rounded-md",children:E?e.jsx(w,{className:N}):e.jsx(y,{className:N})})]}),e.jsxs("div",{className:"map-control-glass flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(oA,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(k,{className:N})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(oA,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(C,{className:N})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(oA,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(B,{className:N})})]})]})})}const XA="#4ADE80",qA="DeepAnalysis";function $A(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function Ae({isActive:t,hasAnalyzed:r,isLoading:o,onClick:i}){const[a,l]=A.useState(!1),[c,u]=A.useState(qA),d=A.useRef(!1),f=A.useRef(null),[h]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=a&&!t&&!o&&h;A.useEffect(()=>{if(a&&!t&&!o&&!d.current){d.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{f.current&&cancelAnimationFrame(f.current)}},[a,t,o]);const m=o?"Analyzing...":c;return e.jsxs("button",{onClick:i,onMouseEnter:()=>h&&l(!0),onMouseLeave:()=>h&&l(!1),onPointerEnter:()=>h&&l(!0),onPointerLeave:()=>h&&l(!1),disabled:o,className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors "+(o?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-green)":"var(--bg-surface)"},title:o?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[o?e.jsx(s,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):e.jsx(n,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-green-400":"text-text-secondary"),style:g?{color:XA}:void 0}),e.jsx("span",{className:t?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||g?700:500,letterSpacing:"-0.01em",lineHeight:1,...g?{color:XA}:{}},children:m})]})}const ee="#12A594";function te({isActive:t,onClick:r}){const[n,o]=A.useState(!1),[i,a]=A.useState(0),s=A.useRef(!1),l=A.useRef(null),[c,u]=A.useState(0),d=A.useRef(!1),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),h=n&&!t&&f;A.useEffect(()=>{h&&!d.current&&(d.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(d.current=!1,u(0))},[h,n]),A.useEffect(()=>{if(n&&!t&&!s.current){s.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);a(n),n<1&&(l.current=requestAnimationFrame(e))};l.current=requestAnimationFrame(e)}return n||(l.current&&(cancelAnimationFrame(l.current),l.current=null),s.current=!1,a(0)),()=>{l.current&&cancelAnimationFrame(l.current)}},[n,t]);const g=A=>{if(t)return;if(!h)return;const e=11*i;return A>=e-2&&Af&&o(!0),onMouseLeave:()=>f&&o(!1),onPointerEnter:()=>f&&o(!0),onPointerLeave:()=>f&&o(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-teal)":"var(--bg-surface)"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(M,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"text-sys-teal":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?ee:"none",stroke:1===c||2===c?"#FFFFFF":h?ee:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"text-sys-teal":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||h?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:g(t)||void 0},children:A},t))})]})}const re="#fe8019";function ne({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(!1),[c]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{DA()},[]),A.useEffect(()=>{if(!i||t)return;const A=requestAnimationFrame(()=>l(!0)),e=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[i,t]);const u=Math.max(.01,Math.min(1,n)),d=u<.999,f=u>.011,h=i&&!t&&c;return e.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-amber)":"var(--bg-surface)"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(D,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:h?{color:re}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||h?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||h?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":h?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...h?{color:re}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!f,className:"p-0.5 rounded transition-colors "+(f?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:e.jsx(v,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!d,className:"p-0.5 rounded transition-colors "+(d?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:e.jsx(p,{className:"w-3.5 h-3.5"})})]})]})}function oe(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function ie(A){return Math.exp(-A*Math.LN2/7)}const ae="pymc-wardriving-url",se="pymc-wardriving-enabled",le="pymc-wardriving-brightness";function ce(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(ae,A):localStorage.removeItem(ae))}function ue(A){"undefined"!=typeof localStorage&&localStorage.setItem(se,String(A))}function de(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(le);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function fe(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const he=E((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(se),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(ae)||"",brightness:de(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(le,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;ue(t),A({isVisible:t})},setVisible:e=>{ue(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=oe(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=ie(i),s=fe(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),ce(e.trim()),ue(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),ce(""),ue(!1)}})),ge={type:"spring",damping:25,stiffness:300},me={type:"spring",damping:20,stiffness:300};function be({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const r={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];if(!r)return null;const n="connecting"===A?30:"loading"===A?60:90;return e.jsx(t.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:me,className:"overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[e.jsx("div",{className:"relative",children:e.jsx(s,{className:"w-5 h-5 text-amber-400 animate-spin"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-amber-400 font-medium",children:r}),e.jsx("div",{className:"mt-2 h-1.5 bg-amber-500/20 rounded-full overflow-hidden",children:e.jsx(t.div,{className:"h-full bg-amber-400 rounded-full",initial:{width:0},animate:{width:`${n}%`},transition:{duration:.4,ease:"easeOut"}})})]})]})})}function pe({icon:A,title:r,description:n,variant:o}){const i={success:"bg-accent-success/10 border-accent-success/30 text-accent-success",error:"bg-accent-danger/10 border-accent-danger/30 text-accent-danger",warning:"bg-accent-secondary/10 border-accent-secondary/30 text-accent-secondary"}[o];return e.jsx(t.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:me,className:"overflow-hidden",children:e.jsxs("div",{className:`flex items-start gap-3 p-4 border rounded-xl ${i}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:A}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r}),n&&e.jsx("p",{className:"text-xs opacity-80 mt-0.5",children:n})]})]})})}function ve({icon:A,label:r,value:n,min:o,max:i,formatValue:a,onChange:s}){const l=a?a(n):`${Math.round(n)}%`;return e.jsx(t.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:me,className:"overflow-hidden",children:e.jsx("div",{className:"p-4 bg-bg-surface border border-border-subtle rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:r}),e.jsx("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:l})]}),e.jsx("input",{type:"range",min:o,max:i,value:n,onChange:A=>s(Number(A.target.value)),className:"w-full h-1.5 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-3.5\n [&::-webkit-slider-thumb]:h-3.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-secondary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:transition-transform\n [&::-webkit-slider-thumb]:hover:scale-110\n [&::-webkit-slider-thumb]:shadow-md"})]})]})})})}function xe(){const{isModalOpen:n,closeModal:i,status:a,isVisible:c,stats:u,error:d,url:h,brightness:g,loadCoverage:m,clearCoverage:b,toggleVisibility:v,setUrl:x,setBrightness:w}=he(),y="connecting"===a||"loading"===a||"processing"===a,[k,C]=A.useState(h),B=A.useCallback(async()=>{await m(k)},[k,m]),M=A.useCallback(()=>{C(""),b()},[b]),D=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||y||(A.preventDefault(),B())},[B,y]),E=A.useCallback(A=>{const e=A.target.value;C(e),x(e)},[x]),T=u.coverageCount>0,L=k.trim().length>0&&!y;return e.jsx(l,{children:n&&e.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[e.jsx(t.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:y?void 0:i}),e.jsx(t.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:ge,className:"relative w-full max-w-md mx-4",children:e.jsxs("div",{className:"map-control-glass rounded-2xl overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-accent-secondary/20",children:e.jsx(j,{className:"w-5 h-5 text-accent-secondary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),e.jsx(oA,{plain:!0,color:"muted",onClick:i,disabled:y,className:"!p-2 !rounded-lg","aria-label":"Close modal",children:e.jsx(N,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),e.jsx("input",{type:"url",value:k,onChange:E,onKeyDown:D,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-bg-surface border border-border-subtle rounded-xl \n text-text-primary placeholder:text-text-muted \n focus:outline-none focus:ring-2 focus:ring-accent-secondary/50 focus:border-accent-secondary/50 \n transition-all disabled:opacity-50",disabled:y}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),e.jsxs(l,{mode:"wait",children:[y&&e.jsx(be,{status:a},"loading"),"error"===a&&d&&e.jsx(pe,{icon:e.jsx(Q,{className:"w-5 h-5"}),title:"Connection Failed",description:d,variant:"error"},"error"),"success"===a&&T&&e.jsx(pe,{icon:e.jsx(r,{className:"w-5 h-5"}),title:"Data Loaded Successfully",description:`${u.coverageCount.toLocaleString()} coverage points • ${u.repeaterCount.toLocaleString()} repeaters`,variant:"success"},"success"),T&&!y&&"success"!==a&&e.jsx(pe,{icon:e.jsx(S,{className:"w-5 h-5"}),title:"Coverage Data Loaded",description:`${u.coverageCount.toLocaleString()} points${u.lastUpdated?` • Last updated ${u.lastUpdated.toLocaleTimeString()}`:""}`,variant:"warning"},"info")]}),e.jsx(l,{children:T&&!y&&e.jsx(ve,{icon:e.jsx(p,{className:"w-4 h-4 "+(g>.5?"text-accent-secondary":"text-text-muted")}),label:"Brightness",value:100*g,min:1,max:100,formatValue:A=>`${Math.round(A)}%`,onChange:A=>w(A/100)},"brightness")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-t border-border-subtle",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(l,{children:T&&e.jsxs(t.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"flex items-center gap-1",children:[e.jsx(oA,{plain:!0,color:"muted",onClick:v,disabled:y,title:c?"Hide heatmap":"Show heatmap",children:c?e.jsxs(e.Fragment,{children:[e.jsx(F,{"data-slot":"icon"})," Hide"]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{"data-slot":"icon"})," Show"]})}),e.jsxs(oA,{plain:!0,color:"danger",onClick:M,disabled:y,title:"Clear coverage data",children:[e.jsx(P,{"data-slot":"icon"})," Clear"]})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oA,{plain:!0,color:"muted",onClick:i,disabled:y,children:T?"Done":"Cancel"}),e.jsx(oA,{color:"warning",onClick:B,disabled:!L,children:y?e.jsxs(e.Fragment,{children:[e.jsx(s,{"data-slot":"icon",className:"animate-spin"}),"Loading..."]}):T?e.jsxs(e.Fragment,{children:[e.jsx(o,{"data-slot":"icon"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(o,{"data-slot":"icon"}),"Connect"]})})]})]})]})})]})})}const we={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5};function ye({label:A,value:t,min:r,max:n,step:o,unit:i,formatValue:a,onChange:s}){const l=a?a(t):t.toFixed(2);return e.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[e.jsx("span",{className:"text-[11px] sm:text-[11px] text-text-secondary w-14 sm:w-16 flex-shrink-0",children:A}),e.jsx("input",{type:"range",min:r,max:n,step:o,value:t,onChange:A=>s(parseFloat(A.target.value)),className:"flex-1 h-1.5 sm:h-1 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-4\n [&::-webkit-slider-thumb]:h-4\n [&::-webkit-slider-thumb]:sm:w-2.5\n [&::-webkit-slider-thumb]:sm:h-2.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-primary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:shadow-md"}),e.jsxs("span",{className:"text-[11px] sm:text-[11px] text-text-primary font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",children:[l,i&&e.jsx("span",{className:"text-text-muted ml-0.5 hidden sm:inline",children:i})]})]})}function ke({icon:A,label:t,value:r,subtext:n}){return e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[10px] sm:text-[11px] text-text-secondary truncate",children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-[11px] sm:text-xs font-mono text-text-primary",children:r}),n&&e.jsx("div",{className:"text-[8px] sm:text-[9px] text-text-muted leading-tight",children:n})]})]})}function Ce({visible:r,onClose:n,settings:o,onSettingsChange:i,partition:a,totalNodes:s}){const c=T(),u=A.useRef(null),d=A.useMemo(()=>{if(!a)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const A=Array.from(a.communities.values()).map(A=>A.length),e=A.reduce((A,e)=>A+e,0);return{numCommunities:a.numCommunities,avgCommunitySize:A.length>0?Math.round(e/A.length):0,minCommunitySize:A.length>0?Math.min(...A):0,maxCommunitySize:A.length>0?Math.max(...A):0,fiedlerValue:a.fiedlerValue,modularity:0,coveragePercent:s>0?Math.round(e/s*100):0}},[a,s]),f=(A,e)=>{i({...o,[A]:e})},h=(111*o.bandwidth).toFixed(1);return e.jsx("div",{ref:u,className:"absolute inset-0 z-[600] pointer-events-none",children:e.jsx(l,{children:r&&e.jsx(t.div,{drag:!0,dragControls:c,dragConstraints:u,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{type:"spring",damping:25,stiffness:300},className:"\n absolute pointer-events-auto\n /* Mobile: bottom sheet style, full width with margins */\n bottom-2 left-2 right-2\n /* sm+: floating panel in bottom-right */\n sm:bottom-16 sm:left-auto sm:right-3 sm:w-64\n /* md+: slightly wider */\n md:w-72\n ",style:{touchAction:"none"},children:e.jsxs("div",{className:"\n map-control-glass rounded-lg overflow-hidden shadow-lg\n /* Mobile: limit height, allow scroll */\n max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto\n /* iOS momentum scrolling */\n overscroll-contain\n ",children:[e.jsxs("div",{className:"\n flex items-center justify-between \n px-3 py-2 sm:px-2.5 sm:py-1.5 \n border-b border-border-subtle \n cursor-grab active:cursor-grabbing\n /* Larger touch target on mobile */\n min-h-[44px] sm:min-h-0\n ",onPointerDown:A=>c.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(L,{className:"w-4 h-4 sm:w-3 sm:h-3 text-text-muted"}),e.jsx(b,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-accent-primary"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium text-text-primary",children:"Partition"})]}),e.jsx(oA,{plain:!0,color:"muted",onClick:n,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:e.jsx(N,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b border-border-subtle",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[e.jsx(ke,{icon:e.jsx(b,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities}),e.jsx(ke,{icon:e.jsx(I,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:d.avgCommunitySize,subtext:`${d.minCommunitySize}–${d.maxCommunitySize}`}),e.jsx(ke,{icon:e.jsx(R,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3)}),e.jsx(ke,{icon:e.jsx(I,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${d.coveragePercent}%`,subtext:`of ${s}`})]})}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:e.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[e.jsx(ye,{label:"Bandwidth",value:o.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>h,unit:"km",onChange:A=>f("bandwidth",A)}),e.jsx(ye,{label:"Threshold",value:o.threshold,min:.05,max:.5,step:.01,formatValue:A=>`${Math.round(100*(1-A))}%`,unit:"cov",onChange:A=>f("threshold",A)}),e.jsx(ye,{label:"Opacity",value:o.opacity,min:.1,max:1,step:.05,formatValue:A=>`${Math.round(100*A)}%`,onChange:A=>f("opacity",A)}),e.jsx(ye,{label:"Stroke",value:o.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:A=>A.toFixed(1),onChange:A=>f("strokeWidth",A)})]})})]})})})})}const Be={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},Me=E()(EA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:jA(()=>Be)}));var De=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,d,f,h,g,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&p)return p.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(f,A,e):""}function x(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=h=new Int16Array(A),t.HEAP32=g=new Int32Array(A),t.HEAPU8=f=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=b=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var y=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}y=(u=t.buffer?t.buffer:new ArrayBuffer(y)).byteLength,w(u),g[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function j(A){D.unshift(A)}var N=Math.abs,Q=Math.ceil,S=Math.floor,F=Math.min,P=0,T=null;t.preloadedImages={},t.preloadedAudios={};var L,I,R=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return d.length}R="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAA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AAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAA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q5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAB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QHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAA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09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function T(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(g=i=a)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|HA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,h=0,g=1,s=A;;){if(!(d|h)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(h<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(f<<2)>>2]=g,l=(0|(A=d+1|0))==(0|g),u=6==(0|(c=h+1|0)),0|HA(s,e)){s=9;break A}if((0|(g=g+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,h=l?u?0:c:h}else for(f=1,d=0,h=0,g=1,s=A;;){if(!(d|h)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(h<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=d+1|0))==(0|g),u=6==(0|(c=h+1|0)),0|HA(s,e)){s=9;break A}if((0|(g=g+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,h=l?u?0:c:h}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,d=0,f=0,h=0,g=0,m=0,b=0,p=0;if(u=S,S=S+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),h=0|B(),!(!(0|(p=0|n[(b=g=r+(d<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(f=(0|p)==(0|A)&(0|b)==(0|e))))do{d=0|$e(0|(d=0|Ve(0|d,0|h,1,0)),0|B(),0|i,0|a),h=0|B(),f=(0|(b=0|n[(p=g=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=o+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return S=u,0;if(n[(p=g)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return S=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|I(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|I(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|I(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|I(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|I(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|I(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|d}function I(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,h=0;if((t|=0)>>>0>6)return 1;if(d=(0|n[(r|=0)>>2])%6|0,n[r>>2]=d,(0|d)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(a=127&d)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(h=!(0|ZA(s)),s=s+-1|0,f=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(h?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~f,e|=l=0|B(),!(t=0|n[(h?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(h=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~h||(h=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(h|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|z(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}M(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|VA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&d){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(h=o)>>2]=A,n[h+4>>2]=e,0}function R(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0;if(i=S,S=S+16|0,g=i+8|0,n[(h=o=i)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(g=r)>>2]=A,n[g+4>>2]=e,S=i,0;n[g>>2]=0;A:do{if(0|HA(A,e))A=9;else{a=0,h=A;do{if(0|(A=0|I(h,e,4,g,o)))break A;if(a=a+1|0,0|HA(h=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(f=r)>>2]=h,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(a=26800+(d<<2)|0,5==(0|d))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|I(0|n[(A=o)>>2],0|n[A+4>>2],l,g,o)))break A;if((0|s)!=(0|f)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|HA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|I(s,l,u,g,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|HA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}d=d+1|0}while(d>>>0<6);A=(0|h)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|I(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function H(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,d,f,h,g,m,b,p,v=0,x=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,j=0,N=0,Q=0,F=0,P=0,T=0,L=0,I=0,R=0,_=0;if(p=S,S=S+64|0,g=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(x=0|n[(A|=0)>>2]))<=0)return S=p,0;for(u=A+4|0,d=g+8|0,f=m+8|0,h=l+8|0,v=0,F=0;;){Q=(w=0|n[u>>2])+(F<<4)|0,n[g>>2]=n[Q>>2],n[g+4>>2]=n[Q+4>>2],n[g+8>>2]=n[Q+8>>2],n[g+12>>2]=n[Q+12>>2],(0|F)==(x+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(Q=w+(F+1<<4)|0,n[m>>2]=n[Q>>2],n[m+4>>2]=n[Q+4>>2],n[m+8>>2]=n[Q+8>>2],n[m+12>>2]=n[Q+12>>2]),x=0|tA(g,m,r,b);A:do{if(x)w=0,v=x;else if(w=0|n[(x=b)>>2],(0|(x=0|n[x+4>>2]))>0|!(0|x)&w>>>0>0){N=0,Q=0;e:for(;;){if(I=1/(+(w>>>0)+4294967296*+(0|x)),_=+o[g>>3],R=+((x=0|Ze(0|w,0|x,0|N,0|Q))>>>0)+4294967296*+(0|B()),L=+(N>>>0)+4294967296*+(0|Q),o[l>>3]=I*(_*R)+I*(+o[m>>3]*L),o[h>>3]=I*(+o[d>>3]*R)+I*(+o[f>>3]*L),0|(x=0|KA(l,r,c))){v=x;break}C=0|At(0|(E=0|n[(j=c)>>2]),0|(j=0|n[j+4>>2]),0|e,0|t),y=0|B(),w=0|n[(k=x=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))P=x,T=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){v=1;break e}if((0|w)==(0|E)&(0|k)==(0|j))break t;if(C=0|$e(0|(x=0|Ve(0|C,0|y,1,0)),0|B(),0|e,0|t),y=0|B(),D=0|Ve(0|D,0|M,1,0),M=0|B(),!(0|(w=0|n[(k=x=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=x,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|E)&!(0|j))||(n[(D=P)>>2]=E,n[D+4>>2]=j,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=j,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(j=i)>>2]=D,n[j+4>>2]=E),N=0|Ve(0|N,0|Q,1,0),Q=0|B(),w=0|n[(x=b)>>2],!((0|(x=0|n[x+4>>2]))>(0|Q)|(0|x)==(0|Q)&w>>>0>N>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){T=21;break}if((0|F)>=(0|(x=0|n[A>>2]))){v=0,T=21;break}}return 21==(0|T)?(S=p,0|v):0}function z(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function W(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function V(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,d,f,h,g=0,m=0,b=0,p=0,x=0,y=0,k=0;f=S,S=S+288|0,d=f+264|0,p=f+96|0,m=(g=b=f)+96|0;do{n[g>>2]=0,g=g+4|0}while((0|g)<(0|m));return 0|(e=0|Ae(e,b))?(S=f,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+ae(d,p+8|0),o[d>>3]=+o[A>>3],o[(m=d+8|0)>>3]=+o[A+16>>3],o[p>>3]=+o[A+8>>3],o[(b=p+8|0)>>3]=+o[A+24>>3],a=+ae(d,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),h=+o[d>>3]-+o[p>>3],r=+l(+h),!(0==k|0==h)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,x=~~k>>>0,y=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|x)&!(0|y),n[(e=t)>>2]=p?1:x,n[e+4>>2]=p?0:y,e=0):e=1,S=f,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,d,f=0,h=0,g=0;d=S,S=S+288|0,c=d+264|0,u=d+96|0,a=(f=h=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|a));return 0|(t=0|Ae(t,h))?(S=d,0|(r=t)):(qA(f=0|n[(t=h)>>2],t=0|n[t+4>>2],c),$A(f,t,u),g=+ae(c,u+8|0),g=+v(+ +ae(A,e)/(2*g)),o[i>>3]=g,t=~~g>>>0,f=+l(g)>=1?g>0?~~+w(+s(g/4294967296),4294967295)>>>0:~~+v((g-+(~~g>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(h=!(0|t)&!(0|f),n[r>>2]=h?1:t,n[r+4>>2]=h?0:f,S=d,0|(r=0)):(S=d,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|x(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|x(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|x(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&M(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&M(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&M(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function dA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+(((r=(0|n[A>>2])-o|0)<<1)+(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((3*o|0)-r|0)),n[t>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i)}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function xA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function wA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n[t>>2]=i,o=(a<<1)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function yA(A){var e,t,r,o=0,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[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function MA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|HA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&M(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,a)?jA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+p(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?a:.37796447300922725*a))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+a)*(t*+d(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+d(+e),a=t*+f(+a)*c,t=+o[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +p(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function jA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,h,g,m,b,p,v,x,w,y,k,C,B,D,E,j,N=0,Q=0,F=0,P=0,T=0,L=0;if(j=S,S=S+272|0,P=j+240|0,B=j,D=j+224|0,E=j+208|0,b=j+176|0,p=j+160|0,v=j+192|0,x=j+144|0,w=j+128|0,y=j+112|0,k=j+96|0,C=j+80|0,n[(N=j+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],NA(P,N,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=j;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[N>>2])<<2)|0,d=16960+(a<<2)|0,f=w+8|0,h=y+8|0,g=k+8|0,m=E+4|0,F=t;A:for(;;){Q=B+((0|F)%5<<4)|0,n[E>>2]=n[Q>>2],n[E+4>>2]=n[Q+4>>2],n[E+8>>2]=n[Q+8>>2],n[E+12>>2]=n[Q+12>>2];do{}while(2==(0|QA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[E>>2],n[b+4>>2]=n[E+4>>2],n[b+8>>2]=n[E+8>>2],n[b+12>>2]=n[E+12>>2],oA(s,p),r=0|n[b>>2],N=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*N|0)>>2],(0|(Q=0|n[18640+(80*r|0)+(20*N|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|Q))}switch(Q=18640+(80*r|0)+(20*N|0)+4|0,n[v>>2]=n[Q>>2],n[v+4>>2]=n[Q+4>>2],n[v+8>>2]=n[Q+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,x),T=+(0|n[d>>2]),o[w>>3]=3*T,o[f>>3]=0,L=-1.5*T,o[y>>3]=L,o[h>>3]=2.598076211353316*T,o[k>>3]=L,o[g>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=y,r=w;break;case 3:A=k,r=y;break;case 2:A=w,r=k;break;default:A=12;break A}Ne(p,x,r,A,C),EA(C,0|n[b>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,b),EA(b,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[D>>2]=n[E>>2],n[D+4>>2]=n[E+4>>2],n[D+8>>2]=n[E+8>>2],n[D+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):S=j}}function NA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(gA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function QA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,d=0,f=0,h=0,g=0;if(c=S,S=S+32|0,l=c+12|0,i=c,g=4+(A|=0)|0,h=0|n[16960+((e|=0)<<2)>>2],h=(s=!!(0|r))?3*h|0:h,u=0|n[g>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(d=A+12|0)>>2])|0))==(0|h))return S=c,1;f=d}else u=o+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|h))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){d=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,h,0,0),aA(g,l,i),pA(i),iA(i,l,g),d=r,r=A):(d=r,r=A)}else d=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[d>>2],(0|n[(u=d+16|0)>>2])>0){r=0;do{bA(g),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=d+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(g,l,g),nA(g),r=s&&((0|n[a>>2])+(0|n[g>>2])+(0|n[f>>2])|0)==(0|h)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|QA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,h,g,m,b,p,v,x,w,y,k,C,B=0,D=0,E=0,j=0,N=0;if(C=S,S=S+240|0,x=C+208|0,w=C,y=C+192|0,k=C+176|0,g=C+160|0,m=C+144|0,b=C+128|0,p=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[x>>2]=n[A>>2],n[x+4>>2]=n[A+4>>2],n[x+8>>2]=n[A+8>>2],n[x+12>>2]=n[A+12>>2],PA(x,B,w),n[i>>2]=0,(0|(h=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=y+4|0,D=0,E=t,r=-1;A:for(;;){if(A=w+((B=(0|E)%6|0)<<4)|0,n[y>>2]=n[A>>2],n[y+4>>2]=n[A+4>>2],n[y+8>>2]=n[A+8>>2],n[y+12>>2]=n[A+12>>2],A=D,D=0|QA(y,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,g),j=+(0|n[l>>2]),o[m>>3]=3*j,o[c>>3]=0,N=-1.5*j,o[b>>3]=N,o[u>>3]=2.598076211353316*j,o[p>>3]=N,o[d>>3]=-2.598076211353316*j,B=0|n[x>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[y>>2]:r)<<2)>>2]){case 1:A=b,r=m;break;case 3:A=p,r=b;break;case 2:A=m,r=p;break;default:A=8;break A}Ne(k,g,r,A,v),0|Qe(k,v)||0|Qe(g,v)||(EA(v,0|n[x>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(f,k),EA(k,0|n[y>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|h)){A=3;break}r=0|n[y>>2]}3!=(0|A)?8==(0|A)&&M(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(gA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function IA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function RA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|z(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|Ve(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function HA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function zA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|xA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|xA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|xA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+d(+n),n=+f(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+d(+n),o[e>>3]=r,n=t*+f(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+g(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+d(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+f(+n),t=+o[A>>3],+ +p(+a,+(+f(+i)*+d(+t)-+d(+n)*(r*+f(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+h(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+d(+l)*a,o[r>>3]=s,l=+f(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,d=0,f=0,h=0,g=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],d=+l(+r),i=+o[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+i)),d-=+(0|(s=~~d)),f-=+(0|(A=~~f));do{if(d<.5){if(d<.3333333333333333){if(n[e>>2]=s,f<.5*(d+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(f<(g=1-d)))+A|0,n[e+4>>2]=A,g<=f&f<2*d){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(d<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,f<.5*d){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(f<1-d){if(n[e+4>>2]=A,2*d-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((h=0|Ze(0|s,((0|s)<0)<<31>>31,0|(h=(A+1|0)/2|0),((0|h)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((h=0|Ze(0|s,((0|s)<0)<<31>>31,0|(h=(0|A)/2|0),((0|h)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);h=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[h>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[h>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[h>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[h>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[h>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)):(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|z(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|xA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&M(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|z(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?hA(r):gA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|z(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|xA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(gA(l),s=c+1|0):s=c,0|z(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|QA(t,s,i,0)){if(0|z(u))do{}while(0|QA(t,s,0,0));(0|s)!=(0|c)&&fA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|z(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return jA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|z(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|z(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|zA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|HA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|zA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|HA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|pe(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,g=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+f(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],g=+f(.5*(u-n)),r=+d(+i),a=+d(+v),g=2*+p(+ +c(+(g=m*m+g*(a*r*g))),+ +c(+(1-g))),m=+o[t>>3],v=+f(.5*(m-v)),s=+o[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+f(.5*(i-m)),s=+f(.5*(n-s)),s=2*+p(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+b(+ +c(+ +h(.5*(l=.5*(g+u+s)))*+h(.5*(l-g))*+h(.5*(l-u))*+h(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&M(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function de(A){A|=0;var e,t,r=0;return(e=0|We(1,12))||M(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&M(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function fe(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||M(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&M(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function he(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function ge(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0;if(c=S,S=S+32|0,x=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|o,52),B(),(0|u)!=(15&b))return S=c,12;if(g=0|tt(0|A,0|e,45),B(),g&=127,m=0|tt(0|t,0|o,45),B(),g>>>0>121|(m&=127)>>>0>121)return S=c,5;if(b=(0|g)!=(0|m)){if(7==(0|(f=0|V(g,m))))return S=c,1;7==(0|(h=0|V(m,g)))?M(27514,27538,161,27548):(p=f,d=h)}else p=0,d=0;a=0|z(g),s=0|z(m),n[x>>2]=0,n[x+4>>2]=0,n[x+8>>2]=0,n[x+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*g|0)+(p<<2)>>2]))>0,s)if(f){g=0,h=t,f=o;do{h=0|WA(h,f),f=0|B(),1==(0|(d=0|xA(d)))&&(d=0|xA(1)),g=g+1|0}while((0|g)!=(0|m));m=d,g=h,h=f}else m=d,g=t,h=o;else if(f){g=0,h=t,f=o;do{h=0|VA(h,f),f=0|B(),d=0|xA(d),g=g+1|0}while((0|g)!=(0|m));m=d,g=h,h=f}else m=d,g=t,h=o;if(JA(g,h,x),b||M(27563,27538,191,27548),(f=!!(0|a))&(d=!!(0|s))&&M(27590,27538,192,27548),f){if(7==(0|(d=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*d|0)+p|0]){u=1;break}g=h=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(g,h)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}g=0,h=0|n[21168+(28*m|0)+(d<<2)>>2]}else g=0,h=0;if((g|h|0)<0)u=5;else{if((0|h)>0){f=x+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(0|h))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,p),0|u)for(;0|ZA(u)?hA(l):gA(l),(0|u)>1;)u=u+-1|0;if((0|g)>0){u=0;do{pA(l),u=u+1|0}while((0|u)!=(0|g))}iA(v=x+4|0,l,v),nA(v),v=51}}else if(JA(t,o,x),!!(0|a)&!!(0|s))if((0|m)!=(0|g)&&M(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*d|0)+u|0])u=1;else if((0|(d=0|n[21168+(28*d|0)+(u<<2)>>2]))>0){f=x+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=x+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function be(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,d=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,h=0|tt(0|A,0|e,45),B(),(h&=127)>>>0>121)return S=a,5;if(i=0|z(h),rt(0|s,0,52),b=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=b,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|W(h,s)))?(S=a,0|(b=1)):(g=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(h=r)+4>>2]|m,n[(b=r)>>2]=n[h>>2]|g,n[b+4>>2]=m,S=a,0|(b=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}if(aA(c,u,d),nA(d),v=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(x=3*(15-l|0)|0)),s&=~B(),x=0|rt(0|lA(d),0,0|x),s=0|B()|s,n[(b=r)>>2]=x|v&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){d=127==(0|(s=0|W(h,t=0|lA(o))))?0:0|z(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|W(h,s)))&&M(27648,27538,411,27678),0|z(t)?M(27693,27538,412,27678):(m=t,g=l,f=s)}else m=s,g=0,f=t;if((0|(u=0|n[4272+(28*h|0)+(f<<2)>>2]))<=-1&&M(27724,27538,419,27678),!d){if((0|g)<0){s=5;break A}if(0|g){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=l,s=s+1|0}while((0|s)<(0|g))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|V(m,h)))&&M(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&M(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&M(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(x=r)>>2]=l,n[x+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|d)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(x=r)>>2]=c,n[x+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&d&&(t=59),59==(0|t)&&1==(0|OA(0|n[(x=r)>>2],0|n[x+4>>2]))){s=9;break}p=0|n[(x=r)>>2],x=-1040385&n[x+4>>2],v=0|rt(0|s,0,45),x=0|x|B(),n[(s=r)>>2]=p|v,n[s+4>>2]=x,s=0}else s=1}while(0);return S=a,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,f=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+d(+u),f=+o[25968+(l<<3)>>3],o[t>>3]=u+f,o[t+8>>3]=u-f,u=+o[s+8>>3],c*=f,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function xe(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{v=A+12|0,b=3==(0|c),m=255&a,h=3==(1|c),p=A+24|0,g=(c+-1|0)>>>0<3,d=3==(2|c),f=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){x=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){x=19;break e}}if(h&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){x=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){x=29;break}}if(g){if(0|(c=0|$A(s,l,e))){x=32;break}if(0|ve(s,l,t,0)){x=36;break}if(d&&0|De(0|n[o>>2],0|n[p>>2],e,t)){x=42;break}if(h&&0|je(0|n[o>>2],0|n[p>>2],e,t)){x=42;break}}if(b){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){x=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){x=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],f)){x=53;break}if(0|je(0|n[o>>2],0|n[p>>2],t,e)){x=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){x=58;break e}if(!(0|q(c,e))){x=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){x=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){x=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else x=73}while(0);if(73==(0|x)&&(x=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|x){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,x=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,x=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(S=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,x=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,x=55;break;case 58:0|c&&Ye(c),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,x=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,x=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|x))return void(S=i);if(55==(0|x))return void(S=i);if(71==(0|x))return void(S=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[w>>2]=0,S=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;t=S,S=S+16|0,d=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return d=0|rt(((d=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,d|=A&~s,C(0|u),S=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),S=t,0|d):(IA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),S=t,0|d)}function ye(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(h=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|h)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|h)){t=22;break A}A=d,d=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|h)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|h)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|h)){t=22;break A}A=d,d=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(f=l==f|a==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|h)){t=22;break}t=d}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,v=0,A=-1,f=17976931348623157e292,h=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,x=0;c=+o[t+(x<<4)>>3],g=+o[t+(x<<4)+8>>3],d=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=c),g>3]=g,h=g),c>m?o[e>>3]=c:c=m,g>u&&(o[s>>3]=g,u=g),b=g>0&gp?g:p,v|=+l(+(g-d))>3.141592653589793,(0|(A=x+1|0))!=(0|r);)w=x,m=c,x=A,A=w;v&&(o[s>>3]=p,o[a>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(x=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292,y=0;s=+o[a+(y<<4)>>3],h=+o[a+(y<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?o[e>>3]=s:s=g,h>c&&(o[w>>3]=h,c=h),m=h>0&hb?h:b,i|=+l(+(h-u))>3.141592653589793,(0|(r=y+1|0))!=(0|p);)B=y,g=s,y=r,r=B;i&&(o[w>>3]=b,o[x>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,x=e+((C=C+1|0)<<5)|0,w=0|n[a+(i<<3)>>2]){if(o[(y=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[x>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,v=0,d=17976931348623157e292,f=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(v<<4)>>3],g=+o[p+(v<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,d=s),g>3]=g,f=g),s>h?o[x>>3]=s:s=h,g>c&&(o[k>>3]=g,c=g),m=g>0&gb?g:b,a|=+l(+(g-u))>3.141592653589793,(0|(i=v+1|0))!=(0|w);)M=v,v=i,h=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[x>>2]=0,n[x+4>>2]=0,n[x+8>>2]=0,n[x+12>>2]=0,n[x+16>>2]=0,n[x+20>>2]=0,n[x+24>>2]=0,n[x+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function Me(A,e,t){var r=0,o=0,i=0;if(!(0|ye(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|ye((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function De(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|ye((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|ye(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,M=0;if(u=S,S=S+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,d),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{y=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[d>>2]),o[B>>3]=y,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],y=+ie(+o[r+16>>3],0|n[d>>2]),i=+ie(+o[r+24>>3],0|n[d>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(d=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],x=+o[e+(t<<4)>>3],w=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,f=+o[e+(B<<4)>>3],h=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(x>=a)|!(f>=a)&&!(x<=s)|!(f<=s)&&!(w<=i)|!(h<=i)&&!(w>=y)|!(h>=y)){v=f-x,b=h-w,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+o[c+8+(M<<4)+8>>3],h=+o[c+8+(B<<4)+8>>3]-f,g=+o[c+8+(M<<4)>>3],!(0==(p=v*h-b*(m=+o[c+8+(B<<4)>>3]-g))||(k=w-f,C=x-g,m=(k*m-h*C)/p,m<0|m>1))&&(p=(v*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|d))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function je(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function Ne(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,d,f=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],f=((f=+o[r>>3]-u)*(a-(d=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-d))/(s*c-i*f),o[n>>3]=l+s*f,o[n+8>>3]=a+i*f}function Qe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|TA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|z(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:M(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0;if(l=S,S=S+32|0,x=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,h=(h=!(0|HA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),h>>>0<=t>>>0)return S=l,2;!(b=!(0|(m&=15)))&&!((p=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|HA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,x))return S=l,1;if(u=(0|n[x>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|I(A,e,p,s,a);do{if(!c){if(g=0|n[(f=a)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&g>>>0>>0)?g:A,d=d?f:e,!b&&!(g&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+h|0)%(0|h)|0,c=0|HA(A,e),(0|f)<0&&M(27795,27797,248,27822),(0|((h=!!(0|c))?4:5))<(0|f)&&M(27795,27797,248,27822),0|Fe(A,e,x)&&M(27795,27797,248,27822),c=(0|n[x>>2])+f|0,7==(0|(f=0|n[(c=h?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,248,27822),n[i>>2]=0,0|(c=0|I(A,e,f,i,o)))break;h=0|n[(g=o)>>2],g=0|n[g+4>>2];do{if(g>>>0>>0|(0|g)==(0|d)&h>>>0>>0){if(u=0|HA(h,g)?0|_(h,g,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,g),(u+-1|0)>>>0>5){c=-1,u=h,d=g;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=h,d=g;break}do{if(!(0|Fe(h,g,x))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[x>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[x>>2])|0)%6|0;break}c=-1}while(0);u=h,d=g}else c=t}while(0);g=0|n[(f=a)>>2],f=0|n[f+4>>2]}if((0|u)==(0|g)&(0|d)==(0|f)){if(A=(h=!!(0|HA(g,f)))?0|_(g,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(g,f,x))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[x>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[x>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|h&5==(0|c)?0:c}e=d,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),x=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=x,S=l,0}function Te(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|We(e,4),n[A>>2]=r,r||M(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Ie(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Re(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function He(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||M(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function ze(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0;e=S,S=S+16|0,h=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(f=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=f&~(1<>2]=A,n[r>>2]=a),y=t<<3,n[o+4>>2]=3|y,n[(y=o+y+4|0)>>2]=1|n[y>>2],S=e,0|i;if(u>>>0>(d=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=f&~(1<>2]=t,n[A>>2]=r,A=f),s=(y=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+y>>2]=s,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?y:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(y=c+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|f,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}f=u}else f=u}else f=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(b=A<<(f=(A+1048320|0)>>>16&8))|0)>>>16&4)|f|(c=(245760+(b<<=l)|0)>>>16&2))+(b<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,b=65;break A}A=r,i=s}if(a=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:b,!r){r=a,b=61;break}l<<=1}else r=0,A=0,b=61}while(0);if(61==(0|b)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=f>>>12&16)>>>5&8)|s|(l=(f>>>=a)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(f=(-8&n[a+4>>2])-u|0)>>>0>>0)?f:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(d=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else y=0|n[l+8>>2],n[y+12>>2]=t,n[t+8>>2]=y}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?y:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)y=s+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2];else{if(n[l+4>>2]=3|u,n[d+4>>2]=1|s,n[d+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=d,n[t+12>>2]=d,n[d+8>>2]=t,n[d+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[d+28>>2]=r,n[4+(A=d+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=d,n[w>>2]=d,n[d+8>>2]=y,n[d+12>>2]=t,n[d+24>>2]=0}}while(0);return S=e,0|l+8}f=u}else f=u;else f=-1}while(0);if((r=0|n[6983])>>>0>=f>>>0)return t=r-f|0,A=0|n[6986],t>>>0>15?(y=A+f|0,n[6986]=y,n[6983]=t,n[y+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|f):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(y=A+r+4|0)>>2]=1|n[y>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return x=s-f|0,n[6984]=x,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|x,n[y+4>>2]=3|f,S=e,0|y+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&h^1431655768,A=4096),l=f+48|0,(u=(a=A+(c=f+47|0)|0)&(i=0-A|0))>>>0<=f>>>0)return S=e,0;if(0|(A=0|n[7091])&&(h=(d=0|n[7089])+u|0)>>>0<=d>>>0|h>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((h=0|n[o>>2])>>>0<=r>>>0&&(h+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){b=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,b=145;break A}}else o=A,b=136;else t=0}else b=128}while(0);do{if(128==(0|b))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(g=0|n[7100])-1|0)&t?(m+t&0-g)-t|0:0)+u|0)+(g=0|n[7089])|0,t>>>0>f>>>0&t>>>0<2147483647)){if(0|(h=0|n[7091])&&m>>>0<=g>>>0|m>>>0>h>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,b=145;break A}o=A,b=136}else t=0}while(0);do{if(136==(0|b)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(x=0|ut(0|u)))|1^(v=(p=(m=0|ut(0))-x|0)>>>0>(f+40|0)>>>0)|x>>>0>>0&-1!=(0|x)&-1!=(0|m)^1)&&(s=v?p:t,a=x,b=145),145==(0|b)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|b)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(x=7&(x=c+8|0)?0-x&7:0)|0,x=(y=(0|n[6984])+s|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[c+y+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){b=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|b)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=a+(7&(d=a+8|0)?0-d&7:0)|0)+f|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-d-f|0,n[d+4>>2]=3|f;e:do{if((0|c)==(0|t))y=(0|n[6984])+l|0,n[6984]=y,n[6987]=u,n[u+4>>2]=1|y;else{if((0|n[6986])==(0|t)){y=(0|n[6983])+l|0,n[6983]=y,n[6986]=u,n[u+4>>2]=1|y,n[u+y>>2]=y;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else y=0|n[t+8>>2],n[y+12>>2]=A,n[A+8>>2]=y}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?y:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=u,n[w>>2]=u,n[u+8>>2]=y,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|d+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(y=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=y+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,w=a+(x=7&(x=a+8|0)?0-x&7:0)|0,x=(r=s+-40|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{w=t,n[(t=t+4|0)>>2]=7}while((w+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=c,n[w>>2]=c,n[c+8>>2]=y,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(y=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,w=a+(x=7&(x=a+8|0)?0-x&7:0)|0,x=(y=s+-40|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[a+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return x=t-f|0,n[6984]=x,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|x,n[y+4>>2]=3|f,S=e,0|y+8}return n[(y=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function We(A,e){e|=0;var t=0;return(A|=0)?(t=0|x(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function Ve(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0;if(u=A|=0,a=t|=0,s=f=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(f=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=d=i+1|0,A=u>>>(d>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(d>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(d=32-s|0)-1>>31&c>>>((h=s-32|0)>>>0)|(c<>>(s>>>0))&(e=h>>31),e&=c>>>(s>>>0),i=u<<(g=64-s|0)&(l=d>>31),s=(c<>>(h>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(g=0|A,0|(C(0|(h=l|0&e)),g)):(h=c>>>((g=0|Ke(0|a))>>>0)|0,g=c<<32-g|u>>>(g>>>0),0|(C(0|h),g))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),g=(c>>>0)/(a>>>0)>>>0,0|(C(0|(h=0)),g);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),g=(c>>>0)/(s>>>0)>>>0,0|(C(0|(h=0)),g);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),h=0,g=c>>>((0|Ke(0|s))>>>0),0|(C(0|h),g);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,g=0,0|(C(0|(h=0)),g)):(g=0,0|(C(0|(h=0)),g))}while(0);if(a){c=0|Ve(0|(d=0|t),0|(u=f|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(f=A>>>31|e<<1)),s=1&(h=(g=0|B())>>31|((0|g)<0?-1:0)<<1),A=0|Ze(0|r,0|f,h&d|0,(((0|g)<0?-1:0)>>31|((0|g)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),g=i<<1&-2|s,0|(C(0|(h=(0|i)>>>31|(c|a)<<1|l)),g)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|x(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|x(o,r=A>>>16))|0,e=0|x(o=e>>>16,n),0|(C((A>>>16)+(0|x(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|x(e,o))+(0|x(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return j(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(Q(0|e),D(12),-1):(0|e)>(0|r)&&!(0|N(0|e))?(D(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,d=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,d=0|tt(0|t,0|r,52),B(),(0|c)!=(15&d))return S=s,12;if(l=c+-1|0,c>>>0>1){RA(A,e,l,a),RA(t,r,l,i),u=0|n[(d=a)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|d)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|HA(u,d)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:We,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0;if(o=S,S=S+16|0,p=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=b,l=0|B()|l}while((0|c)<(0|v));b=a}else b=a;else b=A,l=e;m=0|tt(0|b,0|l,45),B();A:do{if(0|z(127&m)){if(c=0|tt(0|b,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,g=v;;){if(h=g,(g=g+-1|0)>>>0>15|(0|v)<(0|g)){u=19;break}if((0|v)!=(0|g))if(a=0|rt(0|g,0,52),a|=A,c=0|B()|m,(0|v)<(0|h))f=a;else{u=g;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=f,c=0|B()|c}while((0|u)<(0|v));f=a}else f=A,c=e;if(d=0|tt(0|f,0|c,45),B(),0|z(127&d)){d=0|tt(0|f,0|c,52),B(),d&=15;e:do{if(d)for(u=1;;){if(a=0|tt(0|f,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-h|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(f=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=v-h|0,((0|u)<0)<<31>>31),d=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|d,5,0)),0|B(),-5,-1),a=0|Ve(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=d),h=0|Ve(0|a,0|c,0|(h=0|qe(0|u,0|d,0|(h=f+-1|0),((0|h)<0)<<31>>31)),0|B()),d=0|Ve(0|h,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(h=r)>>2]=d,n[h+4>>2]=f),(0|g)<=(0|t)){u=37;break}}if(19==(0|u))M(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|pe(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,v,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(v=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|Ve(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:RA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|HA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|ze(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):He(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Ie(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Re(i)))do{e=0|de(t);do{fe(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Re(i)}while(0|A);return Ie(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,D=0,E=0,j=0,N=0,Q=0,S=0,F=0,P=0,T=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||M(27396,27235,317,27415),(e=0|Ue(i<<5))||M(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,D=0,m=0;A:for(;;){if(g=0|n[a>>2]){c=0,u=g;do{if(f=+o[u+8>>3],r=u,u=0|n[u+16>>2],d=+o[(s=(h=!(0|u))?g:u)+8>>3],+l(+(f-d))>3.141592653589793){L=14;break}c+=(d-f)*(+o[r>>3]+ +o[s>>3])}while(!h);if(14==(0|L)){L=0,c=0,r=g;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:g)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=D,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|We(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(D<<5)|0,h=0|n[a>>2]){for(o[(g=e+(D<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(D<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(b=e+(D<<5)+16|0)>>3]=-17976931348623157e292,y=17976931348623157e292,k=-17976931348623157e292,s=0,p=h,f=17976931348623157e292,x=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((v=!(0|p))?h:p)+8>>3],c>3]=c,f=c),B>3]=B,x=B),c>w?o[u>>3]=c:c=w,B>d&&(o[b>>3]=B,d=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)w=c;s&&(o[b>>3]=k,o[m>>3]=y)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=D+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}D=s,m=r}if(21==(0|L))M(27213,27235,35,27247);else if(23==(0|L))M(27267,27235,37,27247);else if(27==(0|L))M(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),Q=s<<2,S=!(0|A),N=0,r=0;;){if(j=0|n[t+(N<<2)>>2],F)L=73;else{if(!(D=0|Ue(Q))){L=50;break}if(!(E=0|Ue(Q))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|ge(0|n[u>>2],a,0|n[j>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[D>>2],1==(0|v))i=a;else for(b=0,p=-1,i=a,m=a;;){for(h=0|n[m>>2],a=0,u=0;g=(0|(s=0|n[n[D+(u<<2)>>2]>>2]))==(0|h)?a:a+(1&ge(s,0|n[E+(u<<2)>>2],0|n[h>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=g;if(i=(s=(0|g)>(0|p))?m:i,(0|(a=b+1|0))==(0|v))break e;b=a,p=s?g:p,m=0|n[D+(a<<2)>>2]}else i=0}}while(0);if(Ye(D),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=j,n[s>>2]=j}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[j>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(j),r=1}if((0|(N=N+1|0))>=(0|P)){T=r;break A}}50==(0|L)?M(27452,27235,249,27471):52==(0|L)?M(27490,27235,252,27471):70==(0|L)&&M(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(he(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&M(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(d=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[d>>2])>>>0>A>>>0:0))))return S=a,2;d=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|z(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|d)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=d-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|Ve(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|Ve(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),g=0|n[(f=i)>>2],f=0|n[f+4>>2],h=0|rt(7,0,0|(m=3*(u+r|0)|0)),f&=~B(),m=0|rt(0|(o=0|Ve(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),f=0|B()|f,n[(o=i)>>2]=m|g&~h,n[o+4>>2]=f,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}h=0|n[(m=i)>>2],m=0|n[m+4>>2],g=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=h&~g,n[s+4>>2]=m,s=1;break}o=0|n[(h=i)>>2],h=0|n[h+4>>2],f=0|rt(7,0,0|(r=3*(u+r|0)|0)),h&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),h=0|B()|h,n[(g=i)>>2]=r|o&~f,n[g+4>>2]=h,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|d)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|d)<1)return S=a,0;for(o=15^l,s=1;;){if(g=0|pe(7,0,g=d-s|0,((0|g)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(f=0|Xe(0|A,0|e,0|g,0|m)),0|(h=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|f,0|h,0|g,0|m)),0|B()),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,D=0,E=0,j=0,N=0,Q=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{Q=0|n[4+(N=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[N>>2],n[S+4>>2]=Q,i=0|Ve(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(Q=0|Ue(o=t<<3)))return 13;if(st(0|Q,0|A,0|o),!(N=0|We(t,8)))return Ye(Q),13;A:for(;;){E=0|tt(0|(u=0|n[(i=Q)>>2]),0|(i=0|n[i+4>>2]),52),B(),j=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(x=0|rt(0|j,0,52),w=0|B(),j>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|Ve(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=Q+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|j)){i=12,S=27;break A}if((0|d)!=(0|j)&&(l|=x,A=-15728641&A|w,d>>>0>=E>>>0)){c=j;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(h=0|At(0|l,0|A,0|t,0|r),g=0|B(),!(!(0|(f=0|n[(d=c=N+(h<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,v=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|f)==(0|l)&(-117440513&d)==(0|A)){m=0|tt(0|f,0|d,56),B(),b=1+(m&=7)|0,k=0|tt(0|f,0|d,45),B();t:do{if(0|z(127&k)){if(f=0|tt(0|f,0|d,52),B(),!(f&=15)){d=6;break}for(d=1;;){if(!(!((k=0|rt(7,0,3*(15-d|0)|0))&l)&!((0|B())&A))){d=7;break t}if(!(d>>>0>>0)){d=6;break}d=d+1|0}}else d=7}while(0);if((m+2|0)>>>0>d>>>0){S=41;break A}k=0|rt(0|b,0,56),A=B()|-117440513&A,n[(y=c)>>2]=0,n[y+4>>2]=0,l|=k}else h=0|$e(0|(h=0|Ve(0|h,0|g,1,0)),0|B(),0|t,0|r),g=0|B();v=0|Ve(0|v,0|p,1,0),p=0|B(),f=0|n[(d=c=N+(h<<3)|0)>>2],d=0|n[d+4>>2]}while(!(!(0|f)&!(0|d)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|Ve(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=Q+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|Ve(0|t,0|r,5,0),(y=0|B())>>>0<0|!(0|y)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){S=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=d=N+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{f=0|tt(0|a,0|s,56),B(),l=1+(f&=7)|0,h=-117440513&s,y=0|tt(0|a,0|s,45),B();e:do{if(0|z(127&y)){if(g=0|tt(0|a,0|s,52),B(),0|(g&=15))for(c=1;;){if(!(!(a&(y=0|rt(7,0,3*(15-c|0)|0)))&!(h&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|h,n[(l=d)>>2]=a,n[l+4>>2]=s,l=f+2|0}}while(0);7==(0|l)?(n[(y=k+(A<<3)|0)>>2]=a,n[y+4>>2]=-117440513&s,A=0|Ve(0|A,0|m,1,0),y=0|B()):y=m}if(b=0|Ve(0|b,0|p,1,0),!((0|(p=0|B()))<(0|r)|(0|p)==(0|r)&b>>>0>>0))break;m=y}if(C){if(v=j>>>0>15,x=0|rt(0|j,0,52),w=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(j=e+(a<<3)|0)>>2]=u,n[j+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()),l=0|Ve(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=Q+(l<<3)|0)>>2],i=0|n[i+4>>2];i=y;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(g=0|tt(0|u,0|i,52),B(),v|(0|(g&=15))<(0|j)){S=80;break A}if((0|g)!=(0|j)){if(d=u|x,f=-15728641&i|w,g>>>0>=E>>>0){h=j;do{D=0|rt(7,0,3*(14-h|0)|0),h=h+1|0,d|=D,f=0|B()|f}while(h>>>0>>0)}}else d=u,f=i;m=0|At(0|d,0|f,0|t,0|r),h=0,g=0,p=0|B();do{if((0|h)>(0|r)|(0|h)==(0|r)&g>>>0>t>>>0){S=81;break A}if((-117440513&(b=0|n[4+(D=N+(m<<3)|0)>>2]))==(0|f)&&(0|n[D>>2])==(0|d)){S=65;break}m=0|$e(0|(D=0|Ve(0|m,0|p,1,0)),0|B(),0|t,0|r),p=0|B(),g=0|Ve(0|g,0|h,1,0),h=0|B(),D=N+(m<<3)|0}while((0|n[D>>2])!=(0|d)||(0|n[D+4>>2])!=(0|f));if(65==(0|S)&&(S=0,!0&100663296==(117440512&b)))break;n[(D=e+(a<<3)|0)>>2]=u,n[D+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|Ve(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0>>0))break;u=0|n[(i=Q+(s<<3)|0)>>2],i=0|n[i+4>>2]}i=y}else a=0,i=y}else a=0,A=0,i=0}while(0);if(lt(0|N,0,0|o),st(0|Q,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){S=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|S))!0&!(117440512&i)?(i=4,S=27):S=21;else if(31==(0|S))M(27795,27122,620,27132);else{if(41==(0|S))return Ye(Q),Ye(N),10;if(48==(0|S))return Ye(Q),Ye(N),13;80==(0|S)?M(27795,27122,711,27132):81==(0|S)?M(27795,27122,723,27132):85==(0|S)&&(st(0|e,0|Q,t<<3),S=89)}return 21==(0|S)?(Ye(Q),Ye(N),0|(S=5)):27==(0|S)?(Ye(Q),Ye(N),0|(S=i)):89==(0|S)?(Ye(Q),Ye(N),0|(S=0)):0},_constructCell:function(A,e,t,o){t|=0,o|=0;var i=0,a=0,s=0,l=0,c=0,u=0;if((A|=0)>>>0>15)return 4;if((e|=0)>>>0>121)return 17;s=0|rt(0|A,0,52),i=0|B(),l=0|rt(0|e,0,45),i=0|i|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),a=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){i=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){i=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),i&=~B(),a=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|a&~c,i=0|B()|i,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|i}else a=-1}while(0);return n[(u=o)>>2]=a,n[u+4>>2]=i,0},_destroyLinkedMultiPolygon:he,_directedEdgeToBoundary:DA,_directedEdgeToCells:function(A,e,t){A|=0;var r,o,i,a=0;return r=S,S=S+16|0,a=r,!0&268435456==(2013265920&(e|=0))?(o=-2130706433&e|134217728,n[(i=t|=0)>>2]=A,n[i+4>>2]=o,n[a>>2]=0,e=0|tt(0|A,0|e,56),B(),a=0|I(A,o,7&e,a,t+8|0),S=r,0|a):(S=r,0|(a=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,h=0,g=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{h=i,i=+o[l+8+((A=A+1|0)<<4)>>3],g=+f(.5*(i-h)),u=a,a=+o[l+8+(A<<4)+8>>3],u=g*g+(u=+f(.5*(a-u)))*(+d(+h)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,g=s,g*=6371.007180918475,o[t>>3]=g,S=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,h=0,g=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{h=i,i=+o[l+8+((A=A+1|0)<<4)>>3],g=+f(.5*(i-h)),u=a,a=+o[l+8+(A<<4)+8>>3],u=g*g+(u=+f(.5*(a-u)))*(+d(+h)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,g=s,g*=6371.007180918475,g*=1e3,o[t>>3]=g,S=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,h=0,g=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return S=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return S=r,0;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{h=i,i=+o[l+8+((A=A+1|0)<<4)>>3],g=+f(.5*(i-h)),u=a,a=+o[l+8+(A<<4)+8>>3],u=g*g+(u=+f(.5*(a-u)))*(+d(+i)*+d(+h)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,S=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),o=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=S,S=S+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|I(A,-2130706433&e|134217728,7&o,i,t),S=r,0|i):(S=r,0|(i=6))},_getDirectedEdgeOrigin:function(A,e,t){return A|=0,t|=0,!0&268435456==(2013265920&(e|=0))?(n[t>>2]=A,n[t+4>>2]=-2130706433&e|134217728,0|(t=0)):0|(t=6)},_getHexagonAreaAvgKm2:se,_getHexagonAreaAvgM2:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;o=S,S=S+128|0,d=o+112|0,s=o+96|0,f=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[d>>2]=c,l=0|tt(0|e,0|t,45),B(),l&=127;A:do{if(0|z(l)){if(0|c)for(i=1;;){if(!(!((u=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){a=0;break A}if(!(i>>>0>>0))break;i=i+1|0}if(!(1&a))return u=0|rt(c+1|0,0,52),f=B()|-15728641&t,f=0|A((u|e)&~(d=0|rt(7,0,3*(14-c|0)|0)),f&~B(),r),S=o,0|f;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(NA(s,d,f),u=5):(PA(s,d,f),u=6);A:do{if(0|z(l))if(c)for(i=1;;){if(!(!((l=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(i>>>0>>0)){e=5;break}i=i+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(a)for(s=0;;){if(SA(l=f+(s<<4)|0,0|n[d>>2]),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}else for(s=0;;){if(QA(l=f+(s<<4)|0,0|n[d>>2],0,1),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}}while(0)}return S=o,0|i},_getIndexDigit:function(A,e,t,r){return r|=0,((t|=0)-1|0)>>>0>14?0|(r=4):(t=0|tt(0|(A|=0),0|(e|=0),3*(15-t|0)|0),B(),n[r>>2]=7&t,0|(r=0))},_getNumCells:le,_getPentagons:Ae,_getRes0Cells:function(A){A|=0;var e=0,t=0,r=0;e=0;do{rt(0|e,0,45),r=134225919|B(),n[(t=A+(e<<3)|0)>>2]=-1,n[t+4>>2]=r,e=e+1|0}while(122!=(0|e));return 0},_getResolution:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),15&e},_greatCircleDistanceKm:ae,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:P,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=S,S=S+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(S=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(S=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,S=a,0|(l=0))},_gridPathCells:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,D=0,E=0;if(a=S,S=S+48|0,c=a+12|0,D=a,!(s=0|me(A|=0,e|=0,A,e,i=a+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(i,c)))<0)<<31>>31,n[i>>2]=0,n[i+4>>2]=0,n[i+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,i)&&M(27795,27538,692,27747),0|me(A,e,t,r,c)&&M(27795,27538,697,27747),CA(i),CA(c),h=0|k?1/+(0|k):0,t=0|n[i>>2],v=h*+((0|n[c>>2])-t|0),r=0|n[(x=i+4|0)>>2],w=h*+((0|n[c+4>>2])-r|0),s=0|n[(y=i+8|0)>>2],h*=+((0|n[c+8>>2])-s|0),n[D>>2]=t,n[(g=D+4|0)>>2]=r,n[(m=D+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(b=0,p=0;;){E=v*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=h*d+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+d),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(E>u&E>d)){if(f=0-t|0,u>d){r=f-s|0;break}r=c,s=f-c|0;break}t=0-(c+s)|0,r=c}while(0);if(n[D>>2]=t,n[g>>2]=r,n[m>>2]=s,BA(D),0|(s=0|be(A,e,D,o+(p<<3)|0)))break A;if(!((0|b)<(0|C)|(0|b)==(0|C)&p>>>0>>0)){s=0;break A}t=0|Ve(0|p,0|b,1,0),b=r=0|B(),p=t,t=0|n[i>>2],r=0|n[x>>2],s=0|n[y>>2]}}while(0);return S=a,0|s}return S=a,0|s},_gridPathCellsSize:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a=0,s=0,l=0;return i=S,S=S+32|0,l=i,(a=0|me(A|=0,e|=0,A,e,s=i+12|0))||(a=0|me(A,e,t,r,l))?(S=i,0|(l=a)):(r=0|Ve(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=o)>>2]=r,n[l+4>>2]=s,S=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|R(A|=0,e|=0,t|=0,r|=0)?(lt(0|r,0,48*t|0),0|(r=0|function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;if(o=S,S=S+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,S=o,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(i=0|le(15,s)))break;i=0|n[(a=s)>>2],a=0|n[a+4>>2]}else d=0|qe(0|t,0|(i=((0|t)<0)<<31>>31),3,0),a=0|B(),i=0|Ve(0|t,0|i,1,0),i=0|Ve(0|(i=0|qe(0|d,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(d=s)>>2]=i,n[d+4>>2]=a;if(u=0|We(i,8)){if(!(d=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|L(A,e,t,u,d,i,a,0))){Ye(u),Ye(d);break}if(e=0|n[s>>2],(0|(s=0|n[s+4>>2]))>0|!(0|s)&e>>>0>0){i=0,l=0,c=0;do{!(0|(a=0|n[(A=u+(l<<3)|0)>>2]))&!(0|(A=0|n[A+4>>2]))||(0|n[d+(l<<2)>>2])!=(0|t)||(n[(f=r+(i<<3)|0)>>2]=a,n[f+4>>2]=A,i=i+1|0),l=0|Ve(0|l,0|c,1,0),c=0|B()}while((0|c)<(0|s)|(0|c)==(0|s)&l>>>0>>0)}Ye(u),Ye(d),i=0}else i=13}else i=2}while(0);return S=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:R,_i64Add:Ve,_i64Subtract:Ze,_isPentagon:HA,_isResClassIII:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),1&e},_isValidCell:LA,_isValidDirectedEdge:MA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,o=0,i=0;if(!0&134217728==(-16777216&(e|=0))&&(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0<=121)&&!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(i=0|nt(0|A,0|t),B(),(63-i|0)%3|0)return 1}return 0|MA(A,e)?0|(i=1):0|(i=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:KA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:ot,_llvm_minnum_f64:it,_llvm_round_f64:at,_localIjToCell:function(A,e,t,r,o){var i,a;return A|=0,e|=0,t|=0,o|=0,a=S,S=S+16|0,i=a,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,o,i=0,a=0,s=0;if(a=0|n[(A|=0)>>2],n[e>>2]=a,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(o=e+8|0)>>2]=0,A=(i=(0|s)<(0|a))?a:s,(0|(i=i?s:a))<0){if(-2147483648==(0|i)||((0|A)>0?(2147483647-A|0)<(0|i):(-2147483648-A|0)>(0|i)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|i):(-2147483648^A)<(0|i))return 1}return A=s-a|0,(0|a)<0?(i=0-a|0,n[r>>2]=A,n[o>>2]=i,n[e>>2]=0,a=0):(A=s,i=0),(0|A)<0&&(a=a-A|0,n[e>>2]=a,i=i-A|0,n[o>>2]=i,n[r>>2]=0,A=0),t=a-i|0,s=A-i|0,(0|i)<0?(n[e>>2]=t,n[r>>2]=s,n[o>>2]=0,A=s,s=t,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|A)<(0|s)?A:s))?i:a))<=0||(n[e>>2]=s-a,n[r>>2]=A-a,n[o>>2]=i-a),0}(t,i))||(t=0|be(A,e,i,o)),S=a,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,o=0;if(o=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&o)))return o=2,n[t>>2]=o,0;if(o=0|tt(0|A,0|e,52),B(),!(o&=15))return o=5,n[t>>2]=o,0;for(r=1;;){if(!(!((0|rt(7,0,3*(15-r|0)|0))&A)&!((0|B())&e))){r=2,A=6;break}if(!(r>>>0>>0)){r=5,A=6;break}r=r+1|0}return 6==(0|A)?(n[t>>2]=r,0):0},_maxGridDiskSize:function(A,e){e|=0;var t=0,r=0,o=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(o=0|qe(0|A,0|(t=((0|A)<0)<<31>>31),3,0),r=0|B(),t=0|Ve(0|A,0|t,1,0),t=0|Ve(0|(t=0|qe(0|o,0|r,0|t,0|B())),0|B(),1,0),A=0|B(),n[e>>2]=t,n[e+4>>2]=A,0|(e=0))},_maxPolygonToCellsSize:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0;if(o=S,S=S+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return S=o,0|t;if(l=0|n[(c=A)+4>>2],n[(t=a)>>2]=n[c>>2],n[t+4>>2]=l,ke(a,i),!(t=0|eA(i,e,s))){if(e=0|n[a>>2],(0|(a=0|n[A+8>>2]))>0){i=0|n[A+12>>2],t=0;do{e=(0|n[i+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a))}i=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(a=((0|e)<0)<<31>>31))|(0|t)==(0|a)&i>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=a,t=a):e=i,l=0|Ve(0|e,0|t,12,0),c=0|B(),n[(t=s)>>2]=l,n[t+4>>2]=c,n[(t=r)>>2]=l,n[t+4>>2]=c,t=0}return S=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,f=0,h=0,g=0,m=0,b=0,p=0;if(s=S,S=S+48|0,g=s+32|0,h=s+40|0,a=s,!(0|n[(A|=0)>>2]))return n[(m=i)>>2]=0,n[m+4>>2]=0,S=s,0;IA(g,0,0,0),c=0|n[(f=g)>>2],f=0|n[f+4>>2];do{if(e>>>0>15)n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|h],r[t+1|0]=0|r[h+1|0],r[t+2|0]=0|r[h+2|0],t=4,m=9;else{if(0|(t=0|Ce(t))){n[(g=a)>>2]=0,n[g+4>>2]=0,n[a+8>>2]=t,n[a+12>>2]=-1,m=a+29|0,n[(g=a+16|0)>>2]=0,n[g+4>>2]=0,n[g+8>>2]=0,r[g+12|0]=0,r[0|m]=0|r[0|h],r[m+1|0]=0|r[h+1|0],r[m+2|0]=0|r[h+2|0],m=9;break}if(!(t=0|We(1+(0|n[A+8>>2])|0,32))){n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|h],r[t+1|0]=0|r[h+1|0],r[t+2|0]=0|r[h+2|0],t=13,m=9;break}Be(A,t),n[(p=a)>>2]=c,n[p+4>>2]=f,n[(f=a+8|0)>>2]=0,n[a+12>>2]=e,n[a+20>>2]=A,n[a+24>>2]=t,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|h],r[c+1|0]=0|r[h+1|0],r[c+2|0]=0|r[h+2|0],n[a+16>>2]=3,b=+J(t),b*=+Z(t),u=+l(+ +o[t>>3]),u=b/+d(+ +it(+u,+ +l(+ +o[t+8>>3])))*6371.007180918475*6371.007180918475,t=0|n[(c=a+12|0)>>2];A:do{if((0|t)>0)do{if(se(t+-1|0,g),!(u/+o[g>>3]>10))break A;t=(p=0|n[c>>2])-1|0,n[c>>2]=t}while((0|p)>1)}while(0);if(xe(a),n[(c=i)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=a)>>2]))&!(0|(c=0|n[c+4>>2]))))do{_A(t,c,e,g),h=g,h=0|Ve(0|n[(A=i)>>2],0|n[A+4>>2],0|n[h>>2],0|n[h+4>>2]),A=0|B(),n[(p=i)>>2]=h,n[p+4>>2]=A,xe(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return S=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,o=0;return r=!(0|HA(A|=0,e|=0)),e&=-2130706433,n[(o=t)>>2]=r?A:0,n[o+4>>2]=r?285212672|e:0,n[(o=t+8|0)>>2]=A,n[o+4>>2]=301989888|e,n[(o=t+16|0)>>2]=A,n[o+4>>2]=318767104|e,n[(o=t+24|0)>>2]=A,n[o+4>>2]=335544320|e,n[(o=t+32|0)>>2]=A,n[o+4>>2]=352321536|e,n[(t=t+40|0)>>2]=A,n[t+4>>2]=369098752|e,0},_pentagonCount:function(){return 12},_polygonToCells:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i,a,s,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,j=0,N=0,Q=0,F=0,P=0,I=0,R=0,_=0;if(s=S,S=S+112|0,o=s+80|0,f=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return S=s,0|l;if(!(_=0|Ue(32+(n[(h=A+8|0)>>2]<<5)|0)))return S=s,13;if(Be(A,_),!(l=0|Ce(t))){if(R=0|n[(I=A)+4>>2],n[(l=f)>>2]=n[I>>2],n[l+4>>2]=R,ke(f,o),l=0|eA(o,e,i))I=0,R=0;else{if(l=0|n[f>>2],(0|(c=0|n[h>>2]))>0){u=0|n[A+12>>2],t=0;do{l=(0|n[u+(t<<3)>>2])+l|0,t=t+1|0}while((0|t)!=(0|c));t=l}else t=l;c=0|n[(l=i)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=i)>>2]=t,n[l+4>>2]=u,l=u):t=c,I=0|Ve(0|t,0|l,12,0),R=0|B(),n[(l=i)>>2]=I,n[l+4>>2]=R,l=0}if(!l){if(!(t=0|We(I,8)))return Ye(_),S=s,13;if(!(d=0|We(I,8)))return Ye(_),Ye(t),S=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,P=0|n[(F=A)+4>>2],n[(l=f)>>2]=n[F>>2],n[l+4>>2]=P,l=0|H(f,I,R,e,o,t,d);A:do{if(l)Ye(t),Ye(d),Ye(_);else{e:do{if((0|n[h>>2])>0){for(u=A+12|0,c=0;l=0|H((0|n[u>>2])+(c<<3)|0,I,R,e,o,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[h>>2]))break e;Ye(t),Ye(d),Ye(_);break A}}while(0);(0|R)>0|!(0|R)&I>>>0>0&<(0|d,0,I<<3),F=0|n[(P=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[P>>2])>>>0>0){j=t,N=d,Q=t,F=d,P=t,l=t,M=t,D=d,E=d,t=d;t:for(;;){for(w=0,y=0,k=0,C=0,c=0,u=0;;){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|T(h=0|n[(e=j+(w<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(L(h,e,1,i,d,7,0,0),Ye(d))}for(x=0;;){p=0|n[(v=i+(x<<3)|0)>>2],v=0|n[v+4>>2];r:do{if(!(0|p)&!(0|v))d=c,f=u;else{if(g=0|At(0|p,0|v,0|I,0|R),h=0|B(),!(!(0|(f=0|n[(e=d=r+(g<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|R)|(0|m)==(0|R)&b>>>0>I>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|v)){d=c,f=u;break r}g=0|$e(0|(d=0|Ve(0|g,0|h,1,0)),0|B(),0|I,0|R),h=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(g<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|v)){d=c,f=u;break}qA(p,v,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=v,n[(c=N+(c<<3)|0)>>2]=p,n[c+4>>2]=v,c=b),d=c,f=u}}while(0);if((x=x+1|0)>>>0>=7)break;c=d,u=f}if(w=0|Ve(0|w,0|y,1,0),y=0|B(),k=0|Ve(0|k,0|C,1,0),C=0|B(),c=0|n[(u=o)>>2],!((0|C)<(0|(u=0|n[u+4>>2]))|(0|C)==(0|u)&k>>>0>>0))break;c=d,u=f}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=j+(c<<3)|0)>>2]=0,n[C+4>>2]=0,c=0|Ve(0|c,0|u,1,0),u=0|B(),k=0|n[(C=o)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=o)>>2]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;x=t,w=E,y=P,k=D,C=N,t=M,E=l,D=Q,M=x,l=w,P=F,F=y,Q=k,N=j,j=C}Ye(Q),Ye(F),Ye(_),l=1;break A}l=d}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return S=s,0|l}}return Ye(_),S=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,d=0,f=0,h=0,g=0,m=0,b=0,p=0;c=S,S=S+160|0,d=c+64|0,g=c+112|0,p=c,function(A,e,t,o){A|=0,e|=0,t|=0,o|=0;var i,a,s,l=0,c=0,u=0,d=0;s=S,S=S+48|0,i=s+40|0,a=s,IA(c=s+32|0,0,0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n[h>>2],n[m+4>>2]=n[h+4>>2],n[m+8>>2]=n[h+8>>2],n[m+12>>2]=n[h+12>>2],n[m+16>>2]=n[h+16>>2],n[m+20>>2]=n[h+20>>2],n[m+24>>2]=n[h+24>>2],n[m+28>>2]=n[h+28>>2],n[(m=p)>>2]=s,n[m+4>>2]=f,n[(m=p+8|0)>>2]=u,e=g,t=36+(A=p+12|0)|0;do{n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}while((0|A)<(0|t));if(n[(g=p+48|0)>>2]=n[d>>2],n[g+4>>2]=n[d+4>>2],n[g+8>>2]=n[d+8>>2],n[g+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return S=c,0|u;t=p+16|0,l=p+24|0,h=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=a+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(g),!(0|(e=0|n[(A=g)>>2]))&!(0|(A=0|n[A+4>>2]))){if(xe(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){b=10;break}te(A,e,0|n[h>>2],g),e=0|n[(A=g)>>2],A=0|n[A+4>>2]}n[(f=p)>>2]=e,n[f+4>>2]=A}while(!(!(0|e)&!(0|A)));return 4==(0|b)?(0|(e=0|n[(A=p+40|0)>>2])&&Ye(e),n[(b=p+16|0)>>2]=0,n[b+4>>2]=0,n[l>>2]=0,n[p+36>>2]=0,n[h>>2]=-1,n[p+32>>2]=0,n[A>>2]=0,te(0,0,0,g),n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=0,S=c,0|(p=14)):(10==(0|b)&&(n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=n[l>>2]),p=0|n[m>>2],S=c,0|p)},_readInt64AsDoubleFromPointer:function(A){return+(+((0|n[(A|=0)>>2])>>>0)+4294967296*+(0|n[A+4>>2]))},_res0CellCount:function(){return 122},_round:ct,_sbrk:ut,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(A,e,t,r,o,i,a){A|=0,r|=0,o|=0,i|=0;var s,l=0,c=0,u=0,d=0,f=0,h=0,g=0,m=0;if(s=S,S=S+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return S=s,0;if((0|(a|=0))>=16)return S=s,12;h=0,g=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(h<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(f=r+(c<<3)|0)>>2]=u,n[f+4>>2]=d,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(f=m)>>2],d=0|n[f+4>>2]}while(!(!(0|u)&!(0|d)))}if(h=0|Ve(0|h,0|g,1,0),!((0|(g=0|B()))<(0|t)|(0|g)==(0|t)&h>>>0>>0)){l=0,c=11;break}f=c}return 10==(0|c)?(S=s,0|(m=14)):11==(0|c)?(S=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0;a=S,S=S+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(d=0,l=0,s=0,f=0;;){if(!(!(0|(c=0|n[(u=A+(d<<3)|0)>>2]))&!(0|(u=0|n[u+4>>2]))||(u=!(0|_A(c,u,r,i)),l=0|Ve(0|n[(c=i)>>2],0|n[c+4>>2],0|l,0|s),s=0|B(),u))){s=12;break}if(d=0|Ve(0|d,0|f,1,0),!((0|(f=0|B()))<(0|t)|(0|f)==(0|t)&d>>>0>>0))break A}return S=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,S=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=S,S=S+192|0,o=a,i=a+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,i))?(S=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,l)?jA(i,e,s,1,o):FA(i,e,s,1,o),l=o+8|0,n[t>>2]=n[l>>2],n[t+4>>2]=n[l+4>>2],n[t+8>>2]=n[l+8>>2],n[t+12>>2]=n[l+12>>2],S=a,0|(l=0))},establishStackSpace:function(A,e){S=A|=0},stackAlloc:function(A){var e;return e=S,S=15+(S=S+(A|=0)|0)&-16,0|e},stackRestore:function(A){S=A|=0},stackSave:function(){return 0|S}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(A){s=A},c:function(){return s},d:function(A,e,t,r){tA("Assertion failed: "+v(A)+", at: "+[e?v(e):"unknown filename",t,r?v(r):"unknown function"])},e:function(A){return t.___errno_location&&(g[t.___errno_location()>>2]=A),A},f:z,g:function(A,e,t){f.set(f.subarray(e,e+t),A)},h:function(A){var e=z(),t=16777216,r=2130706432;if(A>r)return!1;for(var n=Math.max(e,16777216);n0))return 0;for(var n=t+r-1,o=0;o=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++o)),i<=127){if(t>=n)break;e[t++]=i}else if(i<=2047){if(t+1>=n)break;e[t++]=192|i>>6,e[t++]=128|63&i}else if(i<=65535){if(t+2>=n)break;e[t++]=224|i>>12,e[t++]=128|i>>6&63,e[t++]=128|63&i}else{if(t+3>=n)break;e[t++]=240|i>>18,e[t++]=128|i>>12&63,e[t++]=128|i>>6&63,e[t++]=128|63&i}}e[t]=0}(A,f,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,d.set(e,t),r}},o=c(A),i=[],a=0;if(r)for(var s=0;s>1]=e;break;case"i32":g[A>>2]=e;break;case"i64":I=[e>>>0,(L=e,+N(L)>=1?L>0?(0|F(+S(L/4294967296),4294967295))>>>0:~~+Q((L-+(~~L>>>0))/4294967296)>>>0:0)],g[A>>2]=I[0],g[A+4>>2]=I[1];break;case"float":m[A>>2]=e;break;case"double":b[A>>3]=e;break;default:tA("invalid type for setValue: "+t)}},t.getValue=function(A,e,t){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return d[0|A];case"i16":return h[A>>1];case"i32":case"i64":return g[A>>2];case"float":return m[A>>2];case"double":return b[A>>3];default:tA("invalid type for getValue: "+e)}return null},R){H(R)||(W=R,R=t.locateFile?t.locateFile(W,o):o+W),P++,t.monitorRunDependencies&&t.monitorRunDependencies(P);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),f.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&T){var A=T;T=null,A()}}()},q=function(){n(R,X,function(){throw"could not load memory initializer "+R})},$=O(R);if($)X($.buffer);else if(t.memoryInitializerRequest){var AA=function(){var A=t.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=O(t.memoryInitializerRequestURL);if(!r)return void q();e=r.buffer}X(e)};t.memoryInitializerRequest.response?setTimeout(AA,0):t.memoryInitializerRequest.addEventListener("load",AA)}else q()}function eA(A){function e(){V||(V=!0,l||(k(B),k(M),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)j(t.postRun.shift());k(D)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}function tA(A){throw t.onAbort&&t.onAbort(A),i(A+=""),a(A),l=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info."}if(T=function A(){V||eA(),V||(T=A)},t.run=eA,t.abort=tA,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return eA(),A}("object"==typeof De?De:{}),Ee="number",je={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid",16:"Index argument was not valid",17:"Base cell number was outside of acceptable range",18:"Child indexing digits invalid",19:"Child indexing digits refer to a deleted subsequence"},Ne={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function Qe(A,e,t){var r=t&&"value"in t,n=new Error((A[e]||"Unknown error")+" (code: "+e+(r?", value: "+t.value:"")+")");return n.code=e,n}function Se(A){if(0!==A)throw function(A,e){return Qe(je,A,2===arguments.length?{value:e}:{})}(A)}var Fe={};[["sizeOfH3Index",Ee],["sizeOfLatLng",Ee],["sizeOfCellBoundary",Ee],["sizeOfGeoLoop",Ee],["sizeOfGeoPolygon",Ee],["sizeOfLinkedGeoPolygon",Ee],["sizeOfCoordIJ",Ee],["readInt64AsDoubleFromPointer",Ee],["isValidCell",Ee,[Ee,Ee]],["isValidIndex",Ee,[Ee,Ee]],["latLngToCell",Ee,[Ee,Ee,Ee,Ee]],["cellToLatLng",Ee,[Ee,Ee,Ee]],["cellToBoundary",Ee,[Ee,Ee,Ee]],["maxGridDiskSize",Ee,[Ee,Ee]],["gridDisk",Ee,[Ee,Ee,Ee,Ee]],["gridDiskDistances",Ee,[Ee,Ee,Ee,Ee,Ee]],["gridRing",Ee,[Ee,Ee,Ee,Ee]],["gridRingUnsafe",Ee,[Ee,Ee,Ee,Ee]],["maxPolygonToCellsSize",Ee,[Ee,Ee,Ee,Ee]],["polygonToCells",Ee,[Ee,Ee,Ee,Ee]],["maxPolygonToCellsSizeExperimental",Ee,[Ee,Ee,Ee,Ee]],["polygonToCellsExperimental",Ee,[Ee,Ee,Ee,Ee,Ee,Ee]],["cellsToLinkedMultiPolygon",Ee,[Ee,Ee,Ee]],["destroyLinkedMultiPolygon",null,[Ee]],["compactCells",Ee,[Ee,Ee,Ee,Ee]],["uncompactCells",Ee,[Ee,Ee,Ee,Ee,Ee,Ee]],["uncompactCellsSize",Ee,[Ee,Ee,Ee,Ee,Ee]],["isPentagon",Ee,[Ee,Ee]],["isResClassIII",Ee,[Ee,Ee]],["getBaseCellNumber",Ee,[Ee,Ee]],["getResolution",Ee,[Ee,Ee]],["getIndexDigit",Ee,[Ee,Ee,Ee]],["constructCell",Ee,[Ee,Ee,Ee,Ee]],["maxFaceCount",Ee,[Ee,Ee,Ee]],["getIcosahedronFaces",Ee,[Ee,Ee,Ee]],["cellToParent",Ee,[Ee,Ee,Ee,Ee]],["cellToChildren",Ee,[Ee,Ee,Ee,Ee]],["cellToCenterChild",Ee,[Ee,Ee,Ee,Ee]],["cellToChildrenSize",Ee,[Ee,Ee,Ee,Ee]],["cellToChildPos",Ee,[Ee,Ee,Ee,Ee]],["childPosToCell",Ee,[Ee,Ee,Ee,Ee,Ee,Ee]],["areNeighborCells",Ee,[Ee,Ee,Ee,Ee,Ee]],["cellsToDirectedEdge",Ee,[Ee,Ee,Ee,Ee,Ee]],["getDirectedEdgeOrigin",Ee,[Ee,Ee,Ee]],["getDirectedEdgeDestination",Ee,[Ee,Ee,Ee]],["isValidDirectedEdge",Ee,[Ee,Ee]],["directedEdgeToCells",Ee,[Ee,Ee,Ee]],["originToDirectedEdges",Ee,[Ee,Ee,Ee]],["directedEdgeToBoundary",Ee,[Ee,Ee,Ee]],["gridDistance",Ee,[Ee,Ee,Ee,Ee,Ee]],["gridPathCells",Ee,[Ee,Ee,Ee,Ee,Ee]],["gridPathCellsSize",Ee,[Ee,Ee,Ee,Ee,Ee]],["cellToLocalIj",Ee,[Ee,Ee,Ee,Ee,Ee,Ee]],["localIjToCell",Ee,[Ee,Ee,Ee,Ee,Ee]],["getHexagonAreaAvgM2",Ee,[Ee,Ee]],["getHexagonAreaAvgKm2",Ee,[Ee,Ee]],["getHexagonEdgeLengthAvgM",Ee,[Ee,Ee]],["getHexagonEdgeLengthAvgKm",Ee,[Ee,Ee]],["greatCircleDistanceM",Ee,[Ee,Ee]],["greatCircleDistanceKm",Ee,[Ee,Ee]],["greatCircleDistanceRads",Ee,[Ee,Ee]],["cellAreaM2",Ee,[Ee,Ee,Ee]],["cellAreaKm2",Ee,[Ee,Ee,Ee]],["cellAreaRads2",Ee,[Ee,Ee,Ee]],["edgeLengthM",Ee,[Ee,Ee,Ee]],["edgeLengthKm",Ee,[Ee,Ee,Ee]],["edgeLengthRads",Ee,[Ee,Ee,Ee]],["getNumCells",Ee,[Ee,Ee]],["getRes0Cells",Ee,[Ee]],["res0CellCount",Ee],["getPentagons",Ee,[Ee,Ee]],["pentagonCount",Ee],["cellToVertex",Ee,[Ee,Ee,Ee,Ee]],["cellToVertexes",Ee,[Ee,Ee,Ee]],["vertexToLatLng",Ee,[Ee,Ee,Ee]],["isValidVertex",Ee,[Ee,Ee]]].forEach(function(A){Fe[A[0]]=De.cwrap.apply(De,A)});var Pe=16,Te=Fe.sizeOfH3Index(),Le=Fe.sizeOfLatLng(),Ie=Fe.sizeOfCellBoundary();Fe.sizeOfGeoPolygon(),Fe.sizeOfGeoLoop(),Fe.sizeOfLinkedGeoPolygon(),Fe.sizeOfCoordIJ();var Re=/[^0-9a-fA-F]/;function _e(A){if(A>=0)return A.toString(Pe);var e=He(8,(A&=2147483647).toString(Pe));return(parseInt(e[0],Pe)+8).toString(Pe)+e.substring(1)}function He(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(i-.85)/.15*.1:.1+(i-.15)/.7*.8;var i;return Je(r[Math.min(23,Math.floor(24*o))])}function qe({coveragePoints:t,visible:r,terrainEnabled:n=!1,brightness:o=.7,basemapMode:i="dark"}){const{current:a}=_(),[s,l]=A.useState(null);A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==a?void 0:a.getMap)?void 0:A.call(a);e&&!s&&l(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[a,s]);const[c,u]=A.useState(null),[d,f]=A.useState(!1),h=A.useRef({aborted:!1}),g=A.useRef(0),m=A.useRef(i),b=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(t),p=A.useMemo(()=>function(A="dark"){var e;if("light"===A)return Ke;const t=MA();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:Ze}(i),[i]);A.useEffect(()=>{if(!b||!Array.isArray(b)||0===b.length)return void queueMicrotask(()=>{u(null),g.current=0});const A=m.current!==i;if(b.length===g.current&&c&&!A)return;g.current=b.length,m.current=i,h.current.aborted=!0,h.current={aborted:!1};const e=h.current;f(!0);const{cells:t,minQuality:r,maxQuality:n}=function(A){const e=new Map;for(const o of A){if("number"!=typeof o.lat||"number"!=typeof o.lon||isNaN(o.lat)||isNaN(o.lon))continue;const A=Oe(o.lat,o.lon,8),t=e.get(A),r=o.weight;t?(t.count++,t.qualitySum+=r):e.set(A,{count:1,qualitySum:r})}const t=[];let r=1/0,n=-1/0;for(const[o,i]of e.entries()){const A=i.qualitySum/i.count;t.push({hexId:o,count:i.count,avgQuality:A}),r=Math.min(r,A),n=Math.max(n,A)}return{cells:t,minQuality:t.length>0?r:0,maxQuality:t.length>0?n:0}}(b);if(0===t.length)return u(null),void f(!1);if(t.length<500){const A=function(A,e,t,r){const n=[];for(const o of A){const A=Ue(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=Xe(o.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:i,quality:o.avgQuality,count:o.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(t,r,n,p);return void(e.aborted||(u(A),f(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=Xe(n.avgQuality,e,t,r);o.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[a]}})}irequestAnimationFrame(A))}return{type:"FeatureCollection",features:o}}(t,r,n,p,e).then(A=>{!e.aborted&&A&&u(A)}).finally(()=>{e.aborted||f(!1)}),()=>{e.aborted=!0}},[b,p]),A.useEffect(()=>{if(!s)return;const A=()=>{var A,e;try{const t=s.getLayer(Ve),n=s.getSource(We);if(r&&c&&c.features.length>0){if(n?s.getSource(We).setData(c):s.addSource(We,{type:"geojson",data:c}),!t){const t=s.getLayer("topology-weak-edges-native"),r=null==(e=null==(A=s.getStyle())?void 0:A.layers)?void 0:e.find(A=>"symbol"===A.type),n=t?"topology-weak-edges-native":null==r?void 0:r.id;s.addLayer({id:Ve,type:"fill",source:We,paint:{"fill-color":["get","color"],"fill-opacity":o}},n)}}else t&&s.removeLayer(Ve),n&&s.removeSource(We)}catch(t){}};s.isStyleLoaded()?A():s.once("style.load",A)},[s,r,c,n]),A.useEffect(()=>{if(s&&r)try{s.getLayer(Ve)&&s.setPaintProperty(Ve,"fill-opacity",o)}catch{}},[s,o,r]),A.useEffect(()=>()=>{if(s)try{s.getLayer(Ve)&&s.removeLayer(Ve),s.getSource(We)&&s.removeSource(We)}catch{}},[s]);const v=(null==c?void 0:c.features.length)??0;return v>0&&r?e.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==t?void 0:t.length)||0,"data-cell-count":v,"data-terrain-enabled":n,"data-is-processing":d,style:{display:"none"}}):null}const $e="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",At="terrarium",et="terrain-dem",tt="hillshade-dem",rt="terrain-hillshade";function nt({enabled:e,exaggeration:t=4}){const{current:r}=_(),[n,o]=A.useState(null),i=A.useRef(null);return A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);e&&!n&&o(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[r,n]),A.useEffect(()=>{if(!n)return;let A=!0;const e=()=>{var e,t;if(A)try{if(n.getSource(tt)||n.addSource(tt,{type:"raster-dem",tiles:[$e],encoding:At,tileSize:256,maxzoom:14}),!n.getLayer(rt)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:rt,type:"hillshade",source:tt,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.6)","hillshade-highlight-color":"rgba(245, 240, 230, 0.4)","hillshade-accent-color":"rgba(90, 75, 65, 0.3)","hillshade-illumination-direction":315,"hillshade-exaggeration":.35}},null==A?void 0:A.id)}n.getSource(et)||n.addSource(et,{type:"raster-dem",tiles:[$e],encoding:At,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(tt)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(et))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:et,exaggeration:t}),n.setMaxPitch(70),!r&&n.getPitch()<30&&!n.isMoving()&&(r=!0,null!==i.current&&clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,A&&!n.isMoving()&&n.getPitch()<30&&n.easeTo({pitch:45,duration:1e3})},200))):(n.setTerrain(null),n.setCenterClampedToGround(!0),n.getPitch()>0&&!n.isMoving()&&n.easeTo({pitch:0,duration:800}),n.setMaxPitch(60))}catch(o){}};if(n.isStyleLoaded()&&n.getSource(et))o();else{const A=()=>{n.getSource(et)&&o()};n.once("idle",A)}return()=>{A=!1,null!==i.current&&(clearTimeout(i.current),i.current=null)}},[n,e,t]),A.useEffect(()=>()=>{var A;try{(null==(A=null==n?void 0:n.getStyle)?void 0:A.call(n))&&n.isStyleLoaded()&&(n.setTerrain(null),n.getLayer(rt)&&n.removeLayer(rt),n.getSource(tt)&&n.removeSource(tt),n.getSource(et)&&n.removeSource(et))}catch{}},[n]),null}function ot(A,e){let t=0;for(let r=0;r0)for(let t=0;t=A.length)return A;const t=[],r=A.length/e;for(let n=0;no.has(A.fromHash)&&o.has(A.toHash));if(0===i.length)return null;const a=function(A,e,t,r){const n=e.length,o=new Map(e.map((A,e)=>[A,e])),i=Array(n).fill(null).map(()=>Array(n).fill(0));for(const a of A){const A=o.get(a.fromHash),e=o.get(a.toHash);if(void 0!==A&&void 0!==e&&A!==e){const n=a.strength*a.certainCount;let o=1;if(t){const A=t.get(a.fromHash),e=t.get(a.toHash);A&&e&&(o=lt(_A(A[0],A[1],e[0],e[1])/1e3))}let s=1;if(r){const A=[a.fromHash,a.toHash].sort().join("-");s=1-.7*(r.get(A)??0)}const l=.3+.7*(a.symmetryRatio??0),c=Math.pow(n,.7)*Math.pow(o,.3)*s*l;i[A][e]=c,i[e][A]=c}}return i}(i,e,t,r),s=function(A){const e=A.length,t=Array(e).fill(null).map(()=>Array(e).fill(0));for(let r=0;rArray(e).fill(0));for(let a=0;a43758.5453*Math.sin(12.9898*e)%1-.5);at(o,t),it(o);let i=0;for(let a=0;a<100;a++){const A=st(n,o);at(A,t);const e=ot(A,A)/ot(o,A);if(it(A),o=A,Math.abs(e-i)<1e-8)return{vector:o,eigenvalue:r-e};i=e}return{vector:o,eigenvalue:r-i}}(s);if(c<.001)return null;const u=[],d=[];for(let f=0;f0&&A.push([A[0][0],A[0][1]]),t=A}return t}function pt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=ht,threshold:r=gt,cellSize:n=mt}=e,o=function(A,e){let t=1/0,r=-1/0,n=1/0,o=-1/0;for(const[i,a]of A)ir&&(r=i),ao&&(o=a);return t-=e,r+=e,n-=e,o+=e,{minX:t,minY:n,maxX:r,maxY:o,width:r-t,height:o-n}}(A,.02),i=Math.ceil(o.width/(t/2)),a=Math.ceil(o.height/(t/2)),s=Math.min(1,200/Math.max(i,a)),l=Math.max(10,Math.ceil(i*s)),c=Math.max(10,Math.ceil(a*s)),u=A=>A/l*o.width+o.minX,d=A=>A/c*o.height+o.minY,f=t/o.width*l;try{const e=yA().x(A=>(A[0]-o.minX)/o.width*l).y(A=>(A[1]-o.minY)/o.height*c).size([l,c]).bandwidth(Math.max(5,f)).cellSize(n)(A);if(0===e.length)return{coordinates:[],valid:!1};const t=Math.max(...e.map(A=>A.value))*r;let i=e[0],a=1/0;for(const A of e){const e=Math.abs(A.value-t);e0){const e=A[0],t=A[A.length-1];e[0]===t[0]&&e[1]===t[1]||A.push([e[0],e[1]])}if(A.length>=4){const t=bt(A);e.push(t)}}e.length>0&&s.push(e)}const h=[];for(const A of s)for(const e of A)h.push(e);return{coordinates:s,valid:s.length>0}}catch(h){return{coordinates:[],valid:!1}}}(A,e);return t.valid&&0!==t.coordinates.length?1===t.coordinates.length?{type:"Polygon",coordinates:t.coordinates[0]}:{type:"MultiPolygon",coordinates:t.coordinates}:null}function vt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function xt(A,e,t,r,n){const o=n*n,i=o*n;return[.5*(2*e[0]+(-A[0]+t[0])*n+(2*A[0]-5*e[0]+4*t[0]-r[0])*o+(-A[0]+3*e[0]-3*t[0]+r[0])*i),.5*(2*e[1]+(-A[1]+t[1])*n+(2*A[1]-5*e[1]+4*t[1]-r[1])*o+(-A[1]+3*e[1]-3*t[1]+r[1])*i)]}function wt(A){let e=function(A){if(A.length<3)return A;const e=[...A].sort((A,e)=>A[0]-e[0]||A[1]-e[1]),t=[];for(const n of e){for(;t.length>=2&&vt(t[t.length-2],t[t.length-1],n)<=0;)t.pop();t.push(n)}const r=[];for(let n=e.length-1;n>=0;n--){const A=e[n];for(;r.length>=2&&vt(r[r.length-2],r[r.length-1],A)<=0;)r.pop();r.push(A)}return t.pop(),r.pop(),t.concat(r)}(A);if(e.length<3)return null;e=function(A){if(A.length<3)return A;let e=0,t=0;for(const[r,n]of A)e+=r,t+=n;return e/=A.length,t/=A.length,A.map(([A,r])=>{const n=A-e,o=r-t,i=Math.sqrt(n*n+o*o);if(i<1e-4)return[A,r];const a=(i+.008)/i;return[e+n*a,t+o*a]})}(e);const t=function(A){if(A.length<3)return A;const e=[],t=A.length;for(let r=0;rt?function(A,e,t,r){const n=[];for(const[o,i]of A.communities){const A=[];for(const t of i){const r=e.get(t);r&&A.push([r[1],r[0]])}if(A.length<3)continue;let a=pt(A,{bandwidth:t,threshold:r});a||(a=wt(A)),a&&n.push({type:"Feature",properties:{community:o,color:dt(o),borderColor:ft(o),nodeCount:i.length},geometry:a})}return{type:"FeatureCollection",features:n}}(t,r,i,a):{type:"FeatureCollection",features:[]},[t,r,i,a]),c=n?o:0,u={"fill-color":["get","color"],"fill-opacity":c},d={"line-color":["get","borderColor"],"line-width":s,"line-opacity":c};return e.jsxs(H,{id:"mincut-partition",type:"geojson",data:l,children:[e.jsx(z,{id:"mincut-partition-fill",type:"fill",paint:u}),e.jsx(z,{id:"mincut-partition-stroke",type:"line",paint:d})]})}const kt={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},Ct=E()(EA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:kt,setToggle:(e,t)=>A(A=>({toggles:{...A.toggles,[e]:t},lastSavedAt:Date.now()})),setToggles:e=>A(A=>({toggles:{...A.toggles,...e},lastSavedAt:Date.now()})),hasAnalyzed:!1,setHasAnalyzed:e=>A({hasAnalyzed:e,lastSavedAt:Date.now()}),lastSavedAt:null,reset:()=>A({viewState:null,toggles:kt,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Bt(A,e=!1,t=!1,r=!1,n=.7,o){const i=CA(o);return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function Mt(A){return[A[1],A[0]]}function Dt(A,e,t,r=12){const[n,o]=A,[i,a]=e,s=[];for(let l=0;l<=r;l++){const A=l/r,e=o+(a-o)*A,c=n+(i-n)*A,u=4*t*A*(1-A);s.push([e,c,u])}return s}function Et(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function jt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const d=UA(),f=[];let h=1/0,g=-1/0;const m=[];for(const p of A){const A=.7*(p.edge.avgConfidence??(e?.7:.5))+p.edge.certainCount/Math.max(i,1)*.3+(e?.5:0);m.push({polyline:p,brightnessScore:A}),h=Math.min(h,A),g=Math.max(g,A)}if(0===m.length)return{type:"FeatureCollection",features:[]};const b=g-h||1;m.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:p,brightnessScore:v}of m){const{from:A,to:i,edge:g}=p,m=t.get(g.key)??0;if(m<=0)continue;const x=a.has(g.key),w=s.has(g.key),y=g.avgConfidence??(e?.7:.5),k=l===g.key,C=c[g.fromHash],B=c[g.toHash],M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||g.fromHash.slice(0,8),D=(null==B?void 0:B.node_name)||(null==B?void 0:B.name)||g.toHash.slice(0,8),E=[A[0]+(i[0]-A[0])*m,A[1]+(i[1]-A[1])*m];let j,N,Q,S;if(e){const A=o.get(g.key)??HA(g.certainCount),e=n.get(g.key)??A;j=e+(A-e)*r,k?j=Math.max(1.6*j,4.5):w&&(j*=1.3)}else j=1.5;if(N=k?d.edges.highlight:Bt(0,g.isDirectPathEdge??!1,x,w,y,u),Q=k?d.edges.highlight:g.isDirectPathEdge?d.edges.hoverDirect:x?d.edges.hoverLoop:d.edges.hoverStandard,e){const A=Math.min(1.5*m,1)*d.edgeOpacity;S=w?1.15*A:A}else S=(.3+.3*y)*m;k&&(S=.95);const F=(v-h)/b;f.push({type:"Feature",properties:{key:g.key,baseColor:N,hoverColor:Q,baseWidth:j,baseOpacity:S,brightnessScore:F,isLoopEdge:x,isBackbone:w,isDirectPath:g.isDirectPathEdge??!1,isHubConnection:g.isHubConnection??!1,isZeroHop:g.isZeroHop??!1,isValidated:e,certainCount:g.certainCount,confidence:y,symmetryRatio:g.symmetryRatio??1,dominantDirection:g.dominantDirection??"balanced",fromName:M,toName:D,fromHash:g.fromHash,toHash:g.toHash},geometry:{type:"LineString",coordinates:[Mt(A),Mt(E)]}})}return{type:"FeatureCollection",features:f}}function Nt(A,e){const t=UA(),r=[];let n=0;for(const o of A){const A=e.get(o.hash);A&&A.blendedScore>n&&(n=A.blendedScore)}for(const o of A){const{from:A,to:i,hash:a,neighbor:s,lastHopData:l}=o,c=`neighbor-${a}`,u=(null==l?void 0:l.avgRssi)??s.rssi??null,d=(null==l?void 0:l.avgSnr)??s.snr??null,f=(null==l?void 0:l.count)??0,h=(null==l?void 0:l.confidence)??1,g=e.get(a),m=(null==g?void 0:g.listenerScore)??0,b=(null==g?void 0:g.loudScore)??0,p=(null==g?void 0:g.blendedScore)??0,v=n>0?p/n:0,x=o.rxAdvertCount??0,w=o.txProxyCount??0,y=x+w,k=y>0?(w-x)/y:0,C=Dt(A,i,150,8);r.push({type:"Feature",properties:{key:c,hash:a,name:s.node_name||s.name||a.slice(0,8),prefix:a.slice(2,4).toUpperCase(),color:t.neighborColor,width:2.5,opacity:.85,rssi:u,snr:d,packetCount:f,confidence:h,hasAvgRssi:void 0!==(null==l?void 0:l.avgRssi),hasAvgSnr:void 0!==(null==l?void 0:l.avgSnr),isNeighborEdge:!0,listenerScore:m,loudScore:b,blendedScore:p,trafficWeight:v,linkAsymmetry:k,rxAdvertCount:x,txProxyCount:w},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function Qt(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function St(A,e){if(A<240)return.5;if(A<480)return 1;const t=(A-480)/(e-480);return Math.max(0,.33*(1-t))}function Ft(A,e,t){const r=t?cA(t):null,n=[];for(const o of A){if(r&&o.toUpperCase()===r){t&&n.push(t);continue}const A=e.get(o.toUpperCase());A&&n.push(A)}return n}const Pt="edge-blink-source",Tt="edge-blink-layer",Lt=1e3,It=1e3,Rt="node-markers-layer";function _t(A){return A<0||A>=Lt?0:1-A/Lt}function Ht(A){if(A<0)return 0;if(A>=It)return 0;const e=A/It;return Math.pow(1-e,3)}function zt(A){return[A[1],A[0]]}function Gt(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function Ot({hash:t,hashPrefix:n,name:o,isHub:i,isGateway:a,isBackbone:s,isZeroHop:l,isMobile:c,isRoomServer:u,isStale:d,lastSeenTimestamp:f,centrality:h,affinity:g,meanSnr:m,meanRssi:b,neighbor:p,onRemove:v,txDelayRec:x}){const[w,y]=A.useState(!1),k=l?"Direct":(null==g?void 0:g.typicalHopPosition)?`${g.typicalHopPosition}-hop`:null,C=x&&!x.insufficientData;return e.jsxs("div",{className:"w-[240px] pr-2",children:[e.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-tight truncate mb-1",children:o}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[e.jsx("code",{className:"font-mono text-[10px] text-text-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:n}),e.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(t),y(!0),setTimeout(()=>y(!1),1500)}catch(A){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),y(!0),setTimeout(()=>y(!1),1500)}catch{}document.body.removeChild(e)}},className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:w?e.jsx(r,{className:"w-3 h-3 text-sys-green"}):e.jsx(G,{className:"w-3 h-3 text-text-secondary"})}),e.jsx(FA,{hash:t,size:"sm"}),k&&e.jsx(dA,{color:l?TA.direct:TA.multihop,compact:!0,children:k}),p.is_repeater&&e.jsx(dA,{color:LA.repeater,compact:!0,children:"Rptr"}),i&&e.jsx(dA,{color:LA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),a&&!i&&e.jsx(dA,{color:LA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),s&&e.jsx(dA,{color:LA.backbone,compact:!0,title:"Backbone",children:"Bone"}),c&&e.jsx(dA,{color:LA.mobile,compact:!0,children:"Mobile"}),u&&e.jsx(dA,{color:LA.room,compact:!0,children:"Room"}),d&&f&&e.jsxs(dA,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",Gt(f)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(O,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:fA(p.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(U,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-text-primary",children:(B=g.distanceMeters,null===B?"—":B<1e3?`${Math.round(B)}m`:`${(B/1e3).toFixed(1)}km`)})]}),p.latitude&&p.longitude&&0!==p.latitude&&0!==p.longitude&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(Y,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-text-muted",children:[p.latitude.toFixed(2),", ",p.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(PA,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-[10px] mb-1.5",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Packets"}),e.jsx("span",{className:"data-box data-box-compact",children:(null==g?void 0:g.frequency)||0})]}),l&&void 0!==m&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"SNR"}),e.jsxs("span",{className:"data-box data-box-compact",children:[m.toFixed(1)," dB"]})]}),C&&x.networkRole&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Role"}),e.jsx(dA,{color:IA[x.networkRole],compact:!0,title:{hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"}[x.networkRole],children:x.networkRole})]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Adverts"}),e.jsx("span",{className:"data-box data-box-compact",children:p.advert_count||0})]}),l&&void 0!==b&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"RSSI"}),e.jsxs("span",{className:"data-box data-box-compact",children:[Math.round(b)," dBm"]})]}),C&&x.dataConfidence&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Data"}),e.jsx(dA,{color:RA[x.dataConfidence],compact:!0,title:{high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"}[x.dataConfidence],children:x.dataConfidence})]})]}),!C&&v&&e.jsx("button",{onClick:v,className:"p-1 self-start text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(P,{className:"w-3.5 h-3.5"})})]}),C&&e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 py-1 px-1.5 bg-amber-400/5 rounded",children:[e.jsx(W,{className:"w-3 h-3 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-text-muted",children:"TxDelay"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",(x.floodFactor??x.txDelayFactor).toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",(x.directFactor??x.directTxDelayFactor).toFixed(1)]})]})]})]}),v&&e.jsx("button",{onClick:v,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(P,{className:"w-3.5 h-3.5"})})]})]});var B}const Ut="node-markers-native",Yt="node-markers-layer",Wt="node-markers-layer-local",Vt="marker-standard",Zt="marker-standard-neighbor",Kt="marker-hub",Jt="marker-hub-neighbor",Xt="marker-gateway",qt="marker-gateway-neighbor",$t="marker-mobile",Ar="marker-mobile-neighbor",er="marker-room-server",tr="marker-room-server-neighbor",rr="marker-local",nr="marker-blink-black",or="marker-blink-black-local",ir="marker-blink",ar="marker-blink-local";function sr(A){var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t}function lr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function cr({neighborsWithLocation:t,localNode:r,localHash:n,zeroHopNeighbors:o,lastHopNeighborMap:i,meshTopology:a,hoveredMarker:s,onMarkerHover:l,getNodeOpacity:c,shouldShowNode:u,onRequestRemove:d,openPopupId:f,onOpenPopup:h,onClosePopup:g,onNodeClick:m,blinkingNodes:b}){const{current:p}=_(),v=A.useRef(!1),[x,w]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e)return;const t=()=>{try{!function(A){const e=kA(),t=(A,e,t=0,r=!1)=>{const n=document.createElement("canvas");n.width=32,n.height=32;const o=n.getContext("2d",r?{colorSpace:"display-p3"}:void 0),i=14-t/2;return o.beginPath(),o.arc(16,16,i,0,2*Math.PI),o.fillStyle=A,o.fill(),e&&t>0&&(o.strokeStyle=e,o.lineWidth=2*t,o.stroke()),o.shadowColor="rgba(0,0,0,0.3)",o.shadowBlur=4,o.shadowOffsetY=2,{data:o.getImageData(0,0,32,32),pixelRatio:2}},r=(A,e=!1)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d",e?{colorSpace:"display-p3"}:void 0),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",r.beginPath(),r.moveTo(24-n,24),r.lineTo(24,24-n),r.lineTo(40.8,24),r.stroke(),r.beginPath(),r.moveTo(24-.7*n,24),r.lineTo(24-.7*n,35.76),r.lineTo(35.76,35.76),r.lineTo(35.76,24),r.stroke(),r.beginPath(),r.moveTo(20.64,35.76),r.lineTo(20.64,27.36),r.lineTo(27.36,27.36),r.lineTo(27.36,35.76),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},n=(A,e)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d"),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(24-n,24-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(18.96,34.08),r.lineTo(24-.6*n,40.8),r.lineTo(24,34.08),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},o="#00FF00",i={[Vt]:t(e.nodeFill),[Zt]:t(e.neighborColor),[Kt]:t(e.hubColor),[Jt]:t(e.neighborColor),[Xt]:t(e.gatewayColor),[qt]:t(e.neighborColor),[$t]:t("transparent",e.mobileColor,2.5),[Ar]:t(e.neighborColor),[er]:n(e.roomColor),[tr]:n(e.neighborColor,"#1a1a1c"),[rr]:r(e.localColor),[nr]:t("#000000"),[or]:r("#000000"),[ir]:t(o,void 0,0,!0),[ar]:r(o,!0)};for(const[a,s]of Object.entries(i))A.hasImage(a)&&A.removeImage(a),A.addImage(a,s.data,{pixelRatio:s.pixelRatio})}(e),v.current=!0,x||w(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{e.hasImage(Vt)||t()};e.on("styledata",r);const n=()=>{v.current=!1,t()},o=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(n,100);break}});o.observe(document.documentElement,{attributes:!0});const i=document.querySelector("[data-basemap]");let a=null;return i&&(a=new MutationObserver(A=>{for(const e of A)if("data-basemap"===e.attributeName){setTimeout(n,100);break}}),a.observe(i,{attributes:!0})),()=>{e.off("styledata",r),o.disconnect(),null==a||a.disconnect()}},[p,x]);const y=A.useMemo(()=>{var A;const e=[],r=[...t].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return sr(e)?5e3:o.has(A)?3e3:a.hubNodes.includes(A)?2e3:(null==(t=a.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[t,s]of r){if(!s.latitude||!s.longitude)continue;if(n&&((n.startsWith("0x")?n.slice(2,4).toLowerCase():n.slice(0,2).toLowerCase())===(t.startsWith("0x")?t.slice(2,4).toLowerCase():t.slice(0,2).toLowerCase())||t===n))continue;const r=u(t),l=c(t,r);if(l<=.01)continue;const d=o.has(t),f=a.hubNodes.includes(t),h=(null==(A=a.gatewayNodes)?void 0:A.includes(t))??!1,g=a.mobileNodes.includes(t),m=sr(s),b=a.centrality.get(t)||0,p=i.get(t),v="stale"===(null==p?void 0:p.status),x=v?Math.min(l,.5):l;let w="standard";m?w="roomServer":f?w="hub":h?w="gateway":g&&(w="mobile");const y=a.fullAffinity.get(t),k=a.txDelayRecommendations.get(t);e.push({type:"Feature",geometry:{type:"Point",coordinates:[s.longitude,s.latitude]},properties:{hash:t,name:s.node_name||s.name||"Unknown",hashPrefix:lr(t),iconType:w,isNeighbor:d,isHub:f,isGateway:h,isMobile:g,isRoomServer:m,isStale:v,isZeroHop:d,opacity:x,blinkIntensity:0,lastSeenTimestamp:null==p?void 0:p.lastSeen,centrality:b,neighborJson:JSON.stringify(s),affinityJson:y?JSON.stringify(y):void 0,txDelayRecJson:k?JSON.stringify(k):void 0,meanSnr:(null==p?void 0:p.avgSnr)??void 0,meanRssi:(null==p?void 0:p.avgRssi)??void 0}})}return{type:"FeatureCollection",features:e}},[t,n,o,i,a,c,u]),k=A.useMemo(()=>(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)?{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{hash:"local",name:r.name,hashPrefix:n?lr(n):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,isZeroHop:!1,opacity:1,blinkIntensity:0,centrality:0}}]}:{type:"FeatureCollection",features:[]},[r,n]),C=A.useCallback(A=>{var e;if(!A.features||0===A.features.length)return;const t=null==(e=A.features[0].properties)?void 0:e.hash;t&&(h&&h(t),m&&"local"!==t&&m(t))},[h,m]),B=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==p?void 0:p.getMap)?void 0:e.call(p);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&l(n)},[p,l]),M=A.useCallback(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);e&&(e.getCanvas().style.cursor=""),l(null)},[p,l]);A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e||!x)return;const t=[Yt,Wt];for(const r of t)e.on("click",r,C),e.on("mouseenter",r,B),e.on("mouseleave",r,M);return()=>{for(const A of t)e.off("click",A,C),e.off("mouseenter",A,B),e.off("mouseleave",A,M)}},[p,x,C,B,M]);const D=A.useRef(y),E=A.useRef(k);A.useEffect(()=>{D.current=y,E.current=k},[y,k]),A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e||!x||!b||0===b.size)return;const t=e.getSource(Ut),r=e.getSource(`${Ut}-local`);if(t||r){if(t){const A=D.current;let e=!1;const r=A.features.map(A=>{const t=b.get(A.properties.hash)??0;return t!==A.properties.blinkIntensity?(e=!0,{...A,properties:{...A.properties,blinkIntensity:t}}):A});e&&t.setData({type:"FeatureCollection",features:r})}if(r&&n){const A=b.get(n)??0,e=E.current;e.features.length>0&&e.features[0].properties.blinkIntensity!==A&&r.setData({type:"FeatureCollection",features:[{...e.features[0],properties:{...e.features[0].properties,blinkIntensity:A}}]})}}},[p,x,b,n]);const j=A.useMemo(()=>{if(!f)return null;if("local"===f&&r)return{longitude:r.longitude,latitude:r.latitude,isLocal:!0,name:r.name,hash:n};const A=y.features.find(A=>A.properties.hash===f);if(!A)return null;const e=A.properties,t=e.txDelayRecJson?JSON.parse(e.txDelayRecJson):void 0;return{longitude:A.geometry.coordinates[0],latitude:A.geometry.coordinates[1],isLocal:!1,hash:e.hash,hashPrefix:e.hashPrefix,name:e.name,isHub:e.isHub,isGateway:e.isGateway,isBackbone:"backbone"===(null==t?void 0:t.networkRole),isZeroHop:e.isZeroHop,isMobile:e.isMobile,isRoomServer:e.isRoomServer,isStale:e.isStale,lastSeenTimestamp:e.lastSeenTimestamp,centrality:e.centrality,neighbor:e.neighborJson?JSON.parse(e.neighborJson):void 0,affinity:e.affinityJson?JSON.parse(e.affinityJson):void 0,txDelayRec:t,meanSnr:e.meanSnr,meanRssi:e.meanRssi}},[f,r,n,y]);if(!x)return null;const N=kA(),Q=["case",[">",["get","blinkIntensity"],.66],ir,[">",["get","blinkIntensity"],.33],nr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],tr,er],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],Jt,Kt],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],qt,Xt],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],Ar,$t],["case",["get","isNeighbor"],Zt,Vt]],S=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(H,{id:Ut,type:"geojson",data:y,children:e.jsx(z,{id:Yt,type:"symbol",layout:{"icon-image":Q,"icon-size":S,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),e.jsx(H,{id:`${Ut}-local`,type:"geojson",data:k,children:e.jsx(z,{id:Wt,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],ar,[">",["get","blinkIntensity"],.33],or,rr],"icon-size":S,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),j&&g&&e.jsx(V,{longitude:j.longitude,latitude:j.latitude,offset:{center:[0,0],top:[0,12],"top-left":[6,12],"top-right":[-6,12],bottom:[0,-12],"bottom-left":[6,-12],"bottom-right":[-6,-12],left:[12,0],right:[-12,0]},maxWidth:"280px",closeOnClick:!0,onClose:g,className:"maplibre-popup",children:j.isLocal?e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{className:"text-base",children:j.name}),j.hash&&e.jsx("span",{className:"ml-2 font-mono text-xs text-text-muted bg-surface-elevated px-1.5 py-0.5 rounded",children:lr(j.hash)}),e.jsx("br",{}),e.jsx("span",{style:{color:N.localColor},className:"font-medium",children:"This Node (Local)"}),e.jsx("br",{}),r&&e.jsxs("span",{className:"text-xs text-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):j.neighbor&&j.hash?e.jsx(Ot,{hash:j.hash,hashPrefix:j.hashPrefix,name:j.name,isHub:j.isHub,isGateway:j.isGateway,isBackbone:j.isBackbone,isZeroHop:j.isZeroHop,isMobile:j.isMobile,isRoomServer:j.isRoomServer,isStale:j.isStale,lastSeenTimestamp:j.lastSeenTimestamp,centrality:j.centrality,affinity:j.affinity,meanSnr:j.meanSnr,meanRssi:j.meanRssi,neighbor:j.neighbor,txDelayRec:j.txDelayRec,onRemove:d?()=>d(j.hash,j.name):void 0}):null})]})}const ur=[Yt,Wt];A.createContext(null);const dr="topology-validated-edges-native",fr="topology-weak-edges-native",hr="neighbor-edges-native",gr="topology-weak-edges-native",mr="topology-validated-edges-native",br="neighbor-edges-native",pr={type:"FeatureCollection",features:[]},vr={"line-cap":"round","line-join":"round"},xr={"line-color":"transparent","line-width":16,"line-opacity":0};function wr({showTopology:t,isExiting:r,hoveredEdgeKey:n,highlightedLoopEdges:o,highlightedFocusEdges:i,onEdgeHover:a,onLoopHover:s,loops:l=[],neighborNames:c={},opacityBias:u=.5,widthMultiplier:d=1,trafficFilter:f=0,showNeighborLines:h=!0,disableHover:g=!1}){const{current:m}=_(),b=t||r,p=!0,v=h?"visible":"none",x=g||r,w=A.useRef(null),y=A.useRef(x),k=A.useRef(new Map),C=A.useRef(c),B=A.useRef(s);A.useLayoutEffect(()=>{y.current=x,C.current=c,B.current=s});const M=A.useMemo(()=>function(A){const e=new Map;for(const t of A)for(const A of t.edgeKeys){const r=e.get(A)??[];r.push(t),e.set(A,r)}return e}(l),[l]);A.useLayoutEffect(()=>{k.current=M},[M]);const D=A.useCallback(A=>{var e,t;if(y.current)return;if(!A.features||0===A.features.length)return;const r=A.features[0].properties;if(!(null==r?void 0:r.key))return;const n=r.key;if(n!==w.current){w.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,i=!0===r.isLoopEdge||"true"===r.isLoopEdge;if(o){const t={key:n,fromName:"Local",toName:r.name,certainCount:Number(r.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};a(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=B.current)||e.call(B,null)}else if(i&&B.current){const e=k.current.get(n)??[];if(e.length>0){const t=new Set;for(const A of e)for(const e of A.edgeKeys)t.add(e);const r={loops:e,highlightedEdgeKeys:t,hoveredEdgeKey:n,nodeNames:e[0].nodes.map(A=>C.current[A]||A.substring(0,4))};B.current(r,[A.lngLat.lng,A.lngLat.lat]),a(n)}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:!0,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};a(n,[A.lngLat.lng,A.lngLat.lat],e)}}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:i,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};a(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=B.current)||t.call(B,null)}}},[a]),E=A.useCallback(()=>{var A;null!==w.current&&(w.current=null,a(null),null==(A=B.current)||A.call(B,null))},[a]);A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e||!b)return;const t="topology-validated-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,D),e.on("mouseleave",t,E),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}},[m,b,D,E]),A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e||!h)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,D),e.on("mouseleave",t,E),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}},[m,p,h,D,E]),A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e)return;let t=null;const r=(A,t)=>{try{if(e.getLayer(A)&&e.getLayer(t))return e.moveLayer(A,t),!0}catch{}return!1},n=()=>{try{if(!e.getLayer("node-markers-layer"))return;r(br,"node-markers-layer"),r("neighbor-edges-hitarea-native",br),(r(mr,"neighbor-edges-hitarea-native")||r(mr,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",mr),r(gr,"topology-validated-edges-hitarea-native")}catch{}},o=()=>{t&&clearTimeout(t),t=setTimeout(n,50)},i=setTimeout(n,100);e.on("styledata",o);const a=A=>{(A.sourceId===dr||A.sourceId===fr||A.sourceId===hr)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[m,b,p,h]);const j=x?null:n,N=function(A,e,t,r,n,o){const i=UA(),a=null!==A,s=n&&n.size>0,l=o&&o.size>0,c=s?Array.from(n):[],u=l?Array.from(o):[],d=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],f=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],h=s?["in",["get","key"],["literal",c]]:l?["in",["get","key"],["literal",u]]:!!a&&["==",["get","key"],A],g=a||s||l,m=i.edges.hoverLoop??"#A78BFA";return{"line-color":g?["case",h,s?m:l?"#FFD700":["get","hoverColor"],d]:d,"line-width":g?["case",h,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,g?["case",h,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],f,.35]]:["*",["get","baseOpacity"],f]]}}(j,u,d,f,x?null:o,i??null),Q=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=J,i=["to-number",["get","listenerScore"],0],a=["to-number",["get","loudScore"],0],s=["/",i,["max",["+",i,a],1]],l=["*",["+",.2,["*",["to-number",["get","trafficWeight"],0],.8]],8];return{"line-color":["case",["all",["==",i,0],["==",a,0]],o,[">=",s,.97],r,["<=",s,.03],n,["interpolate",["linear"],s,.03,n,.5,t,.97,r]],"line-width":["interpolate",["linear"],["zoom"],6,e?["case",["==",["get","key"],A],["max",["*",l,.25],1.25],["*",l,.25]]:["*",l,.25],10,e?["case",["==",["get","key"],A],["max",l,5],l]:l],"line-opacity":e?["case",["==",["get","key"],A],1,.35]:.9}}(j);return e.jsxs(e.Fragment,{children:[b&&e.jsx(H,{id:fr,type:"geojson",data:pr,children:e.jsx(z,{id:gr,type:"line",paint:N,layout:{...vr,visibility:v}})}),b&&e.jsxs(H,{id:dr,type:"geojson",data:pr,children:[e.jsx(z,{id:"topology-validated-edges-hitarea-native",type:"line",paint:xr,layout:{...vr,visibility:v}}),e.jsx(z,{id:mr,type:"line",paint:N,layout:{...vr,visibility:v}})]}),e.jsxs(H,{id:hr,type:"geojson",data:pr,children:[e.jsx(z,{id:"neighbor-edges-hitarea-native",type:"line",paint:xr,layout:{...vr,visibility:v}}),e.jsx(z,{id:br,type:"line",paint:Q,layout:{...vr,visibility:v}})]})]})}const yr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function kr({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=_(),o=A.useRef(null);return A.useEffect(()=>{if(!n||!e||e===o.current)return;const A=t.get(e);if(!A)return;const i=n.getMap();i.isMoving()&&i.stop(),o.current=e;const[a,s]=A;n.flyTo({center:[s,a],zoom:10,duration:2500,essential:!0}),setTimeout(()=>{null==r||r()},2600)},[e,t,n,r]),null}function Cr({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:o}=_(),i=A.useRef(null);return A.useEffect(()=>{if(!o||!e)return;if(e===i.current)return;i.current=e,n();const A=t.find(A=>A.edge.key===e)||r.find(A=>A.edge.key===e);if(!A)return;if(o.getMap().isMoving())return;const a=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=o.getZoom(),c=Math.max(l,11);o.easeTo({center:[s,a],zoom:c,duration:500})},[e,t,r,o,n]),null}function Br(A,e,t,r=64){const n=[],o=t/6371e3*(180/Math.PI),i=o/Math.cos(e*Math.PI/180);for(let a=0;a<=r;a++){const t=a/r*2*Math.PI,s=A+i*Math.cos(t),l=e+o*Math.sin(t);n.push([s,l])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}}function Mr({ghost:t,neighborCoordinates:r,onHighlightedNeighborsChange:n}){const{current:o}=_(),i=A.useRef(null),a=A.useRef(null),s=A.useMemo(()=>t?new Set(t.commonNeighbors):new Set,[t]);A.useEffect(()=>{null==n||n(s)},[s,n]);const l=A.useMemo(()=>{if(!(null==t?void 0:t.commonNeighbors)||t.commonNeighbors.length<2)return 8e3;let A=0;const e=[];for(const n of t.commonNeighbors){const A=r.get(n);A&&e.push(A)}t.estimatedLocation&&e.push([t.estimatedLocation.lat,t.estimatedLocation.lon]);for(let t=0;tA&&(A=n)}return Math.max(A,2e3)},[t,r]),c=A.useMemo(()=>{if(!(null==t?void 0:t.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:e,uncertaintyM:r}=t.estimatedLocation,n=.5*l,o=r>0?r:2e3;return{type:"FeatureCollection",features:[Br(e,A,Math.max(500,Math.min(o,n)))]}},[t,l]);if(A.useEffect(()=>{if(!o)return;const A=o.getMap();if(t&&t.prefix!==a.current){if(a.current=t.prefix,!i.current&&A.getZoom()>3){const e=A.getCenter();i.current={center:[e.lng,e.lat],zoom:A.getZoom(),pitch:A.getPitch(),bearing:A.getBearing()}}const e=[];for(const A of t.commonNeighbors){const t=r.get(A);t&&e.push([t[1],t[0]])}if(t.estimatedLocation&&e.push([t.estimatedLocation.lon,t.estimatedLocation.lat]),e.length>0){const r=()=>{var n;if(A.isMoving())setTimeout(r,100);else if(1===e.length)o.flyTo({center:e[0],zoom:13,duration:1500});else{let A=1/0,r=-1/0,i=1/0,a=-1/0;for(const[t,n]of e)A=Math.min(A,t),r=Math.max(r,t),i=Math.min(i,n),a=Math.max(a,n);if(null==(n=t.estimatedLocation)?void 0:n.uncertaintyM){const e=t.estimatedLocation.uncertaintyM/111e3;A-=e,r+=e,i-=e,a+=e}o.fitBounds([[A,i],[r,a]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(r,50)}}if(!t&&null!==a.current&&(a.current=null,i.current)){const e=i.current,t=()=>{A.isMoving()?setTimeout(t,100):(o.flyTo({center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,duration:1e3}),i.current=null)};setTimeout(t,50)}},[t,o,r]),!(null==t?void 0:t.estimatedLocation))return null;return e.jsx(H,{id:"ghost-uncertainty-circle",type:"geojson",data:c,children:e.jsx(z,{id:"ghost-uncertainty-fill",type:"fill",paint:{"fill-color":"rgba(167, 139, 250, 0.15)","fill-opacity":.8}})})}!function(A){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(A);e&&(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}(OA.edges.neighborHover);const Dr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Er={longitude:0,latitude:0,zoom:2};function jr({data:A}){const t=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return e.jsxs("div",{className:"w-[540px]",children:[e.jsxs("div",{className:"flex items-center justify-between h-5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&e.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),e.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&e.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,t)=>e.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},t))})]}),t&&e.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:e.jsx("span",{className:"font-mono text-[10px] text-text-muted truncate block",children:A.subtitle.text})}),e.jsx("div",{className:`flex items-center gap-4 h-4 ${t?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,t)=>e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-text-primary"}`,children:A.value}),e.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},t))})]})}function Nr({neighbors:t,localNode:r,localHash:n,onRemoveNode:o,selectedNodeHash:i,onNodeSelected:a,highlightedEdgeKey:s,highlightedGhost:l}){const c=A.useRef(null),u=hA(),d=gA(),f=mA(),h=bA(),g=pA(),[m,b]=A.useState(!1),p=Ct(A=>A.viewState),v=Ct(A=>A.toggles),x=Ct(A=>A.hasAnalyzed),w=Ct(A=>A.setViewState),y=Ct(A=>A.setToggle),k=Ct(A=>A.setHasAnalyzed),C=vA(A=>A.preloadFromNodes),B=vA(A=>A.isLoading),M=vA(A=>A.terrainGrid),D=n??g,E=A.useMemo(()=>{const A=[];for(const[,e]of Object.entries(t))e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[t]),j=A.useMemo(()=>function(A,e){let t=[...A];if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&t.push([e.latitude,e.longitude]),0===t.length)return null;if(1===t.length){const[A,e]=t[0];return{longitude:e,latitude:A,zoom:14}}t=function(A,e){if(A.length<=2)return A;let t,r;if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude))t=e.latitude,r=e.longitude;else{let e=0,n=0;for(const[t,r]of A)e+=t,n+=r;t=e/A.length,r=n/A.length}const n=A.map(([A,e])=>{return{pos:[A,e],dist:(n=t,o=r,i=A,a=e,_A(n,o,i,a)/1e3)};var n,o,i,a});n.sort((A,e)=>A.dist-e.dist);const o=n[Math.floor(n.length/2)].dist,i=Math.max(3*o,50),a=n.filter(A=>A.dist<=i).map(A=>A.pos);return a.length<.5*A.length?A:a}(t,e);let r=1/0,n=-1/0,o=1/0,i=-1/0;for(const[f,h]of t)r=Math.min(r,h),n=Math.max(n,h),o=Math.min(o,f),i=Math.max(i,f);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let d=16;return u>0&&(d=Math.floor(Math.log2(360/u*1.2)),d=Math.max(1,Math.min(14,d))),d=Math.min(d+1,12),{longitude:a,latitude:s,zoom:d}}(E,r),[E,r]),[N,Q]=A.useState(()=>p??j??Er),S=A.useCallback(A=>{Q(A),w(A)},[w]),F=A.useRef(!!p);A.useEffect(()=>{F.current||!j||p?p&&setTimeout(()=>b(!0),50):(Q(j),w(j),F.current=!0,setTimeout(()=>b(!0),50))},[j,p,w]);const[P,T]=A.useState(!1),[L,I]=A.useState(v.showTopology),[R,_]=A.useState(v.showNeighborLines),[H,z]=A.useState(!1),[G,O]=A.useState(v.showMinCut),[U,Y]=A.useState(we),[W,V]=A.useState(v.show3DTerrain),[J,q]=A.useState(v.nodeFilter),$=A.useCallback(A=>{I(e=>{const t="function"==typeof A?A(e):A;return y("showTopology",t),t})},[y]),AA=A.useCallback(A=>{_(e=>{const t="function"==typeof A?A(e):A;return y("showNeighborLines",t),t})},[y]),eA=A.useCallback(A=>{O(e=>{const t="function"==typeof A?A(e):A;return y("showMinCut",t),t})},[y]),tA=A.useCallback(A=>{V(e=>{const t="function"==typeof A?A(e):A;return y("show3DTerrain",t),t})},[y]),rA=A.useCallback(A=>{q(A),y("nodeFilter",A)},[y]),[nA,oA]=A.useState(null),[iA,dA]=A.useState(null),[fA,wA]=A.useState(null),[yA]=A.useState(0),[kA]=A.useState(.5),[CA]=A.useState(0),[BA,MA]=A.useState(null),[DA,EA]=A.useState(""),[jA,FA]=A.useState(!1),[PA,TA]=A.useState("fetching"),[LA,IA]=A.useState(!1),[RA,zA]=A.useState(0),[OA,UA]=A.useState(x),WA=A.useCallback(A=>{UA(A),k(A)},[k]),[VA,ZA]=A.useState(null),XA=A.useCallback(A=>ZA(A),[]),qA=A.useCallback(()=>ZA(null),[]),[,$A]=A.useState(new Set),ee=he(A=>A.coveragePoints),re=he(A=>A.isVisible),oe=he(A=>A.brightness),ie=he(A=>A.openModal),ae=Me(A=>A.isEnabled),se=Me(A=>A.toggle),le=NA(),ce=QA(),ue=A.useRef(!1);A.useEffect(()=>{ee.length>0&&re&&!ue.current&&(AA(!1),ue.current=!0)},[ee.length,re]);const de=A.useRef(null);A.useEffect(()=>{if(i&&i!==de.current){de.current=i;const A=setTimeout(()=>{ZA(i)},1250);return()=>clearTimeout(A)}},[i]);const[fe,ge]=A.useState(null),[me,be]=A.useState(null),pe=A.useCallback((A,e,t)=>{dA(A),A&&e&&t?ge({longitude:e[0],latitude:e[1],type:"topology",properties:{key:t.key,fromName:t.fromName,toName:t.toName,certainCount:t.certainCount,confidence:t.confidence,isBackbone:t.isBackbone,isLoopEdge:t.isLoopEdge,isDirectPath:t.isDirectPath,isHubConnection:t.isHubConnection,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||ge(null)},[]),ve=A.useCallback((A,e)=>{be(A),A&&ge(null)},[]),ye=A.useMemo(()=>{var A;if(!L)return null;if(!nA)return null;if(iA)return null;const e=u.loops;if(0===e.length)return null;const r=function(A,e,t){const r=function(A,e){return e.filter(e=>e.nodes.includes(A)).sort((A,e)=>e.avgCertainCount-A.avgCertainCount)}(A,e),n=new Set,o=[];for(const i of r)for(const A of i.edgeKeys)if(!n.has(A)){n.add(A);const e=t.get(A);o.push({key:A,certainCount:(null==e?void 0:e.certainCount)??0})}return o.sort((A,e)=>e.certainCount-A.certainCount),{loops:r,highlightedEdgeKeys:n,sortedEdges:o}}(nA,e,u.edgeMap);if(0===r.loops.length)return null;const n=r.loops[0].nodes.map(A=>{var e,r;return A===D?"You":(null==(e=t[A])?void 0:e.node_name)||(null==(r=t[A])?void 0:r.name)||A.substring(0,4)});return{loops:r.loops,highlightedEdgeKeys:r.highlightedEdgeKeys,hoveredEdgeKey:(null==(A=r.sortedEdges[0])?void 0:A.key)||"",nodeNames:n}},[L,nA,iA,u.loops,u.edgeMap,t,D]);A.useEffect(()=>{iA||be(ye)},[ye,iA]);const ke=A.useMemo(()=>{const A={};for(const[e,r]of Object.entries(t))A[e]=r.node_name||r.name||e.substring(0,4);return D&&(A[D]="You"),A},[t,D]),Be=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),De=A.useMemo(()=>{const A=new Map;D&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(D,[r.latitude,r.longitude]);for(const[e,t]of Be)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[D,r,Be]),Ee=A.useMemo(()=>{const A=new Map;for(const e of f)"expired"!==e.status&&A.set(e.hash,{hash:e.hash,prefix:e.prefix,count:e.count,avgRssi:e.avgRssi,avgSnr:e.avgSnr,lastSeen:e.lastSeen,confidence:1,status:e.status});return A},[f]),je=A.useMemo(()=>{var A,e;const r=new Set;for(const n of Ee.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[Ee,t]),Ne=A.useMemo(()=>{if(0===je.size||!D)return new Map;const A=sA.getPackets();if(0===A.length)return new Map;const e=cA(D);return X(A,je,e).scores},[je,D,h.packetCount]),Qe=A.useCallback(A=>!!(D&&(A.fromHash===D&&je.has(A.toHash)||A.toHash===D&&je.has(A.fromHash))),[D,je]),Se=A.useMemo(()=>{var A,e;if(0===f.length||!D)return[];if(h.backgroundLoadComplete)return[];const r=[];for(const n of f){if("expired"===n.status)continue;if(!(null==(A=t[n.hash])?void 0:A.latitude)||!(null==(e=t[n.hash])?void 0:e.longitude))continue;const o=[D,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:D,toHash:n.hash,key:i,packetCount:n.count,avgConfidence:1,strength:.8,avgRecency:1,hopDistanceFromLocal:0,isHubConnection:!1,isCertain:!0,certainCount:n.count,isLoopEdge:!1,forwardCount:n.count,reverseCount:0,symmetryRatio:0,dominantDirection:"forward",floodCount:n.count,directCount:0,isDirectPathEdge:!1,isZeroHop:!0,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return r},[f,D,h.backgroundLoadComplete,t]),Fe=A.useMemo(()=>{const A=[];if(Se.length>0&&!h.backgroundLoadComplete){for(const e of Se){const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of u.validatedEdges){if(Qe(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.validatedEdges,De,Qe,Se,h.backgroundLoadComplete]),Pe=A.useMemo(()=>{const A=[];for(const e of u.weakEdges){if(Qe(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.weakEdges,De,Qe]),Te=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],e=[r.latitude,r.longitude],n=new Map;for(const t of u.lastHopNeighbors)n.set(t.hash,t.count);const o=new Map;for(const t of f)o.set(t.hash,t.count);for(const r of je){const i=t[r];if(!(null==i?void 0:i.latitude)||!(null==i?void 0:i.longitude))continue;const a=o.get(r),s=n.get(r);A.push({from:e,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:Ee.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,je,t,Ee,u.lastHopNeighbors,f]),Le=A.useMemo(()=>new Set(u.loopEdgeKeys),[u.loopEdgeKeys]),Ie=A.useMemo(()=>new Set(u.backboneEdges),[u.backboneEdges]),Re=A.useMemo(()=>{if(!fA)return null;const A=u.validatedEdges.filter(A=>A.fromHash===fA||A.toHash===fA);if(0===A.length)return null;const e=[...A].sort((A,e)=>e.certainCount-A.certainCount),t=Math.max(1,Math.ceil(.2*e.length)),r=e.slice(0,t);return new Set(r.map(A=>A.key))},[fA,u.validatedEdges]),_e=A.useMemo(()=>{let A=0;if(Se.length>0&&!h.backgroundLoadComplete){for(const e of Se)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of u.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[u.validatedEdges,Se,h.backgroundLoadComplete]),He=A.useMemo(()=>{if(0===u.validatedEdges.length)return null;const A=new Set;for(const r of u.validatedEdges)A.add(r.fromHash),A.add(r.toHash);const e=Array.from(A).filter(A=>De.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=De.get(r);A&&t.set(r,A)}return function(A,e,t,r){const n=e.length;if(n<3)return{communities:new Map([[0,e]]),nodePartitions:e.map(A=>({hash:A,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:n<=1};const o=[];let i=1/0;const a=[[e,0]];for(;a.length>0;){const[e,n]=a.shift();if((t?ct(e,t):0)>20&&n<4&&e.length>=10){const o=ut(A,e,t,r);if(o){i=Math.min(i,o.fiedlerValue),a.push([o.group0,n+1]),a.push([o.group1,n+1]);continue}}o.push(e)}const s=new Map,l=[],c=new Map;for(let u=0;u{eA(A=>{const e=!A;if(e&&He&&c.current){const A=c.current.getMap();if(!A)return e;let t=1/0,r=-1/0,n=1/0,o=-1/0,i=!1;for(const[,e]of He.communities)for(const A of e){const e=De.get(A);if(e){const[A,a]=e;n=Math.min(n,A),o=Math.max(o,A),t=Math.min(t,a),r=Math.max(r,a),i=!0}}i&&A.fitBounds([[t,n],[r,o]],{padding:{top:60,bottom:100,left:60,right:320},duration:800,maxZoom:14})}return e})},[He,De]),Ge=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Ge.current=(null==(e=null==(A=c.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Oe=aA(),Ue=A.useMemo(()=>sA.getPackets(),[Oe]);!function({map:e,nodeCoordinates:t,packets:r,localHash:n,neighbors:o,meshTopology:i,enabled:a=!0}){const s=A.useRef(null),l=e&&"current"in e?e.current:e;A.useEffect(()=>{s.current=l},[l]);const c=A.useRef(!1),u=A.useRef(null),d=A.useRef([]),f=A.useRef(0),h=A.useRef(!1),[g,m]=A.useState(!1),b=A.useRef(null),p=A.useRef([]),v=A.useRef(new Map),x=A.useRef(t);A.useEffect(()=>{x.current=t},[t]),A.useEffect(()=>{v.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=cA(r);t.has(A)||t.set(A,r)}if(e){const A=cA(e);t.set(A,e)}return t}(o,n)},[o,n]),A.useEffect(()=>{if(!a){b.current&&(clearTimeout(b.current),b.current=null),p.current=[],null!==u.current&&(cancelAnimationFrame(u.current),u.current=null),d.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(Pt);e&&e.setData({type:"FeatureCollection",features:[]})}h.current=!1,f.current=0}},[a]),A.useEffect(()=>{const A=l;if(!A)return;let e=null,t=!1;const r=()=>{if(!t&&!c.current)try{A.getLayer(Tt)&&A.removeLayer(Tt),A.getSource(Pt)&&A.removeSource(Pt),A.addSource(Pt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(Rt)?Rt:void 0;A.addLayer({id:Tt,type:"line",source:Pt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#12A594"],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],1.875,2.5],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},t),c.current=!0,m(!0),e&&(clearInterval(e),e=null)}catch{}};return A.isStyleLoaded()&&r(),A.once("style.load",()=>{r()}),c.current||(e=setInterval(()=>{c.current?e&&clearInterval(e):r()},100),setTimeout(()=>{e&&(clearInterval(e),e=null)},5e3)),()=>{t=!0,e&&clearInterval(e),null!==u.current&&(cancelAnimationFrame(u.current),u.current=null);const A=s.current;if(A&&c.current){try{A.getLayer(Tt)&&A.removeLayer(Tt),A.getSource(Pt)&&A.removeSource(Pt)}catch{}c.current=!1,m(!1)}}},[l]);const w=A.useRef(()=>{});A.useEffect(()=>{w.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(Pt);if(!e)return;const t=performance.now(),r=d.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?It:Lt)){o.push(i);const e=i.isSpeculative?Ht(A):_t(A);e>0&&n.push({type:"Feature",properties:{intensity:e,opacityMult:i.isSpeculative?.5:1,isSpeculative:i.isSpeculative??!1},geometry:{type:"LineString",coordinates:[i.fromCoord,i.toCoord]}})}}e.setData({type:"FeatureCollection",features:n}),d.current=o,o.length>0?u.current=requestAnimationFrame(()=>w.current()):u.current=null}},[]);const y=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(Tt))return;const e=A.getLayer(Rt)?Rt:void 0;try{A.moveLayer(Tt,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>w.current()))},[]),k=A.useCallback(()=>{if(!s.current||!c.current)return;const A=p.current;if(p.current=[],b.current=null,0===A.length)return;const e=v.current,t=x.current;if(0===e.size)return;const r=performance.now();let o=0,a=!1;const l=new Set;for(const s of A){const A=lA(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,f=null;for(let n=0;n0){A.sort((A,e)=>e.confidence-A.confidence);const e=Math.max(1,Math.ceil(.25*A.length)),n=A.slice(0,e),i=o+150*u;for(const{edgeKey:A,otherHash:o}of n){const e=t.get(f),n=t.get(o);d.current.push({edgeKey:A,fromCoord:zt(e),toCoord:zt(n),startTime:r,delay:i,isSpeculative:!0}),l.add(A),a=!0}}}u>0&&(o+=150*u*.5)}a&&y()},[n,i,y]);A.useEffect(()=>{const A=s.current;if(!a)return;if(!A)return;if(!g)return;if(0===r.length)return;const e=Date.now(),t=f.current;if(!h.current){h.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A);let n=0;for(const e of r){const A=e.timestamp??0;A>n&&(n=A)}if(f.current=n,t.length>0){t.sort((A,e)=>(A.timestamp??0)-(e.timestamp??0));const A=t.slice(-20);p.current.push(...A),k()}return}const n=r.filter(A=>(A.timestamp??0)>t);if(0===n.length)return;let o=0;for(const r of n){const A=r.timestamp??0;A>o&&(o=A)}f.current=o,p.current.push(...n),b.current&&clearTimeout(b.current),b.current=setTimeout(k,175)},[a,r,k,g]),A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[])}({map:Ge,nodeCoordinates:De,packets:Ue,localHash:D,neighbors:t,meshTopology:u,enabled:ae});const{isExiting:Ye,isAnimating:We,resetAnimationState:Ve}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:d=[],showNeighborLines:f=!0,neighborSourceId:h,neighborLinkScores:g=new Map,basemapMode:m}){const b=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;b.current=A});const p=A.useRef(new Map),v=A.useRef(1),x=A.useRef(new Map),w=A.useRef(new Map),y=A.useRef(!1),k=A.useRef(null),C=A.useRef(t),B=A.useRef(new Set),M=A.useRef(""),D=A.useRef(new Map),E=A.useRef(""),j=A.useRef(""),N=A.useRef(""),Q=A.useRef(r),S=A.useRef(n),F=A.useRef(o),P=A.useRef(i),T=A.useRef(a),L=A.useRef(s),I=A.useRef(l),R=A.useRef(d),_=A.useRef(f),H=A.useRef(g),z=A.useRef(m);A.useEffect(()=>{Q.current=r,S.current=n,F.current=o,P.current=i,T.current=a,L.current=s,I.current=l,R.current=d,_.current=f,H.current=g,z.current=m},[r,n,o,i,a,s,l,d,f,g,m]);const G=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,d;const f=b.current;if(!f)return;const g=f.getSource(c),m=f.getSource(u),y=f.getSource(h);if(g){const o=jt(Q.current,!0,p.current,v.current,x.current,w.current,F.current,P.current,T.current,L.current,I.current,z.current),i=`${o.features.length}:${(null==(t=null==(e=o.features[0])?void 0:e.properties)?void 0:t.key)??""}:${(null==(n=null==(r=o.features[o.features.length-1])?void 0:r.properties)?void 0:n.key)??""}:${Array.from(p.current.values()).reduce((A,e)=>A+e,0).toFixed(2)}`;(A||i!==E.current)&&(g.setData(o),E.current=i)}if(m){const e=jt(S.current,!1,p.current,v.current,x.current,w.current,F.current,P.current,T.current,L.current,I.current,z.current),t=`${e.features.length}:${(null==(i=null==(o=e.features[0])?void 0:o.properties)?void 0:i.key)??""}:${(null==(s=null==(a=e.features[e.features.length-1])?void 0:a.properties)?void 0:s.key)??""}`;(A||t!==j.current)&&(m.setData(e),j.current=t)}if(y&&R.current.length>0){const e=Nt(R.current,H.current),t=`${e.features.length}:${(null==(d=null==(l=e.features[0])?void 0:l.properties)?void 0:d.hash)??""}`;(A||t!==N.current)&&(y.setData(e),N.current=t)}},[c,u,h]),O=A.useCallback(()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null),p.current=new Map,v.current=1,x.current=new Map,w.current=new Map,y.current=!1,B.current=new Set,M.current="",D.current=new Map},[]);A.useEffect(()=>{const A=C.current,e=t;if(C.current=t,b.current){if(k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&!e&&!y.current){y.current=!0;const A=new Map(p.current);let e=null;const t=r=>{e||(e=r);const n=r-e,o=Math.min(n/500,1),i=(a=o,1-Math.pow(1-a,3));var a;for(const[e,t]of A)p.current.set(e,t*(1-i));G(!0),o<1?k.current=requestAnimationFrame(t):(y.current=!1,p.current=new Map,B.current=new Set,M.current="",x.current=new Map,w.current=new Map,k.current=null,G(!0))};k.current=requestAnimationFrame(t)}!A&&e&&(p.current=new Map,B.current=new Set,M.current="")}},[t,G]),A.useEffect(()=>{const A=b.current;if(!t||y.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===B.current.size,a=""!==M.current&&M.current!==o;if(!i&&!a)return void G();const s=[],l=[];for(const{edge:t}of e)B.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(x.current=new Map(D.current),v.current=0),w.current=new Map;for(const{edge:t}of r){const A=HA(t.certainCount);w.current.set(t.key,A)}for(const t of s)p.current.set(t,0);for(const t of l)p.current.has(t)||p.current.set(t,1);if(s.length>0||a&&l.length>0){k.current&&(cancelAnimationFrame(k.current),k.current=null);let A=null;const e=Math.min(100,YA/Math.max(s.length,1)/2),t=r=>{A||(A=r);const n=r-A;for(let A=0;A0){const A=Math.min(n/YA,1);v.current=Et(A)}G(!0);const o=YA+(s.length-1)*e;k.current=n{const A=b.current;if(!A||!h)return;const e=()=>{const e=A.getSource(h);if(!e)return!1;if(d.length>0){const A=Nt(d,g);e.setData(A)}else e.setData({type:"FeatureCollection",features:[]});return!0};if(e())return;const t=r=>{r.sourceId===h&&e()&&A.off("sourcedata",t)};A.on("sourcedata",t);const r=()=>{e()&&(A.off("styledata",r),A.off("sourcedata",t))};return A.on("styledata",r),()=>{A.off("sourcedata",t),A.off("styledata",r)}},[h,d,g]);const U=A.useRef(m);return A.useEffect(()=>{m!==U.current&&(U.current=m,E.current="",j.current="",N.current="",G(!0))},[m,G]),A.useEffect(()=>()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null)},[]),{isExiting:y.current,isAnimating:null!==k.current,resetAnimationState:O,weightAnimProgress:v.current,animStartWeights:x.current,animTargetWeights:w.current}}({map:Ge,showTopology:L,validatedPolylines:Fe,weakPolylines:Pe,maxCertainCount:_e,loopEdgeKeys:Le,backboneEdgeKeys:Ie,highlightedEdgeKey:s,neighbors:t,validatedSourceId:dr,weakSourceId:fr,neighborPolylines:Te,showNeighborLines:R,neighborSourceId:hr,neighborLinkScores:Ne,basemapMode:le}),Ze=A.useMemo(()=>{const A=new Set;for(const e of u.hubNodes){A.add(e);for(const t of u.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[u.hubNodes,u.validatedEdges]),Ke=A.useMemo(()=>{const A=new Set;if(!n)return A;for(const e of u.validatedEdges)e.fromHash===n&&A.add(e.toHash),e.toHash===n&&A.add(e.fromHash);return A},[n,u.validatedEdges]),{getNodeOpacity:Je}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:o,localConnectedNodes:i,showTopology:a}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),d=A.useRef(new Map),f=A.useRef(null),h=A.useRef(n),g=A.useRef(o),m=A.useRef(i),b=A.useRef(a);return A.useEffect(()=>{h.current=n,g.current=o,m.current=i,b.current=a},[n,o,i,a]),A.useEffect(()=>{const A=c.current,n=u.current,o=e,i=t;if(c.current=e,u.current=t,A===o&&n===i)return;f.current&&(cancelAnimationFrame(f.current),f.current=null);const a=h.current,s=g.current,p=m.current,v=b.current;for(const e of r)d.current.has(e)||d.current.set(e,Math.random());const x=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=v&&p.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},w=[];for(const e of r){const t=x(e,A,n),r=x(e,o,i);t!==r&&w.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===w.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of w)e.set(t,r);return e});const y=w;let k=null;const C=A=>{k||(k=A);const e=A-k;let t=!0;l(()=>{const A=new Map;for(const{hash:r,startOpacity:n,targetOpacity:o}of y){const i=250*(d.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*Qt(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?f.current=requestAnimationFrame(C):(f.current=null,l(new Map))};return f.current=requestAnimationFrame(C),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===J,soloHubs:"hubs"===J,neighborHashes:Be.map(([A])=>A),hubConnectedNodes:Ze,directNodeSet:je,localConnectedNodes:Ke,showTopology:L}),{blinkingNodes:Xe,blinkColor:$e}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=aA(),a=A.useRef(sA.getPackets());A.useEffect(()=>{a.current=sA.getPackets()},[i]);const s=A.useRef(0),l=A.useRef(null),c=A.useRef(new Map),u=A.useRef(new Map);A.useEffect(()=>{u.current=function(A){const e=new Map;for(const t of Object.keys(A)){const A=cA(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const d=A.useRef(null);return A.useEffect(()=>{d.current=()=>{const A=performance.now(),e=c.current;if(0===e.size)return l.current=null,void o(new Map);const t=new Map,r=[];for(const[n,{startTime:o,staggerDelay:i}]of e){const e=A-o-i;if(e<0);else if(e>=750)r.push(n);else{const A=St(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&d.current?l.current=requestAnimationFrame(d.current):l.current=null}},[]),A.useEffect(()=>{if(!r)return;const A=a.current;if(0===A.length)return;const e=s.current,n=A.filter(A=>(A.timestamp??0)>e);if(0===e){const e=A.reduce((A,e)=>Math.max(A,e.timestamp??0),0);return void(s.current=e)}if(0===n.length)return;const o=n.reduce((A,e)=>Math.max(A,e.timestamp??0),0);s.current=o;const i=performance.now();let f=0;for(const r of n){const A=lA(r,t);if(!A||0===A.original.length)continue;const e=Ft(A.original,u.current,t);if(0===e.length)continue;const n=375;for(let t=0;t()=>{null!==l.current&&(cancelAnimationFrame(l.current),l.current=null)},[]),{blinkingNodes:n,blinkColor:"#00FF00"}}({neighbors:t,localHash:n,enabled:ae}),At=A.useCallback(A=>{if("all"===J)return!0;if("direct"===J)return je.has(A);if("hubs"===J){if(u.hubNodes.includes(A))return!0;for(const e of u.validatedEdges){if(e.fromHash===A&&u.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&u.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[J,je,u.hubNodes,u.validatedEdges]);A.useEffect(()=>{"fetching"===PA&&(h.loadProgress?zA(h.loadProgress.loaded):h.packetCount>0&&zA(h.packetCount))},[PA,h.loadProgress,h.packetCount]);const et=A.useCallback(async()=>{IA(!0),FA(!0),TA("fetching"),zA(0),await d(),TA("analyzing"),await new Promise(A=>setTimeout(A,200)),TA("building");const A=Date.now(),e=Date.now()-A;e<1700&&await new Promise(A=>setTimeout(A,1700-e)),TA("complete"),await new Promise(A=>setTimeout(A,1e3)),FA(!1),IA(!1),Ve(),WA(!0),setTimeout(()=>{$(!0)},150)},[d,Ve]),tt=A.useCallback(()=>{OA?$(A=>!A):et()},[OA,et]),rt=A.useCallback(A=>{S(A.viewState),(A.viewState.pitch??0)>10&&!W&&tA(!0)},[W]),ot=A.useCallback(()=>{T(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=c.current)?void 0:e.getContainer())?void 0:t.closest(".map-container-fullscreen, .map-container-16-9"))?void 0:r.parentElement;return s?l&&document.fullscreenEnabled?null==(n=l.requestFullscreen)||n.call(l).catch(()=>{}):l&&document.webkitFullscreenEnabled&&(null==(o=l.webkitRequestFullscreen)||o.call(l)):document.fullscreenElement?null==(i=document.exitFullscreen)||i.call(document).catch(()=>{}):document.webkitFullscreenElement&&(null==(a=document.webkitExitFullscreen)||a.call(document)),s})},[]),it=A.useCallback(A=>{rA(A)},[]),at=A.useCallback(()=>{AA(A=>!A)},[]),st=A.useCallback(()=>{z(A=>!A)},[]),lt=A.useCallback(()=>{tA(A=>{const e=!A;if(c.current){const A=c.current.getMap();A&&A.stop()}if(e&&c.current){const A=c.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:A=>1-Math.pow(1-A,3)})}if(!e&&c.current){const A=c.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:A=>1-Math.pow(1-A,2)})}return e})},[]),dt=A.useCallback(()=>{L||$(!0)},[L]),ft=A.useCallback((A,e)=>{MA(A),EA(e)},[]),ht=A.useCallback(()=>{BA&&o&&o(BA),MA(null),EA("")},[BA,o]),gt=A.useMemo(()=>[...yr,...ur],[]),mt=A.useRef(!1);A.useEffect(()=>{mt.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const bt=A.useCallback(A=>{A.features&&0!==A.features.length||(mt.current&&fe&&(ge(null),dA(null)),fA&&wA(null))},[fe,fA]),pt=A.useCallback(A=>{wA(e=>e===A?null:A)},[]),vt=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;if(A.features.some(A=>{var e,t;return null==(t=null==(e=A.layer)?void 0:e.id)?void 0:t.startsWith("node-markers-")}))return void(iA&&(dA(null),ge(null)));const r=A.features.find(A=>{var e;const t=null==(e=A.layer)?void 0:e.id;return(null==t?void 0:t.startsWith("topology-"))||(null==t?void 0:t.startsWith("neighbor-"))});if(!r)return;const n=null==(e=r.layer)?void 0:e.id,o=r.properties;if(!(null==o?void 0:o.key))return;const i=null==n?void 0:n.startsWith("topology-"),a=null==n?void 0:n.startsWith("neighbor-");if(i||a){const e=o.key.replace(/-loop[12]$/,"");dA(e),A.lngLat&&ge({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:i?"topology":"neighbor",properties:o})}try{(null==(t=c.current)?void 0:t.getCanvas())&&(c.current.getCanvas().style.cursor="pointer")}catch{}},[iA]),xt=A.useCallback(()=>{var A;dA(null),ge(null);try{(null==(A=c.current)?void 0:A.getCanvas())&&(c.current.getCanvas().style.cursor="")}catch{}},[]),wt=P?"map-container-fullscreen":"map-container-16-9",kt=E.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),Bt=!m||!kt,Mt=kt;return e.jsxs("div",{className:`relative ${wt}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions","data-basemap":le,children:[e.jsx("span",{id:"map-instructions",className:"sr-only",children:"Interactive map showing mesh network contacts. Use mouse or touch to pan and zoom. Press Tab to navigate map controls. Press Escape to exit fullscreen mode."}),Bt&&e.jsx("div",{className:"absolute inset-0 z-50 glass-card flex items-center justify-center","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),Mt&&e.jsx("div",{className:`relative w-full h-full ${P?"":"rounded-[1.125rem] overflow-hidden"} ${Bt?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:e.jsxs(Z,{ref:c,...N,onMove:rt,mapStyle:Dr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:gt,onMouseMove:vt,onMouseLeave:xt,onClick:bt,onError:A=>{},onIdle:()=>{if(!M&&!B&&c.current){const A=c.current.getMap();if(A){const e=Object.values(t).filter(A=>A.latitude&&A.longitude).map(A=>({latitude:A.latitude,longitude:A.longitude}));(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&e.push({latitude:r.latitude,longitude:r.longitude}),e.length>0&&C(e,A)}}},children:[e.jsx(K,{position:"bottom-right"}),e.jsx(SA,{mode:le}),e.jsx(nt,{enabled:W,exaggeration:4}),e.jsx(qe,{coveragePoints:ee,visible:ee.length>0&&re,terrainEnabled:W,brightness:oe,basemapMode:le}),e.jsx(yt,{partition:He,nodeCoordinates:De,visible:G&&OA,opacity:U.opacity,bandwidth:U.bandwidth,threshold:U.threshold,strokeWidth:U.strokeWidth}),e.jsx(wr,{showTopology:L,isExiting:Ye,hoveredEdgeKey:iA,highlightedLoopEdges:null==me?void 0:me.highlightedEdgeKeys,highlightedFocusEdges:Re,onEdgeHover:pe,onLoopHover:ve,loops:u.loops,neighborNames:ke,opacityBias:yA,widthMultiplier:kA,trafficFilter:CA,showNeighborLines:R,disableHover:We||LA}),i&&e.jsx(kr,{targetHash:i,nodeCoordinates:De,onComplete:a}),s&&e.jsx(Cr,{highlightedEdgeKey:s,validatedPolylines:Fe,weakPolylines:Pe,onEnsureTopology:dt}),e.jsx(Mr,{ghost:l??null,neighborCoordinates:De,onHighlightedNeighborsChange:$A}),e.jsx(cr,{neighborsWithLocation:Be,localNode:r,localHash:n,zeroHopNeighbors:je,lastHopNeighborMap:Ee,meshTopology:u,hoveredMarker:nA,onMarkerHover:oA,getNodeOpacity:Je,shouldShowNode:At,onRequestRemove:o?ft:void 0,openPopupId:VA,onOpenPopup:XA,onClosePopup:qA,onNodeClick:pt,blinkingNodes:Xe,blinkColor:$e})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"hops",value:A.size},{label:"seen",value:A.minCertainCount}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-amber-400"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-violet-400/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-violet-400"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-text-secondary",mono:!0},stats:r,badges:n}}if("neighbor"===(null==A?void 0:A.type)){const e=A.properties,t=[];void 0!==e.rssi&&null!==e.rssi&&t.push({label:"RSSI",value:`${Math.round(e.rssi)} dBm`,unit:e.hasAvgRssi?"avg":void 0}),void 0!==e.snr&&null!==e.snr&&t.push({label:"SNR",value:`${Number(e.snr).toFixed(1)} dB`,unit:e.hasAvgSnr?"avg":void 0});const r=e.listenerScore??0,n=e.loudScore??0,o=r>0||n>0;return o&&(t.push({label:"listener",value:r,color:"text-accent-success"}),t.push({label:"loud",value:n,color:"text-accent-danger"})),void 0===e.packetCount||o||t.push({label:"packets",value:Number(e.packetCount).toLocaleString()}),{type:"neighbor",title:{icon:"●",text:e.prefix?`${e.name} (${e.prefix})`:e.name,color:"text-amber-400"},subtitle:{text:"Direct RF Neighbor",color:"text-amber-400/70"},stats:t,badges:[]}}if("topology"===(null==A?void 0:A.type)){const e=A.properties,r=t>0?Number(e.certainCount)/t:0,n=[{label:"validations",value:e.certainCount},{label:"of max traffic",value:`${Math.round(100*r)}%`},{label:"confidence",value:`${Math.round(100*Number(e.confidence))}%`}];if(void 0!==e.symmetryRatio&&e.symmetryRatio<1){const A="forward"===e.dominantDirection?"→":"reverse"===e.dominantDirection?"←":"↔";n.push({label:"symmetric",value:`${A} ${Math.round(100*e.symmetryRatio)}%`,color:"text-text-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-gray-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-violet-400"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-teal-400"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-text-primary"},stats:n,badges:o}}return null}(fe?{type:fe.type,properties:fe.properties}:null,me,_e);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:e.jsx(jr,{data:A})})})})(),e.jsx(JA,{mapRef:c,showNeighborLines:R,onToggleNeighborLines:at,hasNeighborPolylines:Te.length>0,nodeFilter:J,onNodeFilterChange:it,hasHubNodes:u.hubNodes.length>0,hasZeroHopNeighbors:je.size>0,showCoverage:H,onToggleCoverage:st,showMinCut:G,onToggleMinCut:ze,hasMinCutData:OA&&null!==He&&He.numCommunities>1,show3DTerrain:W,onToggle3DTerrain:lt,basemapMode:le,onToggleBasemap:ce,isFullscreen:P,onToggleFullscreen:ot}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(Ae,{isActive:L,hasAnalyzed:OA,isLoading:LA,onClick:tt}),e.jsx(te,{isActive:ae,onClick:se}),e.jsx(ne,{isActive:ee.length>0&&re,onClick:ie}),e.jsx(KA,{showTopology:L,validatedPolylineCount:Fe.length,filteredNeighborCount:Be.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:u,zeroHopNeighbors:je,neighborsWithLocation:Be})]}),!P&&e.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(xA,{isOpen:null!==BA,onCancel:()=>MA(null),onConfirm:ht,title:"Remove Node?",message:`Remove "${DA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),e.jsx(GA,{isOpen:jA,currentStep:PA,packetCount:RA}),e.jsx(xe,{}),e.jsx(Ce,{visible:G&&OA,onClose:()=>eA(!1),settings:U,onSettingsChange:Y,partition:He,totalNodes:Object.keys(t).length})]})}export{Nr as default};
diff --git a/frontend/dist/assets/ContactsMapMapLibre-DbKijMVr.js b/frontend/dist/assets/ContactsMapMapLibre-DbKijMVr.js
deleted file mode 100644
index 88b68e20..00000000
--- a/frontend/dist/assets/ContactsMapMapLibre-DbKijMVr.js
+++ /dev/null
@@ -1 +0,0 @@
-import{r as A,j as e,m as t,af as r,aD as n,bB as o,ay as i,q as a,ao as s,aO as l,a7 as c,ak as u,aF as f,C as d,b9 as g,be as h,bC as m,bD as b,bE as p,bF as v,bG as x,aG as w,Y as y,b6 as k,a5 as C,bH as B,i as D,bI as M,X as E,bJ as Q,bK as N,bL as j,aU as S,bt as F,bM as P,ah as I,D as L,aN as R,ap as T,bN as _,bx as H,by as z,bA as G,bw as O,bO as U}from"./vendor-react-DWFolw7W.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as Y,c as W}from"./link-scoring-CDPrlIBa.js";import{aC as V,J as Z,O as K,T as J,x as X,aD as q,m as $,aE as AA,aF as eA,d as tA,aG as rA,B as nA,a0 as oA,aH as iA,aI as aA,f as sA,q as lA,aJ as cA,aK as uA}from"./index-Bqom4285.js";import{C as fA}from"./ConfirmModal-eh_HUzgW.js";import{c as dA}from"./recharts-BfwfJFmd.js";import{D as gA,a as hA}from"./dialog-BxW5aXUD.js";import{i as mA,j as bA,k as pA,l as vA}from"./useThemeColors-BvpMB3J1.js";import{l as xA}from"./font-loader-jlbdh9Fw.js";import{p as wA,a as yA}from"./vendor-core-WoOfkQwm.js";import{u as kA,a as CA,B as BA}from"./BasemapLayer-CVTB3HoG.js";import{P as DA,N as MA}from"./Contacts-5M0yF8mP.js";import{H as EA,C as QA,N as NA,b as jA}from"./SignalIndicator-3iePFw_K.js";import"./deckgl-DTsmDcfs.js";import"./ping-BNDHcn6h.js";import"./PageLayout-Ddo-4Uor.js";import"./DataBox-DmFkSY6u.js";import"./CollisionExplorerModal-DIUOoEai.js";import"./leaflet-D_ckmI2R.js";function SA(A,e,t,r){const n=(t-A)*Math.PI/180,o=(r-e)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(A*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}function FA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}function PA({label:A,icon:t,status:n,detail:o}){return e.jsxs("div",{className:dA("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===n&&"opacity-40"),children:[e.jsx("div",{className:dA("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-primary/20","pending"===n&&"bg-subtle-fill"),children:"complete"===n?e.jsx(r,{className:"w-4 h-4 text-accent-primary"}):"active"===n?e.jsx(s,{className:"w-4 h-4 animate-spin text-accent-primary"}):e.jsx("span",{className:"text-text-muted",children:t})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:dA("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-primary","pending"===n&&"text-text-muted"),children:A}),o&&"pending"!==n&&e.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:o})]})]})}const IA=A.memo(function({isOpen:A,currentStep:s,packetCount:l,onClose:c}){const u="complete"===s,f=A=>{const e=["fetching","analyzing","building","discovering","complete"],t=e.indexOf(s),r=e.indexOf(A);return r{});return e.jsx(gA,{open:A,onClose:d,size:"sm",bottomSheet:!1,children:e.jsx(hA,{className:"p-6",children:u?e.jsxs("div",{className:"flex flex-col items-center py-6",children:[e.jsx(t.div,{variants:V,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:e.jsx(r,{className:"w-8 h-8 text-accent-primary"})}),e.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center bg-accent-primary/15",children:e.jsx(n,{className:"w-5 h-5 text-accent-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(PA,{label:"Fetching Packets",icon:e.jsx(o,{className:"w-4 h-4"}),status:f("fetching"),detail:l>0?`${l.toLocaleString()} packets`:"Loading database..."}),e.jsx(PA,{label:"Analyzing Database",icon:e.jsx(i,{className:"w-4 h-4"}),status:f("analyzing"),detail:"Processing packet paths"}),e.jsx(PA,{label:"Building Topology",icon:e.jsx(n,{className:"w-4 h-4"}),status:f("building"),detail:"Computing mesh edges"}),e.jsx(PA,{label:"Discovering Nodes",icon:e.jsx(a,{className:"w-4 h-4"}),status:f("discovering"),detail:"Viterbi HMM ghost detection"})]}),e.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})}),LA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function RA(){if("undefined"==typeof window)return LA;const A=mA(),e=bA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:LA.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:LA.edges.neighborRest,neighborHover:LA.edges.neighborHover,highlight:e.highlight},edgeOpacity:LA.edgeOpacity}}const TA=2e3;function _A({text:A}){return e.jsx(J,{content:A,delay:200,children:e.jsx(g,{className:"w-3.5 h-3.5 text-text-muted cursor-help"})})}function HA({title:A,tooltip:t,isOpen:r,onToggle:n,hasBorder:o=!1}){return e.jsxs("button",{onClick:n,className:"w-full flex items-center justify-between text-text-secondary font-medium py-1 hover:text-text-primary transition-colors "+(o?"mt-2 pt-2 border-t border-white/10":""),children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(_A,{text:t})]}),e.jsx(d,{className:"w-3 h-3 text-text-muted transition-transform duration-200 "+(r?"":"-rotate-90")})]})}function zA({showTopology:t,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:s,neighborsWithLocation:d}){const g=pA(),h=Z(),m=K(),b=h.filter(A=>A.isLikelyReal).length,p=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(i),[v,x]=A.useState(!0),[w,y]=A.useState(!0),[k,C]=A.useState(!0);return e.jsxs("div",{className:"text-xs rounded-lg bg-bg-elevated border border-border-subtle",style:{padding:"0.625rem"},children:[e.jsx(HA,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:v,onToggle:()=>x(!v)}),v&&e.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.nodeFill}}),e.jsx("span",{className:"text-text-secondary",children:"Node"}),e.jsx(_A,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor}}),e.jsx("span",{className:"text-text-secondary",children:"Hub"}),e.jsx(_A,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(B=d,B.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{className:"w-3 h-3 flex-shrink-0",style:{color:g.roomColor},strokeWidth:2.5}),e.jsx("span",{className:"text-text-secondary",children:"Room"}),e.jsx(_A,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(c,{className:"w-3 h-3 flex-shrink-0",style:{color:g.localColor},strokeWidth:2.5}),e.jsx("span",{className:"text-text-secondary",children:"Local"}),e.jsx(_A,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),s.size>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.neighborColor}}),e.jsx("span",{className:"text-text-secondary",children:"Neighbor"}),e.jsx(_A,{text:"Zero-hop direct RF contact. Yellow indicates we receive their ADVERTs directly without relays."})]}),i.gatewayNodes.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.gatewayColor}}),e.jsx("span",{className:"text-text-secondary",children:"Gateway"}),e.jsx(_A,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),p>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor}}),e.jsx("span",{className:"text-text-secondary",children:"Backbone"}),e.jsx(_A,{text:"Critical relay with 4+ neighbors and high betweenness centrality. Backbone nodes carry the majority of mesh traffic."})]}),i.mobileNodes.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",background:"transparent",border:`4px solid ${g.mobileColor}`,boxSizing:"border-box"}}),e.jsx("span",{className:"text-text-secondary",children:"Mobile"}),e.jsx(_A,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),b>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(a,{className:"w-3 h-3 flex-shrink-0",style:{color:g.ghostColor},strokeWidth:2.5}),e.jsxs("span",{className:"text-text-secondary",children:["Ghost (",b,")"]}),e.jsx(_A,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]}),s.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(HA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional link balance. 2-Way = balanced. Listener = they hear us. Loud = they route to us.",isOpen:w,onToggle:()=>y(!w),hasBorder:!0}),w&&e.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:Y.YELLOW}}),e.jsx("span",{className:"text-text-secondary",children:"2-Way"}),e.jsx(_A,{text:"33-67% balanced. Ideal bidirectional link - this neighbor both hears us and routes traffic to us equally well."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:Y.GREEN}}),e.jsx("span",{className:"text-text-secondary",children:"Listener"}),e.jsx(_A,{text:">67% listener score. This neighbor hears our transmissions well (good RX from us)."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:Y.RED}}),e.jsx("span",{className:"text-text-secondary",children:"Loud"}),e.jsx(_A,{text:"<33% listener score. This neighbor routes more traffic TO us than they hear from us."})]})]})]}),t&&r>0&&e.jsxs(e.Fragment,{children:[e.jsx(HA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = relative strength.",isOpen:k,onToggle:()=>C(!k),hasBorder:!0}),k&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted mt-1",children:[e.jsxs("div",{className:"flex justify-between tabular-nums",children:[e.jsx("span",{children:"Nodes"}),e.jsx("span",{className:"text-text-secondary",children:n+(o?1:0)})]}),i.hubNodes.length>0&&e.jsxs("div",{className:"flex justify-between tabular-nums",children:[e.jsx("span",{children:"Hubs"}),e.jsx("span",{style:{color:LA.hubColor},children:i.hubNodes.length})]})]}),i.loops.length>0&&e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{className:"w-3 h-3 flex-shrink-0",style:{color:LA.edges.hoverLoop}}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{style:{color:LA.edges.hoverLoop},className:"font-medium",children:[i.loops.length," ",1===i.loops.length?"Loop":"Loops"]}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),m.totalPaths>0&&e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(f,{className:"w-3 h-3 flex-shrink-0",style:{color:g.ghostColor}}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{style:{color:g.ghostColor},className:"font-medium",children:[m.totalPaths.toLocaleString()," Viterbi"]}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})]})]});var B}function GA({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,show3DTerrain:u,onToggle3DTerrain:f,basemapMode:d,onToggleBasemap:g,isFullscreen:C,onToggleFullscreen:B}){const D="w-4 h-4";return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"flex items-center gap-1 p-1 rounded-lg bg-bg-elevated border border-border-subtle",children:[n&&e.jsx(X,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide neighbor lines":"Show neighbor lines","aria-label":t?"Hide neighbor lines":"Show neighbor lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(h,{className:D})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(q,{color:"zinc",onClick:()=>i("all"),title:"Show all nodes",className:"!border "+("all"===o?"!border-current":"!border-transparent"),children:"All"}),a&&e.jsx(q,{color:"blue",onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",className:"!border "+("hubs"===o?"!border-current":"!border-transparent"),children:"Hubs"}),s&&e.jsx(q,{color:"amber",onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",className:"!border "+("direct"===o?"!border-current":"!border-transparent"),children:"Direct"})]}),e.jsx(X,{plain:!0,color:"light"===d?"primary":"muted",onClick:g,title:"light"===d?"Switch to dark map":"Switch to light map","aria-label":"light"===d?"Switch to dark map":"Switch to light map","aria-pressed":"light"===d,className:"!p-1.5 !rounded-md",children:"light"===d?e.jsx(m,{className:D}):e.jsx(b,{className:D})}),e.jsx(X,{plain:!0,color:u?"success":"muted",onClick:f,title:u?"Disable 3D terrain":"Enable 3D terrain","aria-label":u?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":u,className:"!p-1.5 !rounded-md",children:e.jsx(p,{className:D})}),e.jsx(X,{plain:!0,color:"muted",onClick:B,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen","aria-pressed":C,className:"!p-1.5 !rounded-md",children:C?e.jsx(v,{className:D}):e.jsx(x,{className:D})})]}),e.jsxs("div",{className:"flex flex-col items-stretch rounded-lg bg-bg-elevated border border-border-subtle overflow-hidden self-end",children:[e.jsx(X,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(w,{className:D})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(X,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(y,{className:D})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(X,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(k,{className:D})})]})]})})}const OA="#4ADE80",UA="DeepAnalysis";function YA(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function WA({isActive:t,hasAnalyzed:r,isLoading:o,onClick:i}){const[a,l]=A.useState(!1),[c,u]=A.useState(UA),f=A.useRef(!1),d=A.useRef(null),[g]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),h=a&&!t&&!o&&g;A.useEffect(()=>{if(a&&!t&&!o&&!f.current){f.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{d.current&&cancelAnimationFrame(d.current)}},[a,t,o]);const m=o?"Analyzing...":c;return e.jsxs("button",{onClick:i,onMouseEnter:()=>g&&l(!0),onMouseLeave:()=>g&&l(!1),onPointerEnter:()=>g&&l(!0),onPointerLeave:()=>g&&l(!1),disabled:o,className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors "+(o?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-green)":"var(--bg-elevated)",border:"1px solid var(--border-subtle)"},title:o?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[o?e.jsx(s,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):e.jsx(n,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-green-400":"text-text-secondary"),style:h?{color:OA}:void 0}),e.jsx("span",{className:t?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||h?700:500,letterSpacing:"-0.01em",lineHeight:1,...h?{color:OA}:{}},children:m})]})}const VA="#12A594";function ZA({isActive:t,onClick:r}){const[n,o]=A.useState(!1),[i,a]=A.useState(0),s=A.useRef(!1),l=A.useRef(null),[c,u]=A.useState(0),f=A.useRef(!1),[d]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=n&&!t&&d;A.useEffect(()=>{g&&!f.current&&(f.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(f.current=!1,u(0))},[g,n]),A.useEffect(()=>{if(n&&!t&&!s.current){s.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);a(n),n<1&&(l.current=requestAnimationFrame(e))};l.current=requestAnimationFrame(e)}return n||(l.current&&(cancelAnimationFrame(l.current),l.current=null),s.current=!1,a(0)),()=>{l.current&&cancelAnimationFrame(l.current)}},[n,t]);const h=A=>{if(t)return;if(!g)return;const e=11*i;return A>=e-2&&Ad&&o(!0),onMouseLeave:()=>d&&o(!1),onPointerEnter:()=>d&&o(!0),onPointerLeave:()=>d&&o(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-teal)":"var(--bg-elevated)",border:"1px solid var(--border-subtle)"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"text-sys-teal":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?VA:"none",stroke:1===c||2===c?"#FFFFFF":g?VA:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"text-sys-teal":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||g?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:h(t)||void 0},children:A},t))})]})}const KA="#fe8019";function JA({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(!1),[c]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{xA()},[]),A.useEffect(()=>{if(!i||t)return;const A=requestAnimationFrame(()=>l(!0)),e=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[i,t]);const u=Math.max(.01,Math.min(1,n)),f=u<.999,d=u>.011,g=i&&!t&&c;return e.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-amber)":"var(--bg-elevated)",border:"1px solid var(--border-subtle)"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(B,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:g?{color:KA}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||g?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||g?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":g?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...g?{color:KA}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!d,className:"p-0.5 rounded transition-colors "+(d?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:e.jsx(b,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!f,className:"p-0.5 rounded transition-colors "+(f?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:e.jsx(m,{className:"w-3.5 h-3.5"})})]})]})}function XA(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function qA(A){return Math.exp(-A*Math.LN2/7)}const $A="pymc-wardriving-url",Ae="pymc-wardriving-enabled",ee="pymc-wardriving-brightness";function te(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem($A,A):localStorage.removeItem($A))}function re(A){"undefined"!=typeof localStorage&&localStorage.setItem(Ae,String(A))}function ne(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(ee);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function oe(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const ie=D((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(Ae),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem($A)||"",brightness:ne(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(ee,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;re(t),A({isVisible:t})},setVisible:e=>{re(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=XA(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=qA(i),s=oe(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),te(e.trim()),re(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),te(""),re(!1)}}));function ae({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const t={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];return t?e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[e.jsx("div",{className:"relative",children:e.jsx(s,{className:"w-5 h-5 text-amber-400 animate-spin"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-amber-400 font-medium",children:t}),e.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all duration-300",style:{width:"connecting"===A?"30%":"loading"===A?"60%":"90%"}})})]})]}):null}function se(){const{isModalOpen:t,closeModal:n,status:i,isVisible:a,stats:l,error:c,url:u,brightness:d,loadCoverage:g,clearCoverage:h,toggleVisibility:b,setUrl:p,setBrightness:v}=ie(),x="connecting"===i||"loading"===i||"processing"===i,[w,y]=A.useState(u),k=A.useCallback(async()=>{await g(w)},[w,g]),C=A.useCallback(()=>{y(""),h()},[h]),B=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||x||(A.preventDefault(),k())},[k,x]),D=A.useCallback(A=>{const e=A.target.value;y(e),p(e)},[p]);if(!t)return null;const P=l.coverageCount>0,I=w.trim().length>0&&!x;return e.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:x?void 0:n}),e.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:e.jsx(M,{className:"w-5 h-5 text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),e.jsx("button",{onClick:n,disabled:x,className:"p-2 rounded-lg hover:bg-subtle-fill-hover transition-colors disabled:opacity-50",children:e.jsx(E,{className:"w-5 h-5 text-text-secondary"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),e.jsx("input",{type:"url",value:w,onChange:D,onKeyDown:B,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-subtle-fill border border-border-subtle rounded-xl text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-amber-500/50 focus:border-amber-500/50 transition-all disabled:opacity-50",disabled:x}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),e.jsx(ae,{status:i}),"error"===i&&c&&e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[e.jsx(Q,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),e.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:c})]})]}),"success"===i&&P&&e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[e.jsx(r,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),e.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," coverage points • ",l.repeaterCount.toLocaleString()," repeaters"]})]})]}),P&&!x&&"success"!==i&&e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[e.jsx(N,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),e.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," points •",l.lastUpdated&&` Last updated ${l.lastUpdated.toLocaleTimeString()}`]})]})]}),P&&!x&&e.jsx("div",{className:"p-3 bg-subtle-fill border border-border-subtle rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{className:"w-4 h-4 flex-shrink-0 "+(d>.5?"text-amber-400":"text-text-muted")}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Brightness"}),e.jsxs("span",{className:"text-xs text-text-muted font-mono",children:[Math.round(100*d),"%"]})]}),e.jsx("input",{type:"range",min:"1",max:"100",value:100*d,onChange:A=>v(Number(A.target.value)/100),className:"w-full h-1.5 cursor-pointer accent-amber-400"})]})]})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[e.jsx("div",{className:"flex items-center gap-2",children:P&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:b,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-text-secondary hover:text-text-primary hover:bg-subtle-fill-hover rounded-lg transition-colors disabled:opacity-50",title:a?"Hide heatmap":"Show heatmap",children:a?e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-3.5 h-3.5"})," Hide"]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"w-3.5 h-3.5"})," Show"]})}),e.jsxs("button",{onClick:C,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-400/80 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors disabled:opacity-50",title:"Clear coverage data",children:[e.jsx(S,{className:"w-3.5 h-3.5"})," Clear"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:n,disabled:x,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-subtle-fill-hover rounded-lg transition-colors disabled:opacity-50",children:P?"Done":"Cancel"}),e.jsx("button",{onClick:k,disabled:!I,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium bg-amber-500 hover:bg-amber-400 text-black rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:x?e.jsxs(e.Fragment,{children:[e.jsx(s,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):P?e.jsxs(e.Fragment,{children:[e.jsx(o,{className:"w-4 h-4"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}const le={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},ce=D()(wA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:yA(()=>le)}));var ue=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,f,d,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&p)return p.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(d,A,e):""}function x(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=f=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=d=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=b=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var y=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}y=(u=t.buffer?t.buffer:new ArrayBuffer(y)).byteLength,w(u),h[7156]=5271536;var C=[],B=[],D=[],M=[];function E(A){C.unshift(A)}function Q(A){M.unshift(A)}var N=Math.abs,j=Math.ceil,S=Math.floor,F=Math.min,P=0,I=null;t.preloadedImages={},t.preloadedAudios={};var L,R,T=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return f.length}T="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAA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uz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAA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UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAA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aDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAE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ZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function I(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|HA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(d<<2)>>2]=h,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,f=0,d=0,g=0,h=0,m=0,b=0,p=0;if(u=S,S=S+16|0,l=u+8|0,c=u,f=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(f<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(d=(0|p)==(0|A)&(0|b)==(0|e))))do{f=0|$e(0|(f=0|Ve(0|f,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),d=(0|(b=0|n[(p=h=r+(f<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|d));if(f=o+(f<<2)|0,d&&(0|n[f>>2])<=(0|s))return S=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[f>>2]=s,(0|s)>=(0|t))return S=u,0;switch(d=s+1|0,n[l>>2]=0,0|(f=0|R(A,e,2,l,c))){case 9:m=9;break;case 0:(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(f=0|R(A,e,3,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|R(A,e,1,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|R(A,e,5,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|R(A,e,4,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|R(A,e,6,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|f}function R(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if((t|=0)>>>0>6)return 1;if(f=(0|n[(r|=0)>>2])%6|0,n[r>>2]=f,(0|f)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(f=0|tt(0|A,0|e,45),B(),(a=127&f)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(g=!(0|ZA(s)),s=s+-1|0,d=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(g?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~d,e|=l=0|B(),!(t=0|n[(g?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(g=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(g|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|z(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}D(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|VA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&f){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(g=o)>>2]=A,n[g+4>>2]=e,0}function T(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(i=S,S=S+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,S=i,0;n[h>>2]=0;A:do{if(0|HA(A,e))A=9;else{a=0,g=A;do{if(0|(A=0|R(g,e,4,h,o)))break A;if(a=a+1|0,0|HA(g=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(d=r)>>2]=g,n[d+4>>2]=e,d=t+-1|0,f=0,A=1;do{if(a=26800+(f<<2)|0,5==(0|f))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|R(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|d)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|HA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|R(s,l,u,h,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|HA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}f=f+1|0}while(f>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|R(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function H(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,f,d,g,h,m,b,p,v=0,x=0,w=0,y=0,k=0,C=0,D=0,M=0,E=0,Q=0,N=0,j=0,F=0,P=0,I=0,L=0,R=0,T=0,_=0;if(p=S,S=S+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(x=0|n[(A|=0)>>2]))<=0)return S=p,0;for(u=A+4|0,f=h+8|0,d=m+8|0,g=l+8|0,v=0,F=0;;){j=(w=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[j>>2],n[h+4>>2]=n[j+4>>2],n[h+8>>2]=n[j+8>>2],n[h+12>>2]=n[j+12>>2],(0|F)==(x+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(j=w+(F+1<<4)|0,n[m>>2]=n[j>>2],n[m+4>>2]=n[j+4>>2],n[m+8>>2]=n[j+8>>2],n[m+12>>2]=n[j+12>>2]),x=0|tA(h,m,r,b);A:do{if(x)w=0,v=x;else if(w=0|n[(x=b)>>2],(0|(x=0|n[x+4>>2]))>0|!(0|x)&w>>>0>0){N=0,j=0;e:for(;;){if(R=1/(+(w>>>0)+4294967296*+(0|x)),_=+o[h>>3],T=+((x=0|Ze(0|w,0|x,0|N,0|j))>>>0)+4294967296*+(0|B()),L=+(N>>>0)+4294967296*+(0|j),o[l>>3]=R*(_*T)+R*(+o[m>>3]*L),o[g>>3]=R*(+o[f>>3]*T)+R*(+o[d>>3]*L),0|(x=0|KA(l,r,c))){v=x;break}C=0|At(0|(E=0|n[(Q=c)>>2]),0|(Q=0|n[Q+4>>2]),0|e,0|t),y=0|B(),w=0|n[(k=x=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))P=x,I=16;else for(D=0,M=0;;){if((0|D)>(0|t)|(0|D)==(0|t)&M>>>0>e>>>0){v=1;break e}if((0|w)==(0|E)&(0|k)==(0|Q))break t;if(C=0|$e(0|(x=0|Ve(0|C,0|y,1,0)),0|B(),0|e,0|t),y=0|B(),M=0|Ve(0|M,0|D,1,0),D=0|B(),!(0|(w=0|n[(k=x=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=x,I=16;break}}}while(0);if(16!=(0|I)||(I=0,!(0|E)&!(0|Q))||(n[(M=P)>>2]=E,n[M+4>>2]=Q,M=a+(n[i>>2]<<3)|0,n[M>>2]=E,n[M+4>>2]=Q,M=0|Ve(0|n[(M=i)>>2],0|n[M+4>>2],1,0),E=0|B(),n[(Q=i)>>2]=M,n[Q+4>>2]=E),N=0|Ve(0|N,0|j,1,0),j=0|B(),w=0|n[(x=b)>>2],!((0|(x=0|n[x+4>>2]))>(0|j)|(0|x)==(0|j)&w>>>0>N>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){I=21;break}if((0|F)>=(0|(x=0|n[A>>2]))){v=0,I=21;break}}return 21==(0|I)?(S=p,0|v):0}function z(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function W(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function V(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,f,d,g,h=0,m=0,b=0,p=0,x=0,y=0,k=0;d=S,S=S+288|0,f=d+264|0,p=d+96|0,m=(h=b=d)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(S=d,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],f),$A(b,m,p),u=+ae(f,p+8|0),o[f>>3]=+o[A>>3],o[(m=f+8|0)>>3]=+o[A+16>>3],o[p>>3]=+o[A+8>>3],o[(b=p+8|0)>>3]=+o[A+24>>3],a=+ae(f,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[f>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,x=~~k>>>0,y=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|x)&!(0|y),n[(e=t)>>2]=p?1:x,n[e+4>>2]=p?0:y,e=0):e=1,S=d,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,f,d=0,g=0,h=0;f=S,S=S+288|0,c=f+264|0,u=f+96|0,a=(d=g=f)+96|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|a));return 0|(t=0|Ae(t,g))?(S=f,0|(r=t)):(qA(d=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(d,t,u),h=+ae(c,u+8|0),h=+v(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,d=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+v((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|d),n[r>>2]=g?1:t,n[r+4>>2]=g?0:d,S=f,0|(r=0)):(S=f,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|x(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|x(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|x(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&D(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&D(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&D(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&D(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=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8|0)>>2])+s|0,n[A>>2]=s,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function xA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function wA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n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=i-(a?A:0)|0,0|((0|(A=(0|(A=s-(a?A:0)|0))>-1?A:0-A|0))>(0|(e=(0|(i=(0|i)>-1?i:0-i|0))>(0|(e=(0|e)>-1?e:0-e|0))?i:e))?A:e)}function CA(A){var e,t,r,o;t=(o=0|n[(e=8+(A|=0)|0)>>2])-(0|n[A>>2])|0,n[A>>2]=t,A=(0|n[(r=A+4|0)>>2])-o|0,n[r>>2]=A,n[e>>2]=0-(A+t)}function BA(A){var e,t,r=0,o=0,i=0,a=0,s=0;r=0-(o=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,a=(i=0|n[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function DA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|HA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function MA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&D(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,a)?QA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+p(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?a:.37796447300922725*a))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+f(+t),t=+d(+t),e=s*+d(+e)+ +f(+a)*(t*+f(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+f(+e),a=t*+d(+a)*c,t=+o[A>>3],e=c*((s-+d(+e)*+d(+t))/+f(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +p(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function QA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,b,p,v,x,w,y,k,C,B,M,E,Q,N=0,j=0,F=0,P=0,I=0,L=0;if(Q=S,S=S+272|0,P=Q+240|0,B=Q,M=Q+224|0,E=Q+208|0,b=Q+176|0,p=Q+160|0,v=Q+192|0,x=Q+144|0,w=Q+128|0,y=Q+112|0,k=Q+96|0,C=Q+80|0,n[(N=Q+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],NA(P,N,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=Q;else{s=M+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[N>>2])<<2)|0,f=16960+(a<<2)|0,d=w+8|0,g=y+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){j=B+((0|F)%5<<4)|0,n[E>>2]=n[j>>2],n[E+4>>2]=n[j+4>>2],n[E+8>>2]=n[j+8>>2],n[E+12>>2]=n[j+12>>2];do{}while(2==(0|jA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[E>>2],n[b+4>>2]=n[E+4>>2],n[b+8>>2]=n[E+8>>2],n[b+12>>2]=n[E+12>>2],oA(s,p),r=0|n[b>>2],N=0|n[17040+(80*r|0)+(n[M>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*N|0)>>2],(0|(j=0|n[18640+(80*r|0)+(20*N|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|j))}switch(j=18640+(80*r|0)+(20*N|0)+4|0,n[v>>2]=n[j>>2],n[v+4>>2]=n[j+4>>2],n[v+8>>2]=n[j+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,x),I=+(0|n[f>>2]),o[w>>3]=3*I,o[d>>3]=0,L=-1.5*I,o[y>>3]=L,o[g>>3]=2.598076211353316*I,o[k>>3]=L,o[h>>3]=-2.598076211353316*I,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=y,r=w;break;case 3:A=k,r=y;break;case 2:A=w,r=k;break;default:A=12;break A}Ne(p,x,r,A,C),EA(C,0|n[b>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,b),EA(b,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[M>>2]=n[E>>2],n[M+4>>2]=n[E+4>>2],n[M+8>>2]=n[E+8>>2],n[M+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&D(26970,27017,572,27027):S=Q}}function NA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function jA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,f=0,d=0,g=0,h=0;if(c=S,S=S+32|0,l=c+12|0,i=c,h=4+(A|=0)|0,g=0|n[16960+((e|=0)<<2)>>2],g=(s=!!(0|r))?3*g|0:g,u=0|n[h>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(f=A+12|0)>>2])|0))==(0|g))return S=c,1;d=f}else u=o+u+(r=0|n[(d=A+12|0)>>2])|0;if((0|u)<=(0|g))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){f=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),aA(h,l,i),pA(i),iA(i,l,h),f=r,r=A):(f=r,r=A)}else f=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[f>>2],(0|n[(u=f+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=f+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(h,l,h),nA(h),r=s&&((0|n[a>>2])+(0|n[h>>2])+(0|n[d>>2])|0)==(0|g)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|jA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,b,p,v,x,w,y,k,C,B=0,M=0,E=0,Q=0,N=0;if(C=S,S=S+240|0,x=C+208|0,w=C,y=C+192|0,k=C+176|0,h=C+160|0,m=C+144|0,b=C+128|0,p=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[x>>2]=n[A>>2],n[x+4>>2]=n[A+4>>2],n[x+8>>2]=n[A+8>>2],n[x+12>>2]=n[A+12>>2],PA(x,B,w),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,f=p+8|0,d=y+4|0,M=0,E=t,r=-1;A:for(;;){if(A=w+((B=(0|E)%6|0)<<4)|0,n[y>>2]=n[A>>2],n[y+4>>2]=n[A+4>>2],n[y+8>>2]=n[A+8>>2],n[y+12>>2]=n[A+12>>2],A=M,M=0|jA(y,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,h),Q=+(0|n[l>>2]),o[m>>3]=3*Q,o[c>>3]=0,N=-1.5*Q,o[b>>3]=N,o[u>>3]=2.598076211353316*Q,o[p>>3]=N,o[f>>3]=-2.598076211353316*Q,B=0|n[x>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[y>>2]:r)<<2)>>2]){case 1:A=b,r=m;break;case 3:A=p,r=b;break;case 2:A=m,r=p;break;default:A=8;break A}Ne(k,h,r,A,v),0|je(k,v)||0|je(h,v)||(EA(v,0|n[x>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(d,k),EA(k,0|n[y>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|g)){A=3;break}r=0|n[y>>2]}3!=(0|A)?8==(0|A)&&D(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function IA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function RA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function TA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|z(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|Ve(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function HA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function zA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|xA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|xA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|xA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+f(+n),n=+d(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+f(+n),o[e>>3]=r,n=t*+d(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+h(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+f(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+d(+n),t=+o[A>>3],+ +p(+a,+(+d(+i)*+f(+t)-+f(+n)*(r*+d(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+g(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+f(+l)*a,o[r>>3]=s,l=+d(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,f=0,d=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],f=+l(+r),i=+o[A+8>>3],f+=.5*(d=1.1547005383792515*+l(+i)),f-=+(0|(s=~~f)),d-=+(0|(A=~~d));do{if(f<.5){if(f<.3333333333333333){if(n[e>>2]=s,d<.5*(f+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(d<(h=1-f)))+A|0,n[e+4>>2]=A,h<=d&d<2*f){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(f<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,d<.5*f){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(d<1-f){if(n[e+4>>2]=A,2*f-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(A+1|0)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(0|A)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);g=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[g>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[g>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[g>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[g>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[g>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)):(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|z(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|xA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&D(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|z(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?gA(r):hA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|z(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|xA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(hA(l),s=c+1|0):s=c,0|z(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|jA(t,s,i,0)){if(0|z(u))do{}while(0|jA(t,s,0,0));(0|s)!=(0|c)&&dA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|z(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return QA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|z(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|z(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|zA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|HA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|zA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|HA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|pe(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,h=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+d(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+d(.5*(u-n)),r=+f(+i),a=+f(+v),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],v=+d(.5*(m-v)),s=+o[t+8>>3],u=+d(.5*(s-u)),l=+f(+m),u=2*+p(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+d(.5*(i-m)),s=+d(.5*(n-s)),s=2*+p(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+b(+ +c(+ +g(.5*(l=.5*(h+u+s)))*+g(.5*(l-h))*+g(.5*(l-u))*+g(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&D(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function fe(A){A|=0;var e,t,r=0;return(e=0|We(1,12))||D(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&D(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function de(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||D(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&D(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function ge(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function he(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0;if(c=S,S=S+32|0,x=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|o,52),B(),(0|u)!=(15&b))return S=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|o,45),B(),h>>>0>121|(m&=127)>>>0>121)return S=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(d=0|V(h,m))))return S=c,1;7==(0|(g=0|V(m,h)))?D(27514,27538,161,27548):(p=d,f=g)}else p=0,f=0;a=0|z(h),s=0|z(m),n[x>>2]=0,n[x+4>>2]=0,n[x+8>>2]=0,n[x+12>>2]=0;do{if(p){if(d=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(d){h=0,g=t,d=o;do{g=0|WA(g,d),d=0|B(),1==(0|(f=0|xA(f)))&&(f=0|xA(1)),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;else if(d){h=0,g=t,d=o;do{g=0|VA(g,d),d=0|B(),f=0|xA(f),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;if(JA(h,g,x),b||D(27563,27538,191,27548),(d=!!(0|a))&(f=!!(0|s))&&D(27590,27538,192,27548),d){if(7==(0|(f=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*f|0)+p|0]){u=1;break}h=g=0|n[21168+(28*f|0)+(p<<2)>>2]}else if(f){if(7==(0|(f=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*f|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(f<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){d=x+4|0,f=0;do{pA(d),f=f+1|0}while((0|f)!=(0|g))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,p),0|u)for(;0|ZA(u)?gA(l):hA(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{pA(l),u=u+1|0}while((0|u)!=(0|h))}iA(v=x+4|0,l,v),nA(v),v=51}}else if(JA(t,o,x),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&D(27621,27538,261,27548),7==(0|(f=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*f|0)+u|0])u=1;else if((0|(f=0|n[21168+(28*f|0)+(u<<2)>>2]))>0){d=x+4|0,u=0;do{pA(d),u=u+1|0}while((0|u)!=(0|f));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=x+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function be(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,f=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,g=0|tt(0|A,0|e,45),B(),(g&=127)>>>0>121)return S=a,5;if(i=0|z(g),rt(0|s,0,52),b=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=b,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|W(g,s)))?(S=a,0|(b=1)):(h=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(g=r)+4>>2]|m,n[(b=r)>>2]=n[g>>2]|h,n[b+4>>2]=m,S=a,0|(b=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}if(aA(c,u,f),nA(f),v=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(x=3*(15-l|0)|0)),s&=~B(),x=0|rt(0|lA(f),0,0|x),s=0|B()|s,n[(b=r)>>2]=x|v&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){f=127==(0|(s=0|W(g,t=0|lA(o))))?0:0|z(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|W(g,s)))&&D(27648,27538,411,27678),0|z(t)?D(27693,27538,412,27678):(m=t,h=l,d=s)}else m=s,h=0,d=t;if((0|(u=0|n[4272+(28*g|0)+(d<<2)>>2]))<=-1&&D(27724,27538,419,27678),!f){if((0|h)<0){s=5;break A}if(0|h){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=l,s=s+1|0}while((0|s)<(0|h))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|V(m,g)))&&D(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(x=r)>>2]=t,n[x+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&D(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&D(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(x=r)>>2]=l,n[x+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|f)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(x=r)>>2]=c,n[x+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&f&&(t=59),59==(0|t)&&1==(0|OA(0|n[(x=r)>>2],0|n[x+4>>2]))){s=9;break}p=0|n[(x=r)>>2],x=-1040385&n[x+4>>2],v=0|rt(0|s,0,45),x=0|x|B(),n[(s=r)>>2]=p|v,n[s+4>>2]=x,s=0}else s=1}while(0);return S=a,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,d=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+f(+u),d=+o[25968+(l<<3)>>3],o[t>>3]=u+d,o[t+8>>3]=u-d,u=+o[s+8>>3],c*=d,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function xe(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{v=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,f=3==(2|c),d=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){x=15;break e}if(0|De(0|n[o>>2],0|n[p>>2],e)){x=19;break e}}if(g&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){x=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){x=29;break}}if(h){if(0|(c=0|$A(s,l,e))){x=32;break}if(0|ve(s,l,t,0)){x=36;break}if(f&&0|Me(0|n[o>>2],0|n[p>>2],e,t)){x=42;break}if(g&&0|Qe(0|n[o>>2],0|n[p>>2],e,t)){x=42;break}}if(b){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){x=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){x=53;break}if(0|De(0|n[o>>2],0|n[p>>2],d)){x=53;break}if(0|Qe(0|n[o>>2],0|n[p>>2],t,e)){x=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){x=58;break e}if(!(0|q(c,e))){x=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|Me(0|n[o>>2],0|n[p>>2],t,e))){x=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){x=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else x=73}while(0);if(73==(0|x)&&(x=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|x){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,x=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,x=20;break;case 25:D(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(S=i);case 36:D(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,x=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,x=55;break;case 58:0|c&&Ye(c),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,x=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,x=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|x))return void(S=i);if(55==(0|x))return void(S=i);if(71==(0|x))return void(S=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[w>>2]=0,S=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;t=S,S=S+16|0,f=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return f=0|rt(((f=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,f|=A&~s,C(0|u),S=t,0|f}}while(0);return(r&=127)>>>0>120?(f=0,C(0|(u=0)),S=t,0|f):(RA(f,0,r+1|0,0),u=0|n[f+4>>2],f=0|n[f>>2],C(0|u),S=t,0|f)}function ye(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(d=c==d|l==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}else{e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(d=l==d|a==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,v=0,A=-1,d=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,x=0;c=+o[t+(x<<4)>>3],h=+o[t+(x<<4)+8>>3],f=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,d=c),h>3]=h,g=h),c>m?o[e>>3]=c:c=m,h>u&&(o[s>>3]=h,u=h),b=h>0&hp?h:p,v|=+l(+(h-f))>3.141592653589793,(0|(A=x+1|0))!=(0|r);)w=x,m=c,x=A,A=w;v&&(o[s>>3]=p,o[a>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,D=0;if(p=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(x=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,f=17976931348623157e292,d=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,y=0;s=+o[a+(y<<4)>>3],g=+o[a+(y<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,f=s),g>3]=g,d=g),s>h?o[e>>3]=s:s=h,g>c&&(o[w>>3]=g,c=g),m=g>0&gb?g:b,i|=+l(+(g-u))>3.141592653589793,(0|(r=y+1|0))!=(0|p);)B=y,h=s,y=r,r=B;i&&(o[w>>3]=b,o[x>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,x=e+((C=C+1|0)<<5)|0,w=0|n[a+(i<<3)>>2]){if(o[(y=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[x>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,v=0,f=17976931348623157e292,d=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(v<<4)>>3],h=+o[p+(v<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,f=s),h>3]=h,d=h),s>g?o[x>>3]=s:s=g,h>c&&(o[k>>3]=h,c=h),m=h>0&hb?h:b,a|=+l(+(h-u))>3.141592653589793,(0|(i=v+1|0))!=(0|w);)D=v,v=i,g=s,i=D;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[x>>2]=0,n[x+4>>2]=0,n[x+8>>2]=0,n[x+12>>2]=0,n[x+16>>2]=0,n[x+20>>2]=0,n[x+24>>2]=0,n[x+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function De(A,e,t){var r=0,o=0,i=0;if(!(0|ye(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|ye((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function Me(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|ye((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|ye(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,D=0;if(u=S,S=S+176|0,l=u+172|0,f=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,f),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{y=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[f>>2]),o[B>>3]=y,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],y=+ie(+o[r+16>>3],0|n[f>>2]),i=+ie(+o[r+24>>3],0|n[f>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(f=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],x=+o[e+(t<<4)>>3],w=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,d=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(x>=a)|!(d>=a)&&!(x<=s)|!(d<=s)&&!(w<=i)|!(g<=i)&&!(w>=y)|!(g>=y)){v=d-x,b=g-w,e=0;do{if(D=e,B=(0|(e=e+1|0))==(0|f)?0:e,d=+o[c+8+(D<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-d,h=+o[c+8+(D<<4)>>3],!(0==(p=v*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=w-d,C=x-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(v*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|f))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function Qe(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function Ne(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,f,d=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],d=((d=+o[r>>3]-u)*(a-(f=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-f))/(s*c-i*d),o[n>>3]=l+s*d,o[n+8>>3]=a+i*d}function je(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|IA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|z(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:D(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0;if(l=S,S=S+32|0,x=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,g=(g=!(0|HA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),g>>>0<=t>>>0)return S=l,2;!(b=!(0|(m&=15)))&&!((p=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|HA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,x))return S=l,1;if(u=(0|n[x>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|R(A,e,p,s,a);do{if(!c){if(h=0|n[(d=a)>>2],u=(f=(d=0|n[d+4>>2])>>>0>>0|(0|d)==(0|e)&h>>>0>>0)?h:A,f=f?d:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(d&(0|B())))c=t;else{if(d=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|d)<0&&D(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|d)&&D(27795,27797,248,27822),0|Fe(A,e,x)&&D(27795,27797,248,27822),c=(0|n[x>>2])+d|0,7==(0|(d=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&D(27795,27797,248,27822),n[i>>2]=0,0|(c=0|R(A,e,d,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|f)&g>>>0>>0){if(u=0|HA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,f=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,f=h;break}do{if(!(0|Fe(g,h,x))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[x>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[x>>2])|0)%6|0;break}c=-1}while(0);u=g,f=h}else c=t}while(0);h=0|n[(d=a)>>2],d=0|n[d+4>>2]}if((0|u)==(0|h)&(0|f)==(0|d)){if(A=(g=!!(0|HA(h,d)))?0|_(h,d,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,d),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(h,d,x))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[x>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[x>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|g&5==(0|c)?0:c}e=f,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),x=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=x,S=l,0}function Ie(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|We(e,4),n[A>>2]=r,r||D(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Re(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Te(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function He(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||D(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function ze(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0;e=S,S=S+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(d=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=d&~(1<>2]=A,n[r>>2]=a),y=t<<3,n[o+4>>2]=3|y,n[(y=o+y+4|0)>>2]=1|n[y>>2],S=e,0|i;if(u>>>0>(f=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=d&~(1<>2]=t,n[A>>2]=r,A=d),s=(y=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+y>>2]=s,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?y:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(y=c+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|d,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}d=u}else d=u}else d=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(b=A<<(d=(A+1048320|0)>>>16&8))|0)>>>16&4)|d|(c=(245760+(b<<=l)|0)>>>16&2))+(b<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,b=65;break A}A=r,i=s}if(a=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:b,!r){r=a,b=61;break}l<<=1}else r=0,A=0,b=61}while(0);if(61==(0|b)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=d>>>12&16)>>>5&8)|s|(l=(d>>>=a)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(d=(-8&n[a+4>>2])-u|0)>>>0>>0)?d:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(f=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else y=0|n[l+8>>2],n[y+12>>2]=t,n[t+8>>2]=y}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?y:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)y=s+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2];else{if(n[l+4>>2]=3|u,n[f+4>>2]=1|s,n[f+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=f,n[t+12>>2]=f,n[f+8>>2]=t,n[f+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[f+28>>2]=r,n[4+(A=f+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=f,n[w>>2]=f,n[f+8>>2]=y,n[f+12>>2]=t,n[f+24>>2]=0}}while(0);return S=e,0|l+8}d=u}else d=u;else d=-1}while(0);if((r=0|n[6983])>>>0>=d>>>0)return t=r-d|0,A=0|n[6986],t>>>0>15?(y=A+d|0,n[6986]=y,n[6983]=t,n[y+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|d):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(y=A+r+4|0)>>2]=1|n[y>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>d>>>0)return x=s-d|0,n[6984]=x,w=(y=0|n[6987])+d|0,n[6987]=w,n[w+4>>2]=1|x,n[y+4>>2]=3|d,S=e,0|y+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&g^1431655768,A=4096),l=d+48|0,(u=(a=A+(c=d+47|0)|0)&(i=0-A|0))>>>0<=d>>>0)return S=e,0;if(0|(A=0|n[7091])&&(g=(f=0|n[7089])+u|0)>>>0<=f>>>0|g>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((g=0|n[o>>2])>>>0<=r>>>0&&(g+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){b=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,b=145;break A}}else o=A,b=136;else t=0}else b=128}while(0);do{if(128==(0|b))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(h=0|n[7100])-1|0)&t?(m+t&0-h)-t|0:0)+u|0)+(h=0|n[7089])|0,t>>>0>d>>>0&t>>>0<2147483647)){if(0|(g=0|n[7091])&&m>>>0<=h>>>0|m>>>0>g>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,b=145;break A}o=A,b=136}else t=0}while(0);do{if(136==(0|b)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(x=0|ut(0|u)))|1^(v=(p=(m=0|ut(0))-x|0)>>>0>(d+40|0)>>>0)|x>>>0>>0&-1!=(0|x)&-1!=(0|m)^1)&&(s=v?p:t,a=x,b=145),145==(0|b)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|b)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(x=7&(x=c+8|0)?0-x&7:0)|0,x=(y=(0|n[6984])+s|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[c+y+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){b=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|b)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(f=t+4|0)>>2]=(0|n[f>>2])+s,u=(f=a+(7&(f=a+8|0)?0-f&7:0)|0)+d|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-f-d|0,n[f+4>>2]=3|d;e:do{if((0|c)==(0|t))y=(0|n[6984])+l|0,n[6984]=y,n[6987]=u,n[u+4>>2]=1|y;else{if((0|n[6986])==(0|t)){y=(0|n[6983])+l|0,n[6983]=y,n[6986]=u,n[u+4>>2]=1|y,n[u+y>>2]=y;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else y=0|n[t+8>>2],n[y+12>>2]=A,n[A+8>>2]=y}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?y:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=u,n[w>>2]=u,n[u+8>>2]=y,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|f+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(y=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=y+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,w=a+(x=7&(x=a+8|0)?0-x&7:0)|0,x=(r=s+-40|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{w=t,n[(t=t+4|0)>>2]=7}while((w+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((x=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=x)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=c,n[w>>2]=c,n[c+8>>2]=y,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(y=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,w=a+(x=7&(x=a+8|0)?0-x&7:0)|0,x=(y=s+-40|0)-x|0,n[6987]=w,n[6984]=x,n[w+4>>2]=1|x,n[a+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>d>>>0)return x=t-d|0,n[6984]=x,w=(y=0|n[6987])+d|0,n[6987]=w,n[w+4>>2]=1|x,n[y+4>>2]=3|d,S=e,0|y+8}return n[(y=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function We(A,e){e|=0;var t=0;return(A|=0)?(t=0|x(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function Ve(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(u=A|=0,a=t|=0,s=d=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(d=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=f=i+1|0,A=u>>>(f>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(f>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(f=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),i=u<<(h=64-s|0)&(l=f>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Ke(0|a))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),h=(c>>>0)/(a>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),g=0,h=c>>>((0|Ke(0|s))>>>0),0|(C(0|g),h);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(a){c=0|Ve(0|(f=0|t),0|(u=d|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(d=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|d,g&f|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),h=i<<1&-2|s,0|(C(0|(g=(0|i)>>>31|(c|a)<<1|l)),h)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|x(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|x(o,r=A>>>16))|0,e=0|x(o=e>>>16,n),0|(C((A>>>16)+(0|x(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|x(e,o))+(0|x(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return Q(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(j(0|e),M(12),-1):(0|e)>(0|r)&&!(0|N(0|e))?(M(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,f=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,f=0|tt(0|t,0|r,52),B(),(0|c)!=(15&f))return S=s,12;if(l=c+-1|0,c>>>0>1){TA(A,e,l,a),TA(t,r,l,i),u=0|n[(f=a)>>2],f=0|n[f+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|f)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|HA(u,f)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:We,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0;if(o=S,S=S+16|0,p=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=b,l=0|B()|l}while((0|c)<(0|v));b=a}else b=a;else b=A,l=e;m=0|tt(0|b,0|l,45),B();A:do{if(0|z(127&m)){if(c=0|tt(0|b,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,h=v;;){if(g=h,(h=h+-1|0)>>>0>15|(0|v)<(0|h)){u=19;break}if((0|v)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|v)<(0|g))d=a;else{u=h;do{d=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=d,c=0|B()|c}while((0|u)<(0|v));d=a}else d=A,c=e;if(f=0|tt(0|d,0|c,45),B(),0|z(127&f)){f=0|tt(0|d,0|c,52),B(),f&=15;e:do{if(f)for(u=1;;){if(a=0|tt(0|d,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(d=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=v-g|0,((0|u)<0)<<31>>31),f=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|f,5,0)),0|B(),-5,-1),a=0|Ve(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=f),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|f,0|(g=d+-1|0),((0|g)<0)<<31>>31)),0|B()),f=0|Ve(0|g,0|(d=0|B()),0|n[(f=r)>>2],0|n[f+4>>2]),d=0|B(),n[(g=r)>>2]=f,n[g+4>>2]=d),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))D(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|pe(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,v,p)&&D(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(v=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(D(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|Ve(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:TA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|HA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|ze(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):He(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Re(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Te(i)))do{e=0|fe(t);do{de(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Te(i)}while(0|A);return Re(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,B=0,M=0,E=0,Q=0,N=0,j=0,S=0,F=0,P=0,I=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||D(27396,27235,317,27415),(e=0|Ue(i<<5))||D(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,M=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(d=+o[u+8>>3],r=u,u=0|n[u+16>>2],f=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(d-f))>3.141592653589793){L=14;break}c+=(f-d)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|L)){L=0,c=0,r=h;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:h)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=M,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|We(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(M<<5)|0,g=0|n[a>>2]){for(o[(h=e+(M<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(M<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(b=e+(M<<5)+16|0)>>3]=-17976931348623157e292,y=17976931348623157e292,k=-17976931348623157e292,s=0,p=g,d=17976931348623157e292,x=17976931348623157e292,w=-17976931348623157e292,f=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((v=!(0|p))?g:p)+8>>3],c>3]=c,d=c),B>3]=B,x=B),c>w?o[u>>3]=c:c=w,B>f&&(o[b>>3]=B,f=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)w=c;s&&(o[b>>3]=k,o[m>>3]=y)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=M+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}M=s,m=r}if(21==(0|L))D(27213,27235,35,27247);else if(23==(0|L))D(27267,27235,37,27247);else if(27==(0|L))D(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),j=s<<2,S=!(0|A),N=0,r=0;;){if(Q=0|n[t+(N<<2)>>2],F)L=73;else{if(!(M=0|Ue(j))){L=50;break}if(!(E=0|Ue(j))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[Q>>2])?(n[M+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[M>>2],1==(0|v))i=a;else for(b=0,p=-1,i=a,m=a;;){for(g=0|n[m>>2],a=0,u=0;h=(0|(s=0|n[n[M+(u<<2)>>2]>>2]))==(0|g)?a:a+(1&he(s,0|n[E+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|v))break e;b=a,p=s?h:p,m=0|n[M+(a<<2)>>2]}else i=0}}while(0);if(Ye(M),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=Q,n[s>>2]=Q}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[Q>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(Q),r=1}if((0|(N=N+1|0))>=(0|P)){I=r;break A}}50==(0|L)?D(27452,27235,249,27471):52==(0|L)?D(27490,27235,252,27471):70==(0|L)&&D(27310,27235,61,27333)}else I=0}while(0);return Ye(t),Ye(e),0|I}return 0}(t))?(ge(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&D(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(f=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[f>>2])>>>0>A>>>0:0))))return S=a,2;f=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|z(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|f)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=f-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|Ve(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|Ve(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),h=0|n[(d=i)>>2],d=0|n[d+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),d&=~B(),m=0|rt(0|(o=0|Ve(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),d=0|B()|d,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=d,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}g=0|n[(m=i)>>2],m=0|n[m+4>>2],h=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=g&~h,n[s+4>>2]=m,s=1;break}o=0|n[(g=i)>>2],g=0|n[g+4>>2],d=0|rt(7,0,0|(r=3*(u+r|0)|0)),g&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),g=0|B()|g,n[(h=i)>>2]=r|o&~d,n[h+4>>2]=g,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|f)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|f)<1)return S=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=f-s|0,((0|h)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(d=0|Xe(0|A,0|e,0|h,0|m)),0|(g=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|d,0|g,0|h,0|m)),0|B()),e=0|B(),(0|f)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,x=0,w=0,y=0,k=0,C=0,M=0,E=0,Q=0,N=0,j=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{j=0|n[4+(N=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[N>>2],n[S+4>>2]=j,i=0|Ve(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(j=0|Ue(o=t<<3)))return 13;if(st(0|j,0|A,0|o),!(N=0|We(t,8)))return Ye(j),13;A:for(;;){E=0|tt(0|(u=0|n[(i=j)>>2]),0|(i=0|n[i+4>>2]),52),B(),Q=(E&=15)-1|0,M=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(M&C){if(x=0|rt(0|Q,0,52),w=0|B(),Q>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|Ve(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=j+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(f=0|tt(0|l,0|A,52),B(),(0|(f&=15))<(0|Q)){i=12,S=27;break A}if((0|f)!=(0|Q)&&(l|=x,A=-15728641&A|w,f>>>0>=E>>>0)){c=Q;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(g=0|At(0|l,0|A,0|t,0|r),h=0|B(),!(!(0|(d=0|n[(f=c=N+(g<<3)|0)>>2]))&!(0|(f=0|n[f+4>>2])))){p=0,v=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|d)==(0|l)&(-117440513&f)==(0|A)){m=0|tt(0|d,0|f,56),B(),b=1+(m&=7)|0,k=0|tt(0|d,0|f,45),B();t:do{if(0|z(127&k)){if(d=0|tt(0|d,0|f,52),B(),!(d&=15)){f=6;break}for(f=1;;){if(!(!((k=0|rt(7,0,3*(15-f|0)|0))&l)&!((0|B())&A))){f=7;break t}if(!(f>>>0>>0)){f=6;break}f=f+1|0}}else f=7}while(0);if((m+2|0)>>>0>f>>>0){S=41;break A}k=0|rt(0|b,0,56),A=B()|-117440513&A,n[(y=c)>>2]=0,n[y+4>>2]=0,l|=k}else g=0|$e(0|(g=0|Ve(0|g,0|h,1,0)),0|B(),0|t,0|r),h=0|B();v=0|Ve(0|v,0|p,1,0),p=0|B(),d=0|n[(f=c=N+(g<<3)|0)>>2],f=0|n[f+4>>2]}while(!(!(0|d)&!(0|f)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|Ve(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=j+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|Ve(0|t,0|r,5,0),(y=0|B())>>>0<0|!(0|y)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){S=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=f=N+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{d=0|tt(0|a,0|s,56),B(),l=1+(d&=7)|0,g=-117440513&s,y=0|tt(0|a,0|s,45),B();e:do{if(0|z(127&y)){if(h=0|tt(0|a,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(a&(y=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=f)>>2]=a,n[l+4>>2]=s,l=d+2|0}}while(0);7==(0|l)?(n[(y=k+(A<<3)|0)>>2]=a,n[y+4>>2]=-117440513&s,A=0|Ve(0|A,0|m,1,0),y=0|B()):y=m}if(b=0|Ve(0|b,0|p,1,0),!((0|(p=0|B()))<(0|r)|(0|p)==(0|r)&b>>>0>>0))break;m=y}if(C){if(v=Q>>>0>15,x=0|rt(0|Q,0,52),w=0|B(),!M){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(Q=e+(a<<3)|0)>>2]=u,n[Q+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()),l=0|Ve(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=j+(l<<3)|0)>>2],i=0|n[i+4>>2];i=y;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(h=0|tt(0|u,0|i,52),B(),v|(0|(h&=15))<(0|Q)){S=80;break A}if((0|h)!=(0|Q)){if(f=u|x,d=-15728641&i|w,h>>>0>=E>>>0){g=Q;do{M=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,f|=M,d=0|B()|d}while(g>>>0>>0)}}else f=u,d=i;m=0|At(0|f,0|d,0|t,0|r),g=0,h=0,p=0|B();do{if((0|g)>(0|r)|(0|g)==(0|r)&h>>>0>t>>>0){S=81;break A}if((-117440513&(b=0|n[4+(M=N+(m<<3)|0)>>2]))==(0|d)&&(0|n[M>>2])==(0|f)){S=65;break}m=0|$e(0|(M=0|Ve(0|m,0|p,1,0)),0|B(),0|t,0|r),p=0|B(),h=0|Ve(0|h,0|g,1,0),g=0|B(),M=N+(m<<3)|0}while((0|n[M>>2])!=(0|f)||(0|n[M+4>>2])!=(0|d));if(65==(0|S)&&(S=0,!0&100663296==(117440512&b)))break;n[(M=e+(a<<3)|0)>>2]=u,n[M+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|Ve(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0