diff --git a/README.md b/README.md index 7d98ebb6..16c14995 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,14 @@ The MeshCore Python ecosystem has three components: ### Contacts & Topology - **Interactive map** — MapLibre GL with dark theme, neighbor positions, and smooth animations -- **Mesh topology graph** — Network connections inferred from packet paths -- **Deep Analysis** — One-click full topology rebuild from 20K+ packets -- **Intelligent disambiguation** — Four-factor scoring resolves prefix collisions -- **Edge confidence** — Line thickness scales with observation count +- **3D terrain mode** — Toggle real-world topographic terrain with hillshading; all markers and edges drape onto the landscape +- **3D arc edges** — Topology edges and neighbor lines render as elevated arcs via deck.gl PathLayer (GPU-accelerated) +- **Viterbi HMM path decoding** — Hidden Markov Model resolves prefix collisions using physics-based transition costs and observation evidence +- **Ghost node discovery** — Unknown repeaters detected when no known candidate is geographically plausible; locations estimated from anchor midpoints +- **Deep Analysis** — One-click full topology rebuild from 20K+ packets with Viterbi decoding +- **Edge confidence** — Line thickness and opacity scale with observation count and certainty - **Animated edges** — Trace-in effect on toggle, smooth fade-out -- **Filter toggles** — Solo view for hub nodes or direct neighbors only +- **Filter toggles** — Solo view for hub nodes, direct neighbors, or traffic-based filtering - **Loop detection** — Identifies redundant paths (double-line rendering) - **High-contrast markers** — Light fill with dark outline ensures visibility against any overlay - **Path health panel** — Health scores, weakest links, and latency estimates for observed routes @@ -211,6 +213,24 @@ radio: coding_rate: 6 # 4/5, 4/6, 4/7, or 4/8 ``` +### Advanced: DIO2 and DIO3 Configuration + +Some LoRa modules require specific DIO pin configurations. These are **independent settings** that serve different purposes: + +- **DIO3 (TCXO)** — Temperature Compensated Crystal Oscillator control. Set `use_dio3_tcxo: true` if your module has a TCXO that needs DIO3 for voltage supply. +- **DIO2 (RF Switch)** — Antenna RF switch control for TX/RX path switching. Set `use_dio2_rf: true` if your module requires DIO2 to control an external RF switch. + +> **Note:** These settings are available on the pyMC_Repeater `dev` branch (which uses pyMC_core `dev`). The `main` branch hardcodes `setDio2RfSwitch(False)`. + +Example for modules requiring both: +```yaml +radio: + use_dio3_tcxo: true # Enable TCXO via DIO3 + use_dio2_rf: true # Enable RF switch via DIO2 (dev branch only) +``` + +**Important:** Setting `use_dio3_tcxo: true` does NOT automatically enable DIO2. They are independent configurations for different hardware features. + ### Service Management ```bash @@ -304,7 +324,30 @@ Packet path: ["FA", "79", "24", "19"] Origin → Hop1 → Hop2 → Local ``` -**The Challenge**: Multiple nodes may share the same 2-char prefix (1 in 256 collision chance). The system uses four-factor scoring inspired by [meshcore-bot](https://github.com/agessaman/meshcore-bot) to resolve ambiguity: +**The Challenge**: Multiple nodes may share the same 2-char prefix (1 in 256 collision chance). The system uses a **Viterbi HMM decoder** to find the most likely sequence of actual nodes: + +#### Viterbi Path Decoding + +Inspired by [d40cht/meshcore-connectivity-analysis](https://github.com/d40cht/meshcore-connectivity-analysis), the decoder treats path disambiguation as a Hidden Markov Model problem: + +- **States** — All candidate nodes matching each prefix, plus a "ghost" state for unknown nodes +- **Priors** — Based on recency (recently-seen nodes are more likely) and disambiguation confidence +- **Transitions** — Physics-based costs using geographic distance and LoRa range constraints + +**Key principle: Observation beats theory.** When edge observations have ≥80% confidence, real-world evidence overrides physics-based costs. + +#### Ghost Node Discovery + +When no known candidate is geographically plausible for a prefix, the decoder selects a "ghost" state. These are aggregated to discover unknown repeaters: + +- **Clustering** — Ghost observations grouped by prefix +- **Location estimation** — Weighted centroid of anchor node midpoints +- **Confidence scoring** — Based on observation count, common neighbors, and location variance +- **UI panel** — Shows likely-real ghost nodes with estimated coordinates and adjacent known nodes + +#### Four-Factor Scoring (Pre-Viterbi) + +Before Viterbi decoding, candidates are scored using four-factor analysis inspired by [meshcore-bot](https://github.com/agessaman/meshcore-bot): 1. **Position (15%)** — Where in paths does this prefix typically appear? 2. **Co-occurrence (15%)** — Which prefixes appear adjacent to this one? @@ -317,7 +360,6 @@ Packet path: ["FA", "79", "24", "19"] - **Age filtering** — Nodes not seen in 14 days are excluded from consideration - **Dual-hop anchoring** — Candidates scored by distance to both previous and next hops (a relay must be within RF range of both neighbors) - **Score-weighted redistribution** — Appearance counts redistributed proportionally by combined score -- **Source-geographic correlation** — Position-1 prefixes scored by distance from packet origin The system loads up to 20,000 packets (~7 days of traffic) to build comprehensive topology evidence. @@ -338,6 +380,16 @@ Topology edges are rendered with visual cues indicating confidence: - **Fade animation** — Edges smoothly fade out when topology is disabled - **Loop edges** — Redundant paths rendered as parallel double-lines in accent color +### 3D Terrain & Visualization + +The Contacts map supports full 3D terrain rendering: + +- **Terrain tiles** — AWS Terrarium elevation data (free, no API key) +- **Hillshading** — Visual depth tuned for dark map themes +- **3D arcs** — Topology edges and neighbor lines rendered as elevated arcs via deck.gl +- **GPU acceleration** — deck.gl PathLayer and IconLayer for smooth pan/zoom/tilt +- **Automatic draping** — All markers and edges align to terrain elevation + ### Path Visualization Clicking a packet shows its route on a map with confidence indicators: @@ -346,7 +398,7 @@ Clicking a packet shows its route on a map with confidence indicators: - **Yellow** — 50-99% confidence (high certainty) - **Orange** — 25-49% confidence (medium certainty) - **Red** — 1-24% confidence (low certainty) -- **Gray** — Unknown prefix (not in neighbor list) +- **Gray/Ghost** — Unknown prefix resolved to ghost node ## License @@ -359,5 +411,6 @@ Built on the excellent work of: - **[RightUp](https://github.com/rightup)** — Creator of pyMC_Repeater, pymc_core, and the MeshCore ecosystem - **[pyMC_Repeater](https://github.com/rightup/pyMC_Repeater)** — Core repeater daemon for LoRa communication and mesh routing - **[pymc_core](https://github.com/rightup/pyMC_core)** — Underlying mesh protocol library +- **[d40cht/meshcore-connectivity-analysis](https://github.com/d40cht/meshcore-connectivity-analysis)** — Viterbi HMM approach for path disambiguation and ghost node discovery - **[meshcore-bot](https://github.com/agessaman/meshcore-bot)** — Inspiration for recency scoring and dual-hop anchor disambiguation - **[MeshCore](https://meshcore.co.uk/)** — The MeshCore project and community diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index e20680b2..bad5df3d 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.129 +0.9.130 diff --git a/frontend/dist/assets/CollisionExplorerModal-BqgPeZ5i.js b/frontend/dist/assets/CollisionExplorerModal-BqgPeZ5i.js new file mode 100644 index 00000000..89834ed9 --- /dev/null +++ b/frontend/dist/assets/CollisionExplorerModal-BqgPeZ5i.js @@ -0,0 +1 @@ +import{r as e,b as t,j as o,a4 as s,X as n,a2 as l,ag as a,ah as r,ai as i,aj as c,a7 as d,W as u}from"./vendor-react-nG6Am_s0.js";import{L as m}from"./leaflet-ChRwnWLk.js";import{c as h}from"./recharts-BJXKa0n8.js";import{d as x,s as p,e as f}from"./index-C05_s9O_.js";const b="#4338CA",v="#F59E0B",y="#39D98A";function g({hash:t,highlighted:s}){const[n,l]=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),l(!0),setTimeout(()=>l(!1),2e3)},[t]),r=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:r}),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 w({node:e,className:t}){const s=e.contactType.toLowerCase(),n="room server"===s||"room_server"===s||"room"===s||"server"===s,l="companion"===s||"client"===s||"cli"===s;return n&&e.isRepeater?o.jsxs("div",{className:h("relative",t),children:[o.jsx(a,{className:"w-full h-full",style:{color:v}}),o.jsx(r,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:b}})]}):n?o.jsx(a,{className:t,style:{color:v}}):l?o.jsx(i,{className:h(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?o.jsx(c,{className:t,style:{color:y}}):o.jsx(r,{className:t,style:{color:b}}):o.jsx(i,{className:h(t,"text-text-muted")})}function N({node:e,isHovered:t,onMouseEnter:s,onMouseLeave:n,onTouchStart:l}){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:l,children:[o.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:o.jsx(w,{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",style:{backgroundColor:"rgba(57, 217, 138, 0.2)",color:"#39D98A"},children:"NBR"}),e.isRepeater&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),o.jsx("div",{className:"mt-1",children:o.jsx(g,{hash:e.hash,highlighted:t})})]})]})}function j({nodes:t,hoveredHash:s,onNodeHover:n,onNodeLeave:a}){const r=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||r.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),r.current=e,()=>{e.remove(),r.current=null}},[]),e.useEffect(()=>{const e=r.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 l=o.isNeighbor?y:b,r=m.circleMarker(s,{radius:8,fillColor:l,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});r.bindTooltip(o.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),r.on("mouseover",()=>n(o.hash)),r.on("mouseout",()=>a()),r.addTo(e),c.current.set(o.hash,r)}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=t===s,l=o.isNeighbor?y:b;e.setStyle({radius:n?12:8,fillColor:n?"#FBBF24":l,weight:n?3:2}),n?(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-muted p-4",children:[o.jsx(l,{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 C=e.memo(function({isOpen:l,prefix:a,candidateHashes:r,onClose:i}){const c=x(),d=p(),u=f(),[m,b]=e.useState(null),v=e.useMemo(()=>new Set(u.map(e=>e.hash)),[u]),y=null==c?void 0:c.neighbors,g=e.useMemo(()=>y?r.map(e=>{var t,o;const s=y[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:v.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)):[],[r,y,v,d]),w=e.useCallback(e=>b(e),[]),C=e.useCallback(()=>b(null),[]);return e.useEffect(()=>{if(!l)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)}},[l,i]),l?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-muted",children:[g.length," nodes share this prefix"]})]})]}),o.jsx("button",{onClick:i,className:"p-2 rounded-lg text-text-muted 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(N,{node:e,isHovered:m===e.hash,onMouseEnter:()=>w(e.hash),onMouseLeave:C,onTouchStart:()=>w(e.hash)},e.hash))})}),o.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:o.jsx(j,{nodes:g,hoveredHash:m,onNodeHover:w,onNodeLeave:C})})]})]})}),document.body):null});export{C}; diff --git a/frontend/dist/assets/CollisionExplorerModal-ChC6YKo5.js b/frontend/dist/assets/CollisionExplorerModal-ChC6YKo5.js deleted file mode 100644 index c0c93ede..00000000 --- a/frontend/dist/assets/CollisionExplorerModal-ChC6YKo5.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,f as t,z as o,g as s,j as n,X as a}from"./index-CLi6xczL.js";import{b as r,g as l,c as i}from"./recharts-bmHCCfxU.js";import{L as c}from"./leaflet-ClE6qLuu.js";import{T as d,a as h,C as m}from"./triangle-alert-CtfeX3hX.js";import{M as u}from"./map-pin-BHxLBGAv.js";const x=e("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),p=e("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),y=e("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),f=e("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),b=e("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),g=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),v=e("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),w="#4338CA",j="#F59E0B",N="#39D98A";function k({hash:e,highlighted:t}){const[o,s]=r.useState(!1),a=r.useCallback(t=>{t.preventDefault(),t.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}}(e),s(!0),setTimeout(()=>s(!1),2e3)},[e]),l=e.length>12?`${e.slice(0,12)}…`:e;return n.jsxs("button",{type:"button",onClick:a,className:i("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",t?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${e}`,children:[n.jsx("span",{className:i("transition-colors",o?"text-accent-success":"text-text-secondary"),children:l}),o?n.jsx(h,{className:"w-2.5 h-2.5 text-accent-success"}):n.jsx(m,{className:"w-2.5 h-2.5 opacity-40"})]})}function C({node:e,className:t}){const o=e.contactType.toLowerCase(),s="room server"===o||"room_server"===o||"room"===o||"server"===o,a="companion"===o||"client"===o||"cli"===o;return s&&e.isRepeater?n.jsxs("div",{className:i("relative",t),children:[n.jsx(f,{className:"w-full h-full",style:{color:j}}),n.jsx(v,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:w}})]}):s?n.jsx(f,{className:t,style:{color:j}}):a?n.jsx(b,{className:i(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?n.jsx(x,{className:t,style:{color:N}}):n.jsx(v,{className:t,style:{color:w}}):n.jsx(b,{className:i(t,"text-text-muted")})}function M({node:e,isHovered:t,onMouseEnter:o,onMouseLeave:s,onTouchStart:a}){return n.jsxs("div",{className:i("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:o,onMouseLeave:s,onTouchStart:a,children:[n.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:n.jsx(C,{node:e,className:"w-5 h-5"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:"rgba(57, 217, 138, 0.2)",color:"#39D98A"},children:"NBR"}),e.isRepeater&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),n.jsx("div",{className:"mt-1",children:n.jsx(k,{hash:e.hash,highlighted:t})})]})]})}function T({nodes:e,hoveredHash:t,onNodeHover:o,onNodeLeave:s}){const a=r.useRef(null),l=r.useRef(null),i=r.useRef(new Map),d=r.useMemo(()=>e.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[e]);return r.useEffect(()=>{if(!l.current||a.current)return;const e=c.map(l.current,{zoomControl:!0,attributionControl:!0});return c.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),a.current=e,()=>{e.remove(),a.current=null}},[]),r.useEffect(()=>{const e=a.current;if(!e)return;if(i.current.forEach(e=>e.remove()),i.current.clear(),0===d.length)return;const t=c.latLngBounds([]);for(const n of d){if(!n.latitude||!n.longitude)continue;const a=c.latLng(n.latitude,n.longitude);t.extend(a);const r=n.isNeighbor?N:w,l=c.circleMarker(a,{radius:8,fillColor:r,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});l.bindTooltip(n.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),l.on("mouseover",()=>o(n.hash)),l.on("mouseout",()=>s()),l.addTo(e),i.current.set(n.hash,l)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,o,s]),r.useEffect(()=>{i.current.forEach((e,o)=>{const s=d.find(e=>e.hash===o);if(!s)return;const n=o===t,a=s.isNeighbor?N:w;e.setStyle({radius:n?12:8,fillColor:n?"#FBBF24":a,weight:n?3:2}),n?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[t,d]),0===d.length?n.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:n.jsxs("div",{className:"text-center text-text-muted p-4",children:[n.jsx(u,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),n.jsx("p",{className:"text-sm",children:"No location data available"}),n.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):n.jsx("div",{ref:l,className:"h-full w-full rounded-lg overflow-hidden"})}const E=r.memo(function({isOpen:e,prefix:c,candidateHashes:h,onClose:m}){const u=t(),x=o(),p=s(),[y,f]=r.useState(null),b=r.useMemo(()=>new Set(p.map(e=>e.hash)),[p]),g=null==u?void 0:u.neighbors,v=r.useMemo(()=>g?h.map(e=>{var t,o;const s=g[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:x.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)):[],[h,g,b,x]),w=r.useCallback(e=>f(e),[]),j=r.useCallback(()=>f(null),[]);return r.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&m()};window.addEventListener("keydown",t);const o=window.scrollY,s={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=`-${o}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=s.overflow,document.body.style.position=s.position,document.body.style.width=s.width,document.body.style.top=s.top,window.scrollTo(0,o)}},[e,m]),e?l.createPortal(n.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:m,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:n.jsxs("div",{className:i("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:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:n.jsx(d,{className:"w-5 h-5 text-signal-fair"})}),n.jsxs("div",{children:[n.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",n.jsx("span",{className:"font-mono text-accent-primary",children:c})]}),n.jsxs("p",{className:"text-xs text-text-muted",children:[v.length," nodes share this prefix"]})]})]}),n.jsx("button",{onClick:m,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:n.jsx(a,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:n.jsx("div",{className:"p-2",children:v.map(e=>n.jsx(M,{node:e,isHovered:y===e.hash,onMouseEnter:()=>w(e.hash),onMouseLeave:j,onTouchStart:()=>w(e.hash)},e.hash))})}),n.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:n.jsx(T,{nodes:v,hoveredHash:y,onNodeHover:w,onNodeLeave:j})})]})]})}),document.body):null});export{x as A,E as C,p as E,y as G,f as M,g as N,v as S,b as a}; diff --git a/frontend/dist/assets/Configuration-BGuqb1D4.js b/frontend/dist/assets/Configuration-BGuqb1D4.js new file mode 100644 index 00000000..2b38ab29 --- /dev/null +++ b/frontend/dist/assets/Configuration-BGuqb1D4.js @@ -0,0 +1 @@ +import{r as e,j as t,f as s,i as a,X as r,al as n,a7 as l,aI as c,aJ as i,k as d,p as o,aK as u,aL as m,aM as x,aN as p,aO as h,ay as b,an as y,aP as g,aA as f,aQ as j,a4 as v,$ as N,W as w,a6 as k,aR as C}from"./vendor-react-nG6Am_s0.js";import{a5 as _,a6 as S,a7 as T,E as F,a8 as E,a9 as L,aa as P,ab as R,a4 as A,ac as I,ad as M,ae as D,af as z,ag as O,ah as K,ai as q,aj as H,ak as $}from"./index-C05_s9O_.js";import{H as Y}from"./HashBadge-CXiNob7o.js";import{C as B}from"./ConfirmModal-V3007Nz2.js";import{c as U}from"./recharts-BJXKa0n8.js";import{P as V,a as X,C as W,b as G}from"./PageLayout-D3aCCXDi.js";import{R as J,C as Q}from"./Grid-IJFBFvdm.js";import"./vendor-core-XI_xDZ-M.js";import"./deckgl-MTXp-Y3t.js";const Z=e.memo(function({showLogoOnly:s=!1,showThumbnailsOnly:a=!1}){const{theme:r,setThemePreset:n,setBrightness:l}=_(),{backgroundImage:c,brightness:i}=r,[d,o]=e.useState(!1),[u,m]=e.useState(!1),x=e.useRef(null),p=e.useRef(null),h=S.find(e=>e.backgroundImage===c)??S[0],b=h.id,y=e.useCallback((e,t)=>{if(!p.current)return i;const s=(p.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,p.current.brightness+s)))},[i]),g=e.useCallback(e=>{n(e),o(!0)},[n]),f=e.useCallback(e=>{l(e)},[l]),j=e.useCallback(e=>{const t=S.find(t=>t.id===e);t&&T(t.backgroundImage)},[]);if(s){const e=h.displaySize,s=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return t.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:h.displayFont,color:h.displayColor,fontSize:s,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:h.displayName})}return t.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:S.map(e=>{const s=b===e.id,a=s&&(d||u);return t.jsxs("div",{ref:s?x:void 0,title:e.displayName,className:U("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",s?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{s?o(!0):j(e.id)},onMouseLeave:()=>!u&&o(!1),onClick:()=>!s&&g(e.id),onTouchStart:e=>{if(!s)return;e.preventDefault();const t=e.touches[0];p.current={y:t.clientY,brightness:i},m(!0),o(!0);const a=e=>{e.preventDefault();const t=e.touches[0];f(y(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),p.current=null,m(!1),setTimeout(()=>o(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!s)return;e.preventDefault(),p.current={y:e.clientY,brightness:i},m(!0),o(!0);const t=e=>{f(y(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",a),p.current=null,m(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",a)},children:[t.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:a?.4:1}}),s&&t.jsxs("div",{className:U("absolute inset-0 transition-opacity duration-200",a?"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-i+"%"}}),t.jsx("div",{className:"absolute inset-x-1 h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-i+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[i,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,s)=>t.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),ee=[{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"}],te=[5,6,7,8,9,10,11,12],se=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}];function ae(){var _,S,T,ae,re,ne;const{stats:le,setMode:ce,clearModeMutation:ie,setDutyCycleConfig:de,clearDutyCycleMutation:oe,fetchStats:ue}=F(),me=null==(_=null==le?void 0:le.config)?void 0:_.radio,xe=null==(S=null==le?void 0:le.config)?void 0:S.repeater,pe=null==(T=null==le?void 0:le.config)?void 0:T.duty_cycle,he=(null==le?void 0:le.node_name)||(null==(ae=null==le?void 0:le.config)?void 0:ae.node_name)||"Unknown Node",be=(null==xe?void 0:xe.mode)??"forward",ye=(null==pe?void 0:pe.enforcement_enabled)??!1,ge=null==(re=null==le?void 0:le.config)?void 0:re.delays,[fe,je]=e.useState(!1),[ve,Ne]=e.useState(""),[we,ke]=e.useState(62.5),[Ce,_e]=e.useState(7),[Se,Te]=e.useState(5),[Fe,Ee]=e.useState(""),[Le,Pe]=e.useState("idle"),[Re,Ae]=e.useState(null),Ie=e.useRef(null),Me=e.useRef(null),De=e.useRef(null),[ze,Oe]=e.useState("idle"),[Ke,qe]=e.useState("idle"),[He,$e]=e.useState(null),[Ye,Be]=e.useState(null),Ue=e.useRef(!0),Ve=e.useRef(null),Xe=e.useRef(null),We=e.useRef(null),Ge=e.useRef(null),Je=e.useRef(!1),Qe=e.useRef(!1);e.useEffect(()=>(Ue.current=!0,()=>{Ue.current=!1,Ve.current&&clearTimeout(Ve.current),Xe.current&&clearTimeout(Xe.current),We.current&&clearTimeout(We.current),Ge.current&&clearTimeout(Ge.current),Lt.current&&clearTimeout(Lt.current),Pt.current&&clearTimeout(Pt.current),Me.current&&clearTimeout(Me.current),dt.current&&clearTimeout(dt.current),Ct.current&&clearTimeout(Ct.current)}),[]);const[Ze,et]=e.useState(!1),[tt,st]=e.useState(""),[at,rt]=e.useState(""),[nt,lt]=e.useState(""),[ct,it]=e.useState("idle"),dt=e.useRef(null),[ot,ut]=e.useState(!1),[mt,xt]=e.useState(""),[pt,ht]=e.useState(""),[bt,yt]=e.useState(""),[gt,ft]=e.useState(""),[jt,vt]=e.useState("idle"),[Nt,wt]=e.useState(null),kt=e.useRef(null),Ct=e.useRef(null),_t=null==(ne=null==le?void 0:le.config)?void 0:ne.web,[St,Tt]=e.useState("idle"),[Ft,Et]=e.useState(null),Lt=e.useRef(null),Pt=e.useRef(null),Rt=e.useRef(!1),[At,It]=e.useState([]),[Mt,Dt]=e.useState(!1),[zt,Ot]=e.useState(null),[Kt,qt]=e.useState(!1),[Ht,$t]=e.useState(""),[Yt,Bt]=e.useState(null),[Ut,Vt]=e.useState(!1),[Xt,Wt]=e.useState(null),[Gt,Jt]=e.useState(!1),[Qt,Zt]=e.useState(!1),[es,ts]=e.useState(!1),[ss,as]=e.useState([]),[rs,ns]=e.useState(!1),[ls,cs]=e.useState(null),[is,ds]=e.useState("deny"),[os,us]=e.useState(!1),[ms,xs]=e.useState(null),[ps,hs]=e.useState(new Set),[bs,ys]=e.useState(!1),[gs,fs]=e.useState(!1),[js,vs]=e.useState(!1),[Ns,ws]=e.useState(null),[ks,Cs]=e.useState(null),[_s,Ss]=e.useState(""),[Ts,Fs]=e.useState("deny"),[Es,Ls]=e.useState(!1),[Ps,Rs]=e.useState(!0),[As,Is]=e.useState(!1),[Ms,Ds]=e.useState(!0),[zs,Os]=e.useState("idle"),[Ks,qs]=e.useState(!1),[Hs,$s]=e.useState(!1);e.useEffect(()=>{me&&fe&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me,fe]);const Ys=e.useMemo(()=>{if(!me||!fe)return!1;const e=me.frequency/1e6,t=me.bandwidth/1e3,s=parseFloat(ve)||0;return Math.abs(s-e)>1e-4||we!==t||Ce!==me.spreading_factor||Se!==me.coding_rate||parseInt(Fe)!==me.tx_power},[me,fe,ve,we,Ce,Se,Fe]),Bs=e.useCallback(()=>{je(!1),Ae(null),me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me]);e.useEffect(()=>{if(!fe)return;const e=e=>{Ie.current&&!Ie.current.contains(e.target)&&Bs()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[fe,Bs]);const Us=e.useCallback(()=>{const e=null==ge?void 0:ge.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[ge]),Vs=e.useCallback(()=>{const e=null==ge?void 0:ge.direct_tx_delay_factor;return"number"==typeof e?e:.5},[ge]),Xs=e.useCallback(()=>{const e=null==pe?void 0:pe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[pe]),Ws=e.useCallback(()=>{st(Us().toFixed(2)),rt(Vs().toFixed(2)),lt(Xs().toFixed(1)),et(!0)},[Us,Vs,Xs]),Gs=e.useCallback(()=>{et(!1)},[]);e.useEffect(()=>{if(!Ze)return;const e=e=>{De.current&&!De.current.contains(e.target)&&Gs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ze,Gs]);const Js=e.useCallback(()=>{var e,t,s;xt(he),ht((null==(e=null==xe?void 0:xe.latitude)?void 0:e.toString())||"0"),yt((null==(t=null==xe?void 0:xe.longitude)?void 0:t.toString())||"0"),ft((null==(s=null==xe?void 0:xe.send_advert_interval_hours)?void 0:s.toString())||"0"),wt(null),ut(!0)},[he,xe]),Qs=e.useCallback(()=>{ut(!1),wt(null)},[]);e.useEffect(()=>{if(!ot)return;const e=e=>{kt.current&&!kt.current.contains(e.target)&&Qs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[ot,Qs]);const Zs=async()=>{var e;if("loading"===St)return;const t=(null==_t?void 0:_t.cors_enabled)??!1,s=!t,a=t;Lt.current&&clearTimeout(Lt.current),Pt.current&&clearTimeout(Pt.current),Rt.current=!1,Et(s),Tt("loading"),Lt.current=setTimeout(()=>{Rt.current||Ue.current&&(Et(a),Tt("error"),Pt.current=setTimeout(()=>{Ue.current&&(Tt("idle"),Et(null))},2e3))},1e4);try{const t=await I({web:{cors_enabled:s}});if(Rt.current=!0,Lt.current&&clearTimeout(Lt.current),!Ue.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await ue(),Tt("success"),Pt.current=setTimeout(()=>{Ue.current&&(Tt("idle"),Et(null))},2e3)):(Et(a),Tt("error"),Pt.current=setTimeout(()=>{Ue.current&&(Tt("idle"),Et(null))},2e3))}catch{if(Rt.current=!0,Lt.current&&clearTimeout(Lt.current),!Ue.current)return;Et(a),Tt("error"),Pt.current=setTimeout(()=>{Ue.current&&(Tt("idle"),Et(null))},2e3)}};e.useEffect(()=>{(async()=>{Ds(!0);try{const e=await M();e.success&&e.data?Is(e.data.exists):Is(!1);const t=null==_t?void 0:_t.web_path;Rs(!t||""===t)}catch{Is(!1)}finally{Ds(!1)}})()},[null==_t?void 0:_t.web_path]);const ea=async e=>{var t;if("loading"!==zs){Os("loading");try{const s=await I({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!Ue.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Rs(e),Os("success"),qs(!0),setTimeout(()=>{Ue.current&&Os("idle")},2e3)):(Os("error"),setTimeout(()=>{Ue.current&&Os("idle")},2e3))}catch{if(!Ue.current)return;Os("error"),setTimeout(()=>{Ue.current&&Os("idle")},2e3)}}},ta=e.useCallback(async()=>{Dt(!0),Ot(null);try{const e=await E();It(e.tokens||[])}catch(e){Ot(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Dt(!1)}},[]);e.useEffect(()=>{ta()},[ta]);const sa=async()=>{if(Ht.trim()){Jt(!0),Ot(null);try{const e=await z(Ht.trim());Bt(e.token||null),qt(!1),Vt(!0),$t(""),await ta()}catch(e){Ot(e instanceof Error?e.message:"Failed to create token")}finally{Jt(!1)}}else Ot("Token name is required")},aa=e=>e?new Date(1e3*e).toLocaleString():"Never",ra=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},[]),na=e.useCallback(async()=>{ns(!0),cs(null);try{const e=await L();e.success&&e.data?as(ra(e.data)):cs(e.error||"Failed to load transport keys")}catch(e){cs(e instanceof Error?e.message:"Unknown error occurred")}finally{ns(!1)}},[ra]);e.useEffect(()=>{na()},[na]);const la=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=la(s.children,t);if(e)return e}}return null},[]),ca=e.useCallback(()=>{if(!ms)return;const e=la(ss,ms);return null==e?void 0:e.name},[ms,ss,la]),ia=e.useCallback(e=>{hs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),da=async e=>{us(!0),cs(null);try{const t=await K("allow"===e);t.success?ds(e):cs(t.error||"Failed to update global flood policy")}catch(t){cs(t instanceof Error?t.message:"Failed to update global flood policy")}finally{us(!1)}},oa=async()=>{if(_s.trim()){Ls(!0),cs(null);try{const e=await q({name:_s.trim(),flood_policy:Ts,parent_id:ms??void 0});e.success?(await na(),ys(!1),Ss(""),Fs("deny")):cs(e.error||"Failed to add transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to add transport key")}finally{Ls(!1)}}else cs("Key name is required")},ua=e.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(ws({...e}),fs(!0))},[ms,ss,la]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(bs&&(ys(!1),Ss(""),Fs("deny")),gs&&(fs(!1),ws(null)),js&&(vs(!1),Cs(null)),Kt&&(qt(!1),$t("")),Ut&&(Vt(!1),Bt(null)))};if(bs||gs||js||Kt||Ut)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[bs,gs,js,Kt,Ut]);const ma=e.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(Cs(e),vs(!0))},[ms,ss,la]),xa=({node:e,level:s})=>{const a=ps.has(e.id),r=ms===e.id,n=e.children&&e.children.length>0,l="allow"===is;return t.jsxs("div",{children:[t.jsxs("div",{className:U("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",r?"bg-accent-primary/15":"hover:bg-white/[0.02]",l&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!l&&xs(e.id),children:[n?t.jsx("button",{onClick:t=>{t.stopPropagation(),ia(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:t.jsx(k,{className:U("w-3.5 h-3.5 text-text-muted transition-transform",a&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(C,{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:U("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"})]}),n&&a&&t.jsx("div",{children:e.children.map(e=>t.jsx(xa,{node:e,level:s+1},e.id))})]})};return t.jsxs(V,{children:[t.jsx(X,{title:"Configuration",icon:t.jsx(s,{})}),t.jsxs(J,{template:"standard",children:[t.jsx(Q,{span:12,md:6,children:t.jsx(W,{children:t.jsxs("div",{ref:kt,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(a,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:xe&&(ot?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Qs,disabled:"loading"===jt,className:U("p-2 rounded-lg transition-colors","loading"===jt?"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"!==jt){Ct.current&&clearTimeout(Ct.current),vt("loading"),wt(null);try{const e={};mt&&mt!==he&&(e.node_name=mt);const t=parseFloat(pt);isNaN(t)||t===(null==xe?void 0:xe.latitude)||(e.latitude=t);const s=parseFloat(bt);isNaN(s)||s===(null==xe?void 0:xe.longitude)||(e.longitude=s);const a=parseInt(gt);if(isNaN(a)||a===(null==xe?void 0:xe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return wt({success:!0,message:"No changes to save"}),void vt("idle");const r=await A(e);if(!Ue.current)return;if(r.success&&r.data){const e=r.data.applied.join(", ");wt({success:!0,message:`Updated: ${e}`}),await ue(),vt("success"),Ct.current=setTimeout(()=>{Ue.current&&(vt("idle"),ut(!1),wt(null))},1500)}else wt({success:!1,message:r.error||"Failed to save"}),vt("error"),Ct.current=setTimeout(()=>{Ue.current&&vt("idle")},2e3)}catch(e){if(!Ue.current)return;wt({success:!1,message:String(e)}),vt("error"),Ct.current=setTimeout(()=>{Ue.current&&vt("idle")},2e3)}}},disabled:"loading"===jt,className:U("p-2 rounded-lg transition-colors","loading"===jt?"text-accent-primary cursor-wait":"success"===jt?"text-accent-success":"error"===jt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===jt?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===jt?t.jsx(l,{className:"w-4 h-4"}):"error"===jt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Js,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"})}))})]}),Nt&&t.jsx("div",{className:U("text-xs mb-3 px-2 py-1.5 rounded-md",Nt.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Nt.message}),xe?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:U("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?t.jsx("input",{type:"text",value:mt,onChange:e=>xt(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:he})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Latitude (°)":"Latitude"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?t.jsx("input",{type:"number",value:pt,onChange:e=>ht(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!==xe.latitude?xe.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Longitude (°)":"Longitude"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?t.jsx("input",{type:"number",value:bt,onChange:e=>yt(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!==xe.longitude?xe.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?t.jsx("input",{type:"number",value:gt,onChange:e=>ft(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:xe.send_advert_interval_hours>0?`${xe.send_advert_interval_hours}h`:"Disabled"})}),ot&&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-white/[0.02]",children:t.jsx("span",{className:"type-data text-text-primary",children:xe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(Q,{span:12,md:6,children:t.jsx(W,{children:t.jsxs("div",{ref:Ie,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(i,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:me&&(fe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Bs,disabled:"loading"===Le,className:U("p-2 rounded-lg transition-colors","loading"===Le?"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"!==Le){Me.current&&clearTimeout(Me.current),Pe("loading"),Ae(null);try{const e={},t=parseFloat(ve),s=me?me.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=me?me.bandwidth/1e3:0;we!==a&&(e.bandwidth_khz=we),Ce!==(null==me?void 0:me.spreading_factor)&&(e.spreading_factor=Ce),Se!==(null==me?void 0:me.coding_rate)&&(e.coding_rate=Se);const r=parseInt(Fe);if(r!==(null==me?void 0:me.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Ae({success:!0,message:"No changes to save"}),void Pe("idle");const n=await A(e);if(!Ue.current)return;if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";Ae({success:!0,message:`Updated: ${e}${t}`}),await ue(),Pe("success"),Me.current=setTimeout(()=>{Ue.current&&(Pe("idle"),je(!1),Ae(null))},1500)}else Ae({success:!1,message:n.error||"Failed to save"}),Pe("error"),Me.current=setTimeout(()=>{Ue.current&&Pe("idle")},2e3)}catch(e){if(!Ue.current)return;Ae({success:!1,message:String(e)}),Pe("error"),Me.current=setTimeout(()=>{Ue.current&&Pe("idle")},2e3)}}},disabled:"loading"===Le||!Ys,className:U("p-2 rounded-lg transition-colors","loading"===Le?"text-accent-primary cursor-wait":"success"===Le?"text-accent-success":"error"===Le?"text-accent-danger":Ys?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:Ys?"Save changes":"No changes to save",children:"loading"===Le?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===Le?t.jsx(l,{className:"w-4 h-4"}):"error"===Le?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power))),Ae(null),je(!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"})}))})]}),Re&&t.jsx("div",{className:U("text-xs mb-3 px-2 py-1.5 rounded-md",Re.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Re.message}),me?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:fe?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?t.jsx("input",{type:"number",value:ve,onChange:e=>Ne(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:P(me.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?t.jsx("input",{type:"number",value:Fe,onChange:e=>Ee(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:[me.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:U("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:we,onChange:e=>ke(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:ee.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(d,{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:R(me.bandwidth)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),t.jsx("div",{className:U("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Ce,onChange:e=>_e(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:te.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(d,{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",me.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:U("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Se,onChange:e=>Te(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:se.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(d,{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/",me.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-white/[0.02]",children:t.jsxs("span",{className:"type-data text-text-primary",children:[me.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(J,{template:"standard",children:[t.jsx(Q,{span:12,md:6,children:t.jsx(W,{children:t.jsxs("div",{ref:De,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(o,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:Ze?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==ct){dt.current&&clearTimeout(dt.current),it("loading");try{const e=await A({tx_delay_factor:parseFloat(tt),direct_tx_delay_factor:parseFloat(at)});if(await de({max_airtime_percent:parseFloat(nt),enforcement_enabled:ye}),!Ue.current)return;e.success&&e.data?(await ue(),it("success"),dt.current=setTimeout(()=>{Ue.current&&(it("idle"),et(!1))},1500)):(it("error"),dt.current=setTimeout(()=>{Ue.current&&it("idle")},2e3))}catch{if(!Ue.current)return;it("error"),dt.current=setTimeout(()=>{Ue.current&&it("idle")},2e3)}}},disabled:"loading"===ct,className:U("p-2 rounded-lg transition-colors","loading"===ct?"text-accent-primary cursor-wait":"success"===ct?"text-accent-success":"error"===ct?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===ct?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===ct?t.jsx(l,{className:"w-4 h-4"}):"error"===ct?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})}),t.jsx("button",{onClick:Gs,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:Ws,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!==He?He:"forward"===be;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ze)return;const t=!e,s="forward"===be;Ve.current&&clearTimeout(Ve.current),Xe.current&&clearTimeout(Xe.current),Je.current=!1,$e(t),Oe("loading"),Ve.current=setTimeout(()=>{Je.current||Ue.current&&($e(s),Oe("error"),Xe.current=setTimeout(()=>{Ue.current&&(Oe("idle"),$e(null))},2e3))},1e4);try{if(await ce(t?"forward":"monitor"),Je.current=!0,Ve.current&&clearTimeout(Ve.current),!Ue.current)return;Oe("success"),Xe.current=setTimeout(()=>{Ue.current&&(Oe("idle"),$e(null),ie())},2e3)}catch{if(Je.current=!0,Ve.current&&clearTimeout(Ve.current),!Ue.current)return;$e(s),Oe("error"),Xe.current=setTimeout(()=>{Ue.current&&(Oe("idle"),$e(null))},2e3)}},disabled:"loading"===ze,className:U("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"===ze&&"opacity-70"),"aria-label":"Toggle forward mode",children:t.jsx("span",{className:U("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:U("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ze&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ze&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===ze&&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!==Ye?Ye:ye;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===Ke)return;const t=!e,s=ye;We.current&&clearTimeout(We.current),Ge.current&&clearTimeout(Ge.current),Qe.current=!1,Be(t),qe("loading"),We.current=setTimeout(()=>{Qe.current||Ue.current&&(Be(s),qe("error"),Ge.current=setTimeout(()=>{Ue.current&&(qe("idle"),Be(null))},2e3))},1e4);try{if(await de({max_airtime_percent:Xs(),enforcement_enabled:t}),Qe.current=!0,We.current&&clearTimeout(We.current),!Ue.current)return;qe("success"),Ge.current=setTimeout(()=>{Ue.current&&(qe("idle"),Be(null),oe())},2e3)}catch{if(Qe.current=!0,We.current&&clearTimeout(We.current),!Ue.current)return;Be(s),qe("error"),Ge.current=setTimeout(()=>{Ue.current&&(qe("idle"),Be(null))},2e3)}},disabled:"loading"===Ke,className:U("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"===Ke&&"opacity-70"),"aria-label":"Toggle duty cycle",children:t.jsx("span",{className:U("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:U("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===Ke&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===Ke&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===Ke&&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:U("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:nt,onChange:e=>lt(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:[Xs().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:U("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:tt,onChange:e=>st(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:[Us().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:U("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:at,onChange:e=>rt(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:[Vs().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(Q,{span:12,md:6,children:t.jsxs(W,{children:[t.jsx(G,{icon:t.jsx(s,{}),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!==Ft?Ft:(null==_t?void 0:_t.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Zs,disabled:"loading"===St,className:U("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"===St&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:t.jsx("span",{className:U("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),"loading"===St&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===St&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===St&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Z,{showLogoOnly:!0})}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(Z,{showThumbnailsOnly:!0})})]})]})]})]})})]}),t.jsx(J,{template:"auto",children:t.jsxs(W,{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(u,{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:()=>ys(!0),disabled:"allow"===is,className:U("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(m,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ua,disabled:!ms||"allow"===is,className:U("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:ma,disabled:!ms||"allow"===is,className:U("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-white/[0.02] 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:U("w-10 h-10 rounded-full flex items-center justify-center","allow"===is?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===is?t.jsx(x,{className:"w-5 h-5 text-accent-success"}):t.jsx(p,{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-white/[0.02] rounded-full p-1",children:[t.jsx("button",{onClick:()=>da("deny"),disabled:os,className:U("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===is?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>da("allow"),disabled:os,className:U("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Allow"})]}),os&&t.jsx(n,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ls&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ls}),t.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:rs?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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===ss.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:t.jsx(u,{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:ss.map(e=>t.jsx(xa,{node:e,level:0},e.id))})})]})}),t.jsx(J,{template:"auto",children:t.jsxs(W,{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(h,{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:()=>qt(!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(m,{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(b,{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."})]})]})}),zt&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:zt}),Mt&&0===At.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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..."})]}):At.length>0?t.jsx("div",{className:"space-y-2",children:At.map(e=>t.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] 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(h,{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: ",aa(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",aa(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Wt({id:e.id,name:e.name}),disabled:Qt,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(y,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:t.jsx(h,{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:()=>qt(!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(J,{template:"auto",children:t.jsxs(W,{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(g,{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:U("flex items-start gap-3 p-4 bg-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ps?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===zs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ps,onChange:()=>ea(!0),disabled:"loading"===zs,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:U("flex items-start gap-3 p-4 bg-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ps?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===zs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ps,onChange:()=>ea(!1),disabled:"loading"===zs,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"})]})]})]}),!Ms&&t.jsx("div",{className:U("bg-white/[0.02] rounded-2xl p-4",As?"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:U("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",As?"bg-accent-success/20":"bg-accent-tertiary/20"),children:As?t.jsx(f,{className:"w-4 h-4 text-accent-success"}):t.jsx(b,{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:As?"PyMC Console has been detected":"PyMC Console Not Installed"}),As?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(j,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Ks&&t.jsx("div",{className:"bg-white/[0.02] 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(v,{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(!Hs){$s(!0);try{await D(),qs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{qs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Hs,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:Hs?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(N,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),t.jsx(J,{template:"auto",children:t.jsxs(W,{children:[t.jsx(G,{icon:t.jsx(o,{}),title:"Node Information",largeTitle:!0}),le?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),t.jsx("p",{className:"type-body text-text-primary mt-1",children:he})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.core_version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),t.jsx("div",{className:"mt-1",children:le.local_hash?t.jsx(Y,{hash:le.local_hash,size:"sm"}):t.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),le.public_key&&t.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),t.jsx("div",{className:"mt-1",children:t.jsx(Y,{hash:le.public_key,prefixLength:12,suffixLength:8})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),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&&qt(!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:Ht,onChange:e=>$t(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&&sa(),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:()=>{qt(!1),$t(""),Ot(null)},disabled:Gt,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:sa,disabled:Gt||!Ht.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:Gt?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ut&&Yt&&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&&Vt(!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(v,{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:Yt,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:()=>{Yt&&(navigator.clipboard.writeText(Yt),ts(!0),setTimeout(()=>ts(!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:[es?t.jsx(l,{className:"w-4 h-4 text-accent-success"}):t.jsx(w,{className:"w-4 h-4"}),es?"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: ',Yt.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Vt(!1),Bt(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(B,{isOpen:!!Xt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Xt?void 0:Xt.name}'? This action cannot be undone.`,confirmLabel:Qt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Xt){Zt(!0),Ot(null);try{await O(Xt.id),await ta(),Wt(null)}catch(e){Ot(e instanceof Error?e.message:"Failed to revoke token")}finally{Zt(!1)}}},onCancel:()=>Wt(null)}),bs&&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&&ys(!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:[ms&&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:ca()})]}),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:_s,onChange:e=>Ss(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&&oa(),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("deny"),className:U("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ts?"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("allow"),className:U("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ts?"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:()=>{ys(!1),Ss(""),Fs("deny")},disabled:Es,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:oa,disabled:Es||!_s.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:Es?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),gs&&Ns&&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&&fs(!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:Ns.name,onChange:e=>ws({...Ns,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:()=>ws({...Ns,floodPolicy:"deny"}),className:U("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ns.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:()=>ws({...Ns,floodPolicy:"allow"}),className:U("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ns.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),Ns.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:Ns.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{fs(!1),Cs(Ns),vs(!0),ws(null)},disabled:Es,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:()=>{fs(!1),ws(null)},disabled:Es,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(Ns){Ls(!0),cs(null);try{const e=await H(Ns.id,{name:Ns.name,flood_policy:Ns.floodPolicy});e.success?(await na(),fs(!1),ws(null)):cs(e.error||"Failed to update transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to update transport key")}finally{Ls(!1)}}},disabled:Es||!Ns.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:Es?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),js&&ks&&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&&vs(!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:["'",ks.name,"'"]}),"?"]}),ks.children&&ks.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(v,{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 ",ks.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:()=>{vs(!1),Cs(null)},disabled:Es,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(ks){Ls(!0),cs(null);try{const e=await $(ks.id);e.success?(await na(),vs(!1),Cs(null),xs(null)):cs(e.error||"Failed to delete transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to delete transport key")}finally{Ls(!1)}}},disabled:Es,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:Es?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{ae as default}; diff --git a/frontend/dist/assets/Configuration-Bc_dJgLj.js b/frontend/dist/assets/Configuration-Bc_dJgLj.js deleted file mode 100644 index dc42f7e4..00000000 --- a/frontend/dist/assets/Configuration-Bc_dJgLj.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,ak as t,al as s,am as a,j as r,O as n,an as l,ao as c,ap as i,aq as d,X as o,ar as u,F as m,as as x,R as p,ai as h,at as b,au as y,av as g,aw as f,ax as j,ay as v,az as N,aA as w,aB as k}from"./index-CLi6xczL.js";import{b as C,c as _}from"./recharts-bmHCCfxU.js";import{H as S}from"./HashBadge-Ds68z9zP.js";import{T,C as F}from"./ConfirmModal-6N9orQPe.js";import{P as E,a as L,C as M,b as P}from"./PageLayout-BXoaut2N.js";import{R,C as A}from"./Grid-BpRuWPLK.js";import{L as z}from"./loader-circle-BiSCrAz6.js";import{a as I,T as D,C as O}from"./triangle-alert-CtfeX3hX.js";import{I as H}from"./info-D-OJbIcP.js";import{E as q}from"./external-link-BG6kqAP_.js";import{R as K}from"./refresh-cw-BPBhhAzK.js";import{C as V}from"./chevron-right-uVAMQ-qt.js";import"./maplibre-gl-CFO9X1Ek.js";const $=e("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),Y=e("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),B=e("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),U=e("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),X=e("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),G=e("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),W=e("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),J=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Q=e("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Z=e("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),ee=C.memo(function({showLogoOnly:e=!1,showThumbnailsOnly:n=!1}){const{theme:l,setThemePreset:c,setBrightness:i}=t(),{backgroundImage:d,brightness:o}=l,[u,m]=C.useState(!1),[x,p]=C.useState(!1),h=C.useRef(null),b=C.useRef(null),y=s.find(e=>e.backgroundImage===d)??s[0],g=y.id,f=C.useCallback((e,t)=>{if(!b.current)return o;const s=(b.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,b.current.brightness+s)))},[o]),j=C.useCallback(e=>{c(e),m(!0)},[c]),v=C.useCallback(e=>{i(e)},[i]),N=C.useCallback(e=>{const t=s.find(t=>t.id===e);t&&a(t.backgroundImage)},[]);if(e){const e=y.displaySize,t=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return r.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:y.displayFont,color:y.displayColor,fontSize:t,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:y.displayName})}return r.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:s.map(e=>{const t=g===e.id,s=t&&(u||x);return r.jsxs("div",{ref:t?h:void 0,title:e.displayName,className:_("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",t?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{t?m(!0):N(e.id)},onMouseLeave:()=>!x&&m(!1),onClick:()=>!t&&j(e.id),onTouchStart:e=>{if(!t)return;e.preventDefault();const s=e.touches[0];b.current={y:s.clientY,brightness:o},p(!0),m(!0);const a=e=>{e.preventDefault();const t=e.touches[0];v(f(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),b.current=null,p(!1),setTimeout(()=>m(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!t)return;e.preventDefault(),b.current={y:e.clientY,brightness:o},p(!0),m(!0);const s=e=>{v(f(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),b.current=null,p(!1)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)},children:[r.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[r.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:s?.4:1}}),t&&r.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",s?"opacity-100":"opacity-0"),children:[r.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-o+"%"}}),r.jsx("div",{className:"absolute inset-x-1 h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-o+"%"}}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[o,"%"]})})]})]}),r.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,t)=>r.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,t)=>r.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},t))},t))})]},e.id)})})}),te=[{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"}],se=[5,6,7,8,9,10,11,12],ae=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}];function re(){var e,t,s,a,re,ne;const{stats:le,setMode:ce,clearModeMutation:ie,setDutyCycleConfig:de,clearDutyCycleMutation:oe,fetchStats:ue}=n(),me=null==(e=null==le?void 0:le.config)?void 0:e.radio,xe=null==(t=null==le?void 0:le.config)?void 0:t.repeater,pe=null==(s=null==le?void 0:le.config)?void 0:s.duty_cycle,he=(null==le?void 0:le.node_name)||(null==(a=null==le?void 0:le.config)?void 0:a.node_name)||"Unknown Node",be=(null==xe?void 0:xe.mode)??"forward",ye=(null==pe?void 0:pe.enforcement_enabled)??!1,ge=null==(re=null==le?void 0:le.config)?void 0:re.delays,[fe,je]=C.useState(!1),[ve,Ne]=C.useState(""),[we,ke]=C.useState(62.5),[Ce,_e]=C.useState(7),[Se,Te]=C.useState(5),[Fe,Ee]=C.useState(""),[Le,Me]=C.useState("idle"),[Pe,Re]=C.useState(null),Ae=C.useRef(null),ze=C.useRef(null),Ie=C.useRef(null),[De,Oe]=C.useState("idle"),[He,qe]=C.useState("idle"),[Ke,Ve]=C.useState(null),[$e,Ye]=C.useState(null),Be=C.useRef(!0),Ue=C.useRef(null),Xe=C.useRef(null),Ge=C.useRef(null),We=C.useRef(null),Je=C.useRef(!1),Qe=C.useRef(!1);C.useEffect(()=>(Be.current=!0,()=>{Be.current=!1,Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),ze.current&&clearTimeout(ze.current),dt.current&&clearTimeout(dt.current),Ct.current&&clearTimeout(Ct.current)}),[]);const[Ze,et]=C.useState(!1),[tt,st]=C.useState(""),[at,rt]=C.useState(""),[nt,lt]=C.useState(""),[ct,it]=C.useState("idle"),dt=C.useRef(null),[ot,ut]=C.useState(!1),[mt,xt]=C.useState(""),[pt,ht]=C.useState(""),[bt,yt]=C.useState(""),[gt,ft]=C.useState(""),[jt,vt]=C.useState("idle"),[Nt,wt]=C.useState(null),kt=C.useRef(null),Ct=C.useRef(null),_t=null==(ne=null==le?void 0:le.config)?void 0:ne.web,[St,Tt]=C.useState("idle"),[Ft,Et]=C.useState(null),Lt=C.useRef(null),Mt=C.useRef(null),Pt=C.useRef(!1),[Rt,At]=C.useState([]),[zt,It]=C.useState(!1),[Dt,Ot]=C.useState(null),[Ht,qt]=C.useState(!1),[Kt,Vt]=C.useState(""),[$t,Yt]=C.useState(null),[Bt,Ut]=C.useState(!1),[Xt,Gt]=C.useState(null),[Wt,Jt]=C.useState(!1),[Qt,Zt]=C.useState(!1),[es,ts]=C.useState(!1),[ss,as]=C.useState([]),[rs,ns]=C.useState(!1),[ls,cs]=C.useState(null),[is,ds]=C.useState("deny"),[os,us]=C.useState(!1),[ms,xs]=C.useState(null),[ps,hs]=C.useState(new Set),[bs,ys]=C.useState(!1),[gs,fs]=C.useState(!1),[js,vs]=C.useState(!1),[Ns,ws]=C.useState(null),[ks,Cs]=C.useState(null),[_s,Ss]=C.useState(""),[Ts,Fs]=C.useState("deny"),[Es,Ls]=C.useState(!1),[Ms,Ps]=C.useState(!0),[Rs,As]=C.useState(!1),[zs,Is]=C.useState(!0),[Ds,Os]=C.useState("idle"),[Hs,qs]=C.useState(!1),[Ks,Vs]=C.useState(!1);C.useEffect(()=>{me&&fe&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me,fe]);const $s=C.useMemo(()=>{if(!me||!fe)return!1;const e=me.frequency/1e6,t=me.bandwidth/1e3,s=parseFloat(ve)||0;return Math.abs(s-e)>1e-4||we!==t||Ce!==me.spreading_factor||Se!==me.coding_rate||parseInt(Fe)!==me.tx_power},[me,fe,ve,we,Ce,Se,Fe]),Ys=C.useCallback(()=>{je(!1),Re(null),me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me]);C.useEffect(()=>{if(!fe)return;const e=e=>{Ae.current&&!Ae.current.contains(e.target)&&Ys()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[fe,Ys]);const Bs=C.useCallback(()=>{const e=null==ge?void 0:ge.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[ge]),Us=C.useCallback(()=>{const e=null==ge?void 0:ge.direct_tx_delay_factor;return"number"==typeof e?e:.5},[ge]),Xs=C.useCallback(()=>{const e=null==pe?void 0:pe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[pe]),Gs=C.useCallback(()=>{st(Bs().toFixed(2)),rt(Us().toFixed(2)),lt(Xs().toFixed(1)),et(!0)},[Bs,Us,Xs]),Ws=C.useCallback(()=>{et(!1)},[]);C.useEffect(()=>{if(!Ze)return;const e=e=>{Ie.current&&!Ie.current.contains(e.target)&&Ws()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ze,Ws]);const Js=C.useCallback(()=>{var e,t,s;xt(he),ht((null==(e=null==xe?void 0:xe.latitude)?void 0:e.toString())||"0"),yt((null==(t=null==xe?void 0:xe.longitude)?void 0:t.toString())||"0"),ft((null==(s=null==xe?void 0:xe.send_advert_interval_hours)?void 0:s.toString())||"0"),wt(null),ut(!0)},[he,xe]),Qs=C.useCallback(()=>{ut(!1),wt(null)},[]);C.useEffect(()=>{if(!ot)return;const e=e=>{kt.current&&!kt.current.contains(e.target)&&Qs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[ot,Qs]);const Zs=async()=>{var e;if("loading"===St)return;const t=(null==_t?void 0:_t.cors_enabled)??!1,s=!t,a=t;Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),Pt.current=!1,Et(s),Tt("loading"),Lt.current=setTimeout(()=>{Pt.current||Be.current&&(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))},1e4);try{const t=await b({web:{cors_enabled:s}});if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await ue(),Tt("success"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)):(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))}catch{if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)}};C.useEffect(()=>{(async()=>{Is(!0);try{const e=await y();e.success&&e.data?As(e.data.exists):As(!1);const t=null==_t?void 0:_t.web_path;Ps(!t||""===t)}catch{As(!1)}finally{Is(!1)}})()},[null==_t?void 0:_t.web_path]);const ea=async e=>{var t;if("loading"!==Ds){Os("loading");try{const s=await b({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!Be.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Ps(e),Os("success"),qs(!0),setTimeout(()=>{Be.current&&Os("idle")},2e3)):(Os("error"),setTimeout(()=>{Be.current&&Os("idle")},2e3))}catch{if(!Be.current)return;Os("error"),setTimeout(()=>{Be.current&&Os("idle")},2e3)}}},ta=C.useCallback(async()=>{It(!0),Ot(null);try{const e=await l();At(e.tokens||[])}catch(e){Ot(e instanceof Error?e.message:"Failed to fetch tokens")}finally{It(!1)}},[]);C.useEffect(()=>{ta()},[ta]);const sa=async()=>{if(Kt.trim()){Jt(!0),Ot(null);try{const e=await f(Kt.trim());Yt(e.token||null),qt(!1),Ut(!0),Vt(""),await ta()}catch(e){Ot(e instanceof Error?e.message:"Failed to create token")}finally{Jt(!1)}}else Ot("Token name is required")},aa=e=>e?new Date(1e3*e).toLocaleString():"Never",ra=C.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},[]),na=C.useCallback(async()=>{ns(!0),cs(null);try{const e=await c();e.success&&e.data?as(ra(e.data)):cs(e.error||"Failed to load transport keys")}catch(e){cs(e instanceof Error?e.message:"Unknown error occurred")}finally{ns(!1)}},[ra]);C.useEffect(()=>{na()},[na]);const la=C.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=la(s.children,t);if(e)return e}}return null},[]),ca=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);return null==e?void 0:e.name},[ms,ss,la]),ia=C.useCallback(e=>{hs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),da=async e=>{us(!0),cs(null);try{const t=await v("allow"===e);t.success?ds(e):cs(t.error||"Failed to update global flood policy")}catch(t){cs(t instanceof Error?t.message:"Failed to update global flood policy")}finally{us(!1)}},oa=async()=>{if(_s.trim()){Ls(!0),cs(null);try{const e=await N({name:_s.trim(),flood_policy:Ts,parent_id:ms??void 0});e.success?(await na(),ys(!1),Ss(""),Fs("deny")):cs(e.error||"Failed to add transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to add transport key")}finally{Ls(!1)}}else cs("Key name is required")},ua=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(ws({...e}),fs(!0))},[ms,ss,la]);C.useEffect(()=>{const e=e=>{"Escape"===e.key&&(bs&&(ys(!1),Ss(""),Fs("deny")),gs&&(fs(!1),ws(null)),js&&(vs(!1),Cs(null)),Ht&&(qt(!1),Vt("")),Bt&&(Ut(!1),Yt(null)))};if(bs||gs||js||Ht||Bt)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[bs,gs,js,Ht,Bt]);const ma=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(Cs(e),vs(!0))},[ms,ss,la]),xa=({node:e,level:t})=>{const s=ps.has(e.id),a=ms===e.id,n=e.children&&e.children.length>0,l="allow"===is;return r.jsxs("div",{children:[r.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",a?"bg-accent-primary/15":"hover:bg-white/[0.02]",l&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*t+"px"},onClick:()=>!l&&xs(e.id),children:[n?r.jsx("button",{onClick:t=>{t.stopPropagation(),ia(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:r.jsx(V,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",s&&"rotate-90")})}):r.jsx("span",{className:"w-5"}),r.jsx(B,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),r.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),r.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"})]}),n&&s&&r.jsx("div",{children:e.children.map(e=>r.jsx(xa,{node:e,level:t+1},e.id))})]})};return r.jsxs(E,{children:[r.jsx(L,{title:"Configuration",icon:r.jsx(i,{})}),r.jsxs(R,{template:"standard",children:[r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:kt,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),r.jsx("div",{className:"flex items-center gap-1",children:xe&&(ot?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Qs,disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==jt){Ct.current&&clearTimeout(Ct.current),vt("loading"),wt(null);try{const e={};mt&&mt!==he&&(e.node_name=mt);const t=parseFloat(pt);isNaN(t)||t===(null==xe?void 0:xe.latitude)||(e.latitude=t);const s=parseFloat(bt);isNaN(s)||s===(null==xe?void 0:xe.longitude)||(e.longitude=s);const a=parseInt(gt);if(isNaN(a)||a===(null==xe?void 0:xe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return wt({success:!0,message:"No changes to save"}),void vt("idle");const r=await h(e);if(!Be.current)return;if(r.success&&r.data){const e=r.data.applied.join(", ");wt({success:!0,message:`Updated: ${e}`}),await ue(),vt("success"),Ct.current=setTimeout(()=>{Be.current&&(vt("idle"),ut(!1),wt(null))},1500)}else wt({success:!1,message:r.error||"Failed to save"}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}catch(e){if(!Be.current)return;wt({success:!1,message:String(e)}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}}},disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-accent-primary cursor-wait":"success"===jt?"text-accent-success":"error"===jt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===jt?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===jt?r.jsx(I,{className:"w-4 h-4"}):"error"===jt?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Js,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Nt&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Nt.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Nt.message}),xe?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"text",value:mt,onChange:e=>xt(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):r.jsx("span",{className:"type-data text-text-primary",children:he})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Latitude (°)":"Latitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:pt,onChange:e=>ht(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.latitude?xe.latitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Longitude (°)":"Longitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:bt,onChange:e=>yt(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.longitude?xe.longitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Advert Interval (hours)":"Advert Interval"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:gt,onChange:e=>ft(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:xe.send_advert_interval_hours>0?`${xe.send_advert_interval_hours}h`:"Disabled"})}),ot&&r.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsx("span",{className:"type-data text-text-primary",children:xe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:Ae,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx($,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),r.jsx("div",{className:"flex items-center gap-1",children:me&&(fe?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Ys,disabled:"loading"===Le,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==Le){ze.current&&clearTimeout(ze.current),Me("loading"),Re(null);try{const e={},t=parseFloat(ve),s=me?me.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=me?me.bandwidth/1e3:0;we!==a&&(e.bandwidth_khz=we),Ce!==(null==me?void 0:me.spreading_factor)&&(e.spreading_factor=Ce),Se!==(null==me?void 0:me.coding_rate)&&(e.coding_rate=Se);const r=parseInt(Fe);if(r!==(null==me?void 0:me.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Re({success:!0,message:"No changes to save"}),void Me("idle");const n=await h(e);if(!Be.current)return;if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";Re({success:!0,message:`Updated: ${e}${t}`}),await ue(),Me("success"),ze.current=setTimeout(()=>{Be.current&&(Me("idle"),je(!1),Re(null))},1500)}else Re({success:!1,message:n.error||"Failed to save"}),Me("error"),ze.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}catch(e){if(!Be.current)return;Re({success:!1,message:String(e)}),Me("error"),ze.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}}},disabled:"loading"===Le||!$s,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-accent-primary cursor-wait":"success"===Le?"text-accent-success":"error"===Le?"text-accent-danger":$s?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:$s?"Save changes":"No changes to save",children:"loading"===Le?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===Le?r.jsx(I,{className:"w-4 h-4"}):"error"===Le?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:()=>{me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power))),Re(null),je(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Pe&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Pe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Pe.message}),me?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"Frequency (MHz)":"Frequency"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:ve,onChange:e=>Ne(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:u(me.frequency)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"TX Power (dBm)":"TX Power"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:Fe,onChange:e=>Ee(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsxs("span",{className:"type-data text-text-primary",children:[me.tx_power," dBm"]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:we,onChange:e=>ke(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:te.map(e=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsx("span",{className:"type-data text-text-primary",children:x(me.bandwidth)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Ce,onChange:e=>_e(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:se.map(e=>r.jsxs("option",{value:e,children:["SF",e]},e))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["SF",me.spreading_factor]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Se,onChange:e=>Te(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:ae.map(e=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["4/",me.coding_rate]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsxs("span",{className:"type-data text-text-primary",children:[me.preamble_length," symbols"]})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),r.jsxs(R,{template:"standard",children:[r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:Ie,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[r.jsx(p,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),r.jsx("div",{className:"flex items-center gap-1",children:Ze?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"!==ct){dt.current&&clearTimeout(dt.current),it("loading");try{const e=await h({tx_delay_factor:parseFloat(tt),direct_tx_delay_factor:parseFloat(at)});if(await de({max_airtime_percent:parseFloat(nt),enforcement_enabled:ye}),!Be.current)return;e.success&&e.data?(await ue(),it("success"),dt.current=setTimeout(()=>{Be.current&&(it("idle"),et(!1))},1500)):(it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3))}catch{if(!Be.current)return;it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3)}}},disabled:"loading"===ct,className:_("p-2 rounded-lg transition-colors","loading"===ct?"text-accent-primary cursor-wait":"success"===ct?"text-accent-success":"error"===ct?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===ct?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===ct?r.jsx(I,{className:"w-4 h-4"}):"error"===ct?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})}),r.jsx("button",{onClick:Ws,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Gs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:r.jsx(W,{className:"w-4 h-4"})})})]}),r.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ke?Ke:"forward"===be;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===De)return;const t=!e,s="forward"===be;Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Je.current=!1,Ve(t),Oe("loading"),Ue.current=setTimeout(()=>{Je.current||Be.current&&(Ve(s),Oe("error"),Xe.current=setTimeout(()=>{Be.current&&(Oe("idle"),Ve(null))},2e3))},1e4);try{if(await ce(t?"forward":"monitor"),Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;Oe("success"),Xe.current=setTimeout(()=>{Be.current&&(Oe("idle"),Ve(null),ie())},2e3)}catch{if(Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;Ve(s),Oe("error"),Xe.current=setTimeout(()=>{Be.current&&(Oe("idle"),Ve(null))},2e3)}},disabled:"loading"===De,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"===De&&"opacity-70"),"aria-label":"Toggle forward mode",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===De&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===De&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===De&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==$e?$e:ye;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===He)return;const t=!e,s=ye;Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Qe.current=!1,Ye(t),qe("loading"),Ge.current=setTimeout(()=>{Qe.current||Be.current&&(Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3))},1e4);try{if(await de({max_airtime_percent:Xs(),enforcement_enabled:t}),Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;qe("success"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null),oe())},2e3)}catch{if(Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3)}},disabled:"loading"===He,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"===He&&"opacity-70"),"aria-label":"Toggle duty cycle",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===He&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===He&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===He&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:nt,onChange:e=>lt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Xs().toFixed(1),"%"]})})]})]}),r.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),r.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[r.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:tt,onChange:e=>st(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Bs().toFixed(2),"x"]})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:at,onChange:e=>rt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Us().toFixed(2),"s"]})})]})]})]})]})]})})}),r.jsx(A,{span:12,md:6,children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(i,{}),title:"App Settings",largeTitle:!0}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ft?Ft:(null==_t?void 0:_t.cors_enabled)??!1;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Zs,disabled:"loading"===St,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"===St&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:r.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"===St&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===St&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===St&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ee,{showLogoOnly:!0})}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(ee,{showThumbnailsOnly:!0})})]})]})]})]})})]}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(U,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>ys(!0),disabled:"allow"===is,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[r.jsx(J,{className:"w-3.5 h-3.5"}),"Add"]}),r.jsx("button",{onClick:ua,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),r.jsx("button",{onClick:ma,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===is?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===is?r.jsx(Q,{className:"w-5 h-5 text-accent-success"}):r.jsx(Z,{className:"w-5 h-5 text-accent-danger"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),r.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-white/[0.02] rounded-full p-1",children:[r.jsx("button",{onClick:()=>da("deny"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===is?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Deny"}),r.jsx("button",{onClick:()=>da("allow"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Allow"})]}),os&&r.jsx(z,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ls&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ls}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:rs?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(z,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===ss.length?r.jsxs("div",{className:"text-center py-6",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:r.jsx(U,{className:"w-6 h-6 text-text-muted/50"})}),r.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),r.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):r.jsx("div",{className:"space-y-1",children:ss.map(e=>r.jsx(xa,{node:e,level:0},e.id))})})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(X,{className:"icon-md text-accent-primary"}),"API Tokens"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),r.jsxs("button",{onClick:()=>qt(!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:[r.jsx(J,{className:"w-4 h-4"}),"Create Token"]})]}),r.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(H,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"type-body-sm text-text-muted",children:[r.jsxs("p",{children:[r.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",r.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."]}),r.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),zt&&0===Rt.length?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(z,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Rt.length>0?r.jsx("div",{className:"space-y-2",children:Rt.map(e=>r.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] rounded-2xl p-4 transition-colors",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(X,{className:"w-5 h-5 text-accent-primary"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",aa(e.created_at)]}),r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",aa(e.last_used)]})]})]})]}),r.jsxs("button",{onClick:()=>Gt({id:e.id,name:e.name}),disabled:Qt,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:[r.jsx(T,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):r.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:r.jsx(X,{className:"w-7 h-7 text-text-muted/50"})}),r.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),r.jsx("button",{onClick:()=>qt(!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"})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(G,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:Ms,onChange:()=>ea(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),r.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"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),r.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:!Ms,onChange:()=>ea(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),r.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 ⚡"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!zs&&r.jsx("div",{className:_("bg-white/[0.02] rounded-2xl p-4",Rs?"border border-accent-success/20":"border border-accent-tertiary/20"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Rs?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Rs?r.jsx(Y,{className:"w-4 h-4 text-accent-success"}):r.jsx(H,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:Rs?"PyMC Console has been detected":"PyMC Console Not Installed"}),Rs?r.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",r.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"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",r.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."]}),r.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:[r.jsx(q,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Hs&&r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 border border-accent-secondary/30",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(D,{className:"w-4 h-4 text-accent-secondary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),r.jsx("button",{onClick:async()=>{if(!Ks){Vs(!0);try{await g(),qs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{qs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Ks,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:Ks?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(K,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(p,{}),title:"Node Information",largeTitle:!0}),le?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),r.jsx("p",{className:"type-body text-text-primary mt-1",children:he})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.core_version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),r.jsx("div",{className:"mt-1",children:le.local_hash?r.jsx(S,{hash:le.local_hash,size:"sm"}):r.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),le.public_key&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),r.jsx("div",{className:"mt-1",children:r.jsx(S,{hash:le.public_key,prefixLength:12,suffixLength:8})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),Ht&&r.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&&qt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),r.jsx("input",{type:"text",value:Kt,onChange:e=>Vt(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&&sa(),autoFocus:!0}),r.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{qt(!1),Vt(""),Ot(null)},disabled:Wt,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"}),r.jsx("button",{onClick:sa,disabled:Wt||!Kt.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:Wt?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Bt&&$t&&r.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&&Ut(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[r.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:[r.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:$t,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"}),r.jsxs("button",{onClick:()=>{$t&&(navigator.clipboard.writeText($t),ts(!0),setTimeout(()=>ts(!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:[es?r.jsx(I,{className:"w-4 h-4 text-accent-success"}):r.jsx(O,{className:"w-4 h-4"}),es?"Copied!":"Copy"]})]})]}),r.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[r.jsx("p",{className:"text-sm text-text-secondary mb-2",children:r.jsx("strong",{children:"Usage Example:"})}),r.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: ',$t.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx("button",{onClick:()=>{Ut(!1),Yt(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"})})]})]})}),r.jsx(F,{isOpen:!!Xt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Xt?void 0:Xt.name}'? This action cannot be undone.`,confirmLabel:Qt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Xt){Zt(!0),Ot(null);try{await j(Xt.id),await ta(),Gt(null)}catch(e){Ot(e instanceof Error?e.message:"Failed to revoke token")}finally{Zt(!1)}}},onCancel:()=>Gt(null)}),bs&&r.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&&ys(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[ms&&r.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: ",r.jsx("strong",{className:"text-text-primary",children:ca()})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:_s,onChange:e=>Ss(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&&oa(),autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>Fs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ts?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>Fs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ts?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{ys(!1),Ss(""),Fs("deny")},disabled:Es,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"}),r.jsx("button",{onClick:oa,disabled:Es||!_s.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:Es?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),gs&&Ns&&r.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&&fs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:Ns.name,onChange:e=>ws({...Ns,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})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ns.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ns.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),Ns.transport_key&&r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),r.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:Ns.transport_key})]}),r.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{fs(!1),Cs(Ns),vs(!0),ws(null)},disabled:Es,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"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>{fs(!1),ws(null)},disabled:Es,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"}),r.jsx("button",{onClick:async()=>{if(Ns){Ls(!0),cs(null);try{const e=await w(Ns.id,{name:Ns.name,flood_policy:Ns.floodPolicy});e.success?(await na(),fs(!1),ws(null)):cs(e.error||"Failed to update transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to update transport key")}finally{Ls(!1)}}},disabled:Es||!Ns.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:Es?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),js&&ks&&r.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&&vs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),r.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",r.jsxs("strong",{className:"text-text-primary",children:["'",ks.name,"'"]}),"?"]}),ks.children&&ks.children.length>0&&r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",ks.children.length," child key(s). Deleting will also remove all children."]})]})}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>{vs(!1),Cs(null)},disabled:Es,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"}),r.jsx("button",{onClick:async()=>{if(ks){Ls(!0),cs(null);try{const e=await k(ks.id);e.success?(await na(),vs(!1),Cs(null),xs(null)):cs(e.error||"Failed to delete transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to delete transport key")}finally{Ls(!1)}}},disabled:Es,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:Es?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default}; diff --git a/frontend/dist/assets/ConfirmModal-6N9orQPe.js b/frontend/dist/assets/ConfirmModal-6N9orQPe.js deleted file mode 100644 index a5b04f50..00000000 --- a/frontend/dist/assets/ConfirmModal-6N9orQPe.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,j as t,X as o}from"./index-CLi6xczL.js";import{b as s,g as n,c as r}from"./recharts-bmHCCfxU.js";import{T as d}from"./triangle-alert-CtfeX3hX.js";const a=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),i=s.memo(function({isOpen:e,title:a="Confirm",message:i,confirmLabel:l="Confirm",cancelLabel:c="Cancel",variant:m="default",onConfirm:b,onCancel:x}){if(s.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&x()};window.addEventListener("keydown",t);const o=document.body.style.overflow,s=document.body.style.position,n=document.body.style.width,r=document.body.style.top,d=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${d}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=o,document.body.style.position=s,document.body.style.width=n,document.body.style.top=r,window.scrollTo(0,d)}},[e,x]),!e)return null;const u={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"}}[m];return n.createPortal(t.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-md z-[10010] flex items-end sm:items-center justify-center",onClick:x,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:t.jsxs("div",{className:r("glass-card-elevated w-full max-w-sm","sm:mx-4 sm:rounded-xl","rounded-t-2xl rounded-b-none sm:rounded-b-xl","pb-safe"),onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:r("p-2 rounded-lg bg-bg-subtle",u.icon),children:t.jsx(d,{className:"w-5 h-5"})}),t.jsx("h3",{id:"confirm-modal-title",className:"text-base font-semibold text-text-primary",children:a})]}),t.jsx("button",{onClick:x,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:t.jsx(o,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm text-text-secondary",children:i})}),t.jsxs("div",{className:"flex gap-3 p-4 pt-0",children:[t.jsx("button",{onClick:x,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:c}),t.jsx("button",{onClick:b,className:r("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:l})]})]})}),document.body)});export{i as C,a as T}; diff --git a/frontend/dist/assets/ConfirmModal-V3007Nz2.js b/frontend/dist/assets/ConfirmModal-V3007Nz2.js new file mode 100644 index 00000000..e844c651 --- /dev/null +++ b/frontend/dist/assets/ConfirmModal-V3007Nz2.js @@ -0,0 +1 @@ +import{r as e,b as t,j as o,a4 as s,X as n}from"./vendor-react-nG6Am_s0.js";import{c as r}from"./recharts-BJXKa0n8.js";const d=e.memo(function({isOpen:d,title:l="Confirm",message:a,confirmLabel:i="Confirm",cancelLabel:c="Cancel",variant:m="default",onConfirm:b,onCancel:x}){if(e.useEffect(()=>{if(!d)return;const e=e=>{"Escape"===e.key&&x()};window.addEventListener("keydown",e);const t=document.body.style.overflow,o=document.body.style.position,s=document.body.style.width,n=document.body.style.top,r=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${r}px`,()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t,document.body.style.position=o,document.body.style.width=s,document.body.style.top=n,window.scrollTo(0,r)}},[d,x]),!d)return null;const u={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"}}[m];return t.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-md z-[10010] flex items-end sm:items-center justify-center",onClick:x,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:o.jsxs("div",{className:r("glass-card-elevated w-full max-w-sm","sm:mx-4 sm:rounded-xl","rounded-t-2xl rounded-b-none sm:rounded-b-xl","pb-safe"),onClick:e=>e.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:r("p-2 rounded-lg bg-bg-subtle",u.icon),children:o.jsx(s,{className:"w-5 h-5"})}),o.jsx("h3",{id:"confirm-modal-title",className:"text-base font-semibold text-text-primary",children:l})]}),o.jsx("button",{onClick:x,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:o.jsx(n,{className:"w-5 h-5"})})]}),o.jsx("div",{className:"p-4",children:o.jsx("p",{className:"text-sm text-text-secondary",children:a})}),o.jsxs("div",{className:"flex gap-3 p-4 pt-0",children:[o.jsx("button",{onClick:x,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:c}),o.jsx("button",{onClick:b,className:r("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:i})]})]})}),document.body)});export{d as C}; diff --git a/frontend/dist/assets/Contacts-CVzWZVxU.js b/frontend/dist/assets/Contacts-CVzWZVxU.js new file mode 100644 index 00000000..154120fe --- /dev/null +++ b/frontend/dist/assets/Contacts-CVzWZVxU.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-D3YpXUKi.js","assets/vendor-react-nG6Am_s0.js","assets/vendor-core-XI_xDZ-M.js","assets/index-C05_s9O_.js","assets/ConfirmModal-V3007Nz2.js","assets/useThemeColors-C9IVL-ly.js","assets/SignalIndicator-CC9fMGoT.js","assets/HashBadge-CXiNob7o.js","assets/CollisionExplorerModal-BqgPeZ5i.js","assets/PageLayout-D3aCCXDi.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CXggJtlY.css","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]); +import{j as e,r as t,a8 as s,a4 as a,z as n,h as r,a9 as c,k as i,aa as l,Z as o,ab as d,T as x,D as h,a7 as m,a2 as u,o as p,Y as g,ac as j,p as f,ad as N,X as v,ae as b,af as y,ag as w,ah as k,ai as C,aj as M,ak as S,al as L,am as H,an as P}from"./vendor-react-nG6Am_s0.js";import{x as $,y as R,v as F,z as _,A as E,B as T,C as O,r as A,E as D,f as W,F as K,G as U,H as z,e as G,I as B,J as I,K as V}from"./index-C05_s9O_.js";import{a as q}from"./SignalIndicator-CC9fMGoT.js";import{_ as J}from"./deckgl-MTXp-Y3t.js";import{c as Y,d as Z,T as Q,b as X,a as ee,L as te}from"./recharts-BJXKa0n8.js";import{H as se}from"./HashBadge-CXiNob7o.js";import{C as ae}from"./ConfirmModal-V3007Nz2.js";import{C as ne}from"./CollisionExplorerModal-BqgPeZ5i.js";import{P as re,a as ce}from"./PageLayout-D3aCCXDi.js";class ie extends t.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var t;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==(t=this.state.error)?void 0:t.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 le=t.lazy(()=>J(()=>import("./ContactsMapMapLibre-D3YpXUKi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])));function oe({neighbors:s,localNode:a,localHash:n,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:l}){return e.jsx(ie,{children:e.jsx(t.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(le,{neighbors:s,localNode:a,localHash:n,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:l})})})}function de(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function xe(e){return`${Math.round(100*e)}%`}function he(e,t){return t.has(e.toUpperCase())}const me=t.memo(function({path:t,isHighlighted:s,onHighlight:c,ghostPrefixes:i}){const l=function(t){return t>.2?{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-accent-success"}:t<-.2?{icon:e.jsx(n,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(h,{className:"w-3 h-3"}),color:"text-text-muted"}}(t.observationTrend),m=t.weakestLinkKey&&t.weakestLinkConfidence<.5,u=t.hops.some(e=>he(e,i));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(s?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>c(s?null:t.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(p=t.healthScore,p>=.7?"bg-accent-success/10":p>=.5?"bg-accent-secondary/10":p>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${de(t.healthScore)}`,children:xe(t.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:t.hops.map((s,a)=>{var n;const c=he(s,i),l=m&&(null==(n=t.weakestLinkKey)?void 0:n.includes(s));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":l?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[c&&e.jsx(r,{className:"w-2.5 h-2.5"}),s]}),anew Set(u.map(e=>e.prefix.toUpperCase())),[u]),f=t.useMemo(()=>h.slice(0,o),[h,o]),N=t.useMemo(()=>0===h.length?null:{avgHealth:h.reduce((e,t)=>e+t.healthScore,0)/h.length,declining:h.filter(e=>e.observationTrend<-.2).length,weakLinks:h.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:h.filter(e=>e.hops.some(e=>j.has(e.toUpperCase()))).length},[h,j]),v=e=>{null==d||d(e)};return 0===h.length?null:e.jsxs("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>g(!p),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(s,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",h.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${de(N.avgHealth)}`,children:["Avg: ",xe(N.avgHealth)]}),N.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),N.weakLinks," weak"]}),N.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),N.declining," declining"]}),N.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3"}),N.pathsWithGhosts," ghost"]})]}),p?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]})]}),p&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[m.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(l,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:m.totalPaths.toLocaleString()})," Viterbi decoded"]}),m.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(m.observationOverrideCount/m.totalPaths*100),"% observation override"]}),u.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3"}),u.length," ghost",1!==u.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%)"]}),u.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:f.map(t=>e.jsx(me,{path:t,isHighlighted:x===t.weakestLinkKey,onHighlight:v,ghostPrefixes:j},t.pathKey))}),h.length>o&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",o," of ",h.length," paths"]})]})]})});function pe({ghost:s,neighbors:n,isExpanded:o,onToggle:d}){const x=t.useMemo(()=>Array.from(s.commonNeighbors).map(e=>{var t;return{hash:e,name:null==(t=n[e])?void 0:t.name}}),[s.commonNeighbors,n]),h=s.confidence>=.8?"text-accent-success":s.confidence>=.5?"text-accent-secondary":"text-signal-poor",m=s.estimatedLocation?s.estimatedLocation.uncertaintyM>=1e3?`±${(s.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(s.estimatedLocation.uncertaintyM)}m`:null;return e.jsxs("div",{className:Y("rounded-lg border transition-all duration-150",s.isLikelyReal?"border-accent-tertiary/30 bg-accent-tertiary/5":"border-border-muted bg-bg-card/50"),children:[e.jsxs("button",{onClick:d,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[e.jsx(r,{className:Y("w-5 h-5 flex-shrink-0",s.isLikelyReal?"text-accent-tertiary":"text-text-muted")}),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:s.prefix.toUpperCase()}),s.isLikelyReal&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-accent-tertiary/20 text-accent-tertiary",children:"Likely Real"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted mt-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),s.observationCount," obs"]}),e.jsxs("span",{className:Y("flex items-center gap-1",h),children:[(100*s.confidence).toFixed(0),"% conf"]})]})]}),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:[s.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[s.estimatedLocation.lat.toFixed(5),", ",s.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",m]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(a,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(p,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",_(s.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",_(s.lastSeen)," ago"]})]})]}),x.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(g,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",x.length," known node",1!==x.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[x.slice(0,5).map(({hash:t})=>e.jsx(se,{hash:t,size:"sm"},t)),x.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",x.length-5," more"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"flex-1 h-2 rounded-full bg-bg-elevated overflow-hidden",children:e.jsx("div",{className:Y("h-full rounded-full transition-all",s.confidence>=.8?"bg-accent-success":s.confidence>=.5?"bg-accent-secondary":"bg-signal-poor"),style:{width:100*s.confidence+"%"}})}),e.jsxs("span",{className:"text-xs text-text-muted w-12 text-right",children:[(100*s.confidence).toFixed(0),"%"]})]})]})]})}function ge({neighbors:s,className:n}){const c=F(),i=R(),[l,o]=t.useState(new Set),[d,x]=t.useState(!1),{likelyReal:h,uncertain:u}=t.useMemo(()=>{const e=[],t=[];for(const a of c)a.isLikelyReal?e.push(a):t.push(a);const s=(e,t)=>t.confidence-e.confidence||t.observationCount-e.observationCount;return e.sort(s),t.sort(s),{likelyReal:e,uncertain:t}},[c]);if(0===c.length)return null;const p=e=>{o(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},g=d?u:u.slice(0,5);return e.jsxs("div",{className:Y("space-y-4",n),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"w-5 h-5 text-accent-tertiary"}),e.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Discovered Nodes"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-tertiary/20 text-accent-tertiary",children:c.length})]}),i.totalPaths>0&&e.jsxs("div",{className:"text-xs text-text-muted",children:[i.pathsWithGhosts," / ",i.totalPaths," paths"]})]}),h.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(m,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Undiscovered Repeaters (",h.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:h.map(t=>e.jsx(pe,{ghost:t,neighbors:s,isExpanded:l.has(t.prefix),onToggle:()=>p(t.prefix)},t.prefix))})]}),u.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Uncertain (",u.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:g.map(t=>e.jsx(pe,{ghost:t,neighbors:s,isExpanded:l.has(t.prefix),onToggle:()=>p(t.prefix)},t.prefix))}),u.length>5&&e.jsx("button",{onClick:()=>x(!d),className:"w-full py-1.5 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:d?"Show less":`Show ${u.length-5} more`})]}),i.observationOverrideCount>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:i.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*i.avgPathConfidence).toFixed(0),"%"]})]})]})}const je="var(--signal-critical)",fe="var(--signal-poor)",Ne="var(--signal-fair)",ve="var(--signal-good)",be="var(--signal-excellent)",ye="var(--text-muted)";function we({active:t,payload:s}){if(!t||!s||!s.length)return null;const a=s[0].payload,n=new Date(a.timestamp),r=`${(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:r}),e.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const ke=t.memo(function({nodeHash:t,width:s=60,height:a=20,color:n,showArea:r=!0,showTooltip:c=!1,className:i=""}){const l=E(t),o=T(),d=n??(l.length>0?function(e){if(0===e.length)return je;const t=e.slice(-4),s=t.reduce((e,t)=>e+t.count,0),a=s/t.length,n=e.reduce((e,t)=>e+t.count,0)/e.length;if(0===s)return je;if(n>0){const e=a/n;return e>=1.2?be:e>=.8?ve:e>=.4?Ne:e>=.1?fe:je}return s>=10?be:s>=5?ve:s>=2?Ne:s>=1?fe:je}(l):ye),x="number"==typeof s?s:60,h=a,m=`sparkline-gradient-${t.slice(-6)}`;if(l.length<2){const t=o?ye:je;return e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:x,height:h,color:t},children:e.jsx("svg",{width:x,height:h,viewBox:`0 0 ${x} ${h}`,preserveAspectRatio:"none",children:e.jsx("line",{x1:4,y1:h/2,x2:x-4,y2:h/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2",className:o?"animate-pulse":""})})})}return e.jsx("div",{className:i,style:{width:x,height:h},children:r?e.jsxs(Z,{data:l,width:x,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:d,stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:d,stopOpacity:.05})]})}),c&&e.jsx(Q,{content:e.jsx(we,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(X,{type:"monotone",dataKey:"count",stroke:"none",fill:`url(#${m})`,isAnimationActive:!1}),e.jsx(ee,{type:"monotone",dataKey:"count",stroke:d,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]}):e.jsxs(te,{data:l,width:x,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(Q,{content:e.jsx(we,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(ee,{type:"monotone",dataKey:"count",stroke:d,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),Ce=t.memo(function({hash:s,className:a="",size:n="sm"}){const r=O(),c=R(),[i,o]=t.useState(!1),d=t.useMemo(()=>A(s),[s]),x=t.useMemo(()=>d?r.find(e=>e.prefix===d)??null:null,[d,r]),h=c.totalPaths>0&&c.avgPathConfidence>=.7,u=t.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),p=t.useCallback(()=>{o(!1)},[]);if(!x)return null;const g="sm"===n?"w-3.5 h-3.5":"w-4 h-4",f=h?"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=h?`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:u,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${f} ${a}`,title:N,"aria-label":`View prefix conflict for ${d}${h?" (Viterbi resolved)":""}`,children:h?e.jsxs("span",{className:"relative",children:[e.jsx(l,{className:g}),e.jsx(m,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(j,{className:g})}),e.jsx(ne,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Me(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const Se=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:s}=D(),a=W(),n=K(),r=U(),c=z(),i=G(),l=B(),[o,x]=t.useState(null),[h,j]=t.useState("lastHeard"),[$,R]=t.useState("desc"),[F,_]=t.useState(""),[E,T]=t.useState(!1),[O,A]=t.useState(null),[J,Y]=t.useState(null),[Z,Q]=t.useState(null),[X,ee]=t.useState(new Map),[te,ne]=t.useState(new Map),ie=t.useMemo(()=>(null==s?void 0:s.neighbors)??{},[null==s?void 0:s.neighbors]),le=t.useMemo(()=>Object.fromEntries(Object.entries(ie).filter(([e])=>!a.has(e))),[ie,a]),de=t.useMemo(()=>{var e;return(null==(e=null==s?void 0:s.config)?void 0:e.repeater)?{latitude:s.config.repeater.latitude,longitude:s.config.repeater.longitude,name:s.config.node_name||"Local Node"}:void 0},[s]),xe=null==s?void 0:s.local_hash,he=t.useMemo(()=>{const e=new Map;if(!(null==de?void 0:de.latitude)||!(null==de?void 0:de.longitude))return e;for(const[t,s]of Object.entries(le))s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude?e.set(t,Me(de.latitude,de.longitude,s.latitude,s.longitude)):e.set(t,null);return e},[le,de]),{neighborHashSet:me,neighborSignalMap:pe}=t.useMemo(()=>{const e=new Set,t=new Map;for(const s of i)e.add(s.hash),t.set(s.hash,{avgRssi:s.avgRssi,avgSnr:s.avgSnr});return{neighborHashSet:e,neighborSignalMap:t}},[i]),je=t.useMemo(()=>{const e=F.toLowerCase().trim(),t="neighbor"===e||"neighbors"===e,s=E||t;return Object.fromEntries(Object.entries(le).filter(([a,n])=>{if(s&&!me.has(a))return!1;if(t)return!0;if(!e)return!0;const r=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return r.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[le,F,E,me]),fe=t.useMemo(()=>Object.entries(je).sort(([e,t],[s,a])=>{let n=0;switch(h){case"lastHeard":n=(t.last_seen||0)-(a.last_seen||0);break;case"distance":{const t=he.get(e)??null,a=he.get(s)??null;n=null===t&&null===a?0:null===t?1:null===a?-1:t-a;break}case"centrality":n=(c.get(e)||0)-(c.get(s)||0)}return"desc"===$?-n:n}),[je,h,$,he,c]),Ne=fe.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,ve=t.useMemo(()=>new Set(r),[r]),be=t.useCallback(e=>{h===e?R(e=>"desc"===e?"asc":"desc"):(j(e),R("desc"))},[h]),ye=t.useCallback(e=>{const t=le[e];(null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&0!==t.latitude&&0!==t.longitude&&A(e)},[le]),we=t.useCallback(()=>{A(null)},[]),Se=t.useCallback(async(e,t)=>{if(t.stopPropagation(),!Z){Q(e),ee(t=>{const s=new Map(t);return s.delete(e),s}),ne(t=>{const s=new Map(t);return s.delete(e),s});try{const t=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,s=await I(t,30);s.success&&s.data?(ee(t=>new Map(t).set(e,s.data)),setTimeout(()=>{ee(t=>{const s=new Map(t);return s.delete(e),s})},1e4)):(ne(t=>new Map(t).set(e,s.error||"Ping failed")),setTimeout(()=>{ne(t=>{const s=new Map(t);return s.delete(e),s})},5e3))}catch(s){const t=s instanceof Error?s.message:"Ping failed";ne(s=>new Map(s).set(e,t)),setTimeout(()=>{ne(t=>{const s=new Map(t);return s.delete(e),s})},5e3)}finally{Q(null)}}},[Z]);return e.jsxs(re,{children:[e.jsx(ce,{title:"Contacts",icon:e.jsx(g,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[fe.length," node",1!==fe.length?"s":""]}),Ne>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(u,{className:"w-3.5 h-3.5 relative top-[2px]"}),Ne," with location"]})]})}),e.jsx("div",{className:"relative",children:e.jsx(oe,{neighbors:le,localNode:de,localHash:xe,onRemoveNode:n,selectedNodeHash:O,onNodeSelected:we,highlightedEdgeKey:J})}),e.jsx(ue,{maxPaths:10,highlightedEdge:J,onHighlightEdge:Y}),l.length>0&&e.jsx("div",{className:"chart-container",children:e.jsx(ge,{neighbors:le})}),e.jsxs("div",{className:"chart-container",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(g,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[me.size>0&&e.jsxs("button",{onClick:()=>T(!E),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(E?"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:E?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(f,{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:me.size})]}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{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",value:F,onChange:e=>_(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-xs bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),F&&e.jsx("button",{onClick:()=>{_(""),"neighbor"!==F.toLowerCase().trim()&&"neighbors"!==F.toLowerCase().trim()||T(!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(v,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>be("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("lastHeard"===h?"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(p,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===h&&e.jsx(b,{className:"w-3 h-3 "+("asc"===$?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>be("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("distance"===h?"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(y,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===h&&e.jsx(b,{className:"w-3 h-3 "+("asc"===$?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>be("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("centrality"===h?"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"===h&&e.jsx(b,{className:"w-3 h-3 "+("asc"===$?"rotate-180":"")})]})]})]})]}),fe.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:fe.map(([t,s])=>{var a;const n=s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude,r=s.node_name||s.name||"Unknown",i=ve.has(t),l=me.has(t),o=he.get(t),h=c.get(t)||0,u=l?pe.get(t):void 0,p=l&&u,g=null==(a=s.contact_type)?void 0:a.toLowerCase(),j="room server"===g||"room_server"===g||"room"===g||"server"===g,f="companion"===g||"client"===g||"cli"===g,N=s.is_repeater||"repeater"===g||"rep"===g,v=l?"direct":"flood",b=l?"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:()=>ye(t),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[p&&null!==(null==u?void 0:u.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(R=u.avgSnr,void 0===R?"bg-[var(--signal-unknown)]":R>=5?"bg-[var(--signal-excellent)]":R>=0?"bg-[var(--signal-good)]":R>=-5?"bg-[var(--signal-fair)]":R>=-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:b,children:j&&N?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(w,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),e.jsx(k,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):j?e.jsx(w,{className:"w-5 h-5 text-accent-secondary"}):f?e.jsx(C,{className:"w-5 h-5 text-text-muted"}):N?"direct"===v?e.jsx(M,{className:"w-5 h-5 text-accent-success"}):e.jsx(k,{className:"w-5 h-5 text-accent-tertiary"}):e.jsx(C,{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:r,children:r}),l&&e.jsx("span",{className:"type-badge px-1.5 py-0.5 rounded flex-shrink-0",style:{backgroundColor:"rgba(113, 152, 114, 0.2)",color:"var(--accent-success)"},children:"NBR"}),i&&e.jsxs("span",{className:"type-badge px-1.5 py-0.5 rounded flex items-center gap-1 flex-shrink-0",style:{backgroundColor:"rgba(223, 188, 114, 0.2)",color:"var(--accent-secondary)"},children:[e.jsx(S,{className:"w-3 h-3"}),"HUB"]}),N&&e.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(se,{hash:t,size:"xs",prefixLength:8,suffixLength:6}),e.jsx(Ce,{hash:t})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[p&&null!==(null==u?void 0:u.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(q,{rssi:u.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(u.avgRssi)})]}),p&&null!==(null==u?void 0:u.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[u.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(y,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:($=o,$<1e3?`${Math.round($)}m`:`${($/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:h>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*h).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(ke,{nodeHash:t,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:s.last_seen?V(s.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[l&&e.jsx(e.Fragment,{children:X.has(t)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${X.get(t).rtt_ms.toFixed(0)}ms`,children:[e.jsx(m,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[X.get(t).snr_db.toFixed(1),"dB"]})]}):te.has(t)?e.jsx("span",{className:"text-red-400 text-[10px]",title:te.get(t),children:"✗"}):e.jsx("button",{onClick:e=>Se(t,e),disabled:null!==Z,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:Z===t?e.jsx(L,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(H,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),x({hash:t,name:r})},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(P,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},t);var $,R})})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(g,{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.jsx(ae,{isOpen:!!o,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==o?void 0:o.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{o&&n(o.hash),x(null)},onCancel:()=>x(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{Se as C,ke as N,Ce as P}; diff --git a/frontend/dist/assets/Contacts-DpMrjG_C.js b/frontend/dist/assets/Contacts-DpMrjG_C.js deleted file mode 100644 index 14294125..00000000 --- a/frontend/dist/assets/Contacts-DpMrjG_C.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-Z0Ee3_4F.js","assets/index-CLi6xczL.js","assets/recharts-bmHCCfxU.js","assets/maplibre-gl-CFO9X1Ek.js","assets/index-CqOtDftZ.css","assets/maplibre-gl-haoA4z5Y.js","assets/maplibre-gl-B1CfjdFi.css","assets/ConfirmModal-6N9orQPe.js","assets/triangle-alert-CtfeX3hX.js","assets/CollisionExplorerModal-ChC6YKo5.js","assets/leaflet-ClE6qLuu.js","assets/map-pin-BHxLBGAv.js","assets/CollisionExplorerModal-CIGW-MKW.css","assets/loader-circle-BiSCrAz6.js","assets/useThemeColors-aZ327gx7.js","assets/info-D-OJbIcP.js","assets/house-Br0ddgCN.js","assets/refresh-cw-BPBhhAzK.js","assets/map-Dkyc42DP.js","assets/external-link-BG6kqAP_.js","assets/SignalIndicator-C9Bb21cj.js","assets/zap-BMeccDbl.js","assets/activity-BG2a6SBG.js","assets/trending-up-C2PPgLZS.js","assets/HashBadge-Ds68z9zP.js","assets/users-Bu-DfKmx.js","assets/PageLayout-BXoaut2N.js"])))=>i.map(i=>d[i]); -import{c as e,j as t,_ as s,H as a,I as n,B as r,G as c,F as i,C as l,J as o,K as d,M as x,N as h,y as m,O as u,h as p,Q as g,S as j,T as f,g as v,U as N,V as b,R as y,X as w,Y as k}from"./index-CLi6xczL.js";import{b as M,c as C,h as S,T as L,f as H,e as P,L as $}from"./recharts-bmHCCfxU.js";import{a as R}from"./SignalIndicator-C9Bb21cj.js";import{G as F,E as T,C as _,M as E,S as A,a as O,A as z,N as D}from"./CollisionExplorerModal-ChC6YKo5.js";import{T as U,a as W}from"./triangle-alert-CtfeX3hX.js";import{T as K,Z as G,M as V}from"./zap-BMeccDbl.js";import{A as B}from"./activity-BG2a6SBG.js";import{T as I}from"./trending-up-C2PPgLZS.js";import{H as q}from"./HashBadge-Ds68z9zP.js";import{M as Z}from"./map-pin-BHxLBGAv.js";import{U as J}from"./users-Bu-DfKmx.js";import{T as Q,C as Y}from"./ConfirmModal-6N9orQPe.js";import{P as X,a as ee}from"./PageLayout-BXoaut2N.js";import{L as te}from"./loader-circle-BiSCrAz6.js";const se=e("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),ae=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ne=e("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),re=e("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),ce=e("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),ie=e("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);class le extends M.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:t.jsxs("div",{className:"text-center text-white/50 p-4",children:[t.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),t.jsx("p",{className:"text-sm text-white/30",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),t.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 oe=M.lazy(()=>s(()=>import("./ContactsMapMapLibre-Z0Ee3_4F.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])));function de({neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:c,highlightedEdgeKey:i}){return t.jsx(le,{children:t.jsx(M.Suspense,{fallback:t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:t.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[t.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),t.jsx("span",{children:"Loading map..."})]})}),children:t.jsx(oe,{neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:c,highlightedEdgeKey:i})})})}function xe(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function he(e){return`${Math.round(100*e)}%`}function me(e,t){return t.has(e.toUpperCase())}const ue=M.memo(function({path:e,isHighlighted:s,onHighlight:a,ghostPrefixes:n}){const r=function(e){return e>.2?{icon:t.jsx(I,{className:"w-3 h-3"}),color:"text-accent-success"}:e<-.2?{icon:t.jsx(K,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:t.jsx(V,{className:"w-3 h-3"}),color:"text-text-muted"}}(e.observationTrend),i=e.weakestLinkKey&&e.weakestLinkConfidence<.5,l=e.hops.some(e=>me(e,n));return t.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(s?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>a(s?null:e.weakestLinkKey),children:[t.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(o=e.healthScore,o>=.7?"bg-accent-success/10":o>=.5?"bg-accent-secondary/10":o>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:t.jsx("span",{className:`text-xs font-semibold tabular-nums ${xe(e.healthScore)}`,children:he(e.healthScore)})}),t.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:e.hops.map((s,a)=>{var r;const l=me(s,n),o=i&&(null==(r=e.weakestLinkKey)?void 0:r.includes(s));return t.jsxs("span",{className:"flex items-center",children:[t.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(l?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":o?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[l&&t.jsx(c,{className:"w-2.5 h-2.5"}),s]}),anew Set(x.map(e=>e.prefix.toUpperCase())),[x]),p=M.useMemo(()=>o.slice(0,e),[o,e]),g=M.useMemo(()=>0===o.length?null:{avgHealth:o.reduce((e,t)=>e+t.healthScore,0)/o.length,declining:o.filter(e=>e.observationTrend<-.2).length,weakLinks:o.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:o.filter(e=>e.hops.some(e=>u.has(e.toUpperCase()))).length},[o,u]),j=e=>{null==s||s(e)};return 0===o.length?null:t.jsxs("div",{className:"chart-container",children:[t.jsxs("button",{onClick:()=>m(!h),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(F,{className:"chart-title-icon"}),"Path Health",t.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",o.length," paths)"]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[g&&t.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[t.jsxs("span",{className:`tabular-nums ${xe(g.avgHealth)}`,children:["Avg: ",he(g.avgHealth)]}),g.weakLinks>0&&t.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[t.jsx(U,{className:"w-3 h-3"}),g.weakLinks," weak"]}),g.declining>0&&t.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[t.jsx(K,{className:"w-3 h-3"}),g.declining," declining"]}),g.pathsWithGhosts>0&&t.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[t.jsx(c,{className:"w-3 h-3"}),g.pathsWithGhosts," ghost"]})]}),h?t.jsx(ae,{className:"w-4 h-4 text-text-muted"}):t.jsx(i,{className:"w-4 h-4 text-text-muted"})]})]}),h&&t.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[d.totalPaths>0&&t.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(T,{className:"w-3 h-3 text-accent-primary"}),t.jsx("span",{className:"text-text-secondary",children:d.totalPaths.toLocaleString()})," Viterbi decoded"]}),d.observationOverrideCount>0&&t.jsxs("span",{className:"text-accent-success",children:[Math.round(d.observationOverrideCount/d.totalPaths*100),"% observation override"]}),x.length>0&&t.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[t.jsx(c,{className:"w-3 h-3"}),x.length," ghost",1!==x.length?"s":""]})]}),t.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]}),x.length>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),t.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:p.map(e=>t.jsx(ue,{path:e,isHighlighted:l===e.weakestLinkKey,onHighlight:j,ghostPrefixes:u},e.pathKey))}),o.length>e&&t.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",e," of ",o.length," paths"]})]})]})});function ge({ghost:e,neighbors:s,isExpanded:a,onToggle:n}){const r=M.useMemo(()=>Array.from(e.commonNeighbors).map(e=>{var t;return{hash:e,name:null==(t=s[e])?void 0:t.name}}),[e.commonNeighbors,s]),d=e.confidence>=.8?"text-accent-success":e.confidence>=.5?"text-accent-secondary":"text-signal-poor",x=e.estimatedLocation?e.estimatedLocation.uncertaintyM>=1e3?`±${(e.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(e.estimatedLocation.uncertaintyM)}m`:null;return t.jsxs("div",{className:C("rounded-lg border transition-all duration-150",e.isLikelyReal?"border-accent-tertiary/30 bg-accent-tertiary/5":"border-border-muted bg-bg-card/50"),children:[t.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[t.jsx(c,{className:C("w-5 h-5 flex-shrink-0",e.isLikelyReal?"text-accent-tertiary":"text-text-muted")}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-mono text-sm font-semibold text-text-primary",children:e.prefix.toUpperCase()}),e.isLikelyReal&&t.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs font-medium bg-accent-tertiary/20 text-accent-tertiary",children:"Likely Real"})]}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted mt-0.5",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(T,{className:"w-3 h-3"}),e.observationCount," obs"]}),t.jsxs("span",{className:C("flex items-center gap-1",d),children:[(100*e.confidence).toFixed(0),"% conf"]})]})]}),a?t.jsx(ae,{className:"w-4 h-4 text-text-muted"}):t.jsx(i,{className:"w-4 h-4 text-text-muted"})]}),a&&t.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[e.estimatedLocation?t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Z,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"text-text-primary font-medium",children:[e.estimatedLocation.lat.toFixed(5),", ",e.estimatedLocation.lon.toFixed(5)]}),t.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",x]})]})]}):t.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[t.jsx(U,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(l,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"text-text-primary",children:["First seen: ",o(e.firstSeen)," ago"]}),t.jsxs("div",{className:"text-text-muted",children:["Last seen: ",o(e.lastSeen)," ago"]})]})]}),r.length>0&&t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(J,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",r.length," known node",1!==r.length?"s":"",":"]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.slice(0,5).map(({hash:e})=>t.jsx(q,{hash:e,size:"sm"},e)),r.length>5&&t.jsxs("span",{className:"text-text-muted",children:["+",r.length-5," more"]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border-muted/30",children:[t.jsx("div",{className:"flex-1 h-2 rounded-full bg-bg-elevated overflow-hidden",children:t.jsx("div",{className:C("h-full rounded-full transition-all",e.confidence>=.8?"bg-accent-success":e.confidence>=.5?"bg-accent-secondary":"bg-signal-poor"),style:{width:100*e.confidence+"%"}})}),t.jsxs("span",{className:"text-xs text-text-muted w-12 text-right",children:[(100*e.confidence).toFixed(0),"%"]})]})]})]})}function je({neighbors:e,className:s}){const a=r(),i=n(),[l,o]=M.useState(new Set),[d,x]=M.useState(!1),{likelyReal:h,uncertain:m}=M.useMemo(()=>{const e=[],t=[];for(const n of a)n.isLikelyReal?e.push(n):t.push(n);const s=(e,t)=>t.confidence-e.confidence||t.observationCount-e.observationCount;return e.sort(s),t.sort(s),{likelyReal:e,uncertain:t}},[a]);if(0===a.length)return null;const u=e=>{o(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},p=d?m:m.slice(0,5);return t.jsxs("div",{className:C("space-y-4",s),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(c,{className:"w-5 h-5 text-accent-tertiary"}),t.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Discovered Nodes"}),t.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-tertiary/20 text-accent-tertiary",children:a.length})]}),i.totalPaths>0&&t.jsxs("div",{className:"text-xs text-text-muted",children:[i.pathsWithGhosts," / ",i.totalPaths," paths"]})]}),h.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-tertiary",children:[t.jsx(W,{className:"w-3.5 h-3.5"}),t.jsxs("span",{className:"font-medium",children:["Likely Undiscovered Repeaters (",h.length,")"]})]}),t.jsx("div",{className:"space-y-2",children:h.map(s=>t.jsx(ge,{ghost:s,neighbors:e,isExpanded:l.has(s.prefix),onToggle:()=>u(s.prefix)},s.prefix))})]}),m.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[t.jsx(U,{className:"w-3.5 h-3.5"}),t.jsxs("span",{children:["Uncertain (",m.length,")"]})]}),t.jsx("div",{className:"space-y-2",children:p.map(s=>t.jsx(ge,{ghost:s,neighbors:e,isExpanded:l.has(s.prefix),onToggle:()=>u(s.prefix)},s.prefix))}),m.length>5&&t.jsx("button",{onClick:()=>x(!d),className:"w-full py-1.5 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:d?"Show less":`Show ${m.length-5} more`})]}),i.observationOverrideCount>0&&t.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[t.jsx("span",{className:"text-accent-primary",children:i.observationOverrideCount})," observation overrides • Avg confidence: ",t.jsxs("span",{className:"text-accent-secondary",children:[(100*i.avgPathConfidence).toFixed(0),"%"]})]})]})}const fe="var(--signal-critical)",ve="var(--signal-poor)",Ne="var(--signal-fair)",be="var(--signal-good)",ye="var(--signal-excellent)",we="var(--text-muted)";function ke({active:e,payload:s}){if(!e||!s||!s.length)return null;const a=s[0].payload,n=new Date(a.timestamp),r=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[t.jsx("span",{className:"text-text-muted",children:r}),t.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const Me=M.memo(function({nodeHash:e,width:s=60,height:a=20,color:n,showArea:r=!0,showTooltip:c=!1,className:i=""}){const l=d(e),o=x(),h=n??(l.length>0?function(e){if(0===e.length)return fe;const t=e.slice(-4),s=t.reduce((e,t)=>e+t.count,0),a=s/t.length,n=e.reduce((e,t)=>e+t.count,0)/e.length;if(0===s)return fe;if(n>0){const e=a/n;return e>=1.2?ye:e>=.8?be:e>=.4?Ne:e>=.1?ve:fe}return s>=10?ye:s>=5?be:s>=2?Ne:s>=1?ve:fe}(l):we),m="number"==typeof s?s:60,u=a,p=`sparkline-gradient-${e.slice(-6)}`;if(l.length<2){const e=o?we:fe;return t.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:u,color:e},children:t.jsx("svg",{width:m,height:u,viewBox:`0 0 ${m} ${u}`,preserveAspectRatio:"none",children:t.jsx("line",{x1:4,y1:u/2,x2:m-4,y2:u/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2",className:o?"animate-pulse":""})})})}return t.jsx("div",{className:i,style:{width:m,height:u},children:r?t.jsxs(S,{data:l,width:m,height:u,margin:{top:1,right:1,bottom:1,left:1},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:h,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:h,stopOpacity:.05})]})}),c&&t.jsx(L,{content:t.jsx(ke,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(H,{type:"monotone",dataKey:"count",stroke:"none",fill:`url(#${p})`,isAnimationActive:!1}),t.jsx(P,{type:"monotone",dataKey:"count",stroke:h,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]}):t.jsxs($,{data:l,width:m,height:u,margin:{top:1,right:1,bottom:1,left:1},children:[c&&t.jsx(L,{content:t.jsx(ke,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(P,{type:"monotone",dataKey:"count",stroke:h,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),Ce=M.memo(function({hash:e,className:s="",size:a="sm"}){const r=h(),c=n(),[i,l]=M.useState(!1),o=M.useMemo(()=>m(e),[e]),d=M.useMemo(()=>o?r.find(e=>e.prefix===o)??null:null,[o,r]),x=c.totalPaths>0&&c.avgPathConfidence>=.7,u=M.useCallback(e=>{e.preventDefault(),e.stopPropagation(),l(!0)},[]),p=M.useCallback(()=>{l(!1)},[]);if(!d)return null;const g="sm"===a?"w-3.5 h-3.5":"w-4 h-4",j=x?"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",f=x?`Prefix conflict resolved by Viterbi HMM (${(100*c.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${d.candidateCount} nodes share prefix "${o}"`;return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:u,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${j} ${s}`,title:f,"aria-label":`View prefix conflict for ${o}${x?" (Viterbi resolved)":""}`,children:x?t.jsxs("span",{className:"relative",children:[t.jsx(T,{className:g}),t.jsx(W,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):t.jsx(ne,{className:g})}),t.jsx(_,{isOpen:i,prefix:d.prefix,candidateHashes:d.candidateHashes,onClose:p})]})});function Se(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const Le=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:e}=u(),s=p(),a=g(),n=j(),r=f(),c=v(),i=N(),[o,d]=M.useState(null),[x,h]=M.useState("lastHeard"),[m,C]=M.useState("desc"),[S,L]=M.useState(""),[H,P]=M.useState(!1),[$,F]=M.useState(null),[T,_]=M.useState(null),[U,K]=M.useState(null),[G,V]=M.useState(new Map),[I,ae]=M.useState(new Map),ne=M.useMemo(()=>(null==e?void 0:e.neighbors)??{},[null==e?void 0:e.neighbors]),le=M.useMemo(()=>Object.fromEntries(Object.entries(ne).filter(([e])=>!s.has(e))),[ne,s]),oe=M.useMemo(()=>{var t;return(null==(t=null==e?void 0:e.config)?void 0:t.repeater)?{latitude:e.config.repeater.latitude,longitude:e.config.repeater.longitude,name:e.config.node_name||"Local Node"}:void 0},[e]),xe=null==e?void 0:e.local_hash,he=M.useMemo(()=>{const e=new Map;if(!(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.longitude))return e;for(const[t,s]of Object.entries(le))s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude?e.set(t,Se(oe.latitude,oe.longitude,s.latitude,s.longitude)):e.set(t,null);return e},[le,oe]),{neighborHashSet:me,neighborSignalMap:ue}=M.useMemo(()=>{const e=new Set,t=new Map;for(const s of c)e.add(s.hash),t.set(s.hash,{avgRssi:s.avgRssi,avgSnr:s.avgSnr});return{neighborHashSet:e,neighborSignalMap:t}},[c]),ge=M.useMemo(()=>{const e=S.toLowerCase().trim(),t="neighbor"===e||"neighbors"===e,s=H||t;return Object.fromEntries(Object.entries(le).filter(([a,n])=>{if(s&&!me.has(a))return!1;if(t)return!0;if(!e)return!0;const r=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return r.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[le,S,H,me]),fe=M.useMemo(()=>Object.entries(ge).sort(([e,t],[s,a])=>{let n=0;switch(x){case"lastHeard":n=(t.last_seen||0)-(a.last_seen||0);break;case"distance":{const t=he.get(e)??null,a=he.get(s)??null;n=null===t&&null===a?0:null===t?1:null===a?-1:t-a;break}case"centrality":n=(r.get(e)||0)-(r.get(s)||0)}return"desc"===m?-n:n}),[ge,x,m,he,r]),ve=fe.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Ne=M.useMemo(()=>new Set(n),[n]),be=M.useCallback(e=>{x===e?C(e=>"desc"===e?"asc":"desc"):(h(e),C("desc"))},[x]),ye=M.useCallback(e=>{const t=le[e];(null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&0!==t.latitude&&0!==t.longitude&&F(e)},[le]),we=M.useCallback(()=>{F(null)},[]),ke=M.useCallback(async(e,t)=>{if(t.stopPropagation(),!U){K(e),V(t=>{const s=new Map(t);return s.delete(e),s}),ae(t=>{const s=new Map(t);return s.delete(e),s});try{const t=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,s=await b(t,30);s.success&&s.data?(V(t=>new Map(t).set(e,s.data)),setTimeout(()=>{V(t=>{const s=new Map(t);return s.delete(e),s})},1e4)):(ae(t=>new Map(t).set(e,s.error||"Ping failed")),setTimeout(()=>{ae(t=>{const s=new Map(t);return s.delete(e),s})},5e3))}catch(s){const t=s instanceof Error?s.message:"Ping failed";ae(s=>new Map(s).set(e,t)),setTimeout(()=>{ae(t=>{const s=new Map(t);return s.delete(e),s})},5e3)}finally{K(null)}}},[U]);return t.jsxs(X,{children:[t.jsx(ee,{title:"Contacts",icon:t.jsx(J,{}),controls:t.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[t.jsxs("span",{className:"roster-title tabular-nums",children:[fe.length," node",1!==fe.length?"s":""]}),ve>0&&t.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[t.jsx(Z,{className:"w-3.5 h-3.5 relative top-[2px]"}),ve," with location"]})]})}),t.jsx("div",{className:"relative",children:t.jsx(de,{neighbors:le,localNode:oe,localHash:xe,onRemoveNode:a,selectedNodeHash:$,onNodeSelected:we,highlightedEdgeKey:T})}),t.jsx(pe,{maxPaths:10,highlightedEdge:T,onHighlightEdge:_}),i.length>0&&t.jsx("div",{className:"chart-container",children:t.jsx(je,{neighbors:le})}),t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(J,{className:"chart-title-icon"}),"Discovered Contacts"]}),t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[me.size>0&&t.jsxs("button",{onClick:()=>P(!H),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(H?"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:H?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[t.jsx(y,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),t.jsx("span",{className:"sm:hidden tabular-nums",children:me.size})]}),t.jsxs("div",{className:"relative",children:[t.jsx(ce,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),t.jsx("input",{type:"text",value:S,onChange:e=>L(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-xs bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),S&&t.jsx("button",{onClick:()=>{L(""),"neighbor"!==S.toLowerCase().trim()&&"neighbors"!==S.toLowerCase().trim()||P(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:t.jsx(w,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[t.jsxs("button",{onClick:()=>be("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("lastHeard"===x?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[t.jsx(l,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===x&&t.jsx(se,{className:"w-3 h-3 "+("asc"===m?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>be("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("distance"===x?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[t.jsx(re,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===x&&t.jsx(se,{className:"w-3 h-3 "+("asc"===m?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>be("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("centrality"===x?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[t.jsx(B,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===x&&t.jsx(se,{className:"w-3 h-3 "+("asc"===m?"rotate-180":"")})]})]})]})]}),fe.length>0?t.jsxs(t.Fragment,{children:[t.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:[t.jsx("div",{className:"contacts-col-node",children:"Node"}),t.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),t.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),t.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),t.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),t.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),t.jsx("div",{className:"contacts-col-actions"})]}),t.jsx("div",{className:"divide-y divide-border-subtle/30",children:fe.map(([e,s])=>{var a;const n=s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude,c=s.node_name||s.name||"Unknown",i=Ne.has(e),l=me.has(e),o=he.get(e),x=r.get(e)||0,h=l?ue.get(e):void 0,m=l&&h,u=null==(a=s.contact_type)?void 0:a.toLowerCase(),p="room server"===u||"room_server"===u||"room"===u||"server"===u,g="companion"===u||"client"===u||"cli"===u,j=s.is_repeater||"repeater"===u||"rep"===u,f=l?"direct":"flood",v=l?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return t.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:()=>ye(e),children:[t.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[m&&null!==(null==h?void 0:h.avgSnr)?t.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(b=h.avgSnr,void 0===b?"bg-[var(--signal-unknown)]":b>=5?"bg-[var(--signal-excellent)]":b>=0?"bg-[var(--signal-good)]":b>=-5?"bg-[var(--signal-fair)]":b>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):t.jsx("div",{className:"w-2 flex-shrink-0"}),t.jsx("div",{className:"roster-icon flex-shrink-0",title:v,children:p&&j?t.jsxs("div",{className:"relative w-5 h-5",children:[t.jsx(E,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),t.jsx(A,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):p?t.jsx(E,{className:"w-5 h-5 text-accent-secondary"}):g?t.jsx(O,{className:"w-5 h-5 text-text-muted"}):j?"direct"===f?t.jsx(z,{className:"w-5 h-5 text-accent-success"}):t.jsx(A,{className:"w-5 h-5 text-accent-tertiary"}):t.jsx(O,{className:"w-5 h-5 text-text-muted"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[t.jsx("span",{className:"roster-title truncate",title:c,children:c}),l&&t.jsx("span",{className:"type-badge px-1.5 py-0.5 rounded flex-shrink-0",style:{backgroundColor:"rgba(113, 152, 114, 0.2)",color:"var(--accent-success)"},children:"NBR"}),i&&t.jsxs("span",{className:"type-badge px-1.5 py-0.5 rounded flex items-center gap-1 flex-shrink-0",style:{backgroundColor:"rgba(223, 188, 114, 0.2)",color:"var(--accent-secondary)"},children:[t.jsx(D,{className:"w-3 h-3"}),"HUB"]}),j&&t.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx(q,{hash:e,size:"xs",prefixLength:8,suffixLength:6}),t.jsx(Ce,{hash:e})]})]})]}),t.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[m&&null!==(null==h?void 0:h.avgRssi)&&t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(R,{rssi:h.avgRssi,className:"w-3.5 h-3.5"}),t.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(h.avgRssi)})]}),m&&null!==(null==h?void 0:h.avgSnr)&&t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[h.avgSnr.toFixed(1)," dB"]})]}),t.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=o&&t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"w-3 h-3"}),t.jsx("span",{className:"type-data-xs tabular-nums",children:(N=o,N<1e3?`${Math.round(N)}m`:`${(N/1e3).toFixed(1)}km`)})]})}),t.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:x>0&&t.jsxs(t.Fragment,{children:[t.jsx(B,{className:"w-3 h-3 text-accent-secondary"}),t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*x).toFixed(0),"%"]})]})}),t.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:t.jsx(Me,{nodeHash:e,width:48,height:16})}),t.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:t.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:s.last_seen?k(s.last_seen):"—"})}),t.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[l&&t.jsx(t.Fragment,{children:G.has(e)?t.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${G.get(e).rtt_ms.toFixed(0)}ms`,children:[t.jsx(W,{className:"w-3.5 h-3.5"}),t.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[G.get(e).snr_db.toFixed(1),"dB"]})]}):I.has(e)?t.jsx("span",{className:"text-red-400 text-[10px]",title:I.get(e),children:"✗"}):t.jsx("button",{onClick:t=>ke(e,t),disabled:null!==U,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:U===e?t.jsx(te,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):t.jsx(ie,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),t.jsx("button",{onClick:t=>{t.stopPropagation(),d({hash:e,name:c})},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:t.jsx(Q,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},e);var N,b})})]}):t.jsxs("div",{className:"roster-empty",children:[t.jsx(J,{className:"roster-empty-icon"}),t.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),t.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}),t.jsx(Y,{isOpen:!!o,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==o?void 0:o.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{o&&a(o.hash),d(null)},onCancel:()=>d(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{Le as C,Me as N,Ce as P,ie as T}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-D3YpXUKi.js b/frontend/dist/assets/ContactsMapMapLibre-D3YpXUKi.js new file mode 100644 index 00000000..c5834e19 --- /dev/null +++ b/frontend/dist/assets/ContactsMapMapLibre-D3YpXUKi.js @@ -0,0 +1 @@ +import{r as A,b as e,j as t,a7 as r,a8 as n,aX as i,aY as a,h as o,al as s,W as l,am as c,an as u,ay as d,ag as f,O as g,$ as h,aa as m,aZ as b,a_ as p,a$ as x,b0 as v,b1 as w,b2 as y,b3 as k,a2 as C,ak as B,b4 as D,b5 as E,b6 as M,b7 as Q,b8 as N,b9 as j,ba as P,c as S,X as F,bb as T,a5 as I,aQ as L,bc as _,aT as R,aU as H,aW as z,aS as G,bd as O,be as U}from"./vendor-react-nG6Am_s0.js";import"./maplibre-gl-WBl_4I3M.js";import{J as Y,K as W,v as V,y as Z,al as J,am as K,e as X,an as q,ao as $}from"./index-C05_s9O_.js";import{C as AA}from"./ConfirmModal-V3007Nz2.js";import{c as eA}from"./recharts-BJXKa0n8.js";import{g as tA,f as rA,h as nA,i as iA}from"./useThemeColors-C9IVL-ly.js";import{P as aA,N as oA}from"./Contacts-CVzWZVxU.js";import{M as sA}from"./deckgl-MTXp-Y3t.js";import"./vendor-core-XI_xDZ-M.js";import"./SignalIndicator-CC9fMGoT.js";import"./HashBadge-CXiNob7o.js";import"./CollisionExplorerModal-BqgPeZ5i.js";import"./leaflet-ChRwnWLk.js";import"./PageLayout-D3aCCXDi.js";function lA(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 cA({label:A,icon:e,status:n,detail:i}){return t.jsxs("div",{className:eA("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-success/10","pending"===n&&"opacity-40"),children:[t.jsx("div",{className:eA("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-success/20","pending"===n&&"bg-white/5"),children:"complete"===n?t.jsx(r,{className:"w-4 h-4 text-accent-success"}):"active"===n?t.jsx(s,{className:"w-4 h-4 animate-spin text-accent-primary"}):t.jsx("span",{className:"text-text-muted",children:e})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:eA("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-success","pending"===n&&"text-text-muted"),children:A}),i&&"pending"!==n&&t.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:i})]})]})}const uA=A.memo(function({isOpen:s,currentStep:l,packetCount:c,onClose:u}){if(A.useEffect(()=>{if(!s)return;const A=A=>{"Escape"===A.key&&u&&u()};window.addEventListener("keydown",A);const e=document.body.style.overflow,t=document.body.style.position,r=document.body.style.width,n=document.body.style.top,i=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${i}px`,()=>{window.removeEventListener("keydown",A),document.body.style.overflow=e,document.body.style.position=t,document.body.style.width=r,document.body.style.top=n,window.scrollTo(0,i)}},[s,u]),!s)return null;const d="complete"===l,f=A=>{const e=["fetching","analyzing","building","discovering","complete"],t=e.indexOf(l),r=e.indexOf(A);return r0?`${c.toLocaleString()} packets`:"Loading database..."}),t.jsx(cA,{label:"Analyzing Database",icon:t.jsx(a,{className:"w-4 h-4"}),status:f("analyzing"),detail:"Processing packet paths"}),t.jsx(cA,{label:"Building Topology",icon:t.jsx(n,{className:"w-4 h-4"}),status:f("building"),detail:"Computing mesh edges"}),t.jsx(cA,{label:"Discovering Nodes",icon:t.jsx(o,{className:"w-4 h-4"}),status:f("discovering"),detail:"Viterbi HMM ghost detection"})]}),t.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})]}),document.body)}),dA={nodeFill:"#F5F5F0",nodeStroke:"#4A5568",localColor:"#FBBF24",hubColor:"#8B7BAD",mobileColor:"#F97316",roomServerColor:"#E17899",neighborColor:"#FBBF24",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24"},edgeOpacity:.82};function fA(){if("undefined"==typeof window)return dA;const A=tA(),e=rA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,localColor:A.localColor,hubColor:A.hubColor,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:dA.edges.neighborRest,neighborHover:dA.edges.neighborHover},edgeOpacity:dA.edgeOpacity}}const gA=2e3;function hA({text:A}){return t.jsxs("span",{className:"group relative cursor-help",children:[t.jsx(d,{className:"w-3.5 h-3.5 text-text-muted"}),t.jsx("div",{className:"absolute bottom-full left-0 mb-1 hidden group-hover:block w-48 p-2 text-[11px] leading-snug rounded-lg z-10 bg-tooltip-bg border border-border-subtle shadow-lg",children:A})]})}function mA(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function bA({hash:e,hashPrefix:n,name:i,isHub:a,isGateway:o,isBackbone:d,isZeroHop:f,isMobile:g,isRoomServer:h,isStale:m,lastSeenTimestamp:b,centrality:p,affinity:x,meanSnr:v,meanRssi:w,neighbor:y,onRemove:k,txDelayRec:C,onPingResult:B}){const D=nA(),[E,M]=A.useState(!1),[Q,N]=A.useState(!1),[j,P]=A.useState(null),[S,F]=A.useState(null),T=A.useCallback(async()=>{if(!Q){N(!0),F(null),P(null);try{const A=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await Y(A,30);t.success&&t.data?(P(t.data),null==B||B(t.data)):F(t.error||"Ping failed")}catch(A){F(A instanceof Error?A.message:"Ping failed")}finally{N(!1)}}},[e,Q,B]),I=f?"Direct":(null==x?void 0:x.typicalHopPosition)?`${x.typicalHopPosition}-hop`:null,L=[{label:"Packets",value:(null==x?void 0:x.frequency)||0},{label:"Adverts",value:y.advert_count||0}];f&&void 0!==v&&L.push({label:"SNR",value:`${v.toFixed(1)} dB`}),f&&void 0!==w&&L.push({label:"RSSI",value:`${Math.round(w)} dBm`});const _=C&&!C.insufficientData,R={hub:{bg:"bg-amber-500/20",text:"text-amber-400",title:"Hub: High-connectivity node (4+ neighbors) that bridges many paths"},backbone:{bg:"bg-purple-500/20",text:"text-purple-400",title:"Backbone: Critical relay with 4+ neighbors and high traffic"},relay:{bg:"bg-cyan-500/20",text:"text-cyan-400",title:"Relay: Standard forwarding node with symmetric traffic"},edge:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Edge: Peripheral node with few connections"}},H={high:{bg:"bg-green-500/20",text:"text-green-400",title:"1000+ packets observed"},medium:{bg:"bg-amber-500/20",text:"text-amber-400",title:"500-999 packets observed"},low:{bg:"bg-red-500/20",text:"text-red-400",title:"100-499 packets observed"},insufficient:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Insufficient data for analysis"}};return t.jsxs("div",{className:"w-[232px] pr-3",children:[t.jsx("div",{className:"text-[15px] font-semibold text-text-primary leading-snug truncate mb-1",children:i}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap mb-2",children:[t.jsx("code",{className:"font-mono text-[11px] text-text-secondary bg-white/[0.08] px-1.5 py-0.5 rounded",children:n}),t.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(e),M(!0),setTimeout(()=>M(!1),1500)}catch(A){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),M(!0),setTimeout(()=>M(!1),1500)}catch{}document.body.removeChild(t)}},className:"p-1 hover:bg-white/10 rounded transition-colors",title:"Copy full hash",children:E?t.jsx(r,{className:"w-3.5 h-3.5 text-accent-success"}):t.jsx(l,{className:"w-3.5 h-3.5 text-text-secondary"})}),t.jsx(aA,{hash:e,size:"sm"}),a&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded",style:{backgroundColor:D.hubColor,color:"#fff"},title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),o&&!a&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded",style:{backgroundColor:D.hubColor,color:"#fff",opacity:.8},title:"Gateway: 7-10% of last-hop traffic",children:"Gateway"}),d&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded bg-purple-500/80 text-white",title:"Backbone: Critical relay with high traffic and 4+ neighbors",children:"Backbone"}),I&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded "+(f?"bg-amber-400/90 text-gray-900":"bg-white/[0.15] text-white"),children:I}),g&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded bg-orange-500/25 text-orange-300",children:"Mobile"}),y.is_repeater&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded bg-cyan-500/20 text-cyan-400",children:"Rptr"}),h&&t.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-bold uppercase rounded bg-amber-500/25 text-amber-400",children:"Room"}),m&&b&&t.jsxs("span",{className:"px-1.5 py-0.5 text-[9px] font-medium rounded bg-gray-500/30 text-gray-300",title:"Neighbor not heard in 7+ days",children:["Idle ",mA(b)]})]}),t.jsxs("div",{className:"text-[11px] text-text-secondary mb-2.5 leading-normal",children:[t.jsx("span",{children:W(y.last_seen)}),(null==x?void 0:x.distanceMeters)&&t.jsxs("span",{className:"font-medium text-text-primary",children:[" · ",(z=x.distanceMeters,null===z?"—":z<1e3?`${Math.round(z)}m`:`${(z/1e3).toFixed(1)}km`)]}),y.latitude&&y.longitude&&0!==y.latitude&&0!==y.longitude&&t.jsxs("span",{className:"font-mono text-[10px] text-text-secondary",children:[" · ",y.latitude.toFixed(4),", ",y.longitude.toFixed(4)]})]}),t.jsx("div",{className:"mb-2.5",style:{width:212},children:t.jsx(oA,{nodeHash:e,width:212,height:32,showArea:!0,showTooltip:!0})}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 text-[12px] mb-2.5",children:[L.map((A,e)=>t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-text-secondary",children:A.label}),t.jsx("span",{className:"font-semibold tabular-nums px-1.5 py-0.5 rounded bg-white/[0.06] "+("highlight"in A&&A.highlight?"text-amber-400":"text-text-primary"),children:A.value})]},e)),_&&C.networkRole&&t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center justify-between col-span-2 mt-1.5 pt-1.5 border-t border-white/[0.08]",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-text-secondary",children:"Role"}),t.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold uppercase rounded ${R[C.networkRole].bg} ${R[C.networkRole].text}`,title:R[C.networkRole].title,children:C.networkRole})]}),C.dataConfidence&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-text-secondary",children:"Data"}),t.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold uppercase rounded ${H[C.dataConfidence].bg} ${H[C.dataConfidence].text}`,title:H[C.dataConfidence].title,children:C.dataConfidence})]})]})})]}),(_||k)&&t.jsxs("div",{className:"pt-2 border-t border-white/[0.08]",children:[_&&t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsx("span",{className:"text-text-secondary",children:"TX Delay"}),t.jsxs("span",{className:"font-semibold tabular-nums text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:["×",(C.floodFactor??C.txDelayFactor).toFixed(1)]}),t.jsx("span",{className:"text-text-secondary text-[10px]",children:"flood"}),t.jsxs("span",{className:"font-semibold tabular-nums text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:["×",(C.directFactor??C.directTxDelayFactor).toFixed(1)]}),t.jsx("span",{className:"text-text-secondary text-[10px]",children:"direct"})]}),t.jsxs("div",{className:"flex items-center justify-between "+(_?"mt-2":""),children:[f&&t.jsxs("button",{onClick:T,disabled:Q,className:"flex items-center gap-1.5 -ml-0.5 py-1 text-[11px] text-text-secondary hover:text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:[Q?t.jsx(s,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(c,{className:"w-3.5 h-3.5"}),t.jsx("span",{children:"Ping"})]}),!f&&t.jsx("div",{}),k&&t.jsx("button",{onClick:k,className:"flex items-center gap-1 p-1.5 -mr-1.5 text-[11px] text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:t.jsx(u,{className:"w-3.5 h-3.5"})})]}),j&&t.jsxs("div",{className:"mt-2 pt-2 border-t border-white/[0.08] text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-2 text-accent-success",children:[t.jsx(r,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"font-medium",children:"Ping successful"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 mt-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-text-secondary",children:"RTT"}),t.jsxs("span",{className:"font-semibold tabular-nums text-text-primary bg-white/[0.06] px-1.5 py-0.5 rounded",children:[j.rtt_ms.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-text-secondary",children:"SNR"}),t.jsxs("span",{className:"font-semibold tabular-nums text-text-primary bg-white/[0.06] px-1.5 py-0.5 rounded",children:[j.snr_db.toFixed(1)," dB"]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-text-secondary",children:"RSSI"}),t.jsxs("span",{className:"font-semibold tabular-nums text-text-primary bg-white/[0.06] px-1.5 py-0.5 rounded",children:[j.rssi," dBm"]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-text-secondary",children:"Hops"}),t.jsx("span",{className:"font-semibold tabular-nums text-text-primary bg-white/[0.06] px-1.5 py-0.5 rounded",children:j.path.length})]})]})]}),S&&t.jsx("div",{className:"mt-2 pt-2 border-t border-white/[0.08] text-[11px] text-red-400",children:t.jsxs("span",{children:["⚠ ",S]})})]})]});var z}function pA({showTopology:A,validatedPolylineCount:e,filteredNeighborCount:r,hasLocalNode:n,meshTopology:i,zeroHopNeighbors:a,neighborsWithLocation:s}){const l=nA(),c=V(),u=Z(),d=c.filter(A=>A.isLikelyReal).length,b=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(i);return t.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[t.jsxs("div",{className:"text-text-secondary font-medium mb-1.5 flex items-center gap-1",children:["Nodes",t.jsx(hA,{text:"Node type shown by shape. Yellow = direct RF neighbor."})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:l.nodeFill}}),t.jsx("span",{className:"text-text-muted",children:"Node"}),t.jsx(hA,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:l.hubColor}}),t.jsx("span",{className:"text-text-muted",children:"Hub"}),t.jsx(hA,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(p=s,p.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})&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(f,{className:"w-3 h-3 flex-shrink-0",style:{color:l.roomColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Room"}),t.jsx(hA,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"w-3 h-3 flex-shrink-0",style:{color:l.localColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Local"}),t.jsx(hA,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),a.size>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded flex-shrink-0",style:{width:"12px",height:"8px",backgroundColor:l.neighborColor}}),t.jsx("span",{className:"text-text-muted",children:"Neighbor"}),t.jsx(hA,{text:"Zero-hop direct RF contact. Color indicates we receive their ADVERTs directly."})]}),i.gatewayNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:l.hubColor,opacity:.7}}),t.jsx("span",{className:"text-text-muted",children:"Gateway"}),t.jsx(hA,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),b>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:"rgb(168, 85, 247)",opacity:.8}}),t.jsx("span",{className:"text-text-muted",children:"Backbone"}),t.jsx(hA,{text:"Critical relay with 4+ neighbors and high betweenness centrality. Backbone nodes carry the majority of mesh traffic."})]}),i.mobileNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",background:"transparent",border:`4px solid ${l.mobileColor}`,boxSizing:"border-box"}}),t.jsx("span",{className:"text-text-muted",children:"Mobile"}),t.jsx(hA,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),d>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(o,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-tertiary)"},strokeWidth:2.5}),t.jsxs("span",{className:"text-text-muted",children:["Ghost (",d,")"]}),t.jsx(hA,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]}),A&&e>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"text-text-secondary font-medium mt-2 pt-2 border-t border-white/10 mb-1 flex items-center gap-1",children:["Topology",t.jsx(hA,{text:"Links with 5+ validations. Thickness = relative strength."})]}),t.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted",children:[t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Nodes"}),t.jsx("span",{className:"text-text-secondary",children:r+(n?1:0)})]}),i.hubNodes.length>0&&t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Hubs"}),t.jsx("span",{style:{color:dA.hubColor},children:i.hubNodes.length})]})]}),i.loops.length>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(h,{className:"w-3 h-3 flex-shrink-0",style:{color:dA.edges.hoverLoop}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:dA.edges.hoverLoop},className:"font-medium",children:[i.loops.length," ",1===i.loops.length?"Loop":"Loops"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),u.totalPaths>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(m,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-primary)"}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:"var(--accent-primary)"},className:"font-medium",children:[u.totalPaths.toLocaleString()," Viterbi"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})]});var p}const xA="rgba(251, 191, 36, 0.2)";function vA({isDeepLoading:A,showDeepAnalysisModal:e,onDeepAnalysis:r,showTopology:i,onToggleTopology:a,hasValidatedPolylines:o,showNeighborLines:s,onToggleNeighborLines:l,hasNeighborPolylines:c,showNodes:u,onToggleNodes:d,soloHubs:f,onToggleSoloHubs:g,hasHubNodes:h,soloDirect:m,onToggleSoloDirect:N,hasZeroHopNeighbors:j,showCoverage:P,onToggleCoverage:S,show3DTerrain:F,onToggle3DTerrain:T,isFullscreen:I,onToggleFullscreen:L,edgeOpacityBias:_=.5,onEdgeOpacityBiasChange:R,edgeWidthMultiplier:H=1,onEdgeWidthMultiplierChange:z,edgeTrafficFilter:G=0,onEdgeTrafficFilterChange:O}){const U=i&&o&&R&&z&&O;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"absolute top-3 right-3 z-[600] map-controls-container sm:top-4 sm:right-4",children:[t.jsxs("div",{className:"map-controls-row map-controls-primary",children:[t.jsxs("button",{onClick:r,disabled:A||e,className:"map-control-glass px-2.5 py-1.5 sm:px-3 sm:py-2 flex items-center gap-1.5 sm:gap-2 transition-colors hover:bg-white/10 disabled:opacity-50 disabled:cursor-not-allowed",title:"Deep Analysis - Load full packet history and rebuild topology","aria-label":"Deep Analysis",children:[t.jsx("span",{className:"map-control-label text-xs font-medium text-text-primary",children:"Deep Analysis"}),t.jsx(b,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-primary"})]}),o&&t.jsx("button",{onClick:a,className:"map-control-btn "+(i?"map-control-glass-active":"map-control-glass"),style:i?{backgroundColor:"rgba(74, 222, 128, 0.2)"}:void 0,title:i?"Hide topology lines":"Show topology lines","aria-label":i?"Hide topology":"Show topology","aria-pressed":i,children:i?t.jsx(n,{className:"map-control-icon text-green-400"}):t.jsx(p,{className:"map-control-icon text-text-secondary"})})]}),U&&t.jsx("div",{className:"map-controls-row map-controls-sliders",children:t.jsxs("div",{className:"map-control-glass map-sliders-panel",children:[t.jsxs("div",{className:"map-slider-group",title:"Contrast - dim edges below brightness threshold",children:[t.jsx(x,{className:"map-slider-icon "+(_>.5?"text-purple-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"0",max:"95",value:100*_,onChange:A=>R(Number(A.target.value)/100),className:"map-slider","aria-label":"Edge contrast"})]}),t.jsxs("div",{className:"map-slider-group",title:"Traffic filter - "+(0===G?"All edges":`Top ${Math.round(100*(1-G))}%`),children:[t.jsx(v,{className:"map-slider-icon "+(G<.1?"text-green-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"0",max:"95",value:100*G,onChange:A=>O(Number(A.target.value)/100),className:"map-slider","aria-label":"Traffic filter"}),t.jsx(w,{className:"map-slider-icon "+(G>.8?"text-amber-400":"text-text-muted")})]}),t.jsxs("div",{className:"map-slider-group",title:"Thickness - edge line width",children:[t.jsx(y,{className:"map-slider-icon "+(H>1?"text-blue-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"25",max:"200",value:100*H,onChange:A=>z(Number(A.target.value)/100),className:"map-slider","aria-label":"Edge thickness"})]})]})}),t.jsxs("div",{className:"map-controls-row map-controls-secondary",children:[c&&t.jsx("button",{onClick:l,className:"map-control-btn "+(s?"map-control-glass-active":"map-control-glass"),style:s?{backgroundColor:xA}:void 0,title:s?"Hide neighbor lines":"Show neighbor lines","aria-label":s?"Hide neighbor lines":"Show neighbor lines","aria-pressed":s,children:t.jsx(k,{className:"map-control-icon "+(s?"text-amber-400":"text-text-secondary")})}),t.jsx("button",{onClick:d,className:"map-control-btn "+(u?"map-control-glass-active":"map-control-glass"),style:u?{backgroundColor:"rgba(99, 102, 241, 0.2)"}:void 0,title:u?"Hide all nodes":"Show all nodes","aria-label":u?"Hide nodes":"Show nodes","aria-pressed":u,children:u?t.jsx(C,{className:"map-control-icon text-indigo-400"}):t.jsx(p,{className:"map-control-icon text-text-secondary"})}),h&&t.jsx("button",{onClick:g,className:"map-control-btn "+(f?"map-control-glass-active":"map-control-glass"),style:f?{backgroundColor:xA}:void 0,title:f?"Show all nodes":"Solo hubs & connections","aria-label":f?"Show all nodes":"Solo hubs","aria-pressed":f,children:t.jsx(B,{className:"map-control-icon "+(f?"text-amber-400":"text-text-secondary")})}),j&&t.jsx("button",{onClick:N,className:"map-control-btn "+(m?"map-control-glass-active":"map-control-glass"),style:m?{backgroundColor:"rgba(67, 56, 202, 0.35)"}:void 0,title:m?"Show all nodes":"Solo direct (0-hop) nodes","aria-label":m?"Show all nodes":"Solo direct neighbors","aria-pressed":m,children:t.jsx(D,{className:"map-control-icon "+(m?"text-indigo-400":"text-text-secondary")})}),t.jsx("button",{onClick:T,className:"map-control-btn "+(F?"map-control-glass-active":"map-control-glass"),style:F?{backgroundColor:"rgba(45, 212, 191, 0.2)"}:void 0,title:F?"Disable 3D terrain":"Enable 3D terrain","aria-label":F?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":F,children:t.jsx(E,{className:"map-control-icon "+(F?"text-teal-400":"text-text-secondary")})}),t.jsx("button",{onClick:L,className:"map-control-btn map-control-glass",title:I?"Exit fullscreen":"Fullscreen","aria-label":I?"Exit fullscreen":"Enter fullscreen","aria-pressed":I,children:I?t.jsx(M,{className:"map-control-icon text-text-secondary"}):t.jsx(Q,{className:"map-control-icon text-text-secondary"})})]})]}),U&&t.jsx("div",{className:"map-sliders-bottom",children:t.jsxs("div",{className:"map-control-glass map-sliders-panel-vertical",children:[t.jsxs("div",{className:"map-slider-group-vertical",title:"Contrast - dim edges below brightness threshold",children:[t.jsx(x,{className:"map-slider-icon "+(_>.5?"text-purple-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"0",max:"95",value:100*_,onChange:A=>R(Number(A.target.value)/100),className:"map-slider","aria-label":"Edge contrast"})]}),t.jsxs("div",{className:"map-slider-group-vertical",title:"Traffic filter - "+(0===G?"All edges":`Top ${Math.round(100*(1-G))}%`),children:[t.jsx(v,{className:"map-slider-icon "+(G<.1?"text-green-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"0",max:"95",value:100*G,onChange:A=>O(Number(A.target.value)/100),className:"map-slider","aria-label":"Traffic filter"})]}),t.jsxs("div",{className:"map-slider-group-vertical",title:"Thickness - edge line width",children:[t.jsx(y,{className:"map-slider-icon "+(H>1?"text-blue-400":"text-text-muted")}),t.jsx("input",{type:"range",min:"25",max:"200",value:100*H,onChange:A=>z(Number(A.target.value)/100),className:"map-slider","aria-label":"Edge thickness"})]})]})})]})}function wA({isActive:A,onClick:e,brightness:r=.7,onBrightnessChange:n}){const i=Math.max(.01,Math.min(1,r)),a=i<.999,o=i>.011;return t.jsxs("button",{onClick:e,className:"flex items-center gap-2 w-full text-left transition-colors hover:bg-white/5 "+(A?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",...A?{backgroundColor:"rgba(245, 158, 11, 0.15)"}:{}},title:A?"Configure wardriving coverage":"Show wardriving coverage",children:[t.jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0 "+(A?"text-amber-400":"text-text-secondary")}),t.jsx("span",{className:"text-xs font-medium "+(A?"text-amber-400":"text-text-secondary"),children:"Wardrive"}),A&&n&&t.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,i-.2);null==n||n(e)},disabled:!o,className:"p-0.5 rounded transition-colors "+(o?"hover:bg-white/10 text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*i)}%)`,children:t.jsx(j,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,i+.2);null==n||n(e)},disabled:!a,className:"p-0.5 rounded transition-colors "+(a?"hover:bg-white/10 text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*i)}%)`,children:t.jsx(P,{className:"w-3.5 h-3.5"})})]})]})}function yA(A){let e=!0,t=-90,r=90,n=-180,i=180;for(const a of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(a);if(-1!==A)for(let a=4;a>=0;a--){const o=A>>a&1;if(e){const A=(n+i)/2;o?n=A:i=A}else{const A=(t+r)/2;o?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+i)/2}}function kA(A){return Math.exp(-A*Math.LN2/7)}const CA="pymc-wardriving-url",BA="pymc-wardriving-enabled",DA="pymc-wardriving-brightness";function EA(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(CA,A):localStorage.removeItem(CA))}function MA(A){"undefined"!=typeof localStorage&&localStorage.setItem(BA,String(A))}function QA(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(DA);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function NA(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 jA=S((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(BA),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(CA)||"",brightness:QA(),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(DA,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;MA(t),A({isVisible:t})},setVisible:e=>{MA(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(i){if(i instanceof Error&&"AbortError"===i.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw i}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}=yA(r.hash),i=parseInt(r.time,10),a=isNaN(i)?30:(Date.now()-i)/864e5,o=kA(a),s=NA(r.snr,r.rssi)*(.3+.7*o);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:a,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()}),EA(e.trim()),MA(!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:""}),EA(""),MA(!1)}}));function PA({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const e={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];return e?t.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx("div",{className:"relative",children:t.jsx(s,{className:"w-5 h-5 text-amber-400 animate-spin"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:e}),t.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:t.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 SA(){const{isModalOpen:e,closeModal:n,status:a,isVisible:o,stats:l,error:c,url:d,brightness:f,loadCoverage:g,clearCoverage:h,toggleVisibility:b,setUrl:x,setBrightness:v}=jA(),w="connecting"===a||"loading"===a||"processing"===a,[y,k]=A.useState(d),C=A.useCallback(async()=>{await g(y)},[y,g]),B=A.useCallback(()=>{k(""),h()},[h]),D=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||w||(A.preventDefault(),C())},[C,w]),E=A.useCallback(A=>{const e=A.target.value;k(e),x(e)},[x]);if(!e)return null;const M=l.coverageCount>0,Q=y.trim().length>0&&!w;return t.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:w?void 0:n}),t.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:t.jsx(N,{className:"w-5 h-5 text-amber-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),t.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),t.jsx("button",{onClick:n,disabled:w,className:"p-2 rounded-lg hover:bg-white/10 transition-colors disabled:opacity-50",children:t.jsx(F,{className:"w-5 h-5 text-text-secondary"})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),t.jsx("input",{type:"url",value:y,onChange:E,onKeyDown:D,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-black/30 border border-border 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:w}),t.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)"})]}),t.jsx(PA,{status:a}),"error"===a&&c&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[t.jsx(T,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),t.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:c})]})]}),"success"===a&&M&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[t.jsx(r,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),t.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," coverage points • ",l.repeaterCount.toLocaleString()," repeaters"]})]})]}),M&&!w&&"success"!==a&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx(I,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),t.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," points •",l.lastUpdated&&` Last updated ${l.lastUpdated.toLocaleTimeString()}`]})]})]}),M&&!w&&t.jsx("div",{className:"p-3 bg-black/20 border border-border-subtle rounded-xl",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{className:"w-4 h-4 flex-shrink-0 "+(f>.5?"text-amber-400":"text-text-muted")}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Brightness"}),t.jsxs("span",{className:"text-xs text-text-muted font-mono",children:[Math.round(100*f),"%"]})]}),t.jsx("input",{type:"range",min:"1",max:"100",value:100*f,onChange:A=>v(Number(A.target.value)/100),className:"w-full h-1.5 cursor-pointer accent-amber-400"})]})]})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[t.jsx("div",{className:"flex items-center gap-2",children:M&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:b,disabled:w,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-white/5 rounded-lg transition-colors disabled:opacity-50",title:o?"Hide heatmap":"Show heatmap",children:o?t.jsxs(t.Fragment,{children:[t.jsx(p,{className:"w-3.5 h-3.5"})," Hide"]}):t.jsxs(t.Fragment,{children:[t.jsx(m,{className:"w-3.5 h-3.5"})," Show"]})}),t.jsxs("button",{onClick:B,disabled:w,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:[t.jsx(u,{className:"w-3.5 h-3.5"})," Clear"]})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:n,disabled:w,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-white/10 rounded-lg transition-colors disabled:opacity-50",children:M?"Done":"Cancel"}),t.jsx("button",{onClick:C,disabled:!Q,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:w?t.jsxs(t.Fragment,{children:[t.jsx(s,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):M?t.jsxs(t.Fragment,{children:[t.jsx(i,{className:"w-4 h-4"}),"Refresh"]}):t.jsxs(t.Fragment,{children:[t.jsx(L,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}var FA=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,i="";"undefined"!=typeof document&&document.currentScript&&(i=document.currentScript.src),i=0!==i.indexOf("blob:")?i.substr(0,i.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 a=t.print||function(){}.bind(),o=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,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(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 i="";e>10,56320|1023&l)}}else i+=String.fromCharCode((31&a)<<6|o)}else i+=String.fromCharCode(a)}return i}(f,A,e):""}function v(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=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),h[7156]=5271536;var C=[],B=[],D=[],E=[];function M(A){C.unshift(A)}function Q(A){E.unshift(A)}var N=Math.abs,j=Math.ceil,P=Math.floor,S=Math.min,F=0,T=null;t.preloadedImages={},t.preloadedAudios={};var I,L,_=null,R="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith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P6lzLKY31eu/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAA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ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAA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c/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/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAA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qLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,i,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=o.indexOf(A.charAt(l++))<<2|(n=o.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(i=o.indexOf(A.charAt(l++)))>>2,r=(3&i)<<6|(a=o.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==i&&(s+=String.fromCharCode(t)),64!==a&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(o=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(o=((0|t)<0)<<31>>31),3,0),l=0|B(),o=0|Ve(0|t,0|o,1,0),o=0|Ve(0|(o=0|qe(0|c,0|l,0|o,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=o,n[s+4>>2]=l,s=o;if(lt(0|r,0,s<<3),0|i){lt(0|i,0,s<<2),o=0|I(A,e,t,r,i,s,l,0);break}(o=0|We(s,4))?(c=0|I(A,e,t,r,o,s,l,0),Ye(o),o=c):o=13}else o=2}while(0);return P=a,0|o}function T(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,o,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(o=P,P=P+16|0,m=o+8|0,n[(h=a=o)>>2]=A,n[h+4>>2]=e,(0|t)<0)return P=o,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|i))&&(n[i>>2]=0),0|HA(A,e))return P=o,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|L(s,e,4,m,a)))break A;if(0|HA(s=0|n[(e=a)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|L(s,e,0|n[26800+(g<<2)>>2],m,a)))break A;if(s=0|n[(e=a)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[i+(f<<2)>>2]=h,l=(0|(A=d+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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|L(s,e,4,m,a)))break A;if(0|HA(s=0|n[(e=a)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|L(s,e,0|n[26800+(g<<2)>>2],m,a)))break A;if(s=0|n[(e=a)>>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|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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else s=0}while(0);return P=o,0|s}function I(A,e,t,r,i,a,o,s){t|=0,r|=0,i|=0,s|=0;var l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0;if(u=P,P=P+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(a|=0),0|(o|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=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|g,1,0)),0|B(),0|a,0|o),g=0|B(),f=(0|(b=0|n[(p=h=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=i+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return P=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return P=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|L(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|L(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|L(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|L(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|L(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|L(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,i,a,o,f)))break A;break;default:break A}return P=u,0}}while(0);return P=u,0|d}function L(A,e,t,r,i){A|=0,e|=0,i|=0;var a,o,s=0,l=0,c=0,u=0,d=0,f=0,g=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|xA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(o=127&d)>>>0>121)return 5;a=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,f=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&~f,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*o|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*o|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*o|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*o|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|o)!=(0|c)){if(0|Y(c,0|n[7696+(28*o|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}D(27795,26864,533,26872)}switch(0|a){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|o)!=(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[(g=i)>>2]=A,n[g+4>>2]=e,0}function _(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var i,a,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(a=P,P=P+16|0,h=a+8|0,n[(g=i=a)>>2]=A,n[g+4>>2]=e,(0|t)<0)return P=a,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,P=a,0;n[h>>2]=0;A:do{if(0|HA(A,e))A=9;else{o=0,g=A;do{if(0|(A=0|L(g,e,4,h,i)))break A;if(o=o+1|0,0|HA(g=0|n[(e=i)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|o)<(0|t));n[(f=r)>>2]=g,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(o=26800+(d<<2)|0,5==(0|d))for(l=0|n[o>>2],s=0,o=A;;){if(0|(A=0|L(0|n[(A=i)>>2],0|n[A+4>>2],l,h,i)))break A;if((0|s)!=(0|f)){if(c=0|n[(u=i)>>2],u=0|n[u+4>>2],n[(A=r+(o<<3)|0)>>2]=c,n[A+4>>2]=u,0|HA(c,u)){A=9;break A}A=o+1|0}else A=o;if((0|(s=s+1|0))>=(0|t))break;o=A}else for(l=i,u=0|n[o>>2],c=0,o=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|L(s,l,u,h,i)))break A;if(s=0|n[(l=i)>>2],l=0|n[l+4>>2],n[(A=r+(o<<3)|0)>>2]=s,n[A+4>>2]=l,A=o+1|0,0|HA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;o=A}d=d+1|0}while(d>>>0<6);A=(0|g)==(0|n[(A=i)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return P=a,0|A}function R(A,e,t,r){t|=0,r|=0;var i,a,o,s=0,l=0;for(o=P,P=P+16|0,i=o,a=o+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[a>>2]=0,!(0|L(A,e,s,a,i))&((0|n[(l=i)>>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)?(P=o,0|s):0}function H(A,e,t,r,a,o,s){e|=0,t|=0,r|=0,a|=0,o|=0,s|=0;var l,c,u,d,f,g,h,m,b,p,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0,M=0,Q=0,N=0,j=0,S=0,F=0,T=0,I=0,L=0,_=0,R=0;if(p=P,P=P+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(v=0|n[(A|=0)>>2]))<=0)return P=p,0;for(u=A+4|0,d=h+8|0,f=m+8|0,g=l+8|0,x=0,S=0;;){j=(w=0|n[u>>2])+(S<<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|S)==(v+-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+(S+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]),v=0|tA(h,m,r,b);A:do{if(v)w=0,x=v;else if(w=0|n[(v=b)>>2],(0|(v=0|n[v+4>>2]))>0|!(0|v)&w>>>0>0){N=0,j=0;e:for(;;){if(L=1/(+(w>>>0)+4294967296*+(0|v)),R=+i[h>>3],_=+((v=0|Ze(0|w,0|v,0|N,0|j))>>>0)+4294967296*+(0|B()),I=+(N>>>0)+4294967296*+(0|j),i[l>>3]=L*(R*_)+L*(+i[m>>3]*I),i[g>>3]=L*(+i[d>>3]*_)+L*(+i[f>>3]*I),0|(v=0|JA(l,r,c))){x=v;break}C=0|At(0|(M=0|n[(Q=c)>>2]),0|(Q=0|n[Q+4>>2]),0|e,0|t),y=0|B(),w=0|n[(k=v=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))F=v,T=16;else for(D=0,E=0;;){if((0|D)>(0|t)|(0|D)==(0|t)&E>>>0>e>>>0){x=1;break e}if((0|w)==(0|M)&(0|k)==(0|Q))break t;if(C=0|$e(0|(v=0|Ve(0|C,0|y,1,0)),0|B(),0|e,0|t),y=0|B(),E=0|Ve(0|E,0|D,1,0),D=0|B(),!(0|(w=0|n[(k=v=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){F=v,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|M)&!(0|Q))||(n[(E=F)>>2]=M,n[E+4>>2]=Q,E=o+(n[a>>2]<<3)|0,n[E>>2]=M,n[E+4>>2]=Q,E=0|Ve(0|n[(E=a)>>2],0|n[E+4>>2],1,0),M=0|B(),n[(Q=a)>>2]=E,n[Q+4>>2]=M),N=0|Ve(0|N,0|j,1,0),j=0|B(),w=0|n[(v=b)>>2],!((0|(v=0|n[v+4>>2]))>(0|j)|(0|v)==(0|j)&w>>>0>N>>>0)){w=1;break A}}w=0}else w=1}while(0);if(S=S+1|0,!w){T=21;break}if((0|S)>=(0|(v=0|n[A>>2]))){x=0,T=21;break}}return 21==(0|T)?(P=p,0|x):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=+i[16+(A|=0)>>3])-(t=+i[A+24>>3]),+(r>3]<+i[A+24>>3]|0}function K(A){return+(+i[(A|=0)>>3]-+i[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+i[(e|=0)>>3])>=+i[A+8>>3]&&n<=+i[A>>3]?(t=+i[A+16>>3],n=+i[A+24>>3],e=(r=+i[e+8>>3])>=n,A=r<=t&1,t>3]<+i[e+8>>3]||+i[A+8>>3]>+i[e>>3]?0|(s=0):(n=(l=+i[A+16>>3])<(u=+i[(t=A+24|0)>>3]),c=(o=+i[(s=e+16|0)>>3])<(a=+i[(r=e+24|0)>>3]),e=u-o>3],e)||(u=+ae(+i[t>>3],A))>+ae(+i[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,a,o,s=0,l=0,c=0,u=0;return+i[(A|=0)>>3]<+i[e>>3]||+i[A+8>>3]>+i[e+8>>3]?0|(s=0):(n=(a=+i[(s=A+16|0)>>3])<(l=+i[A+24>>3]),c=(u=+i[(t=e+16|0)>>3])<(o=+i[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ae(+i[s>>3],A))>=+ae(+i[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,a,o,s,l=0;a=P,P=P+176|0,n[(r=a)>>2]=4,l=+i[e>>3],i[r+8>>3]=l,o=+i[e+16>>3],i[r+16>>3]=o,i[r+24>>3]=l,l=+i[e+24>>3],i[r+32>>3]=l,s=+i[e+8>>3],i[r+40>>3]=s,i[r+48>>3]=l,i[r+56>>3]=s,i[r+64>>3]=o,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),P=a}function eA(A,e,t){A|=0,e|=0,t|=0;var r,o,c,u,d,f,g,h=0,m=0,b=0,p=0,v=0,y=0,k=0;f=P,P=P+288|0,d=f+264|0,p=f+96|0,m=(h=b=f)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(P=f,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+oe(d,p+8|0),i[d>>3]=+i[A>>3],i[(m=d+8|0)>>3]=+i[A+16>>3],i[p>>3]=+i[A+8>>3],i[(b=p+8|0)>>3]=+i[A+24>>3],o=+oe(d,p),k=+i[m>>3]-+i[b>>3],c=+l(+k),g=+i[d>>3]-+i[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+it(+c,+r),k=+x(+o*o/+at(+k/+at(+c,+r),3)/(u*(2.59807621135*u)*.8)),i[a>>3]=k,v=~~k>>>0,y=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+x((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[a+4>>2])?(p=!(0|v)&!(0|y),n[(e=t)>>2]=p?1:v,n[e+4>>2]=p?0:y,e=0):e=1,P=f,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,c,u,d,f=0,g=0,h=0;d=P,P=P+288|0,c=d+264|0,u=d+96|0,o=(f=g=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|o));return 0|(t=0|Ae(t,g))?(P=d,0|(r=t)):(qA(f=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(f,t,u),h=+oe(c,u+8|0),h=+x(+ +oe(A,e)/(2*h)),i[a>>3]=h,t=~~h>>>0,f=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+x((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[a+4>>2]?(g=!(0|t)&!(0|f),n[r>>2]=g?1:t,n[r+4>>2]=g?0:f,P=d,0|(r=0)):(P=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,i=0,a=0,o=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[(o=A+8|0)>>2]=(0|n[o>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,a=(0|n[(o=A+8|0)>>2])-r|0,n[o>>2]=a,n[e>>2]=0,r=0):(o=a=A+8|0,a=0|n[a>>2]),(0|a)<0&&(t=t-a|0,n[A>>2]=t,r=r-a|0,n[e>>2]=r,n[o>>2]=0,a=0),(0|(i=(0|a)<(0|(i=(0|r)<(0|t)?r:t))?a:i))<=0||(n[A>>2]=t-i,n[e>>2]=r-i,n[o>>2]=a-i)}function iA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),i[e>>3]=+((0|n[A>>2])-r|0)-.5*t,i[e+8>>3]=.8660254037844386*t}function aA(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 oA(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|v(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|v(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|v(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,i=0,a=0,o=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(i=(0|(o=((e=(0|(a=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-a|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:o)-((a=(0|(i=(0|A)<(0|(i=(0|(r=(e?0:a)-(i?o:0)|0))<(0|(o=(s?0:t)-(e?a:0)-(i?o:0)|0))?r:o))?A:i))>0)?i:0)|0,r=r-(a?i:0)|0;A:do{switch(o-(a?i: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,i=0,a=0,o=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(o=2147483647-e|0,s=-2147483648-e|0,(a=(0|e)>0)?(0|o)<(0|e):(0|s)>(0|e))return 1;if(i=e<<1,a?(2147483647-i|0)<(0|e):(-2147483648-i|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,i=l<<1,(a?(0|o)<(0|i):(0|s)>(0|i))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else i=l<<1,r=3*e|0;return a=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=a,o=0|Oe(.14285714285714285*+(i+e|0)),n[c>>2]=o,n[t>>2]=0,r=(i=(0|o)<(0|a))?a:o,(0|(i=i?o:a))<0&&((-2147483648==(0|i)||((0|r)>0?(2147483647-r|0)<(0|i):(-2147483648-r|0)>(0|i)))&&D(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|i):(-2147483648^r)<(0|i))&&D(27795,26892,354,26903)),r=o-a|0,(0|a)<0?(i=0-a|0,n[c>>2]=r,n[t>>2]=i,n[A>>2]=0,a=0):(r=o,i=0),(0|r)<0&&(a=a-r|0,n[A>>2]=a,i=i-r|0,n[t>>2]=i,n[c>>2]=0,r=0),s=a-i|0,o=r-i|0,(0|i)<0?(n[A>>2]=s,n[c>>2]=o,n[t>>2]=0,r=o,o=s,i=0):o=a,(0|(a=(0|i)<(0|(a=(0|r)<(0|o)?r:o))?i:a))<=0||(n[A>>2]=o-a,n[c>>2]=r-a,n[t>>2]=i-a),0}function uA(A){var e,t=0,r=0,i=0,a=0,o=0,s=0,l=0;if(a=0|n[(e=8+(A|=0)|0)>>2],(o=(0|n[A>>2])-a|0)>>>0>715827881|(a=(0|n[(s=A+4|0)>>2])-a|0)>>>0>715827881){if((r=(0|o)>0)?(2147483647-o|0)<(0|o):(-2147483648-o|0)>(0|o))return 1;if(t=o<<1,(i=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(l=a<<1,i?(2147483647-l|0)<(0|a):(-2147483648-l|0)>(0|a))return 1;if(r?(2147483647-t|0)<(0|a):(-2147483648-t|0)>(0|a))return 1;if(r=3*a|0,(0|a)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))return 1}else r=3*a|0,t=o<<1;return i=0|Oe(.14285714285714285*+(t+a|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(r-o|0)),n[s>>2]=a,n[e>>2]=0,t=(r=(0|a)<(0|i))?i:a,(0|(r=r?a:i))<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=a-i|0,(0|i)<0?(r=0-i|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,i=0):(t=a,r=0),(0|t)<0&&(i=i-t|0,n[A>>2]=i,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),o=i-r|0,a=t-r|0,(0|r)<0?(n[A>>2]=o,n[s>>2]=a,n[e>>2]=0,t=a,a=o,r=0):a=i,(0|(i=(0|r)<(0|(i=(0|t)<(0|a)?t:a))?r:i))<=0||(n[A>>2]=a-i,n[s>>2]=t-i,n[e>>2]=r-i),0}function dA(A){var e,t,r=0,i=0,a=0,o=0,s=0;i=0|n[(e=8+(A|=0)|0)>>2],a=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-i|0)|0)-(i=(0|n[(t=A+4|0)>>2])-i|0)|0)),n[A>>2]=a,r=0|Oe(.14285714285714285*+((i<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,i=r-a|0,(0|a)<0?(s=0-a|0,n[t>>2]=i,n[e>>2]=s,n[A>>2]=0,r=i,a=0,i=s):i=0,(0|r)<0&&(a=a-r|0,n[A>>2]=a,i=i-r|0,n[e>>2]=i,n[t>>2]=0,r=0),s=a-i|0,o=r-i|0,(0|i)<0?(n[A>>2]=s,n[t>>2]=o,n[e>>2]=0,r=o,o=s,i=0):o=a,(0|(a=(0|i)<(0|(a=(0|r)<(0|o)?r:o))?i:a))<=0||(n[A>>2]=o-a,n[t>>2]=r-a,n[e>>2]=i-a)}function fA(A){var e,t,r=0,i=0,a=0,o=0,s=0;i=0|n[(e=8+(A|=0)|0)>>2],a=0|Oe(.14285714285714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,n[r>>2]=0,o=e,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|s)<(0|o)?s:o))?i:a))<=0||(n[A>>2]=o-a,n[t>>2]=s-a,n[r>>2]=i-a)}function pA(A){var e,t,r,i=0,a=0,o=0,s=0;i=0|n[(A|=0)>>2],o=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=o+i|0,n[A>>2]=s,o=a+o|0,n[t>>2]=o,i=a+i|0,n[r>>2]=i,a=o-s|0,(0|s)<0?(i=i-s|0,n[t>>2]=a,n[r>>2]=i,n[A>>2]=0,o=0):(a=o,o=s),(0|a)<0&&(o=o-a|0,n[A>>2]=o,i=i-a|0,n[r>>2]=i,n[t>>2]=0,a=0),e=o-i|0,s=a-i|0,(0|i)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,o=e,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|s)<(0|o)?s:o))?i:a))<=0||(n[A>>2]=o-a,n[t>>2]=s-a,n[r>>2]=i-a)}function xA(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 vA(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,i=0,a=0,o=0,s=0;i=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],o=0|n[(r=A+8|0)>>2],s=a+(i<<1)|0,n[A>>2]=s,a=o+(a<<1)|0,n[t>>2]=a,i=(o<<1)+i|0,n[r>>2]=i,o=a-s|0,(0|s)<0?(i=i-s|0,n[t>>2]=o,n[r>>2]=i,n[A>>2]=0,a=o,o=0):o=s,(0|a)<0&&(o=o-a|0,n[A>>2]=o,i=i-a|0,n[r>>2]=i,n[t>>2]=0,a=0),e=o-i|0,s=a-i|0,(0|i)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,o=e,i=0):s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]=0-(A+t)}function BA(A){var e,t,r=0,i=0,a=0,o=0,s=0;r=0-(i=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,o=(a=0|n[(t=A+4|0)>>2])+i|0,(0|i)>0?(n[t>>2]=o,n[e>>2]=i,n[A>>2]=0,r=0,a=o):i=0,(0|a)<0?(s=r-a|0,n[A>>2]=s,i=i-a|0,n[e>>2]=i,n[t>>2]=0,o=s-i|0,r=0-i|0,(0|i)<0?(n[A>>2]=o,n[t>>2]=r,n[e>>2]=0,a=r,i=0):(a=0,o=s)):o=r,(0|(r=(0|i)<(0|(r=(0|a)<(0|o)?a:o))?i:r))<=0||(n[A>>2]=o-r,n[t>>2]=a-r,n[e>>2]=i-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|IA(A,t)):0|(t=0)}function EA(A,e,t){t|=0;var r,i,a=0,o=0;return i=P,P=P+16|0,r=i,o=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(a=0|tt(0|(A|=0),0|e,56),B(),a=0|function(A,e,t){t|=0;var r,i=0,a=0;if(r=P,P=P+16|0,a=r,i=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return P=r,-1;if(1==(0|t)&(i=!!(0|i)))return P=r,-1;do{if(!(0|Se(A,e,a))){if(i){i=(5+(0|n[26352+(t<<2)>>2])-(0|n[a>>2])|0)%5|0;break}i=(6+(0|n[26384+(t<<2)>>2])-(0|n[a>>2])|0)%6|0;break}i=-1}while(0);return P=r,0|(a=i)}(A,o,7&a),-1==(0|a)?(n[t>>2]=0,P=i,0|(o=6)):(0|XA(A,o,r)&&D(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,o)?QA(r,e,a,2,t):SA(r,e,a,2,t),P=i,0|(o=0))):(P=i,0|(o=6))}function MA(A,e,t,r,a){e|=0,t|=0,r|=0,a|=0;var o,s=0,u=0;if(s=+function(A){var e,t;return t=+i[(A|=0)>>3],e=+i[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[a>>2]=n[e>>2],n[a+4>>2]=n[e+4>>2],n[a+8>>2]=n[e+8>>2],void(n[a+12>>2]=n[e+12>>2]);if(u=+p(+ +i[A+8>>3],+ +i[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}o=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?o:.37796447300922725*o))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var a=0,o=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]);o=e<0?e+6.283185307179586:e,o=e>=6.283185307179586?o+-6.283185307179586:o;do{if(!(o<1e-16)){if(a=+l(+(o+-3.141592653589793))<1e-16,e=+i[A>>3],a){e-=t,i[r>>3]=e,a=r;break}if(s=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+o)*(t*+d(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),i[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return i[r>>3]=1.5707963267948966,void(i[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return i[r>>3]=-1.5707963267948966,void(i[r+8>>3]=0);if(c=1/+d(+e),o=t*+f(+o)*c,t=+i[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+t)),s=o>1?1:o,e=e>1?1:e,(e=+i[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(i[r+8>>3]=e)}e=+i[A>>3]+t,i[r>>3]=e,a=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return i[a>>3]=1.5707963267948966,void(i[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return i[a>>3]=-1.5707963267948966,void(i[r+8>>3]=0);if((e=+i[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);i[r+8>>3]=e}(15600+(e<<4)|0,+ne(+i[15920+(24*e|0)>>3]-u),s,a)}function QA(A,e,t,r,a){A|=0,e|=0,t|=0,r|=0,a|=0;var o,s,l,c,u,d,f,g,h,m,b,p,x,v,w,y,k,C,B,E,M,Q,N=0,j=0,S=0,F=0,T=0,I=0;if(Q=P,P=P+272|0,F=Q+240|0,B=Q,E=Q+224|0,M=Q+208|0,b=Q+176|0,p=Q+160|0,x=Q+192|0,v=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[F>>2]=n[A>>2],n[F+4>>2]=n[A+4>>2],n[F+8>>2]=n[A+8>>2],n[F+12>>2]=n[A+12>>2],NA(F,N,B),n[a>>2]=0,(0|(F=r+t+(5==(0|r)&1)|0))<=(0|t))P=Q;else{s=E+4|0,l=b+4|0,c=t+5|0,u=16880+((o=0|n[N>>2])<<2)|0,d=16960+(o<<2)|0,f=w+8|0,g=y+8|0,h=k+8|0,m=M+4|0,S=t;A:for(;;){j=B+((0|S)%5<<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];do{}while(2==(0|jA(M,o,0,1)));if((0|S)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[M>>2],n[b+4>>2]=n[M+4>>2],n[b+8>>2]=n[M+8>>2],n[b+12>>2]=n[M+12>>2],iA(s,p),r=0|n[b>>2],N=0|n[17040+(80*r|0)+(n[E>>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[x>>2]=n[j>>2],n[x+4>>2]=n[j+4>>2],n[x+8>>2]=n[j+8>>2],sA(x,3*(0|n[u>>2])|0),aA(l,x,l),nA(l),iA(l,v),T=+(0|n[d>>2]),i[w>>3]=3*T,i[f>>3]=0,I=-1.5*T,i[y>>3]=I,i[g>>3]=2.598076211353316*T,i[k>>3]=I,i[h>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[b>>2])|0)+(n[M>>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,v,r,A,C),MA(C,0|n[b>>2],o,1,a+8+(n[a>>2]<<4)|0),n[a>>2]=1+(0|n[a>>2])}if((0|S)<(0|c)&&(iA(m,b),MA(b,0|n[M>>2],o,1,a+8+(n[a>>2]<<4)|0),n[a>>2]=1+(0|n[a>>2])),n[E>>2]=n[M>>2],n[E+4>>2]=n[M+4>>2],n[E+8>>2]=n[M+8>>2],n[E+12>>2]=n[M+12>>2],(0|(S=S+1|0))>=(0|F)){A=3;break}}3!=(0|A)?12==(0|A)&&D(26970,27017,572,27027):P=Q}}function NA(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,o=0,s=0,l=0;r=P,P=P+128|0,a=r,s=20240,l=60+(o=i=r+64|0)|0;do{n[o>>2]=n[s>>2],o=o+4|0,s=s+4|0}while((0|o)<(0|l));s=20304,l=(o=a)+60|0;do{n[o>>2]=n[s>>2],o=o+4|0,s=s+4|0}while((0|o)<(0|l));i=(l=!(0|ZA(0|n[e>>2])))?i:a,wA(a=A+4|0),yA(a),0|ZA(0|n[e>>2])&&(hA(a),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],aA(a,i,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],aA(a,i+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],aA(a,i+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],aA(a,i+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],aA(a,i+48|0,t=t+68|0),nA(t),P=r}function jA(A,e,t,r){t|=0,r|=0;var i,a,o,s,l,c,u=0,d=0,f=0,g=0,h=0;if(c=P,P=P+32|0,l=c+12|0,a=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],i=0|n[(o=A+8|0)>>2],s){if((0|(u=i+u+(r=0|n[(d=A+12|0)>>2])|0))==(0|g))return P=c,1;f=d}else u=i+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|g))return P=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|i)>0){d=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),oA(h,l,a),pA(a),aA(a,l,h),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(h),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),aA(h,l,h),nA(h),r=s&&((0|n[o>>2])+(0|n[h>>2])+(0|n[f>>2])|0)==(0|g)?1:2,P=c,0|r}function PA(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 SA(A,e,t,r,a){A|=0,e|=0,t|=0,r|=0,a|=0;var o,s,l,c,u,d,f,g,h,m,b,p,x,v,w,y,k,C,B=0,E=0,M=0,Q=0,N=0;if(C=P,P=P+240|0,v=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,x=C+96|0,n[(B=C+224|0)>>2]=e,n[v>>2]=n[A>>2],n[v+4>>2]=n[A+4>>2],n[v+8>>2]=n[A+8>>2],n[v+12>>2]=n[A+12>>2],FA(v,B,w),n[a>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))P=C;else{s=t+6|0,l=16960+((o=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=y+4|0,E=0,M=t,r=-1;A:for(;;){if(A=w+((B=(0|M)%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=E,E=0|jA(y,o,0,1),(0|M)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(iA(w+((B+5|0)%6<<4)+4|0,k),iA(w+(B<<4)+4|0,h),Q=+(0|n[l>>2]),i[m>>3]=3*Q,i[c>>3]=0,N=-1.5*Q,i[b>>3]=N,i[u>>3]=2.598076211353316*Q,i[p>>3]=N,i[d>>3]=-2.598076211353316*Q,B=0|n[v>>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,x),0|je(k,x)||0|je(h,x)||(MA(x,0|n[v>>2],o,1,a+8+(n[a>>2]<<4)|0),n[a>>2]=1+(0|n[a>>2]))}if((0|M)<(0|s)&&(iA(f,k),MA(k,0|n[y>>2],o,1,a+8+(n[a>>2]<<4)|0),n[a>>2]=1+(0|n[a>>2])),(0|(M=M+1|0))>=(0|g)){A=3;break}r=0|n[y>>2]}3!=(0|A)?8==(0|A)&&D(27054,27017,737,27099):P=C}}function FA(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,o=0,s=0,l=0;r=P,P=P+160|0,a=r,s=20368,l=72+(o=i=r+80|0)|0;do{n[o>>2]=n[s>>2],o=o+4|0,s=s+4|0}while((0|o)<(0|l));s=20448,l=(o=a)+72|0;do{n[o>>2]=n[s>>2],o=o+4|0,s=s+4|0}while((0|o)<(0|l));i=(l=!(0|ZA(0|n[e>>2])))?i:a,wA(a=A+4|0),yA(a),0|ZA(0|n[e>>2])&&(hA(a),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],aA(a,i,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],aA(a,i+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],aA(a,i+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],aA(a,i+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],aA(a,i+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],aA(a,i+60|0,t=t+84|0),nA(t),P=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function IA(A,e){A|=0;var t=0,n=0,i=0,a=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&(a=0|rt(0|(i=0|tt(0|A,0|e,0|(a=3*(15^n)|0))),0|B(),0|a))&Ze(-1227133514,-1171,0|a,0|(i=0|B())))&!(4681&i&B())&&15==(0|n)|!(0|(a=0|tt(0|rt(0|~A,0|~e,0|(a=19+(3*n|0)|0)),0|B(),0|a)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(a=1):(a=0|nt(0|A,0|e),B(),0|!!((63-a|0)%3|0)):0|(a=1):0|(a=0)):0|(A=0)}function LA(A,e,t,r){A|=0,t|=0,r|=0;var i=0,a=0,o=0,s=0;if(i=0|rt(0|(e|=0),0,52),a=0|B(),t=0|rt(0|t,0,45),t=0|a|B()|134225919,(0|e)<1)return a=-1,r=t,n[(e=A)>>2]=a,void(n[(A=A+4|0)>>2]=r);for(a=1,i=-1;s=0|rt(7,0,0|(o=3*(15-a|0)|0)),t&=~B(),i=i&~s|(o=0|rt(0|r,0,0|o)),t=0|t|B(),(0|a)!=(0|e);)a=a+1|0;n[(o=s=A)>>2]=i,n[(s=s+4|0)>>2]=t}function _A(A,e,t,r){t|=0,r|=0;var i=0,a=0;if(a=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(a&=15))<(0|t))return 12;if((0|a)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(i=0|rt(0|t,0,52),i|=A,A=B()|-15728641&e,(0|a)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,i|=e,A=0|B()|A}while((0|t)<(0|a));return n[r>>2]=i,n[r+4>>2]=A,0}function RA(A,e,t,r){t|=0,r|=0;var i=0,a=0,o=0;if(a=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(a&=15))<=(0|t)))return 4;i=t-a|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|z(127&t)){e:do{if(0|a){for(t=1;!((o=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,i,((0|i)<0)<<31>>31),i=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,i,((0|i)<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),i=0|B()}else t=0|pe(7,0,i,((0|i)<0)<<31>>31),i=0|B()}while(0);return n[(o=r)>>2]=t,n[o+4>>2]=i,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 i=0;return i=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(i&=15))<=(0|t)?((0|i)<(0|t)&&(i=0|rt(-1,-1,3+(3*(t+-1-i|0)|0)|0),i=0|rt(0|~i,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~i),i=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|i,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,i=0,a=0,o=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(o=e)),0|s;for(o=1,t=0;;){r=0|rt(7,0,0|(i=3*(15-o|0)|0)),n=0|B(),a=0|tt(0|A,0|e,0|i),B(),A=(i=0|rt(0|xA(7&a),0,0|i))|A&~r,e=(a=0|B())|e&~n;A:do{if(!t)if(!(i&r|0)&!(a&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&a){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|(a=3*(15-t|0)|0)),B(),i=0|rt(7,0,0|a),e&=~B(),A=A&~i|(a=0|rt(0|xA(7&n),0,0|a)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(o>>>0>>0))break;o=o+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,i=0,a=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;a=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|i),e&=~B(),A=(i=0|rt(0|xA(7&a),0,0|i))|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,i=0,a=0,o=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(o=e)),0|s;for(o=1,t=0;;){r=0|rt(7,0,0|(i=3*(15-o|0)|0)),n=0|B(),a=0|tt(0|A,0|e,0|i),B(),A=(i=0|rt(0|vA(7&a),0,0|i))|A&~r,e=(a=0|B())|e&~n;A:do{if(!t)if(!(i&r|0)&!(a&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&a){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(i=0|rt(7,0,0|(n=3*(15-t|0)|0)),a=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~i|(e=0|rt(0|vA(7&e),0,0|n)),e=0|a|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(o>>>0>>0))break;o=o+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,i=0,a=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|rt(7,0,0|(a=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|a),B(),A=(e=0|rt(0|vA(7&e),0,0|a))|A&~i,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 JA(A,e,t){t|=0;var r,a=0;return r=P,P=P+16|0,a=r,(e|=0)>>>0>15?(P=r,0|(a=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,a;r=P,P=P+16|0,function(A,e,t,r){e|=0,r|=0;var a,o=0,s=0,l=0,c=0;if(a=P,P=P+16|0,function(A,e,t){e|=0,t|=0;var r,a,o=0;a=P,P=P+32|0,function(A,e){e|=0;var t,r,n=0;n=+i[(A|=0)>>3],t=+d(+n),n=+f(+n),i[e+16>>3]=n,n=+i[A+8>>3],r=t*+d(+n),i[e>>3]=r,n=t*+f(+n),i[e+8>>3]=n}(A|=0,r=a),n[e>>2]=0,i[t>>3]=5,(o=+Pe(16400,r))<+i[t>>3]&&(n[e>>2]=0,i[t>>3]=o),(o=+Pe(16424,r))<+i[t>>3]&&(n[e>>2]=1,i[t>>3]=o),(o=+Pe(16448,r))<+i[t>>3]&&(n[e>>2]=2,i[t>>3]=o),(o=+Pe(16472,r))<+i[t>>3]&&(n[e>>2]=3,i[t>>3]=o),(o=+Pe(16496,r))<+i[t>>3]&&(n[e>>2]=4,i[t>>3]=o),(o=+Pe(16520,r))<+i[t>>3]&&(n[e>>2]=5,i[t>>3]=o),(o=+Pe(16544,r))<+i[t>>3]&&(n[e>>2]=6,i[t>>3]=o),(o=+Pe(16568,r))<+i[t>>3]&&(n[e>>2]=7,i[t>>3]=o),(o=+Pe(16592,r))<+i[t>>3]&&(n[e>>2]=8,i[t>>3]=o),(o=+Pe(16616,r))<+i[t>>3]&&(n[e>>2]=9,i[t>>3]=o),(o=+Pe(16640,r))<+i[t>>3]&&(n[e>>2]=10,i[t>>3]=o),(o=+Pe(16664,r))<+i[t>>3]&&(n[e>>2]=11,i[t>>3]=o),(o=+Pe(16688,r))<+i[t>>3]&&(n[e>>2]=12,i[t>>3]=o),(o=+Pe(16712,r))<+i[t>>3]&&(n[e>>2]=13,i[t>>3]=o),(o=+Pe(16736,r))<+i[t>>3]&&(n[e>>2]=14,i[t>>3]=o),(o=+Pe(16760,r))<+i[t>>3]&&(n[e>>2]=15,i[t>>3]=o),(o=+Pe(16784,r))<+i[t>>3]&&(n[e>>2]=16,i[t>>3]=o),(o=+Pe(16808,r))<+i[t>>3]&&(n[e>>2]=17,i[t>>3]=o),(o=+Pe(16832,r))<+i[t>>3]&&(n[e>>2]=18,i[t>>3]=o),(o=+Pe(16856,r))<+i[t>>3]?(n[e>>2]=19,i[t>>3]=o,P=a):P=a}(A|=0,t|=0,c=a),(s=+h(+(1-.5*+i[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(P=a);if(c=0|n[t>>2],o=+ne((o=+i[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,a,o;return A|=0,a=+i[(e|=0)>>3],r=+d(+a),n=+i[e+8>>3]-+i[A+8>>3],o=r*+f(+n),t=+i[A>>3],+ +p(+o,+(+f(+a)*+d(+t)-+d(+n)*(r*+f(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(o+-.3334731722518321):o,o=2.618033988749896*+g(+s),(0|e)>0){A=0;do{o*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+d(+l)*o,i[r>>3]=s,l=+f(+l)*o,i[r+8>>3]=l,P=a}(A|=0,e|=0,t|=0,a=r),function(A,e){A|=0;var t,r,a,o,s=0,c=0,u=0,d=0,f=0,g=0,h=0;n[(o=8+(e|=0)|0)>>2]=0,r=+i[A>>3],d=+l(+r),a=+i[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+a)),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<(h=1-d)))+A|0,n[e+4>>2]=A,h<=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*(+((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,a<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[o>>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[o>>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[o>>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[o>>2]=u-c)}(a,t+4|0),P=r}(A,e,a),e=0|function(A,e){A|=0;var t,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0;if(t=P,P=P+64|0,l=t+40|0,i=t+24|0,a=t+12|0,o=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)),P=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),P=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[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],1&e?(dA(s),n[a>>2]=n[s>>2],n[a+4>>2]=n[s+4>>2],n[a+8>>2]=n[s+8>>2],gA(a)):(fA(s),n[a>>2]=n[s>>2],n[a+4>>2]=n[s+4>>2],n[a+8>>2]=n[s+8>>2],hA(a)),oA(i,a,o),nA(o),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(o),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|(i=0|O(l)),0,45),e|=A,A=B()|-1040385&r,o=0|U(l),!(0|z(i))){if((0|o)<=0)break;for(a=0;;){if(i=0|tt(0|e,0|A,52),B(),i&=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|xA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(a=a+1|0))==(0|o))break A}}a=0|tt(0|e,0|A,52),B(),a&=15;e:do{if(a){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(i,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|vA(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|xA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|o)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|o))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),P=t,0|u}(a,e),a=0|B(),n[t>>2]=e,n[t+4>>2]=a,!(0|e)&!(0|a)&&D(27795,27122,1050,27145),P=r,0|(a=0)):(P=r,0|(a=3))}function KA(A,e,t){var r,i=0,a=0,o=0;if(r=4+(t|=0)|0,a=0|tt(0|(A|=0),0|(e|=0),52),B(),a&=15,o=0|tt(0|A,0|e,45),B(),i=!(0|a),0|z(127&o)){if(i)return 1;i=1}else{if(i)return 0;i=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),o=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&o),t>>>0>>0;)t=t+1|0;return 0|i}function XA(A,e,t){t|=0;var r,i,a=0,o=0,s=0,l=0,c=0,u=0;if(i=P,P=P+16|0,r=i,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,P=i,5;A:do{if(0|z(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){a=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7&c){case 5:break e;case 0:break;default:a=e;break A}if(!(a>>>0>>0)){a=e;break A}a=a+1|0}for(o=1,a=e;l=0|rt(7,0,0|(e=3*(15-o|0)|0)),c=a&~B(),a=0|tt(0|A,0|a,0|e),B(),A=A&~l|(a=0|rt(0|vA(7&a),0,0|e)),a=0|c|B(),o>>>0>>0;)o=o+1|0}else a=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|KA(A,a,t)))return P=i,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|a,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(o=0|tt(0|A,0|a,3*(15-e|0)|0),B(),0|(o&=7)){a=o;break A}if(!(e>>>0>>0)){a=0;break}e=e+1|0}else a=0}while(0);a=4==(0|a)&1}else a=0;if(0|jA(t,s,a,0)){if(0|z(u))do{}while(0|jA(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 P=i,0}function qA(A,e,t){t|=0;var r,i,a=0;return i=P,P=P+16|0,0|(a=0|XA(A|=0,e|=0,r=i))?(P=i,0|a):(a=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,i;e|=0,t|=0,r=P,P=P+16|0,iA(4+(A|=0)|0,i=r),MA(i,0|n[A>>2],e,0,t),P=r}(r,15&a,t),P=i,0|(a=0))}function $A(A,e,t){t|=0;var r,n=0,i=0,a=0;if(r=P,P=P+16|0,0|(n=0|XA(A|=0,e|=0,a=r)))return P=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|z(127&n)),i=0|tt(0|A,0|e,52),B(),i&=15;A:do{if(!n){if(0|i)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(a,i,0,5,t),P=r,0}}while(0);return SA(a,i,0,6,t),P=r,0}function Ae(A,e){e|=0;var t=0,r=0,i=0,a=0,o=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),o=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=o,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,o=0;do{if(0|z(o)){for(rt(0|o,0,45),r=1,i=-1,a=0|s|B();i&=~(l=0|rt(7,0,3*(15-r|0)|0)),a&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=i,n[l+4>>2]=a,t=t+1|0}o=o+1|0}while(122!=(0|o));return 0}function ee(A,e,t,r){A|=0,r|=0;var i=0,a=0,o=0;i=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(i&=15))>(0|r)?(a=-1,e=-1,t=0,i=0):(e=0|zA(e,t,i+1|0,r),o=-15728641&B(),t=0|rt(0|r,0,52),a=i,e=(e=!(0|HA(t|=e,o=0|o|B())))?-1:r,i=o),n[(o=A)>>2]=t,n[o+4>>2]=i,n[A+8>>2]=a,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var i=0,a=0;return i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,n[(a=r+8|0)>>2]=i,!(0|A)&!(0|e)|(0|t)>15|(0|i)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[a>>2]=-1,void(n[r+12>>2]=-1)):(A=0|zA(A,e,i+1|0,t),a=-15728641&B(),i=0|rt(0|t,0,52),i|=A,a=0|a|B(),n[(A=r)>>2]=i,n[A+4>>2]=a,A=r+12|0,0|HA(i,a)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(i=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(i&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|i)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,o=i;;){if((0|o)==(0|s)){i=5;break}if(c=(0|o)==(0|n[e>>2]),i=0|tt(0|t,0|r,0|(a=3*(15-o|0)|0)),B(),c&1==(0|(i&=7))&!0){i=7;break}if(!(7==(0|i)&!0)){i=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|a)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|o)>(0|s))){i=10;break}o=o+-1|0}if(5==(0|i))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|i))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|a)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=o+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function ie(A,e){return e|=0,+l(+(+i[(A|=0)>>3]-+i[e>>3]))<17453292519943298e-27?0|(e=+l(+(+i[A+8>>3]-+i[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ae(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 oe(A,e){A|=0;var t,r,n,a=0;return r=+i[(e|=0)>>3],t=+i[A>>3],a=(n=+f(.5*(r-t)))*n+(a=+f(.5*(+i[e+8>>3]-+i[A+8>>3])))*(+d(+r)*+d(+t)*a),2*+p(+ +c(+a),+ +c(+(1-a)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(i[e>>3]=+i[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,a,o,s=0,l=0,u=0,h=0,m=0,x=0;return x=+i[(e|=0)>>3],a=+i[A>>3],m=+f(.5*(x-a)),u=+i[e+8>>3],n=+i[A+8>>3],h=+f(.5*(u-n)),r=+d(+a),o=+d(+x),h=2*+p(+ +c(+(h=m*m+h*(o*r*h))),+ +c(+(1-h))),m=+i[t>>3],x=+f(.5*(m-x)),s=+i[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=x*x+u*(o*l*u))),+ +c(+(1-u))),m=+f(.5*(a-m)),s=+f(.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,a,o,s=0,l=0;if(o=P,P=P+192|0,a=o,0|(l=0|qA(A|=0,e|=0,r=o+168|0)))return P=o,0|l;if(0|$A(A,e,a)&&D(27795,27190,415,27199),(0|(e=0|n[a>>2]))>0){if(s=+ce(a+8|0,a+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(a+8+((l=A)<<4)|0,a+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return i[t>>3]=s,P=o,0}function de(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 fe(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,i=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{i=t,t=0|n[t+16>>2],Ye(i)}while(0|t);i=e,e=0|n[e+8>>2],Ye(i)}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,a=0,o=0,s=0,l=0,c=0,u=0,d=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|J(e),r=+i[t>>3],a=e&(a=+i[t+8>>3])<0?a+6.283185307179586:a,!(A=0|n[A>>2]))return 0;if(e){e=0,u=a,t=A;A:for(;;){for(;s=+i[t>>3],a=+i[t+8>>3],d=0|n[(t=t+16|0)>>2],o=+i[(d=0|d?d:A)>>3],l=+i[d+8>>3],s>o?(c=s,s=l):(c=o,o=s,s=a,a=l),(r=r==o|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-o)/(c-o)*((s=a<0?a+6.283185307179586:a)-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=a,t=A;A:for(;;){for(;s=+i[t>>3],a=+i[t+8>>3],d=0|n[(t=t+16|0)>>2],o=+i[(d=0|d?d:A)>>3],l=+i[d+8>>3],s>o?(c=s,s=l):(c=o,o=s,s=a,a=l),(r=r==o|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-o)/(c-o)*(a-s)>(u=s==u|a==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,i,a){t|=0,i|=0,a|=0;var o,s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(c=P,P=P+32|0,v=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|i,52),B(),(0|u)!=(15&b))return P=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|i,45),B(),h>>>0>121|(m&=127)>>>0>121)return P=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(f=0|V(h,m))))return P=c,1;7==(0|(g=0|V(m,h)))?D(27514,27538,161,27548):(p=f,d=g)}else p=0,d=0;o=0|z(h),s=0|z(m),n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(f){h=0,g=t,f=i;do{g=0|WA(g,f),f=0|B(),1==(0|(d=0|vA(d)))&&(d=0|vA(1)),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=i;else if(f){h=0,g=t,f=i;do{g=0|VA(g,f),f=0|B(),d=0|vA(d),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=i;if(KA(h,g,v),b||D(27563,27538,191,27548),(f=!!(0|o))&(d=!!(0|s))&&D(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}h=g=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(d<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){f=v+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(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))}aA(x=v+4|0,l,x),nA(x),x=51}}else if(KA(t,i,v),!!(0|o)&!!(0|s))if((0|m)!=(0|h)&&D(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,i))))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=v+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));x=51}else x=51;else x=51}while(0);return 51==(0|x)&&(u=v+4|0,n[a>>2]=n[u>>2],n[a+4>>2]=n[u+4>>2],n[a+8>>2]=n[u+8>>2],u=0),P=c,0|u}function be(A,e,t,r){t|=0,r|=0;var i,a,o,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(o=P,P=P+48|0,i=o+36|0,c=o+24|0,u=o+12|0,d=o,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 P=o,5;if(a=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)))?(P=o,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,P=o,0|(b=0));for(n[i>>2]=n[t>>2],n[i+4>>2]=n[t+4>>2],n[i+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[i>>2],n[c+4>>2]=n[i+4>>2],n[c+8>>2]=n[i+8>>2],0|ZA(l)){if(0|(s=0|cA(i))){t=13;break}n[u>>2]=n[i>>2],n[u+4>>2]=n[i+4>>2],n[u+8>>2]=n[i+8>>2],gA(u)}else{if(0|(s=0|uA(i))){t=13;break}n[u>>2]=n[i>>2],n[u+4>>2]=n[i+4>>2],n[u+8>>2]=n[i+8>>2],hA(u)}if(oA(c,u,d),nA(d),x=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(v=3*(15-l|0)|0)),s&=~B(),v=0|rt(0|lA(d),0,0|v),s=0|B()|s,n[(b=r)>>2]=v|x&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[i>>2])<=1&&(0|n[i+4>>2])<=1&&(0|n[i+8>>2])<=1){d=127==(0|(s=0|W(g,t=0|lA(i))))?0:0|z(s);e:do{if(t){if(a){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|xA(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,f=s)}else m=s,h=0,f=t;if((0|(u=0|n[4272+(28*g|0)+(f<<2)>>2]))<=-1&&D(27724,27538,419,27678),!d){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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=l,n[v+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|a)&!!(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[(v=r)>>2]=c,n[v+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[(v=r)>>2],0|n[v+4>>2]))){s=9;break}p=0|n[(v=r)>>2],v=-1040385&n[v+4>>2],x=0|rt(0|s,0,45),v=0|v|B(),n[(s=r)>>2]=p|x,n[s+4>>2]=v,s=0}else s=1}while(0);return P=o,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,i=0,a=0;if(!(0|(t|=0))&!(0|(r|=0)))return i=1,C(0|(n=0)),0|i;i=A,n=e,A=1,e=0;do{A=0|qe(0|((a=!0&!(1&t))?1:i),0|(a?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),i=0|qe(0|i,0|n,0|i,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function xe(A,e,t,r){t|=0,r|=0;var a,o=0,s=0,l=0,c=0,u=0,f=0;a=P,P=P+16|0,s=a,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(o=0|qA(A,e,s))){u=+i[s>>3],c=1/+d(+u),f=+i[25968+(l<<3)>>3],i[t>>3]=u+f,i[t+8>>3]=u-f,u=+i[s+8>>3],c*=f,i[t+16>>3]=c+u,i[t+24>>3]=u-c;break}return P=a,0|o}if(o=0|tt(0|A,0|e,45),B(),(o&=127)>>>0>121)return P=a,5;s=22064+(o<<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,a,o,s,l,c=0,u=0;c=(a=+i[(n=16+(A|=0)|0)>>3])-(r=+i[(t=A+24|0)>>3]),c=a>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+i[(o=A+8|0)>>3]))*e-l),i[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,i[o>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=a+c)>3.141592653589793?e+-6.283185307179586:e,i[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,i[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)&&(i[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(i[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+i[t>>3]&&-1.5707963267948966!=+i[t+8>>3]?(P=a,0|(l=0)):(i[t+16>>3]=3.141592653589793,i[t+24>>3]=-3.141592653589793,P=a,0|(l=0))}function ve(A){var e,t,i,a,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;if(a=P,P=P+336|0,e=a+168|0,t=a,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))P=a;else{if(0|r[0|(o=A+28|0)]?(s=0|we(s,l),l=0|B()):r[0|o]=1,!(0|n[n[(i=A+20|0)>>2]>>2]))return 0|(s=0|n[(o=A+24|0)>>2])&&Ye(s),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[i>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[o>>2]=0,void(P=a);c=15&(o=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{x=A+12|0,b=3==(0|c),m=255&o,g=3==(1|c),p=A+24|0,h=(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[x>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){v=15;break e}if(0|De(0|n[i>>2],0|n[p>>2],e)){v=19;break e}}if(g&&(c=0|n[4+(0|n[i>>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|JA(0|n[4+(0|n[i>>2])>>2],u,t)){v=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){v=29;break}}if(h){if(0|(c=0|$A(s,l,e))){v=32;break}if(0|xe(s,l,t,0)){v=36;break}if(d&&0|Ee(0|n[i>>2],0|n[p>>2],e,t)){v=42;break}if(g&&0|Qe(0|n[i>>2],0|n[p>>2],e,t)){v=42;break}}if(b){if(o=0|xe(s,l,e,1),c=0|n[p>>2],0|o){v=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){v=53;break}if(0|De(0|n[i>>2],0|n[p>>2],f)){v=53;break}if(0|Qe(0|n[i>>2],0|n[p>>2],t,e)){v=53;break}}}}do{if((0|u)<(0|n[x>>2])){if(o=0|xe(s,l,e,1),c=0|n[p>>2],0|o){v=58;break e}if(!(0|q(c,e))){v=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|Ee(0|n[i>>2],0|n[p>>2],t,e))){v=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){v=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else v=73}while(0);if(73==(0|v)&&(v=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|v){case 15:0|(o=0|n[p>>2])&&Ye(o),n[(v=A)>>2]=0,n[v+4>>2]=0,n[i>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,v=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,v=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(P=a);case 32:return 0|(o=0|n[p>>2])&&Ye(o),n[(w=A)>>2]=0,n[w+4>>2]=0,n[i>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(P=a);case 36:D(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[i>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=o,v=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,v=55;break;case 58:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[i>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=o,v=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,v=71;break;case 67:return 0|(o=0|n[p>>2])&&Ye(o),n[(w=A)>>2]=0,n[w+4>>2]=0,n[i>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(P=a)}if(20==(0|v))return void(P=a);if(55==(0|v))return void(P=a);if(71==(0|v))return void(P=a)}}while(0);0|(o=0|n[w>>2])&&Ye(o),n[(v=A)>>2]=0,n[v+4>>2]=0,n[A+8>>2]=0,n[i>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[w>>2]=0,P=a}}function we(A,e){var t,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,d=0;t=P,P=P+16|0,d=t,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,r=0|tt(0|A,0|e,45),B();do{if(i){for(;r=0|rt(i+4095|0,0,52),a=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(o=3*(15-i|0)|0))),a|=l=0|B(),c=0|tt(0|A,0|e,0|o),B(),i=i+-1|0,!((c&=7)>>>0<6);){if(!i){u=4;break}e=a,A=r}if(4==(0|u)){r=0|tt(0|r,0|a,45),B();break}return d=0|rt(((d=!(0|c)&!!(0|HA(r,a)))?2:1)+c|0,0,0|o),u=0|B()|e&~l,d|=A&~s,C(0|u),P=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),P=t,0|d):(LA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),P=t,0|d)}function ye(A,e,t){A|=0;var r,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|J(e),a=+i[t>>3],o=e&(o=+i[t+8>>3])<0?o+6.283185307179586:o,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,f=o,t=-1,A=0;A:for(;;){for(d=A;l=+i[r+(d<<4)>>3],o=+i[r+(d<<4)+8>>3],s=+i[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+i[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=o,o=c),(a=a==s|a==u?a+2220446049250313e-31:a)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(a-s)/(u-s)*((l=o<0?o+6.283185307179586:o)-c))<0?u+6.283185307179586:u)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=o,t=-1,A=0;A:for(;;){for(d=A;l=+i[r+(d<<4)>>3],o=+i[r+(d<<4)+8>>3],s=+i[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+i[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=o,o=c),(a=a==s|a==u?a+2220446049250313e-31:a)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(l+(a-s)/(u-s)*(o-l)>(f=l==f|o==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,a,o,s,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=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(i[(a=e+8|0)>>3]=17976931348623157e292,i[(o=e+24|0)>>3]=17976931348623157e292,i[e>>3]=-17976931348623157e292,i[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,x=0,A=-1,f=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,v=0;c=+i[t+(v<<4)>>3],h=+i[t+(v<<4)+8>>3],d=+i[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=c),h>3]=h,g=h),c>m?i[e>>3]=c:c=m,h>u&&(i[s>>3]=h,u=h),b=h>0&hp?h:p,x|=+l(+(h-d))>3.141592653589793,(0|(A=v+1|0))!=(0|r);)w=v,m=c,v=A,A=w;x&&(i[s>>3]=p,i[o>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,a=0,o=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,D=0;if(p=0|n[(A|=0)>>2]){if(i[(x=e+8|0)>>3]=17976931348623157e292,i[(v=e+24|0)>>3]=17976931348623157e292,i[e>>3]=-17976931348623157e292,i[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(o=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,r=-1,d=17976931348623157e292,f=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,y=0;s=+i[o+(y<<4)>>3],g=+i[o+(y<<4)+8>>3],u=+i[o+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,d=s),g>3]=g,f=g),s>h?i[e>>3]=s:s=h,g>c&&(i[w>>3]=g,c=g),m=g>0&gb?g:b,a|=+l(+(g-u))>3.141592653589793,(0|(r=y+1|0))!=(0|p);)B=y,h=s,y=r,r=B;a&&(i[w>>3]=b,i[v>>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(o=0|n[t>>2],a=C,v=e+((C=C+1|0)<<5)|0,w=0|n[o+(a<<3)>>2]){if(i[(y=e+(C<<5)+8|0)>>3]=17976931348623157e292,i[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,i[v>>3]=-17976931348623157e292,i[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[o+(a<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,o=0,a=-1,x=0,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+i[p+(x<<4)>>3],h=+i[p+(x<<4)+8>>3],u=+i[p+(((0|(a=a+2|0))==(0|w)?0:a)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?i[v>>3]=s:s=g,h>c&&(i[k>>3]=h,c=h),m=h>0&hb?h:b,o|=+l(+(h-u))>3.141592653589793,(0|(a=x+1|0))!=(0|w);)D=x,x=a,g=s,a=D;o&&(i[k>>3]=b,i[A>>3]=m)}}else n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0,n[v+16>>2]=0,n[v+20>>2]=0,n[v+24>>2]=0,n[v+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function De(A,e,t){var r=0,i=0,a=0;if(!(0|ye(A|=0,e|=0,t|=0)))return 0;if((0|n[(i=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(a=A,A=A+1|0,0|ye((0|n[r>>2])+(a<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[i>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function Ee(A,e,t,r){r|=0;var i,a,o=0,s=0,l=0,c=0,u=0;if(a=P,P=P+16|0,i=a,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return P=a,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,o=0;;){if(u=o,o=o+1|0,0|ye((0|n[s>>2])+(u<<3)|0,e+(o<<5)|0,l)){o=0;break}if((0|o)>=(0|n[c>>2]))break A}return P=a,0|o}}while(0);if(0|Me(A,e,t,r))return P=a,0;n[i>>2]=n[t>>2],n[i+4>>2]=l,o=0|n[c>>2];A:do{if((0|o)>0)for(A=A+12|0,l=0,s=o;;){if(o=0|n[A>>2],(0|n[o+(l<<3)>>2])>0){if(0|ye(i,r,0|n[o+(l<<3)+4>>2])){o=0;break A}if(o=l+1|0,0|Me((0|n[A>>2])+(l<<3)|0,e+(o<<5)|0,t,r)){o=0;break A}s=0|n[c>>2]}else o=l+1|0;if(!((0|o)<(0|s))){o=1;break}l=o}else o=1}while(0);return P=a,0|o}function Me(A,e,t,r){A|=0,t|=0;var a,o,s,l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,D=0;if(u=P,P=P+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return P=u,0;if(function(A,e,t,r){var a,o,s,l,c;e|=0,t|=0,r|=0,A=(o=+i[16+(A|=0)>>3])<(c=+i[A+24>>3]),a=(l=+i[e+16>>3])<(s=+i[e+24>>3]),e=c-l>2]=A?a|e?1:2:0,n[r>>2]=a?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=+ae(+i[(B=c+8+(e<<4)+8|0)>>3],0|n[d>>2]),i[B>>3]=y,e=e+1|0}while((0|e)<(0|n[t>>2]))}o=+i[r>>3],s=+i[r+8>>3],y=+ae(+i[r+16>>3],0|n[d>>2]),a=+ae(+i[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],v=+i[e+(t<<4)>>3],w=+ae(+i[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=+i[e+(B<<4)>>3],g=+ae(+i[e+(B<<4)+8>>3],0|n[l>>2]),!(v>=o)|!(f>=o)&&!(v<=s)|!(f<=s)&&!(w<=a)|!(g<=a)&&!(w>=y)|!(g>=y)){x=f-v,b=g-w,e=0;do{if(D=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+i[c+8+(D<<4)+8>>3],g=+i[c+8+(B<<4)+8>>3]-f,h=+i[c+8+(D<<4)>>3],!(0==(p=x*g-b*(m=+i[c+8+(B<<4)>>3]-h))||(k=w-f,C=v-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(x*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 P=u,0|e}function Qe(A,e,t,r){var i=0,a=0,o=0;if(0|Me(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(a=A+8|0)>>2])<=0)return 0;for(i=A+12|0,A=0;;){if(o=A,A=A+1|0,0|Me((0|n[i>>2])+(o<<3)|0,e+(A<<5)|0,t,r)){A=1,i=6;break}if((0|A)>=(0|n[a>>2])){A=0,i=6;break}}return 6==(0|i)?0|A:0}function Ne(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var a,o,s,l,c,u,d,f=0;l=+i[(A|=0)>>3],s=+i[e>>3]-l,o=+i[A+8>>3],a=+i[e+8>>3]-o,u=+i[t>>3],f=((f=+i[r>>3]-u)*(o-(d=+i[t+8>>3]))-(l-u)*(c=+i[r+8>>3]-d))/(s*c-a*f),i[n>>3]=l+s*f,i[n+8>>3]=o+a*f}function je(A,e){return e|=0,+l(+(+i[(A|=0)>>3]-+i[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+i[A+8>>3]-+i[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Pe(A,e){var t,r,n;return e|=0,+((n=+i[(A|=0)>>3]-+i[e>>3])*n+(r=+i[A+8>>3]-+i[e+8>>3])*r+(t=+i[A+16>>3]-+i[e+16>>3])*t)}function Se(A,e,t){t|=0;var r,i,a,o,s=0,l=0,c=0,u=0;if(o=P,P=P+32|0,u=o,0|(s=0|XA(A|=0,e|=0,i=o+16|0)))return P=o,0|s;r=0|TA(A,e),a=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[i>>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[i>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[i>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|a)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|a)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,P=o,0}function Fe(A,e,t,r){t|=0,r|=0;var i,a,o,s,l,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(l=P,P=P+32|0,v=l+24|0,s=l+20|0,o=l+8|0,a=l+16|0,i=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 P=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 P=l,1;if(0|Se(A,e,v))return P=l,1;if(u=(0|n[v>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return P=l,1;n[s>>2]=0,c=0|L(A,e,p,s,o);do{if(!c){if(h=0|n[(f=o)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&h>>>0>>0)?h:A,d=d?f:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|f)<0&&D(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|f)&&D(27795,27797,248,27822),0|Se(A,e,v)&&D(27795,27797,248,27822),c=(0|n[v>>2])+f|0,7==(0|(f=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&D(27795,27797,248,27822),n[a>>2]=0,0|(c=0|L(A,e,f,a,i)))break;g=0|n[(h=i)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|d)&g>>>0>>0){if(u=0|HA(g,h)?0|R(g,h,A,e):0|n[26800+(((0|n[a>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,d=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,d=h;break}do{if(!(0|Se(g,h,v))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[v>>2])|0)%6|0;break}c=-1}while(0);u=g,d=h}else c=t}while(0);h=0|n[(f=o)>>2],f=0|n[f+4>>2]}if((0|u)==(0|h)&(0|d)==(0|f)){if(A=(g=!!(0|HA(h,f)))?0|R(h,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(x=!!(0|c))))do{if(!(0|Se(h,f,v))){if(x){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[v>>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=d,A=u;break A}}while(0);return P=l,0|c}}while(0);return x=0|rt(0|c,0,56),v=B()|-2130706433&e|536870912,n[r>>2]=x|A,n[r+4>>2]=v,P=l,0}function Te(A,e){A|=0;var t,r,i=0,a=0;return r=P,P=P+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|IA(A,i=-2130706433&e|134217728)?(a=0|tt(0|A,0|e,56),B(),i=(a=!(0|Fe(A,i,7&a,t)))&((0|n[(i=t)>>2])==(0|A)?(0|n[i+4>>2])==(0|e):0)&1,P=r,0|i):(P=r,0|(i=0))}function Ie(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 Le(A){var e,t,r,a=0,o=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(o=0|n[e>>2],a=0;;){if((0|a)>=(0|o))break A;if(s=0|n[A>>2],c=0|n[s+(a<<2)>>2])break;a=a+1|0}a=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+i[c>>3]+ +i[c+8>>3]))%+(0|o))>>>0<<2)|0,o=0|n[a>>2];e:do{if(0|o){if(s=c+32|0,(0|o)==(0|c))n[a>>2]=n[s>>2];else{if(!(a=0|n[(o=o+32|0)>>2]))break;for(;(0|a)!=(0|c);)if(!(a=0|n[(o=a+32|0)>>2]))break e;n[o>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function _e(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 Re(A,e){e|=0;var t=0,r=0,a=0,o=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+i[e>>3]+ +i[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;o=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(a=t;;){if((0|a)==(0|e)){a=8;break}if(!(t=0|n[a+32>>2])){t=1,a=10;break}r=a,a=t}if(8==(0|a)){n[r+32>>2]=n[o>>2];break}if(10==(0|a))return 0|t}else n[t>>2]=n[o>>2]}while(0);return Ye(e),n[(o=A+8|0)>>2]=(0|n[o>>2])-1,0}function He(A,e,t){A|=0,e|=0,t|=0;var r,a=0,o=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[(o=r+16|0)>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],n[o+12>>2]=n[t+12>>2],n[r+32>>2]=0,o=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+i[e>>3]+ +i[e+8>>3]))%+(0|n[A+4>>2]))>>>0,o=(0|n[A>>2])+(o<<2)|0,a=0|n[o>>2];do{if(a){for(;!(0|ie(a,e)&&0|ie(a+16|0,t));)if(o=0|n[a+32>>2],!(0|n[(a=0|o?o:a)+32>>2])){s=10;break}if(10==(0|s)){n[a+32>>2]=r;break}return Ye(r),0|a}n[o>>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,a=0;if(a=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+i[e>>3]+ +i[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(a=0|n[(0|n[A>>2])+(a<<2)>>2]))return 0;if(!t){for(A=a;;){if(0|ie(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=a;;){if(0|ie(A,e)&&0|ie(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))*(+i[e>>3]+ +i[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|ie(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,i=0,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;e=P,P=P+16|0,g=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 i=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(o=0|n[(a=i+8|0)>>2]))==(0|A)?n[6981]=f&~(1<>2]=A,n[r>>2]=o),y=t<<3,n[i+4>>2]=3|y,n[(y=i+y+4|0)>>2]=1|n[y>>2],P=e,0|a;if(u>>>0>(d=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(o=(t>>>=r)>>>2&4)|(A=(t>>>=o)>>>1&2)|(i=(t>>>=A)>>>1&1))+(t>>>i)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=o+8|0)>>2]))==(0|t)?(A=f&~(1<>2]=t,n[A>>2]=r,A=f),s=(y=i<<3)-u|0,n[o+4>>2]=3|u,n[4+(a=o+u|0)>>2]=1|s,n[o+y>>2]=s,0|d&&(i=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]=i,n[t+12>>2]=i,n[i+8>>2]=t,n[i+12>>2]=r),n[6983]=s,n[6986]=a,P=e,0|l;if(o=0|n[6982]){for(r=(o&0-o)-1|0,r=c=0|n[28228+(((i=(r>>>=a=r>>>12&16)>>>5&8)|a|(s=(r>>>=i)>>>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=(a=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=a?s:c;if((s=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])){r=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,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|a){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]=o&~(1<>2])==(0|l)?y:a+20)>>2]=r,!r)break;n[r+24>>2]=a,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&&(i=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]=i,n[t+12>>2]=i,n[i+8>>2]=t,n[i+12>>2]=r),n[6983]=c,n[6986]=s),P=e,0|l+8}f=u}else f=u}else f=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),i=0|n[6982]){a=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),o=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,a=0,b=65;break A}A=r,a=s}if(o=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?o:b,!r){r=o,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>>>=o)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=a)}if(65==(0|b))for(o=r;;){if(a=(r=(f=(-8&n[o+4>>2])-u|0)>>>0>>0)?f:a,A=r?o:A,(r=0|n[o+16>>2])||(r=0|n[o+20>>2]),!r){l=A,s=a;break}o=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(d=l+u|0)>>>0>l>>>0){o=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[(a=t+20|0)>>2])t=r,A=a;else{if(!(r=0|n[(a=t+16|0)>>2]))break;t=r,A=a}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(o){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){i&=~(1<>2])==(0|l)?y:o+20)>>2]=t,!t)break;n[t+24>>2]=o,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-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(y<<=v)|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,!(i&(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(i=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(i>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}i<<=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 P=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]),P=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return v=s-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=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=f+48|0,(u=(o=A+(c=f+47|0)|0)&(a=0-A|0))>>>0<=f>>>0)return P=e,0;if(0|(A=0|n[7091])&&(g=(d=0|n[7089])+u|0)>>>0<=d>>>0|g>>>0>A>>>0)return P=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(i=28372;!((g=0|n[i>>2])>>>0<=r>>>0&&(g+(0|n[i+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[i+8>>2])){b=128;break e}i=A}if((t=o-s&a)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[i>>2])+(0|n[i+4>>2])|0)){if(-1!=(0|A)){s=t,o=A,b=145;break A}}else i=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>f>>>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,o=r,b=145;break A}i=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|i))){if(-1==(0|i)){t=0;break}s=t,o=i,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,o=i,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,o=i,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(v=0|ut(0|u)))|1^(x=(p=(m=0|ut(0))-v|0)>>>0>(f+40|0)>>>0)|v>>>0>>0&-1!=(0|v)&-1!=(0|m)^1)&&(s=x?p:t,o=v,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|o)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(i=0|n[t+8>>2]))break;t=i}if(!(154!=(0|b)||(w=t+4|0,8&n[t+12>>2]))&&o>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(v=7&(v=c+8|0)?0-v&7:0)|0,v=(y=(0|n[6984])+s|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,n[c+y+4>>2]=40,n[6988]=n[7103];break}for(o>>>0<(0|n[6985])>>>0&&(n[6985]=o),r=o+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]=o,n[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=o+(7&(d=o+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,i=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}o=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(i=4+(r=t+16|0)|0)>>2])r=i;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(i=0|n[(a=A+20|0)>>2])A=i,r=a;else{if(!(i=0|n[(a=A+16|0)>>2]))break;A=i,r=a}n[r>>2]=0}else y=0|n[t+8>>2],n[y+12>>2]=A,n[A+8>>2]=y}while(0);if(!o)break;i=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[i>>2])==(0|t)){if(n[i>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?y:o+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=o,0|(i=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=i,n[i+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,a=s+l|0}else a=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|a,n[u+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]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=a>>>8;do{if(t){if(a>>>0>16777215){i=31;break}i=a>>>(7+(i=14-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(i=(245760+(y<<=v)|0)>>>16&2))+(y<>>15)|0)|0)&1|i<<1}else i=0}while(0);if(t=28228+(i<<2)|0,n[u+28>>2]=i,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|a)){for(i=a<<(31==(0|i)?0:25-(i>>>1)|0);A=0|n[(r=t+16+(i>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break t}i<<=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 P=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=(a=y+-47|0)+(7&(A=a+8|0)?0-A&7:0)|0)>>>0<(a=c+16|0)>>>0?c:A)+8|0,w=o+(v=7&(v=o+8|0)?0-v&7:0)|0,v=(r=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,n[o+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]=o,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(o=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|o,n[A>>2]=o,t=o>>>3,o>>>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+((i=(t=o>>>8)?o>>>0>16777215?31:o>>>(7+(i=14-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(i=(245760+(y<<=v)|0)>>>16&2))+(y<>>15)|0)|0)&1|i<<1:0)<<2)|0,n[c+28>>2]=i,n[c+20>>2]=0,n[a>>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|o)){for(i=o<<(31==(0|i)?0:25-(i>>>1)|0);A=0|n[(r=t+16+(i>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|o)){t=A;break e}i<<=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]))|o>>>0>>0&&(n[6985]=o),n[7093]=o,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=o+(v=7&(v=o+8|0)?0-v&7:0)|0,v=(y=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,n[o+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return v=t-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=e,0|y+8}return n[(y=27920)>>2]=12,P=e,0}function Ye(A){var e=0,t=0,r=0,i=0,a=0,o=0,s=0,l=0;if(A|=0){t=A+-8|0,i=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,o=t;else{if(r=0|n[t>>2],!(3&A))return;if(a=r+e|0,(o=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|o)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=o,e=a;break}return n[6983]=a,n[A>>2]=-2&e,n[o+4>>2]=1|a,void(n[o+a>>2]=a)}if(t=r>>>3,r>>>0<256){if(A=0|n[o+8>>2],(0|(e=0|n[o+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=o,e=a;break}i=0|n[o+24>>2],A=0|n[o+12>>2];do{if((0|A)==(0|o)){if(A=0|n[(t=4+(e=o+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[o+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(i){if(e=0|n[o+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|o)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|o)?s:i+20)>>2]=A,!A){s=o,e=a;break}n[A+24>>2]=i,0|(t=0|n[(e=o+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=o,e=a):(s=o,e=a)}else s=o,e=a}}while(0);if(!(o>>>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[o+e>>2]=e,i=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]=o,n[s+4>>2]=1|l,void(n[o+l>>2]=l);i=(-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}a=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|a){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:a+20)>>2]=t,!t)break;n[t+24>>2]=a,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|i,n[o+i>>2]=i,(0|s)==(0|n[6986]))return void(n[6983]=i)}if(A=i>>>3,i>>>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=i>>>8)?i>>>0>16777215?31:i>>>(7+(r=14-((a=(520192+(l=A<<(o=(A+1048320|0)>>>16&8))|0)>>>16&4)|o|(r=(245760+(l<<=a)|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|i)){for(r=i<<(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|i)){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[(o=A+8|0)>>2],n[l+12>>2]=s,n[o>>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|v(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 Je(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Ke(A,e,t,r,i){i|=0;var a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(u=A|=0,o=t|=0,s=f=r|=0,!(c=l=e|=0))return a=!!(0|i),s?a?(n[i>>2]=0|A,n[i+4>>2]=0&e,i=0,0|(C(0|(f=0)),i)):(i=0,0|(C(0|(f=0)),i)):(a&&(n[i>>2]=(u>>>0)%(o>>>0),n[i+4>>2]=0),i=(u>>>0)/(o>>>0)>>>0,0|(C(0|(f=0)),i));a=!(0|s);do{if(o){if(!a){if((a=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){o=d=a+1|0,A=u>>>(d>>>0)&(e=a-31>>31)|c<<(s=31-a|0),e&=c>>>(d>>>0),a=0,s=u<>2]=0|A,n[i+4>>2]=l|0&e,i=0,0|(C(0|(f=0)),i)):(i=0,0|(C(0|(f=0)),i))}if((a=o-1|0)&o){o=s=33+(0|k(0|o))-(0|k(0|c))|0,A=(d=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),a=u<<(h=64-s|0)&(l=d>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|i&&(n[i>>2]=a&u,n[i+4>>2]=0),1==(0|o)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Je(0|o))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(a)return 0|i&&(n[i>>2]=(c>>>0)%(o>>>0),n[i+4>>2]=0),h=(c>>>0)/(o>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|i&&(n[i>>2]=0,n[i+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((a=s-1|0)&s))return 0|i&&(n[i>>2]=0|A,n[i+4>>2]=a&c|0&e),g=0,h=c>>>((0|Je(0|s))>>>0),0|(C(0|g),h);if((a=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){o=e=a+1|0,A=c<<(s=31-a|0)|u>>>(e>>>0),e=c>>>(e>>>0),a=0,s=u<>2]=0|A,n[i+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(o){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=a>>>31|l<<1,a=s|a<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(f=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|f,g&d|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),o=o-1|0}while(0|o);c=l,l=0}else c=s,l=0,s=0;return o=0,0|i&&(n[i>>2]=A,n[i+4>>2]=e),h=a<<1&-2|s,0|(C(0|(g=(0|a)>>>31|(c|o)<<1|l)),h)}function Xe(A,e,t,r){var n,i,a,o,s;return t|=0,i=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,a=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(o=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|o),A=i^s,e=n^o,0|Ze((0|Ke(a,0|B(),0|Ze(i^t|0,n^r|0,0|i,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,i;return e|=0,r|=0,t=0|function(A,e){var t,r,n,i=0;return A=((t=0|v(i=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|v(i,r=A>>>16))|0,e=0|v(i=e>>>16,n),0|(C((A>>>16)+(0|v(i,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,i=t|=0),A=0|B(),0|(C((0|v(e,i))+(0|v(r,n))+A|0&A),t)}function $e(A,e,t,r){var i,a,o,s,l,c;return t|=0,i=P,P=P+16|0,s=0|i,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Ke(A=0|Ze((o=(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|o,0|a),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^o|0,n[s+4>>2]^a|0,0|o,0|a),t=0|B(),P=i,0|(C(0|t),r)}function At(A,e,t,r){var i,a;return a=P,P=P+16|0,Ke(A|=0,e|=0,t|=0,r|=0,i=0|a),P=a,0|(C(0|n[i+4>>2]),n[i>>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):+x(A-.5)}function st(A,e,t){A|=0,e|=0;var i,a,o=0;if((0|(t|=0))>=8192)return Q(0|A,0|e,0|t),0|A;if(a=0|A,i=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|a;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(o=(t=-4&i)-64|0;(0|A)<=(0|o);)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=i-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|i);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|a}function lt(A,e,t){e|=0;var i,a=0,o=0,s=0;if(i=(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,o=(a=-4&i)-64|0;(0|A)<=(0|o);)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|a);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|i);)r[0|A]=e,A=A+1|0;return i-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+x(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|M(),(0|A)>0&(0|(e=(t=0|n[o>>2])+A|0))<(0|t)|(0|e)<0?(j(0|e),E(12),-1):(0|e)>(0|r)&&!(0|N(0|e))?(E(12),-1):(n[o>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,i){i|=0;var a,o,s,l=0,c=0,u=0,d=0;if(s=P,P=P+64|0,o=s,a=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return P=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[i>>2]=0,P=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 P=s,12;if(l=c+-1|0,c>>>0>1){_A(A,e,l,o),_A(t,r,l,a),u=0|n[(d=o)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[a>>2])&&(0|d)==(0|n[a+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[i>>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[i>>2]=1,l=0}}while(0);return P=s,0|l}}while(0)}c=(l=o)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return S(A,e,1,o),l=(0|n[(e=o)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=o+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=o+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=o+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=o+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=o+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=o+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[i>>2]=l,P=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))||(i[t>>3]=6371.007180918475*+i[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(i[t>>3]=6371.007180918475*+i[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 i,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0;if(i=P,P=P+16|0,p=i,x=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return P=i,4;if((0|(x&=15))<(0|t))return P=i,12;if((0|x)!=(0|t))if(o=0|rt(0|t,0,52),o|=A,l=B()|-15728641&e,(0|x)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,o|=b,l=0|B()|l}while((0|c)<(0|x));b=o}else b=o;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(o=1;;){if(!(!((m=0|rt(7,0,3*(15-o|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(o>>>0>>0))break;o=o+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|x)>(0|t)){for(m=-15728641&e,h=x;;){if(g=h,(h=h+-1|0)>>>0>15|(0|x)<(0|h)){u=19;break}if((0|x)!=(0|h))if(o=0|rt(0|h,0,52),o|=A,c=0|B()|m,(0|x)<(0|g))f=o;else{u=h;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,o|=f,c=0|B()|c}while((0|u)<(0|x));f=o}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(o=0|tt(0|f,0|c,3*(15-u|0)|0),B(),0|(o&=7))break e;if(!(u>>>0>>0)){o=0;break}u=u+1|0}else o=0}while(0);o=1&!(0|o)}else o=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){a=5,u=42;break}if(1==(0|c)&(o=!!(0|o))){a=5,u=42;break}if(0|(f=c+((!!(0|c)&o)<<31>>31)|0)&&(u=0|pe(7,0,u=x-g|0,((0|u)<0)<<31>>31),d=0|B(),o?(o=0|Ve(0|(o=0|qe(0|u,0|d,5,0)),0|B(),-5,-1),o=0|Ve(0|(o=0|Xe(0|o,0|B(),6,0)),0|B(),1,0),c=0|B()):(o=u,c=d),g=0|Ve(0|o,0|c,0|(g=0|qe(0|u,0|d,0|(g=f+-1|0),((0|g)<0)<<31>>31)),0|B()),d=0|Ve(0|g,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(g=r)>>2]=d,n[g+4>>2]=f),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))D(27795,27122,1367,27158);else{if(37==(0|u)){a=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return P=i,0|a}}else a=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|x)>(0|t)){for(o=x;;){if(a=0|tt(0|A,0|e,3*(15-o|0)|0),B(),7==(0|(a&=7))){a=5;break}if(a=0|qe(0|(s=0|pe(7,0,s=x-o|0,((0|s)<0)<<31>>31)),0|B(),0|a,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|a,0|s),a=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=a,(0|(o=o+-1|0))<=(0|t))break A}return P=i,0|a}a=0,s=0}}while(0);return 0|RA(b,l,x,p)&&D(27795,27122,1327,27173),((0|a)>-1|-1==(0|a)&s>>>0>4294967295)&((0|(p=0|n[(x=p)+4>>2]))>(0|a)|((0|p)==(0|a)?(0|n[x>>2])>>>0>s>>>0:0))?(P=i,0|(x=0)):(D(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var i,a,o=0,s=0;if(a=P,P=P+16|0,ee(i=a,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=i)>>2]))&!(0|(e=0|n[e+4>>2])))return P=a,0;o=0,t=0;do{n[(s=r+(o<<3)|0)>>2]=A,n[s+4>>2]=e,o=0|Ve(0|o,0|t,1,0),t=0|B(),re(i),A=0|n[(s=i)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return P=a,0},_cellToChildrenSize:RA,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,i,a){var o,s;return A|=0,a|=0,s=P,P=P+16|0,o=s,(i|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,o))||(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}(o,a),A=0),P=s,0|A},_cellToParent:_A,_cellToVertex:Fe,_cellToVertexes:function(A,e,t){t|=0;var r,i=0,a=0;return a=!(0|HA(A|=0,e|=0)),r=!(0|(i=0|Fe(A,e,0,t))),a?r?0|(i=0|Fe(A,e,1,t+8|0))||0|(i=0|Fe(A,e,2,t+16|0))||0|(i=0|Fe(A,e,3,t+24|0))||(i=0|Fe(A,e,4,t+32|0))?0|(a=i):0|Fe(A,e,5,t+40|0):0|(a=i):r?0|(i=0|Fe(A,e,1,t+8|0))||0|(i=0|Fe(A,e,2,t+16|0))||0|(i=0|Fe(A,e,3,t+24|0))||0|(i=0|Fe(A,e,4,t+32|0))?0|(a=i):(n[(a=t+40|0)>>2]=0,n[a+4>>2]=0,0|(a=0)):0|(a=i)},_cellsToDirectedEdge:function(A,e,t,r,i){return i|=0,7==(0|(t=0|R(A|=0,e|=0,t|=0,r|=0)))?0|(i=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[i>>2]=A|r,n[i+4>>2]=e,0|(i=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,a,o,s=0;if(o=P,P=P+32|0,r=o,0|(A=0|function(A,e,t){A|=0,t|=0;var r,i,a=0,o=0,s=0,l=0,c=0,u=0;if(i=P,P=P+176|0,r=i,(0|(e|=0))<1)return Ie(t,0,0),P=i,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Ie(t,(0|e)>6?e:6,15&c),c=0;!(0|(a=0|$A(0|n[(a=A+(c<<3)|0)>>2],0|n[a+4>>2],r)));){if((0|(a=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(o=0|ze(t,a=r+8+((0|(l=l+1|0))%(0|a)<<4)|0,s))?Re(t,o):He(t,s,a),a=0|n[r>>2]}while((0|l)<(0|a))}if((0|(c=c+1|0))>=(0|e)){a=0,u=13;break}}return 13==(0|u)?(P=i,0|a):(Le(t),P=i,0|(u=a))}(A|=0,e|=0,a=o+16|0)))return P=o,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|_e(a)))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],Re(a,A),A=0|Ge(a,r)}while(0|A);A=0|_e(a)}while(0|A);return Le(a),(A=0|function(A){var e,t,r=0,a=0,o=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,E=0,M=0,Q=0,N=0,j=0,P=0,S=0,F=0,T=0,I=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(o=0|n[A>>2]))return 0;r=o,a=0;do{a=a+1|0,r=0|n[r+8>>2]}while(0|r);if(a>>>0<2)return 0;(t=0|Ue(a<<2))||D(27396,27235,317,27415),(e=0|Ue(a<<5))||D(27437,27235,321,27415),n[A>>2]=0,n[(M=A+4|0)>>2]=0,n[s>>2]=0,a=0,F=0,E=0,m=0;A:for(;;){if(h=0|n[o>>2]){c=0,u=h;do{if(f=+i[u+8>>3],r=u,u=0|n[u+16>>2],d=+i[(s=(g=!(0|u))?h:u)+8>>3],+l(+(f-d))>3.141592653589793){I=14;break}c+=(d-f)*(+i[r>>3]+ +i[s>>3])}while(!g);if(14==(0|I)){I=0,c=0,r=h;do{B=+i[r+8>>3],P=0|n[(S=r+16|0)>>2],C=+i[(P=0|P?P:h)+8>>3],c+=(+i[r>>3]+ +i[P>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?S:o)>>2]}while(0|r)}c>0?(n[t+(F<<2)>>2]=o,F=F+1|0,s=E,r=m):I=19}else I=19;if(19==(0|I)){I=0;do{if(!a){if(m){s=M,u=m+8|0,r=o,a=A;break}if(0|n[A>>2]){I=27;break A}s=M,u=A,r=o,a=A;break}if(0|n[(r=a+8|0)>>2]){I=21;break A}if(!(a=0|We(1,12))){I=23;break A}n[r>>2]=a,s=a+4|0,u=a,r=m}while(0);if(n[u>>2]=o,n[s>>2]=o,u=e+(E<<5)|0,g=0|n[o>>2]){for(i[(h=e+(E<<5)+8|0)>>3]=17976931348623157e292,i[(m=e+(E<<5)+24|0)>>3]=17976931348623157e292,i[u>>3]=-17976931348623157e292,i[(b=e+(E<<5)+16|0)>>3]=-17976931348623157e292,y=17976931348623157e292,k=-17976931348623157e292,s=0,p=g,f=17976931348623157e292,v=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+i[p>>3],B=+i[p+8>>3],p=0|n[p+16>>2],C=+i[((x=!(0|p))?g:p)+8>>3],c>3]=c,f=c),B>3]=B,v=B),c>w?i[u>>3]=c:c=w,B>d&&(i[b>>3]=B,d=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!x;)w=c;s&&(i[b>>3]=k,i[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=E+1|0}if(o=0|n[(S=o+8|0)>>2],n[S>>2]=0,!o){I=45;break}E=s,m=r}if(21==(0|I))D(27213,27235,35,27247);else if(23==(0|I))D(27267,27235,37,27247);else if(27==(0|I))D(27310,27235,61,27333);else if(45==(0|I)){A:do{if((0|F)>0){for(S=!(0|s),j=s<<2,P=!(0|A),N=0,r=0;;){if(Q=0|n[t+(N<<2)>>2],S)I=73;else{if(!(E=0|Ue(j))){I=50;break}if(!(M=0|Ue(j))){I=52;break}e:do{if(P)a=0;else{for(s=0,a=0,u=A;o=e+(s<<5)|0,0|he(0|n[u>>2],o,0|n[Q>>2])?(n[E+(a<<2)>>2]=u,n[M+(a<<2)>>2]=o,x=a+1|0):x=a,u=0|n[u+8>>2];)s=s+1|0,a=x;if((0|x)>0)if(o=0|n[E>>2],1==(0|x))a=o;else for(b=0,p=-1,a=o,m=o;;){for(g=0|n[m>>2],o=0,u=0;h=(0|(s=0|n[n[E+(u<<2)>>2]>>2]))==(0|g)?o:o+(1&he(s,0|n[M+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|x);)o=h;if(a=(s=(0|h)>(0|p))?m:a,(0|(o=b+1|0))==(0|x))break e;b=o,p=s?h:p,m=0|n[E+(o<<2)>>2]}else a=0}}while(0);if(Ye(E),Ye(M),a){if(o=0|n[(s=a+4|0)>>2])a=o+8|0;else if(0|n[a>>2]){I=70;break}n[a>>2]=Q,n[s>>2]=Q}else I=73}if(73==(0|I)){if(I=0,0|(r=0|n[Q>>2]))do{M=r,r=0|n[r+16>>2],Ye(M)}while(0|r);Ye(Q),r=1}if((0|(N=N+1|0))>=(0|F)){T=r;break A}}50==(0|I)?D(27452,27235,249,27471):52==(0|I)?D(27490,27235,252,27471):70==(0|I)&&D(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(ge(t),P=o,0|(s=A)):(P=o,0|(s=0))},_childPosToCell:function(A,e,t,r,i,a){A|=0,e|=0,a|=0;var o,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(o=P,P=P+16|0,s=o,(i|=0)>>>0>15)return P=o,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|i))return P=o,12;if(0|RA(t,r,i,s)&&D(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 P=o,2;d=i-l|0,i=0|rt(0|i,0,52),c=B()|-15728641&r,n[(u=a)>>2]=i|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 P=o,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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),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return P=o,0|e},_compactCells:function(A,e,t,r){e|=0;var i,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,E=0,M=0,Q=0,N=0,j=0,P=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(o=0|n[(a=A|=0)>>2],!0&!(15728640&(a=0|n[a+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(P=e)>>2]=o,n[P+4>>2]=a,1==(0|t)&!(0|r))return 0;a=1,o=0;do{j=0|n[4+(N=A+(a<<3)|0)>>2],n[(P=e+(a<<3)|0)>>2]=n[N>>2],n[P+4>>2]=j,a=0|Ve(0|a,0|o,1,0),o=0|B()}while((0|o)<(0|r)|(0|o)==(0|r)&a>>>0>>0);return 0}if(!(j=0|Ue(i=t<<3)))return 13;if(st(0|j,0|A,0|i),!(N=0|We(t,8)))return Ye(j),13;A:for(;;){M=0|tt(0|(u=0|n[(a=j)>>2]),0|(a=0|n[a+4>>2]),52),B(),Q=(M&=15)-1|0,E=!!(0|M),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(E&C){if(v=0|rt(0|Q,0,52),w=0|B(),Q>>>0>15){if(!(!(0|u)&!(0|a))){P=16;break A}for(o=0,A=0;;){if(o=0|Ve(0|o,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&o>>>0>>0))break e;if(!(!(0|(k=0|n[(s=j+(o<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){a=s,P=16;break A}}}for(l=u,A=a,o=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){P=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|Q)){a=12,P=27;break A}if((0|d)!=(0|Q)&&(l|=v,A=-15728641&A|w,d>>>0>=M>>>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|(f=0|n[(d=c=N+(g<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,x=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&x>>>0>t>>>0){P=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){P=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();x=0|Ve(0|x,0|p,1,0),p=0|B(),f=0|n[(d=c=N+(g<<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(o=0|Ve(0|o,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&o>>>0>>0))break e;l=0|n[(A=j+(o<<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){P=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){P=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(o=0|n[(s=d=N+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{f=0|tt(0|o,0|s,56),B(),l=1+(f&=7)|0,g=-117440513&s,y=0|tt(0|o,0|s,45),B();e:do{if(0|z(127&y)){if(h=0|tt(0|o,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(o&(y=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}o|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=d)>>2]=o,n[l+4>>2]=s,l=f+2|0}}while(0);7==(0|l)?(n[(y=k+(A<<3)|0)>>2]=o,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(x=Q>>>0>15,v=0|rt(0|Q,0,52),w=0|B(),!E){for(o=0,c=0,l=0,s=0;!(0|u)&!(0|a)||(n[(Q=e+(o<<3)|0)>>2]=u,n[Q+4>>2]=a,o=0|Ve(0|o,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[(a=j+(l<<3)|0)>>2],a=0|n[a+4>>2];a=y;break}for(o=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|a))){if(h=0|tt(0|u,0|a,52),B(),x|(0|(h&=15))<(0|Q)){P=80;break A}if((0|h)!=(0|Q)){if(d=u|v,f=-15728641&a|w,h>>>0>=M>>>0){g=Q;do{E=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,d|=E,f=0|B()|f}while(g>>>0>>0)}}else d=u,f=a;m=0|At(0|d,0|f,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){P=81;break A}if((-117440513&(b=0|n[4+(E=N+(m<<3)|0)>>2]))==(0|f)&&(0|n[E>>2])==(0|d)){P=65;break}m=0|$e(0|(E=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(),E=N+(m<<3)|0}while((0|n[E>>2])!=(0|d)||(0|n[E+4>>2])!=(0|f));if(65==(0|P)&&(P=0,!0&100663296==(117440512&b)))break;n[(E=e+(o<<3)|0)>>2]=u,n[E+4>>2]=a,o=0|Ve(0|o,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[(a=j+(s<<3)|0)>>2],a=0|n[a+4>>2]}a=y}else o=0,a=y}else o=0,A=0,a=0}while(0);if(lt(0|N,0,0|i),st(0|j,0|k,A<<3),Ye(k),!(0|A)&!(0|a)){P=89;break}e=e+(o<<3)|0,r=a,t=A}if(16==(0|P))!0&!(117440512&a)?(a=4,P=27):P=21;else if(31==(0|P))D(27795,27122,620,27132);else{if(41==(0|P))return Ye(j),Ye(N),10;if(48==(0|P))return Ye(j),Ye(N),13;80==(0|P)?D(27795,27122,711,27132):81==(0|P)?D(27795,27122,723,27132):85==(0|P)&&(st(0|e,0|j,t<<3),P=89)}return 21==(0|P)?(Ye(j),Ye(N),0|(P=5)):27==(0|P)?(Ye(j),Ye(N),0|(P=a)):89==(0|P)?(Ye(j),Ye(N),0|(P=0)):0},_constructCell:function(A,e,t,i){t|=0,i|=0;var a=0,o=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),a=0|B(),l=0|rt(0|e,0,45),a=0|a|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),o=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){a=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){a=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),a&=~B(),o=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|o&~c,a=0|B()|a,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|a}else o=-1}while(0);return n[(u=i)>>2]=o,n[u+4>>2]=a,0},_destroyLinkedMultiPolygon:ge,_directedEdgeToBoundary:EA,_directedEdgeToCells:function(A,e,t){A|=0;var r,i,a,o=0;return r=P,P=P+16|0,o=r,!0&268435456==(2013265920&(e|=0))?(i=-2130706433&e|134217728,n[(a=t|=0)>>2]=A,n[a+4>>2]=i,n[o>>2]=0,e=0|tt(0|A,0|e,56),B(),o=0|L(A,i,7&e,o,t+8|0),P=r,0|o):(P=r,0|(o=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,a=0,o=0,s=0,l=0,u=0,g=0,h=0;if(r=P,P=P+176|0,0|(A=0|EA(A|=0,e|=0,l=r)))return l=A,s=+i[t>>3],s*=6371.007180918475,i[t>>3]=s,P=r,0|l;if(i[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,i[t>>3]=s,P=r,0|l;e=A+-1|0,A=0,a=+i[l+8>>3],o=+i[l+16>>3],s=0;do{g=a,a=+i[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(a-g)),u=o,o=+i[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(o-u)))*(+d(+g)*+d(+a)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return i[t>>3]=s,l=0,h=s,h*=6371.007180918475,i[t>>3]=h,P=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,a=0,o=0,s=0,l=0,u=0,g=0,h=0;if(r=P,P=P+176|0,0|(A=0|EA(A|=0,e|=0,l=r)))return l=A,s=+i[t>>3],s*=6371.007180918475,s*=1e3,i[t>>3]=s,P=r,0|l;if(i[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,i[t>>3]=s,P=r,0|l;e=A+-1|0,A=0,a=+i[l+8>>3],o=+i[l+16>>3],s=0;do{g=a,a=+i[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(a-g)),u=o,o=+i[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(o-u)))*(+d(+g)*+d(+a)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return i[t>>3]=s,l=0,h=s,h*=6371.007180918475,h*=1e3,i[t>>3]=h,P=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,a=0,o=0,s=0,l=0,u=0,g=0,h=0;if(r=P,P=P+176|0,0|(A=0|EA(A|=0,e|=0,l=r)))return P=r,0|A;if(i[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return P=r,0;e=A+-1|0,A=0,a=+i[l+8>>3],o=+i[l+16>>3],s=0;do{g=a,a=+i[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(a-g)),u=o,o=+i[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(o-u)))*(+d(+a)*+d(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return i[t>>3]=s,P=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),i=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,i,a=0;return r=P,P=P+16|0,n[(a=r)>>2]=0,!0&268435456==(2013265920&e)?(i=0|tt(0|A,0|e,56),B(),a=0|L(A,-2130706433&e|134217728,7&i,a,t),P=r,0|a):(P=r,0|(a=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):(i[e>>3]=+i[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(i[e>>3]=+i[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(i[e>>3]=+i[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var i,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0;i=P,P=P+128|0,d=i+112|0,s=i+96|0,f=i,o=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&o,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(a=1;;){if(!(!((u=0|rt(7,0,3*(15-a|0)|0))&e)&!((0|B())&t))){o=0;break A}if(!(a>>>0>>0))break;a=a+1|0}if(!(1&o))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),P=i,0|f;o=1}else o=0}while(0);if(!(a=0|XA(e,t,s))){o?(NA(s,d,f),u=5):(FA(s,d,f),u=6);A:do{if(0|z(l))if(c)for(a=1;;){if(!(!((l=0|rt(7,0,3*(15-a|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(a>>>0>>0)){e=5;break}a=a+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(o)for(s=0;;){if(PA(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))a=r;else{o=0;do{if((o=o+1|0)>>>0>=e>>>0){a=1;break A}c=0|n[(a=r+(o<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[a>>2]=l,(s=s+1|0)>>>0>=u>>>0){a=0;break}}else for(s=0;;){if(jA(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))a=r;else{o=0;do{if((o=o+1|0)>>>0>=e>>>0){a=1;break A}c=0|n[(a=r+(o<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[a>>2]=l,(s=s+1|0)>>>0>=u>>>0){a=0;break}}}while(0)}return P=i,0|a},_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:oe,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,a=0;return r=+i[(e|=0)>>3],t=+i[A>>3],a=(n=+f(.5*(r-t)))*n+(a=+f(.5*(+i[e+8>>3]-+i[A+8>>3])))*(+d(+r)*+d(+t)*a),2*+p(+ +c(+a),+ +c(+(1-a)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,a=0;return r=+i[(e|=0)>>3],t=+i[A>>3],a=(n=+f(.5*(r-t)))*n+(a=+f(.5*(+i[e+8>>3]-+i[A+8>>3])))*(+d(+r)*+d(+t)*a),2*+p(+ +c(+a),+ +c(+(1-a)))},_gridDisk:S,_gridDiskDistances:F,_gridDistance:function(A,e,t,r,i){t|=0,r|=0,i|=0;var a,o,s=0,l=0;return o=P,P=P+32|0,l=o,0|(a=0|me(A|=0,e|=0,A,e,s=o+12|0))?(P=o,0|(l=a)):0|(A=0|me(A,e,t,r,l))?(P=o,0|(l=A)):(s=0|kA(s,l),n[(l=i)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,P=o,0|(l=0))},_gridPathCells:function(A,e,t,r,i){t|=0,r|=0,i|=0;var a,o,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,E=0,M=0;if(o=P,P=P+48|0,c=o+12|0,E=o,!(s=0|me(A|=0,e|=0,A,e,a=o+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(a,c)))<0)<<31>>31,n[a>>2]=0,n[a+4>>2]=0,n[a+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,a)&&D(27795,27538,692,27747),0|me(A,e,t,r,c)&&D(27795,27538,697,27747),CA(a),CA(c),g=0|k?1/+(0|k):0,t=0|n[a>>2],x=g*+((0|n[c>>2])-t|0),r=0|n[(v=a+4|0)>>2],w=g*+((0|n[c+4>>2])-r|0),s=0|n[(y=a+8|0)>>2],g*=+((0|n[c+8>>2])-s|0),n[E>>2]=t,n[(h=E+4|0)>>2]=r,n[(m=E+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(b=0,p=0;;){M=x*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=g*d+ +(0|s),t=~~+ot(+M),c=~~+ot(+u),s=~~+ot(+d),M=+l(+(+(0|t)-M)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(M>u&M>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[E>>2]=t,n[h>>2]=r,n[m>>2]=s,BA(E),0|(s=0|be(A,e,E,i+(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[a>>2],r=0|n[v>>2],s=0|n[y>>2]}}while(0);return P=o,0|s}return P=o,0|s},_gridPathCellsSize:function(A,e,t,r,i){t|=0,r|=0,i|=0;var a,o=0,s=0,l=0;return a=P,P=P+32|0,l=a,(o=0|me(A|=0,e|=0,A,e,s=a+12|0))||(o=0|me(A,e,t,r,l))?(P=a,0|(l=o)):(r=0|Ve(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=i)>>2]=r,n[l+4>>2]=s,P=a,0|(l=0))},_gridRing:function(A,e,t,r){return 0|_(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 i,a=0,o=0,s=0,l=0,c=0,u=0,d=0,f=0;if(i=P,P=P+16|0,s=i,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,P=i,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;a=0|n[(o=s)>>2],o=0|n[o+4>>2]}else d=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),o=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|d,0|o,0|a,0|B())),0|B(),1,0),o=0|B(),n[(d=s)>>2]=a,n[d+4>>2]=o;if(u=0|We(a,8)){if(!(d=0|We(a,4))){Ye(u),a=13;break}if(0|(a=0|I(A,e,t,u,d,a,o,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){a=0,l=0,c=0;do{!(0|(o=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+(a<<3)|0)>>2]=o,n[f+4>>2]=A,a=a+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),a=0}else a=13}else a=2}while(0);return P=i,0|a}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:_,_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:IA,_isValidDirectedEdge:DA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,i=0,a=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&(a=0|rt(0|(i=0|tt(0|A,0|e,0|(a=3*(15^n)|0))),0|B(),0|a))&Ze(-1227133514,-1171,0|a,0|(i=0|B())))&!(4681&i&B())&&15==(0|n)|!(0|(a=0|tt(0|rt(0|~A,0|~e,0|(a=19+(3*n|0)|0)),0|B(),0|a)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(a=0|nt(0|A,0|t),B(),(63-a|0)%3|0)return 1}return 0|DA(A,e)?0|(a=1):0|(a=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:JA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:it,_llvm_minnum_f64:at,_llvm_round_f64:ot,_localIjToCell:function(A,e,t,r,i){var a,o;return A|=0,e|=0,t|=0,i|=0,o=P,P=P+16|0,a=o,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,i,a=0,o=0,s=0;if(o=0|n[(A|=0)>>2],n[e>>2]=o,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(i=e+8|0)>>2]=0,A=(a=(0|s)<(0|o))?o:s,(0|(a=a?s:o))<0){if(-2147483648==(0|a)||((0|A)>0?(2147483647-A|0)<(0|a):(-2147483648-A|0)>(0|a)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|a):(-2147483648^A)<(0|a))return 1}return A=s-o|0,(0|o)<0?(a=0-o|0,n[r>>2]=A,n[i>>2]=a,n[e>>2]=0,o=0):(A=s,a=0),(0|A)<0&&(o=o-A|0,n[e>>2]=o,a=a-A|0,n[i>>2]=a,n[r>>2]=0,A=0),t=o-a|0,s=A-a|0,(0|a)<0?(n[e>>2]=t,n[r>>2]=s,n[i>>2]=0,A=s,s=t,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(n[e>>2]=s-o,n[r>>2]=A-o,n[i>>2]=a-o),0}(t,a))||(t=0|be(A,e,a,i)),P=o,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&i)))return i=2,n[t>>2]=i,0;if(i=0|tt(0|A,0|e,52),B(),!(i&=15))return i=5,n[t>>2]=i,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,i=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(i=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|i,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 i,a=0,o=0,s=0,l=0,c=0;if(i=P,P=P+48|0,a=i+16|0,o=i+8|0,s=i,0|(t=0|Ce(t|=0)))return P=i,0|t;if(l=0|n[(c=A)+4>>2],n[(t=o)>>2]=n[c>>2],n[t+4>>2]=l,ke(o,a),!(t=0|eA(a,e,s))){if(e=0|n[o>>2],(0|(o=0|n[A+8>>2]))>0){a=0|n[A+12>>2],t=0;do{e=(0|n[a+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|o))}a=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(o=((0|e)<0)<<31>>31))|(0|t)==(0|o)&a>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=o,t=o):e=a,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 P=i,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,a){e|=0,t|=0,a|=0;var o,s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se(t+-1|0,h),!(u/+i[h>>3]>10))break A;t=(p=0|n[c>>2])-1|0,n[c>>2]=t}while((0|p)>1)}while(0);if(ve(o),n[(c=a)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=o)>>2]))&!(0|(c=0|n[c+4>>2]))))do{RA(t,c,e,h),g=h,g=0|Ve(0|n[(A=a)>>2],0|n[A+4>>2],0|n[g>>2],0|n[g+4>>2]),A=0|B(),n[(p=a)>>2]=g,n[p+4>>2]=A,ve(o),t=0|n[(p=o)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return P=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,i=0;return r=!(0|HA(A|=0,e|=0)),e&=-2130706433,n[(i=t)>>2]=r?A:0,n[i+4>>2]=r?285212672|e:0,n[(i=t+8|0)>>2]=A,n[i+4>>2]=301989888|e,n[(i=t+16|0)>>2]=A,n[i+4>>2]=318767104|e,n[(i=t+24|0)>>2]=A,n[i+4>>2]=335544320|e,n[(i=t+32|0)>>2]=A,n[i+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 i,a,o,s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0,M=0,Q=0,N=0,j=0,S=0,F=0,L=0,_=0,R=0;if(s=P,P=P+112|0,i=s+80|0,f=s+72|0,a=s,o=s+56|0,0|(l=0|Ce(t|=0)))return P=s,0|l;if(!(R=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return P=s,13;if(Be(A,R),!(l=0|Ce(t))){if(_=0|n[(L=A)+4>>2],n[(l=f)>>2]=n[L>>2],n[l+4>>2]=_,ke(f,i),l=0|eA(i,e,a))L=0,_=0;else{if(l=0|n[f>>2],(0|(c=0|n[g>>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=a)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=a)>>2]=t,n[l+4>>2]=u,l=u):t=c,L=0|Ve(0|t,0|l,12,0),_=0|B(),n[(l=a)>>2]=L,n[l+4>>2]=_,l=0}if(!l){if(!(t=0|We(L,8)))return Ye(R),P=s,13;if(!(d=0|We(L,8)))return Ye(R),Ye(t),P=s,13;n[(S=i)>>2]=0,n[S+4>>2]=0,F=0|n[(S=A)+4>>2],n[(l=f)>>2]=n[S>>2],n[l+4>>2]=F,l=0|H(f,L,_,e,i,t,d);A:do{if(l)Ye(t),Ye(d),Ye(R);else{e:do{if((0|n[g>>2])>0){for(u=A+12|0,c=0;l=0|H((0|n[u>>2])+(c<<3)|0,L,_,e,i,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(d),Ye(R);break A}}while(0);(0|_)>0|!(0|_)&L>>>0>0&<(0|d,0,L<<3),S=0|n[(F=i)+4>>2];e:do{if((0|S)>0|!(0|S)&(0|n[F>>2])>>>0>0){Q=t,N=d,j=t,S=d,F=t,l=t,D=t,E=d,M=d,t=d;t:for(;;){for(w=0,y=0,k=0,C=0,c=0,u=0;;){f=(d=a)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|T(g=0|n[(e=Q+(w<<3)|0)>>2],e=0|n[e+4>>2],1,a,0)){f=(d=a)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(I(g,e,1,a,d,7,0,0),Ye(d))}for(v=0;;){p=0|n[(x=a+(v<<3)|0)>>2],x=0|n[x+4>>2];r:do{if(!(0|p)&!(0|x))d=c,f=u;else{if(h=0|At(0|p,0|x,0|L,0|_),g=0|B(),!(!(0|(f=0|n[(e=d=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|_)|(0|m)==(0|_)&b>>>0>L>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|x)){d=c,f=u;break r}h=0|$e(0|(d=0|Ve(0|h,0|g,1,0)),0|B(),0|L,0|_),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|x)){d=c,f=u;break}qA(p,x,o),0|De(A,R,o)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=x,n[(c=N+(c<<3)|0)>>2]=p,n[c+4>>2]=x,c=b),d=c,f=u}}while(0);if((v=v+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=i)>>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=Q+(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=i)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=i)>>2]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;v=t,w=M,y=F,k=E,C=N,t=D,M=l,E=j,D=v,l=w,F=S,S=y,j=k,N=Q,Q=C}Ye(j),Ye(S),Ye(R),l=1;break A}l=d}while(0);Ye(R),Ye(t),Ye(l),l=0}}while(0);return P=s,0|l}}return Ye(R),P=s,0|l},_polygonToCellsExperimental:function(A,e,t,i,a,o){i|=0,a|=0,o|=0;var s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0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2]=n[o+28>>2],P=s}(g=c+80|0,A|=0,e|=0,t|=0),ee(d,0|n[(f=g)>>2],0|n[f+4>>2],e),s=0|n[(f=d)>>2],f=0|n[f+4>>2],u=0|n[g+8>>2],n[(m=h+4|0)>>2]=n[g>>2],n[m+4>>2]=n[g+4>>2],n[m+8>>2]=n[g+8>>2],n[m+12>>2]=n[g+12>>2],n[m+16>>2]=n[g+16>>2],n[m+20>>2]=n[g+20>>2],n[m+24>>2]=n[g+24>>2],n[m+28>>2]=n[g+28>>2],n[(m=p)>>2]=s,n[m+4>>2]=f,n[(m=p+8|0)>>2]=u,e=h,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[(h=p+48|0)>>2]=n[d>>2],n[h+4>>2]=n[d+4>>2],n[h+8>>2]=n[d+8>>2],n[h+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return P=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|a)|(0|u)==(0|a)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=o+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(ve(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){b=10;break}te(A,e,0|n[g>>2],h),e=0|n[(A=h)>>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[g>>2]=-1,n[p+32>>2]=0,n[A>>2]=0,te(0,0,0,h),n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=0,P=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],P=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,i,a,o){A|=0,r|=0,i|=0,a|=0;var s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(s=P,P=P+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return P=s,0;if((0|(o|=0))>=16)return P=s,12;g=0,h=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|o)){l=12,c=11;break}if(ee(m,c,u,o),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|a)|(0|l)==(0|a)&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(g=0|Ve(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0>>0)){l=0,c=11;break}f=c}return 10==(0|c)?(P=s,0|(m=14)):11==(0|c)?(P=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,o,s=0,l=0,c=0,u=0,d=0,f=0;o=P,P=P+16|0,a=o;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|RA(c,u,r,a)),l=0|Ve(0|n[(c=a)>>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 P=o,0|s}l=0,s=0}while(0);return n[i>>2]=l,n[i+4>>2]=s,P=o,0},_vertexToLatLng:function(A,e,t){t|=0;var r,i,a,o,s=0,l=0;return o=P,P=P+192|0,i=o,a=o+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,a))?(P=o,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,l)?QA(a,e,s,1,i):SA(a,e,s,1,i),l=i+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],P=o,0|(l=0))},establishStackSpace:function(A,e){P=A|=0},stackAlloc:function(A){var e;return e=P,P=15+(P=P+(A|=0)|0)&-16,0|e},stackRestore:function(A){P=A|=0},stackSave:function(){return 0|P}}}({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: "+x(A)+", at: "+[e?x(e):"unknown filename",t,r?x(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[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,i=0;i=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&A.charCodeAt(++i)),a<=127){if(t>=n)break;e[t++]=a}else if(a<=2047){if(t+1>=n)break;e[t++]=192|a>>6,e[t++]=128|63&a}else if(a<=65535){if(t+2>=n)break;e[t++]=224|a>>12,e[t++]=128|a>>6&63,e[t++]=128|63&a}else{if(t+3>=n)break;e[t++]=240|a>>18,e[t++]=128|a>>12&63,e[t++]=128|a>>6&63,e[t++]=128|63&a}}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}},i=c(A),a=[],o=0;if(r)for(var s=0;s>1]=e;break;case"i32":h[A>>2]=e;break;case"i64":L=[e>>>0,(I=e,+N(I)>=1?I>0?(0|S(+P(I/4294967296),4294967295))>>>0:~~+j((I-+(~~I>>>0))/4294967296)>>>0:0)],h[A>>2]=L[0],h[A+4>>2]=L[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 g[A>>1];case"i32":case"i64":return h[A>>2];case"float":return m[A>>2];case"double":return b[A>>3];default:tA("invalid type for getValue: "+e)}return null},_){H(_)||(W=_,_=t.locateFile?t.locateFile(W,i):i+W),F++,t.monitorRunDependencies&&t.monitorRunDependencies(F);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),f.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(F--,t.monitorRunDependencies&&t.monitorRunDependencies(F),0==F&&T){var A=T;T=null,A()}}()},q=function(){n(_,X,function(){throw"could not load memory initializer "+_})},$=O(_);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(D),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)Q(t.postRun.shift());k(E)}()))}F>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)M(t.preRun.shift());k(C)}(),F>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),a(A+=""),o(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 FA?FA:{}),TA="number",IA={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"},LA={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function _A(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 RA(A){if(0!==A)throw function(A,e){return _A(IA,A,2===arguments.length?{value:e}:{})}(A)}var HA={};[["sizeOfH3Index",TA],["sizeOfLatLng",TA],["sizeOfCellBoundary",TA],["sizeOfGeoLoop",TA],["sizeOfGeoPolygon",TA],["sizeOfLinkedGeoPolygon",TA],["sizeOfCoordIJ",TA],["readInt64AsDoubleFromPointer",TA],["isValidCell",TA,[TA,TA]],["isValidIndex",TA,[TA,TA]],["latLngToCell",TA,[TA,TA,TA,TA]],["cellToLatLng",TA,[TA,TA,TA]],["cellToBoundary",TA,[TA,TA,TA]],["maxGridDiskSize",TA,[TA,TA]],["gridDisk",TA,[TA,TA,TA,TA]],["gridDiskDistances",TA,[TA,TA,TA,TA,TA]],["gridRing",TA,[TA,TA,TA,TA]],["gridRingUnsafe",TA,[TA,TA,TA,TA]],["maxPolygonToCellsSize",TA,[TA,TA,TA,TA]],["polygonToCells",TA,[TA,TA,TA,TA]],["maxPolygonToCellsSizeExperimental",TA,[TA,TA,TA,TA]],["polygonToCellsExperimental",TA,[TA,TA,TA,TA,TA,TA]],["cellsToLinkedMultiPolygon",TA,[TA,TA,TA]],["destroyLinkedMultiPolygon",null,[TA]],["compactCells",TA,[TA,TA,TA,TA]],["uncompactCells",TA,[TA,TA,TA,TA,TA,TA]],["uncompactCellsSize",TA,[TA,TA,TA,TA,TA]],["isPentagon",TA,[TA,TA]],["isResClassIII",TA,[TA,TA]],["getBaseCellNumber",TA,[TA,TA]],["getResolution",TA,[TA,TA]],["getIndexDigit",TA,[TA,TA,TA]],["constructCell",TA,[TA,TA,TA,TA]],["maxFaceCount",TA,[TA,TA,TA]],["getIcosahedronFaces",TA,[TA,TA,TA]],["cellToParent",TA,[TA,TA,TA,TA]],["cellToChildren",TA,[TA,TA,TA,TA]],["cellToCenterChild",TA,[TA,TA,TA,TA]],["cellToChildrenSize",TA,[TA,TA,TA,TA]],["cellToChildPos",TA,[TA,TA,TA,TA]],["childPosToCell",TA,[TA,TA,TA,TA,TA,TA]],["areNeighborCells",TA,[TA,TA,TA,TA,TA]],["cellsToDirectedEdge",TA,[TA,TA,TA,TA,TA]],["getDirectedEdgeOrigin",TA,[TA,TA,TA]],["getDirectedEdgeDestination",TA,[TA,TA,TA]],["isValidDirectedEdge",TA,[TA,TA]],["directedEdgeToCells",TA,[TA,TA,TA]],["originToDirectedEdges",TA,[TA,TA,TA]],["directedEdgeToBoundary",TA,[TA,TA,TA]],["gridDistance",TA,[TA,TA,TA,TA,TA]],["gridPathCells",TA,[TA,TA,TA,TA,TA]],["gridPathCellsSize",TA,[TA,TA,TA,TA,TA]],["cellToLocalIj",TA,[TA,TA,TA,TA,TA,TA]],["localIjToCell",TA,[TA,TA,TA,TA,TA]],["getHexagonAreaAvgM2",TA,[TA,TA]],["getHexagonAreaAvgKm2",TA,[TA,TA]],["getHexagonEdgeLengthAvgM",TA,[TA,TA]],["getHexagonEdgeLengthAvgKm",TA,[TA,TA]],["greatCircleDistanceM",TA,[TA,TA]],["greatCircleDistanceKm",TA,[TA,TA]],["greatCircleDistanceRads",TA,[TA,TA]],["cellAreaM2",TA,[TA,TA,TA]],["cellAreaKm2",TA,[TA,TA,TA]],["cellAreaRads2",TA,[TA,TA,TA]],["edgeLengthM",TA,[TA,TA,TA]],["edgeLengthKm",TA,[TA,TA,TA]],["edgeLengthRads",TA,[TA,TA,TA]],["getNumCells",TA,[TA,TA]],["getRes0Cells",TA,[TA]],["res0CellCount",TA],["getPentagons",TA,[TA,TA]],["pentagonCount",TA],["cellToVertex",TA,[TA,TA,TA,TA]],["cellToVertexes",TA,[TA,TA,TA]],["vertexToLatLng",TA,[TA,TA,TA]],["isValidVertex",TA,[TA,TA]]].forEach(function(A){HA[A[0]]=FA.cwrap.apply(FA,A)});var zA=16,GA=HA.sizeOfH3Index(),OA=HA.sizeOfLatLng(),UA=HA.sizeOfCellBoundary();HA.sizeOfGeoPolygon(),HA.sizeOfGeoLoop(),HA.sizeOfLinkedGeoPolygon(),HA.sizeOfCoordIJ();var YA=/[^0-9a-fA-F]/;function WA(A){if(A>=0)return A.toString(zA);var e=VA(8,(A&=2147483647).toString(zA));return(parseInt(e[0],zA)+8).toString(zA)+e.substring(1)}function VA(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(a-.85)/.15*.1:.1+(a-.15)/.7*.8;var a;return te(r[Math.min(23,Math.floor(24*i))])}function ne({coveragePoints:e,visible:r,terrainEnabled:n=!1,brightness:i=.7}){const{current:a}=_(),[o,s]=A.useState(null),[l,c]=A.useState(!1),u=A.useRef({aborted:!1}),d=A.useRef(0),f=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(e),g=A.useMemo(()=>function(){var A;const e=iA();return 24===e.length&&0!==(null==(A=e[0])?void 0:A[0])?e:ee}(),[]);A.useEffect(()=>{if(!f||!Array.isArray(f)||0===f.length)return s(null),void(d.current=0);if(f.length===d.current&&o)return;d.current=f.length,u.current.aborted=!0,u.current={aborted:!1};const A=u.current;c(!0);const{cells:e,minQuality:t,maxQuality:r}=function(A){const e=new Map;for(const i of A){if("number"!=typeof i.lat||"number"!=typeof i.lon||isNaN(i.lat)||isNaN(i.lon))continue;const A=KA(i.lat,i.lon,8),t=e.get(A),r=i.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[i,a]of e.entries()){const A=a.qualitySum/a.count;t.push({hexId:i,count:a.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}}(f);if(0===e.length)return s(null),void c(!1);if(e.length<500){const n=function(A,e,t,r){const n=[];for(const i of A){const A=XA(i.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const a=re(i.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:a,quality:i.avgQuality,count:i.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(e,t,r,g);return void(A.aborted||(s(n),c(!1)))}return async function(A,e,t,r,n){const i=[];let a=0;for(;a[e,A]);o.push(o[0]);const s=re(n.avgQuality,e,t,r);i.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[o]}})}arequestAnimationFrame(A))}return{type:"FeatureCollection",features:i}}(e,t,r,g,A).then(e=>{!A.aborted&&e&&s(e)}).finally(()=>{A.aborted||c(!1)}),()=>{A.aborted=!0}},[f,g]),A.useEffect(()=>{var A;const e=null==(A=null==a?void 0:a.getMap)?void 0:A.call(a);if(!e)return;const t=()=>{var A,t;try{const n=e.getLayer(Ae),a=e.getSource($A);if(r&&o&&o.features.length>0){if(a?e.getSource($A).setData(o):e.addSource($A,{type:"geojson",data:o}),!n){const r=e.getLayer("topology-weak-edges-native"),n=null==(t=null==(A=e.getStyle())?void 0:A.layers)?void 0:t.find(A=>"symbol"===A.type),a=r?"topology-weak-edges-native":null==n?void 0:n.id;e.addLayer({id:Ae,type:"fill",source:$A,paint:{"fill-color":["get","color"],"fill-opacity":i}},a)}}else n&&e.removeLayer(Ae),a&&e.removeSource($A)}catch(n){}};e.isStyleLoaded()?t():e.once("style.load",t)},[a,r,o,n]),A.useEffect(()=>{var A;const e=null==(A=null==a?void 0:a.getMap)?void 0:A.call(a);if(e&&r)try{e.getLayer(Ae)&&e.setPaintProperty(Ae,"fill-opacity",i)}catch{}},[a,i,r]),A.useEffect(()=>()=>{var A;const e=null==(A=null==a?void 0:a.getMap)?void 0:A.call(a);if(e)try{e.getLayer(Ae)&&e.removeLayer(Ae),e.getSource($A)&&e.removeSource($A)}catch{}},[a]);const h=(null==o?void 0:o.features.length)??0;return h>0&&r?t.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==e?void 0:e.length)||0,"data-cell-count":h,"data-terrain-enabled":n,"data-is-processing":l,style:{display:"none"}}):null}const ie="terrain-dem",ae="terrain-hillshade";function oe({enabled:e,exaggeration:t=2}){const{current:r}=_(),n=A.useRef(null);return A.useEffect(()=>{var A;const i=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);if(!i)return;let a=!0;const o=()=>{var A,r;if(a)try{if(i.getSource(ie)||i.addSource(ie,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256,maxzoom:10}),e){if(i.setCenterClampedToGround(!1),i.setTerrain({source:ie,exaggeration:t}),!i.getLayer(ae)){const e=null==(r=null==(A=i.getStyle())?void 0:A.layers)?void 0:r.find(A=>"symbol"===A.type);i.addLayer({id:ae,type:"hillshade",source:ie,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.5)","hillshade-highlight-color":"rgba(200, 195, 185, 0.4)","hillshade-accent-color":"rgba(80, 65, 55, 0.35)","hillshade-illumination-direction":315,"hillshade-exaggeration":.25}},null==e?void 0:e.id)}i.setMaxPitch(70),i.getPitch()<30&&!i.isMoving()&&(null!==n.current&&clearTimeout(n.current),n.current=window.setTimeout(()=>{n.current=null,a&&!i.isMoving()&&i.getPitch()<30&&i.easeTo({pitch:45,duration:1e3})},200))}else i.setTerrain(null),i.setCenterClampedToGround(!0),i.getLayer(ae)&&i.removeLayer(ae),i.getSource(ie)&&i.removeSource(ie),i.getPitch()>0&&!i.isMoving()&&i.easeTo({pitch:0,duration:800}),i.setMaxPitch(60)}catch(o){}};let s=null;return i.isStyleLoaded()?o():(s=o,i.once("style.load",o)),()=>{if(a=!1,null!==n.current&&(clearTimeout(n.current),n.current=null),s)try{i.off("style.load",s)}catch{}try{i.isStyleLoaded()&&(i.setTerrain(null),i.getLayer(ae)&&i.removeLayer(ae),i.getSource(ie)&&i.removeSource(ie))}catch{}}},[r,e,t]),null}function se(A,e=!1,t=!1,r=!1,n=.7){const i=rA();return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function le(A){return[A[1],A[0]]}function ce(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function ue(A,e,t,r,n,i,a,o,s,l,c){const u=fA(),d=[];let f=1/0,g=-1/0;const h=[];for(const b of A){const A=.7*(b.edge.avgConfidence??(e?.7:.5))+b.edge.certainCount/Math.max(a,1)*.3+(e?.5:0);h.push({polyline:b,brightnessScore:A}),f=Math.min(f,A),g=Math.max(g,A)}if(0===h.length)return{type:"FeatureCollection",features:[]};const m=g-f||1;h.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:b,brightnessScore:p}of h){const{from:A,to:a,edge:g}=b,h=t.get(g.key)??0;if(h<=0)continue;const x=o.has(g.key),v=s.has(g.key),w=g.avgConfidence??(e?.7:.5),y=l===g.key,k=c[g.fromHash],C=c[g.toHash],B=(null==k?void 0:k.node_name)||(null==k?void 0:k.name)||g.fromHash.slice(0,8),D=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||g.toHash.slice(0,8),E=[A[0]+(a[0]-A[0])*h,A[1]+(a[1]-A[1])*h];let M,Q,N,j;if(e){const A=i.get(g.key)??lA(g.certainCount),e=n.get(g.key)??A;M=e+(A-e)*r,y?M=Math.max(1.6*M,4.5):v&&(M*=1.3)}else M=1.5;if(Q=y?"#FFD700":se(0,g.isDirectPathEdge??!1,x,v,w),N=y?"#FFD700":g.isDirectPathEdge?u.edges.hoverDirect:x?u.edges.hoverLoop:u.edges.hoverStandard,e){const A=Math.min(1.5*h,1)*u.edgeOpacity;j=v?1.15*A:A}else j=(.3+.3*w)*h;y&&(j=.95);const P=(p-f)/m;d.push({type:"Feature",properties:{key:g.key,baseColor:Q,hoverColor:N,baseWidth:M,baseOpacity:j,brightnessScore:P,isLoopEdge:x,isBackbone:v,isDirectPath:g.isDirectPathEdge??!1,isHubConnection:g.isHubConnection??!1,isZeroHop:g.isZeroHop??!1,isValidated:e,certainCount:g.certainCount,confidence:w,symmetryRatio:g.symmetryRatio??1,dominantDirection:g.dominantDirection??"balanced",fromName:B,toName:D,fromHash:g.fromHash,toHash:g.toHash},geometry:{type:"LineString",coordinates:[le(A),le(E)]}})}return{type:"FeatureCollection",features:d}}function de(A){const e=fA(),t=[];for(const{from:r,to:n,hash:i,neighbor:a,lastHopData:o}of A){const A=`neighbor-${i}`,s=(null==o?void 0:o.avgRssi)??a.rssi??null,l=(null==o?void 0:o.avgSnr)??a.snr??null,c=(null==o?void 0:o.count)??0,u=(null==o?void 0:o.confidence)??1;t.push({type:"Feature",properties:{key:A,hash:i,name:a.node_name||a.name||i.slice(0,8),prefix:i.slice(2,4).toUpperCase(),color:e.neighborColor,width:2.5,opacity:.85,rssi:s,snr:l,packetCount:c,confidence:u,hasAvgRssi:void 0!==(null==o?void 0:o.avgRssi),hasAvgSnr:void 0!==(null==o?void 0:o.avgSnr),isNeighborEdge:!0},geometry:{type:"LineString",coordinates:[le(r),le(n)]}})}return{type:"FeatureCollection",features:t}}function fe(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}const ge="node-markers-native",he="node-markers-layer",me="node-markers-layer-local",be="marker-standard",pe="marker-standard-neighbor",xe="marker-hub",ve="marker-hub-neighbor",we="marker-gateway",ye="marker-gateway-neighbor",ke="marker-mobile",Ce="marker-mobile-neighbor",Be="marker-room-server",De="marker-room-server-neighbor",Ee="marker-local",Me=24;function Qe(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 Ne(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function je({neighborsWithLocation:e,localNode:r,localHash:n,zeroHopNeighbors:i,lastHopNeighborMap:a,meshTopology:o,hoveredMarker:s,onMarkerHover:l,getNodeOpacity:c,shouldShowNode:u,onRequestRemove:d,openPopupId:f,onOpenPopup:g,onClosePopup:h}){const{current:m}=_(),b=A.useRef(!1),[p,x]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e)return;const t=()=>{if(!b.current)try{!function(A){const e=tA(),t=(A,e,t=0)=>{const r=document.createElement("canvas");r.width=Me,r.height=Me;const n=r.getContext("2d"),i=10-t/2;return n.beginPath(),n.arc(12,12,i,0,2*Math.PI),n.fillStyle=A,n.fill(),e&&t>0&&(n.strokeStyle=e,n.lineWidth=2*t,n.stroke()),n.shadowColor="rgba(0,0,0,0.3)",n.shadowBlur=4,n.shadowOffsetY=2,n.getImageData(0,0,Me,Me)},r=(A,e)=>{const t=document.createElement("canvas");t.width=Me,t.height=Me;const r=t.getContext("2d"),n=9.600000000000001;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(12-n,12-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(9.12,17.76),r.lineTo(12-.6*n,21.6),r.lineTo(12,17.76),r.stroke(),r.getImageData(0,0,Me,Me)},n={[be]:t(e.nodeFill,e.nodeStroke,1.5),[pe]:t(e.neighborColor),[xe]:t(e.hubColor),[ve]:t(e.neighborColor),[we]:t(e.hubColor+"B3"),[ye]:t(e.neighborColor),[ke]:t("transparent",e.mobileColor,2),[Ce]:t(e.neighborColor),[Be]:r(e.roomColor),[De]:r(e.neighborColor,"#1a1a1c"),[Ee]:(A=>{const e=document.createElement("canvas");e.width=Me,e.height=Me;const t=e.getContext("2d"),r=9.600000000000001;return t.strokeStyle=A,t.lineWidth=5,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(12-r,12),t.lineTo(12,12-r),t.lineTo(21.6,12),t.stroke(),t.beginPath(),t.moveTo(12-.7*r,12),t.lineTo(12-.7*r,18.72),t.lineTo(18.72,18.72),t.lineTo(18.72,12),t.stroke(),t.beginPath(),t.moveTo(10.08,18.72),t.lineTo(10.08,13.92),t.lineTo(13.92,13.92),t.lineTo(13.92,18.72),t.stroke(),t.getImageData(0,0,Me,Me)})(e.localColor)};for(const[i,a]of Object.entries(n))A.hasImage(i)&&A.removeImage(i),A.addImage(i,a,{pixelRatio:2})}(e),b.current=!0,x(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{b.current=!1,t()},n=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(r,100);break}});return n.observe(document.documentElement,{attributes:!0}),()=>{n.disconnect()}},[m]);const v=A.useMemo(()=>{var A;const t=[],r=[...e].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return Qe(e)?5e3:i.has(A)?3e3:o.hubNodes.includes(A)?2e3:(null==(t=o.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[e,n]of r){if(!n.latitude||!n.longitude)continue;const r=u(e),s=c(e,r);if(s<=.01)continue;const l=i.has(e),d=o.hubNodes.includes(e),f=(null==(A=o.gatewayNodes)?void 0:A.includes(e))??!1,g=o.mobileNodes.includes(e),h=Qe(n),m=o.centrality.get(e)||0,b=a.get(e),p="stale"===(null==b?void 0:b.status),x=p?Math.min(s,.5):s;let v="standard";h?v="roomServer":d?v="hub":f?v="gateway":g&&(v="mobile");const w=o.fullAffinity.get(e),y=o.txDelayRecommendations.get(e);t.push({type:"Feature",geometry:{type:"Point",coordinates:[n.longitude,n.latitude]},properties:{hash:e,name:n.node_name||n.name||"Unknown",hashPrefix:Ne(e),iconType:v,isNeighbor:l,isHub:d,isGateway:f,isMobile:g,isRoomServer:h,isStale:p,isZeroHop:l,opacity:x,lastSeenTimestamp:null==b?void 0:b.lastSeen,centrality:m,neighborJson:JSON.stringify(n),affinityJson:w?JSON.stringify(w):void 0,txDelayRecJson:y?JSON.stringify(y):void 0,meanSnr:(null==b?void 0:b.avgSnr)??void 0,meanRssi:(null==b?void 0:b.avgRssi)??void 0}})}return{type:"FeatureCollection",features:t}},[e,i,a,o,c,u]),w=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?Ne(n):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,isZeroHop:!1,opacity:1,centrality:0}}]}:{type:"FeatureCollection",features:[]},[r,n]),y=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&&g&&g(t)},[g]),k=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==m?void 0:m.getMap)?void 0:e.call(m);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&l(n)},[m,l]),C=A.useCallback(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);e&&(e.getCanvas().style.cursor=""),l(null)},[m,l]);A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e||!p)return;const t=[he,me];for(const r of t)e.on("click",r,y),e.on("mouseenter",r,k),e.on("mouseleave",r,C);return()=>{for(const A of t)e.off("click",A,y),e.off("mouseenter",A,k),e.off("mouseleave",A,C)}},[m,p,y,k,C]);const B=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=v.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,v]);if(!p)return null;const D=tA(),E=["case",["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],De,Be],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],ve,xe],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],ye,we],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],Ce,ke],["case",["get","isNeighbor"],pe,be]],M=["interpolate",["linear"],["zoom"],6,.25,10,1];return t.jsxs(t.Fragment,{children:[t.jsx(R,{id:ge,type:"geojson",data:v,children:t.jsx(H,{id:he,type:"symbol",layout:{"icon-image":E,"icon-size":M,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),t.jsx(R,{id:`${ge}-local`,type:"geojson",data:w,children:t.jsx(H,{id:me,type:"symbol",layout:{"icon-image":Ee,"icon-size":M,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),B&&h&&t.jsx(z,{longitude:B.longitude,latitude:B.latitude,offset:{center:[0,0],top:[0,10],"top-left":[6,10],"top-right":[-6,10],bottom:[0,-10],"bottom-left":[6,-10],"bottom-right":[-6,-10],left:[10,0],right:[-10,0]},maxWidth:"280px",closeOnClick:!0,onClose:h,className:"maplibre-popup",children:B.isLocal?t.jsxs("div",{className:"text-sm",children:[t.jsx("strong",{className:"text-base",children:B.name}),B.hash&&t.jsx("span",{className:"ml-2 font-mono text-xs text-text-muted bg-surface-elevated px-1.5 py-0.5 rounded",children:Ne(B.hash)}),t.jsx("br",{}),t.jsx("span",{style:{color:D.localColor},className:"font-medium",children:"This Node (Local)"}),t.jsx("br",{}),r&&t.jsxs("span",{className:"text-xs text-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):B.neighbor&&B.hash?t.jsx(bA,{hash:B.hash,hashPrefix:B.hashPrefix,name:B.name,isHub:B.isHub,isGateway:B.isGateway,isBackbone:B.isBackbone,isZeroHop:B.isZeroHop,isMobile:B.isMobile,isRoomServer:B.isRoomServer,isStale:B.isStale,lastSeenTimestamp:B.lastSeenTimestamp,centrality:B.centrality,affinity:B.affinity,meanSnr:B.meanSnr,meanRssi:B.meanRssi,neighbor:B.neighbor,txDelayRec:B.txDelayRec,onRemove:d?()=>d(B.hash,B.name):void 0}):null})]})}const Pe=A.createContext(null);function Se({children:e}){const{current:r}=_(),n=A.useRef(null),i=A.useRef(new Map),[a,o]=A.useState(!1),s=A.useRef(null),l=A.useRef(!1);A.useEffect(()=>{const A=null==r?void 0:r.getMap();if(A)return n.current||(n.current=new sA({interleaved:!0,useDevicePixels:!0,layers:[]}),A.addControl(n.current),o(!0)),()=>{if(null!==s.current&&(cancelAnimationFrame(s.current),s.current=null),n.current&&A){try{A.removeControl(n.current)}catch{}n.current=null,o(!1)}}},[r]);const c=A.useCallback(()=>{if(s.current=null,!n.current||!l.current)return;l.current=!1;const A=[],e=Array.from(i.current.keys()).sort();for(const r of e){const e=i.current.get(r);if(e&&e.length>0){const t=e.filter(A=>null!=A&&null!=A.id);A.push(...t)}}try{n.current.setProps({layers:A})}catch(t){}},[]),u=A.useCallback(()=>{l.current=!0,null===s.current&&(s.current=requestAnimationFrame(c))},[c]),d=A.useCallback((A,e)=>{0===e.length?i.current.delete(A):i.current.set(A,e),u()},[u]);return t.jsx(Pe.Provider,{value:{setLayers:d,isReady:a},children:e})}const Fe="topology-validated-edges-native",Te="topology-weak-edges-native",Ie="neighbor-edges-native",Le={type:"FeatureCollection",features:[]},_e={"line-cap":"round","line-join":"round"},Re={"line-color":"transparent","line-width":16,"line-opacity":0};function He({showTopology:e,isExiting:r,hoveredEdgeKey:n,onEdgeHover:i,opacityBias:a=.5,widthMultiplier:o=1,trafficFilter:s=0,showNeighborLines:l=!0}){const{current:c}=_(),u=e||r,d=l?"visible":"none",f=A.useRef(null),g=A.useCallback(A=>{if(!A.features||0===A.features.length)return;const e=A.features[0].properties;if(!(null==e?void 0:e.key))return;const t=e.key;if(t!==f.current)if(f.current=t,!0===e.isNeighborEdge||"true"===e.isNeighborEdge){const r={key:t,fromName:"Local",toName:e.name,certainCount:Number(e.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};i(t,[A.lngLat.lng,A.lngLat.lat],r)}else{const r={key:t,fromName:e.fromName,toName:e.toName,certainCount:Number(e.certainCount),confidence:Number(e.confidence),isBackbone:!0===e.isBackbone||"true"===e.isBackbone,isLoopEdge:!0===e.isLoopEdge||"true"===e.isLoopEdge,isDirectPath:!0===e.isDirectPath||"true"===e.isDirectPath,isZeroHop:!0===e.isZeroHop||"true"===e.isZeroHop,symmetryRatio:Number(e.symmetryRatio),dominantDirection:e.dominantDirection,isHubConnection:!0===e.isHubConnection||"true"===e.isHubConnection};i(t,[A.lngLat.lng,A.lngLat.lat],r)}},[i]),h=A.useCallback(()=>{null!==f.current&&(f.current=null,i(null))},[i]);A.useEffect(()=>{var A;const e=null==(A=null==c?void 0:c.getMap)?void 0:A.call(c);if(!e||!u)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,g),e.on("mouseleave",t,h),!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,g),e.off("mouseleave",t,h))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,g),e.off("mouseleave",t,h))}catch{}}},[c,u,g,h]),A.useEffect(()=>{var A;const e=null==(A=null==c?void 0:c.getMap)?void 0:A.call(c);if(!e||!l)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,g),e.on("mouseleave",t,h),!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,g),e.off("mouseleave",t,h))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,g),e.off("mouseleave",t,h))}catch{}}},[c,!0,l,g,h]);const m=function(A,e,t,r){const n=null!==A,i=1+5*e;return{"line-color":n?["case",["==",["get","key"],A],["get","hoverColor"],["get","baseColor"]]:["get","baseColor"],"line-width":n?["case",["==",["get","key"],A],["max",["*",["get","baseWidth"],t,1.2],3],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,n?["case",["==",["get","key"],A],["min",["*",["get","baseOpacity"],1.25],1],e>0?["*",["get","baseOpacity"],.35,["case",["<",["get","brightnessScore"],e],["+",.08,["*",.92,["^",["/",["get","brightnessScore"],e],i]]],1]]:["*",["get","baseOpacity"],.35]]:e>0?["*",["get","baseOpacity"],["case",["<",["get","brightnessScore"],e],["+",.08,["*",.92,["^",["/",["get","brightnessScore"],e],i]]],1]]:["get","baseOpacity"]]}}(n,a,o,s),b=function(A){const e=fA(),t=null!==A;return{"line-color":t?["case",["==",["get","key"],A],e.edges.neighborHover,e.neighborColor]:e.neighborColor,"line-width":t?["case",["==",["get","key"],A],3.5,2.5]:2.5,"line-opacity":t?["case",["==",["get","key"],A],1,.35]:.85}}(n);return t.jsxs(t.Fragment,{children:[u&&t.jsx(R,{id:Te,type:"geojson",data:Le,children:t.jsx(H,{id:"topology-weak-edges-native",type:"line",paint:m,layout:_e})}),u&&t.jsxs(R,{id:Fe,type:"geojson",data:Le,children:[t.jsx(H,{id:"topology-validated-edges-hitarea-native",type:"line",paint:Re,layout:_e}),t.jsx(H,{id:"topology-validated-edges-native",type:"line",paint:m,layout:_e})]}),t.jsxs(R,{id:Ie,type:"geojson",data:Le,children:[t.jsx(H,{id:"neighbor-edges-hitarea-native",type:"line",paint:Re,layout:{..._e,visibility:d}}),t.jsx(H,{id:"neighbor-edges-native",type:"line",paint:b,layout:{..._e,visibility:d}})]})]})}const ze=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Ge({positions:e}){const{current:t}=_(),r=A.useRef(!1);return A.useEffect(()=>{if(!t||0===e.length||r.current)return;const A=()=>{if(t.getMap().isMoving())setTimeout(A,100);else if(r.current=!0,1===e.length)t.flyTo({center:[e[0][1],e[0][0]],zoom:14,duration:1e3});else{const A=e.map(([A,e])=>[e,A]);let r=1/0,n=-1/0,i=1/0,a=-1/0;for(const[e,t]of A)r=Math.min(r,e),n=Math.max(n,e),i=Math.min(i,t),a=Math.max(a,t);const o=[[r,i],[n,a]];t.fitBounds(o,{padding:{top:15,bottom:15,left:15,right:15},maxZoom:16,duration:1e3})}};setTimeout(A,50)},[t,e]),null}function Oe({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=_(),i=A.useRef(null);return A.useEffect(()=>{if(!n||!e||e===i.current)return;const A=t.get(e);if(!A)return;const a=n.getMap();a.isMoving()&&a.stop(),i.current=e;const[o,s]=A;n.flyTo({center:[s,o],zoom:15,duration:2500,essential:!0}),setTimeout(()=>{null==r||r()},2600)},[e,t,n,r]),null}function Ue({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:i}=_(),a=A.useRef(null);return A.useEffect(()=>{if(!i||!e)return;if(e===a.current)return;a.current=e,n();const A=t.find(A=>A.edge.key===e)||r.find(A=>A.edge.key===e);if(!A)return;if(i.getMap().isMoving())return;const o=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=i.getZoom(),c=Math.max(l,11);i.easeTo({center:[s,o],zoom:c,duration:500})},[e,t,r,i,n]),null}!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))}(dA.edges.neighborHover);const Ye={longitude:0,latitude:0,zoom:2};function We({type:A,properties:e,maxCertainCount:r}){if("neighbor"===A){const A=e;return t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"font-medium text-text-primary",children:[t.jsx("span",{className:"text-amber-400",children:"●"})," ",A.name,A.prefix&&t.jsxs("span",{className:"ml-1 text-text-muted font-mono text-[10px]",children:["(",A.prefix,")"]})]}),t.jsxs("div",{className:"text-text-secondary flex gap-2",children:[void 0!==A.rssi&&null!==A.rssi&&t.jsxs("span",{children:["RSSI: ",Math.round(A.rssi)," dBm",A.hasAvgRssi&&" avg"]}),void 0!==A.snr&&null!==A.snr&&t.jsxs("span",{children:["SNR: ",Number(A.snr).toFixed(1)," dB",A.hasAvgSnr&&" avg"]})]}),void 0!==A.packetCount&&t.jsxs("div",{className:"text-text-muted text-[10px]",children:[Number(A.packetCount).toLocaleString()," packets",void 0!==A.confidence&&` • ${Math.round(100*Number(A.confidence))}% conf`]}),t.jsx("div",{className:"text-amber-400 text-[10px] mt-0.5",children:"Direct RF neighbor"})]})}const n=e,i=r>0?Number(n.certainCount)/r:0;return t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"font-medium text-text-primary",children:[n.fromName," ↔ ",n.toName]}),t.jsxs("div",{className:"text-text-secondary",children:[n.certainCount," validations (",Math.round(100*i),"%) • ",Math.round(100*Number(n.confidence)),"% conf"]}),n.isBackbone&&t.jsx("div",{className:"text-gray-300 font-semibold",children:"Backbone"}),n.isLoopEdge&&t.jsx("div",{className:"text-indigo-400 text-[10px] mt-0.5",children:"Redundant path"}),n.isDirectPath&&t.jsx("div",{className:"text-teal-400 text-[10px]",children:"Direct path"})]})}function Ve({neighbors:e,localNode:r,localHash:n,onRemoveNode:i,selectedNodeHash:a,onNodeSelected:o,highlightedEdgeKey:s}){var l,c;const u=A.useRef(null),d=J(),f=K(),g=X(),h=q(),m=$(),b=n??m,[p,x]=A.useState(Ye),[v,w]=A.useState(!1),[y,k]=A.useState(!1),[C,B]=A.useState(!0),[D,E]=A.useState(!0),[M,Q]=A.useState(!1),[N,j]=A.useState(!1),[P,S]=A.useState(!1),[F,T]=A.useState(!1),[I,L]=A.useState(null),[_,R]=A.useState(null),[H,Y]=A.useState(.5),[W,V]=A.useState(1),[Z,eA]=A.useState(0),[tA,rA]=A.useState(null),[nA,iA]=A.useState(""),[aA,oA]=A.useState(!1),[sA,cA]=A.useState("fetching"),[dA,fA]=A.useState(!1),[hA,mA]=A.useState(0),[bA,xA]=A.useState(null),yA=A.useCallback(A=>xA(A),[]),kA=A.useCallback(()=>xA(null),[]),CA=jA(A=>A.coveragePoints),BA=jA(A=>A.isVisible),DA=jA(A=>A.brightness),EA=jA(A=>A.openModal),MA=A.useRef(!1);A.useEffect(()=>{CA.length>0&&BA&&!MA.current&&(B(!1),MA.current=!0)},[CA.length,BA]);const QA=A.useRef(null);A.useEffect(()=>{if(a&&a!==QA.current){QA.current=a;const A=setTimeout(()=>{xA(a)},1250);return()=>clearTimeout(A)}},[a]);const[NA,PA]=A.useState(null),FA=A.useCallback((A,e,t)=>{R(A),A&&e&&t?PA({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,color:"",width:0,opacity:0,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||PA(null)},[]),TA=A.useMemo(()=>Object.entries(e).filter(([,A])=>A.latitude&&A.longitude),[e]),IA=A.useMemo(()=>{const A=[];(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.push([r.latitude,r.longitude]);for(const[,e]of TA)e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[r,TA]),LA=A.useMemo(()=>{const A=new Map;b&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(b,[r.latitude,r.longitude]);for(const[e,t]of TA)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[b,r,TA]),_A=A.useMemo(()=>{const A=new Map;for(const e of g)"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},[g]),RA=A.useMemo(()=>{var A,t;const r=new Set;for(const n of _A.keys())(null==(A=e[n])?void 0:A.latitude)&&(null==(t=e[n])?void 0:t.longitude)&&r.add(n);return r},[_A,e]),HA=A.useCallback(A=>!!(b&&(A.fromHash===b&&RA.has(A.toHash)||A.toHash===b&&RA.has(A.fromHash))),[b,RA]),zA=A.useMemo(()=>{var A,t;if(0===g.length||!b)return[];if(h.backgroundLoadComplete)return[];const r=[];for(const n of g){if("expired"===n.status)continue;if(!(null==(A=e[n.hash])?void 0:A.latitude)||!(null==(t=e[n.hash])?void 0:t.longitude))continue;const i=[b,n.hash].sort(),a=`${i[0]}~${i[1]}`;r.push({fromHash:b,toHash:n.hash,key:a,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},[g,b,h.backgroundLoadComplete,e]),GA=A.useMemo(()=>{const A=[];if(zA.length>0&&!h.backgroundLoadComplete){for(const e of zA){const t=LA.get(e.fromHash),r=LA.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of d.validatedEdges){if(HA(e))continue;const t=LA.get(e.fromHash),r=LA.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[d.validatedEdges,LA,HA,zA,h.backgroundLoadComplete]),OA=A.useMemo(()=>{const A=[];for(const e of d.weakEdges){if(HA(e))continue;const t=LA.get(e.fromHash),r=LA.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[d.weakEdges,LA,HA]),UA=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],t=[r.latitude,r.longitude];for(const r of RA){const n=e[r];(null==n?void 0:n.latitude)&&(null==n?void 0:n.longitude)&&A.push({from:t,to:[n.latitude,n.longitude],hash:r,neighbor:n,lastHopData:_A.get(r)??null})}return A},[r,RA,e,_A]),YA=A.useMemo(()=>new Set(d.loopEdgeKeys),[d.loopEdgeKeys]),WA=A.useMemo(()=>new Set(d.backboneEdges),[d.backboneEdges]),VA=A.useMemo(()=>{let A=0;if(zA.length>0&&!h.backgroundLoadComplete){for(const e of zA)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of d.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[d.validatedEdges,zA,h.backgroundLoadComplete]),ZA=(null==(c=null==(l=u.current)?void 0:l.getMap)?void 0:c.call(l))??null,{isExiting:JA,resetAnimationState:KA}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:i,loopEdgeKeys:a,backboneEdgeKeys:o,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:d=[],showNeighborLines:f=!0,neighborSourceId:g}){const h=A.useRef(new Map),m=A.useRef(1),b=A.useRef(new Map),p=A.useRef(new Map),x=A.useRef(!1),v=A.useRef(null),w=A.useRef(t),y=A.useRef(new Set),k=A.useRef(""),C=A.useRef(new Map),B=A.useRef(r),D=A.useRef(n),E=A.useRef(i),M=A.useRef(a),Q=A.useRef(o),N=A.useRef(s),j=A.useRef(l),P=A.useRef(d),S=A.useRef(f);A.useEffect(()=>{B.current=r,D.current=n,E.current=i,M.current=a,Q.current=o,N.current=s,j.current=l,P.current=d,S.current=f},[r,n,i,a,o,s,l,d,f]);const F=A.useCallback(()=>{if(!e)return;const A=e.getSource(c),t=e.getSource(u),r=e.getSource(g);if(A){const e=ue(B.current,!0,h.current,m.current,b.current,p.current,E.current,M.current,Q.current,N.current,j.current);A.setData(e)}if(t){const A=ue(D.current,!1,h.current,m.current,b.current,p.current,E.current,M.current,Q.current,N.current,j.current);t.setData(A)}if(r&&P.current.length>0){const A=de(P.current);r.setData(A)}},[e,c,u,g]),T=A.useCallback(()=>{v.current&&(cancelAnimationFrame(v.current),v.current=null),h.current=new Map,m.current=1,b.current=new Map,p.current=new Map,x.current=!1,y.current=new Set,k.current="",C.current=new Map},[]);return A.useEffect(()=>{const A=w.current,r=t;if(w.current=t,e){if(v.current&&(cancelAnimationFrame(v.current),v.current=null),A&&!r&&!x.current){x.current=!0;const A=new Map(h.current);let e=null;const t=r=>{e||(e=r);const n=r-e,i=Math.min(n/500,1),a=(o=i,1-Math.pow(1-o,3));var o;for(const[e,t]of A)h.current.set(e,t*(1-a));F(),i<1?v.current=requestAnimationFrame(t):(x.current=!1,h.current=new Map,y.current=new Set,k.current="",b.current=new Map,p.current=new Map,v.current=null,F())};v.current=requestAnimationFrame(t)}!A&&r&&(h.current=new Map,y.current=new Set,k.current="")}},[e,t,F]),A.useEffect(()=>{if(!t||x.current||!e)return;const A=[...r,...n],i=A.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),a=0===y.current.size,o=""!==k.current&&k.current!==i;if(!a&&!o)return void F();const s=[],l=[];for(const{edge:e}of A)y.current.has(e.key)?l.push(e.key):s.push(e.key);o&&l.length>0&&(b.current=new Map(C.current),m.current=0),p.current=new Map;for(const{edge:e}of r){const A=lA(e.certainCount);p.current.set(e.key,A)}for(const e of s)h.current.set(e,0);for(const e of l)h.current.has(e)||h.current.set(e,1);if(s.length>0||o&&l.length>0){let A=null;const e=Math.min(100,gA/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/gA,1);m.current=ce(A)}F();const i=gA+(s.length-1)*e;v.current=n{v.current&&(cancelAnimationFrame(v.current),v.current=null)}},[e,t,r,n,i,F]),A.useEffect(()=>{if(!e||!g)return;const A=()=>{const A=e.getSource(g);if(!A)return!1;if(d.length>0){const e=de(d);A.setData(e)}else A.setData({type:"FeatureCollection",features:[]});return!0};if(A())return;const t=r=>{r.sourceId===g&&A()&&e.off("sourcedata",t)};e.on("sourcedata",t);const r=()=>{A()&&(e.off("styledata",r),e.off("sourcedata",t))};return e.on("styledata",r),()=>{e.off("sourcedata",t),e.off("styledata",r)}},[e,g,d]),{isExiting:x.current,resetAnimationState:T,weightAnimProgress:m.current,animStartWeights:b.current,animTargetWeights:p.current}}({map:ZA,showTopology:y,validatedPolylines:GA,weakPolylines:OA,maxCertainCount:VA,loopEdgeKeys:YA,backboneEdgeKeys:WA,highlightedEdgeKey:s,neighbors:e,validatedSourceId:Fe,weakSourceId:Te,neighborPolylines:UA,showNeighborLines:C,neighborSourceId:Ie}),XA=A.useMemo(()=>{const A=new Set;for(const e of d.hubNodes){A.add(e);for(const t of d.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[d.hubNodes,d.validatedEdges]),qA=A.useMemo(()=>{const A=new Set;if(!n)return A;for(const e of d.validatedEdges)e.fromHash===n&&A.add(e.toHash),e.toHash===n&&A.add(e.fromHash);return A},[n,d.validatedEdges]),{getNodeOpacity:$A}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:i,localConnectedNodes:a,showTopology:o}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),d=A.useRef(new Map),f=A.useRef(null),g=A.useRef(n),h=A.useRef(i),m=A.useRef(a),b=A.useRef(o);return A.useEffect(()=>{g.current=n,h.current=i,m.current=a,b.current=o},[n,i,a,o]),A.useEffect(()=>{const A=c.current,n=u.current,i=e,a=t;if(c.current=e,u.current=t,A===i&&n===a)return;f.current&&(cancelAnimationFrame(f.current),f.current=null);const o=g.current,s=h.current,p=m.current,x=b.current;for(const e of r)d.current.has(e)||d.current.set(e,Math.random());const v=(A,e,t)=>{const r=o.has(A),n=s.has(A),i=x&&p.has(A);return!e&&!t||(e&&t?r||n||i:t?r:!e||n||i)},w=[];for(const e of r){const t=v(e,A,n),r=v(e,i,a);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:i}of y){const a=250*(d.current.get(r)??0),o=Math.max(0,e-a),s=Math.min(o/500,1),l=n+(i-n)*fe(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:P,soloHubs:F,neighborHashes:TA.map(([A])=>A),hubConnectedNodes:XA,directNodeSet:RA,localConnectedNodes:qA,showTopology:y}),Ae=A.useCallback(A=>{if(!P&&!F)return!0;if(P)return RA.has(A);if(F){if(d.hubNodes.includes(A))return!0;for(const e of d.validatedEdges){if(e.fromHash===A&&d.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&d.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[P,F,RA,d.hubNodes,d.validatedEdges]),ee=A.useCallback(async()=>{fA(!0),oA(!0),cA("fetching"),mA(0),await f(),mA(h.packetCount),cA("analyzing"),await new Promise(A=>setTimeout(A,200)),cA("building");const A=Date.now(),e=Date.now()-A;e<1700&&await new Promise(A=>setTimeout(A,1700-e)),cA("complete"),await new Promise(A=>setTimeout(A,1e3)),oA(!1),fA(!1),KA(),setTimeout(()=>{k(!0)},150)},[f,KA,h.packetCount]),te=A.useCallback(A=>{x(A.viewState)},[]),re=A.useCallback(()=>{w(A=>!A)},[]),ie=A.useCallback(()=>{k(A=>!A)},[]),ae=A.useCallback(()=>{S(A=>!A)},[]),se=A.useCallback(()=>{T(A=>!A)},[]),le=A.useCallback(()=>{B(A=>!A)},[]),ge=A.useCallback(()=>{E(A=>!A)},[]),he=A.useCallback(()=>{Q(A=>!A)},[]),me=A.useCallback(()=>{j(A=>{const e=!A;if(u.current){const A=u.current.getMap();A&&A.stop()}if(e&&u.current){const A=u.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:A=>1-Math.pow(1-A,3)})}if(!e&&u.current){const A=u.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:A=>1-Math.pow(1-A,2)})}return e})},[]),be=A.useCallback(()=>{y||k(!0)},[y]),pe=A.useCallback((A,e)=>{rA(A),iA(e)},[]),xe=A.useCallback(()=>{tA&&i&&i(tA),rA(null),iA("")},[tA,i]),ve=A.useMemo(()=>[...ze],[]),we=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=A.features[0],n=null==(e=r.layer)?void 0:e.id,i=r.properties;if(!(null==i?void 0:i.key))return;const a=null==n?void 0:n.startsWith("topology-"),o=null==n?void 0:n.startsWith("neighbor-");if(a||o){const e=i.key.replace(/-loop[12]$/,"");R(e),A.lngLat&&PA({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:a?"topology":"neighbor",properties:i})}try{(null==(t=u.current)?void 0:t.getCanvas())&&(u.current.getCanvas().style.cursor="pointer")}catch{}},[]),ye=A.useCallback(()=>{var A;R(null),PA(null);try{(null==(A=u.current)?void 0:A.getCanvas())&&(u.current.getCanvas().style.cursor="")}catch{}},[]),ke=v?"map-container-fullscreen":"map-container-16-9";return t.jsxs("div",{className:`relative ${ke}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions",children:[t.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."}),t.jsx("div",{className:"relative w-full h-full "+(v?"":"rounded-[1.125rem] overflow-hidden"),children:t.jsxs(G,{ref:u,...p,onMove:te,mapStyle:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:ve,onMouseMove:we,onMouseLeave:ye,onLoad:A=>{const e=A.target;try{const A=e.getStyle();if(null==A?void 0:A.layers){const t=["road","highway","tunnel","bridge","motorway","trunk","primary","secondary","tertiary","street","path","track"],r=A=>t.some(e=>A.toLowerCase().includes(e));for(const n of A.layers)"fill"===n.type&&n.id.toLowerCase().includes("water")&&e.setPaintProperty(n.id,"fill-color","rgba(22, 26, 32, 1)"),"line"===n.type&&r(n.id)&&e.setPaintProperty(n.id,"line-color","rgba(25, 26, 29, 1)"),"symbol"===n.type&&(e.setPaintProperty(n.id,"text-color","rgba(108, 110, 120, 0.85)"),e.setPaintProperty(n.id,"text-halo-color","rgba(8, 9, 11, 0.9)"),e.setPaintProperty(n.id,"text-halo-width",1),e.setLayoutProperty(n.id,"text-font",["Inter","Open Sans Regular","Arial Unicode MS Regular"]))}}catch(t){}},onError:A=>{},children:[t.jsx(O,{position:"top-left",style:{marginTop:"1rem",marginLeft:"1rem"}}),t.jsx(U,{position:"bottom-right"}),t.jsx(oe,{enabled:N,exaggeration:2}),t.jsx(ne,{coveragePoints:CA,visible:CA.length>0&&BA,terrainEnabled:N,brightness:DA}),t.jsx(Ge,{positions:IA}),t.jsx(He,{showTopology:y,isExiting:JA,hoveredEdgeKey:_,onEdgeHover:FA,opacityBias:H,widthMultiplier:W,trafficFilter:Z,showNeighborLines:C}),t.jsx(Se,{children:null}),a&&t.jsx(Oe,{targetHash:a,nodeCoordinates:LA,onComplete:o}),s&&t.jsx(Ue,{highlightedEdgeKey:s,validatedPolylines:GA,weakPolylines:OA,onEnsureTopology:be}),D&&t.jsx(je,{neighborsWithLocation:TA,localNode:r,localHash:n,zeroHopNeighbors:RA,lastHopNeighborMap:_A,meshTopology:d,hoveredMarker:I,onMarkerHover:L,getNodeOpacity:$A,shouldShowNode:Ae,onRequestRemove:i?pe:void 0,openPopupId:bA,onOpenPopup:yA,onClosePopup:kA}),NA&&t.jsx(z,{longitude:NA.longitude,latitude:NA.latitude,anchor:"bottom",offset:[0,-20],closeButton:!1,closeOnClick:!1,maxWidth:"280px",className:"maplibre-popup",children:t.jsx(We,{type:NA.type,properties:NA.properties,maxCertainCount:VA})})]})}),t.jsx(vA,{isDeepLoading:dA,showDeepAnalysisModal:aA,onDeepAnalysis:ee,showTopology:y,onToggleTopology:ie,hasValidatedPolylines:GA.length>0,showNeighborLines:C,onToggleNeighborLines:le,hasNeighborPolylines:UA.length>0,showNodes:D,onToggleNodes:ge,soloHubs:F,onToggleSoloHubs:se,hasHubNodes:d.hubNodes.length>0,soloDirect:P,onToggleSoloDirect:ae,hasZeroHopNeighbors:RA.size>0,showCoverage:M,onToggleCoverage:he,show3DTerrain:N,onToggle3DTerrain:me,isFullscreen:v,onToggleFullscreen:re,edgeOpacityBias:H,onEdgeOpacityBiasChange:Y,edgeWidthMultiplier:W,onEdgeWidthMultiplierChange:V,edgeTrafficFilter:Z,onEdgeTrafficFilterChange:eA}),t.jsxs("div",{className:"map-legend-stack",children:[t.jsx(wA,{isActive:CA.length>0&&BA,onClick:EA}),t.jsx(pA,{showTopology:y,validatedPolylineCount:GA.length,filteredNeighborCount:TA.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:d,zeroHopNeighbors:RA,neighborsWithLocation:TA})]}),!v&&t.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),t.jsx(AA,{isOpen:null!==tA,onCancel:()=>rA(null),onConfirm:xe,title:"Remove Node?",message:`Remove "${nA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),t.jsx(uA,{isOpen:aA,currentStep:sA,packetCount:hA}),t.jsx(SA,{})]})}export{Ve as default}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-Z0Ee3_4F.js b/frontend/dist/assets/ContactsMapMapLibre-Z0Ee3_4F.js deleted file mode 100644 index 2bf064f4..00000000 --- a/frontend/dist/assets/ContactsMapMapLibre-Z0Ee3_4F.js +++ /dev/null @@ -1 +0,0 @@ -var e,t,n=Object.defineProperty,r=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);import{c as s,j as i,G as o,V as a,Y as A,B as l,I as c,ad as u,X as h,_ as d,aC as f,aD as p,g,aE as m}from"./index-CLi6xczL.js";import{b as _,g as b,c as v,r as y}from"./recharts-bmHCCfxU.js";import{u as w,b as x,P as E,a as T,N as S,S as C}from"./maplibre-gl-haoA4z5Y.js";import{T as k,C as R}from"./ConfirmModal-6N9orQPe.js";import{a as P,C as I}from"./triangle-alert-CtfeX3hX.js";import{G as M,M as L,E as N,N as B}from"./CollisionExplorerModal-ChC6YKo5.js";import{L as D}from"./loader-circle-BiSCrAz6.js";import{g as O,e as F,f as U,h as j}from"./useThemeColors-aZ327gx7.js";import{P as G,N as z,T as V}from"./Contacts-DpMrjG_C.js";import{I as W}from"./info-D-OJbIcP.js";import{H}from"./house-Br0ddgCN.js";import{R as $}from"./refresh-cw-BPBhhAzK.js";import{M as X}from"./map-pin-BHxLBGAv.js";import{M as Q}from"./map-Dkyc42DP.js";import{E as Y}from"./external-link-BG6kqAP_.js";import"./maplibre-gl-CFO9X1Ek.js";import"./leaflet-ClE6qLuu.js";import"./SignalIndicator-C9Bb21cj.js";import"./zap-BMeccDbl.js";import"./activity-BG2a6SBG.js";import"./trending-up-C2PPgLZS.js";import"./HashBadge-Ds68z9zP.js";import"./users-Bu-DfKmx.js";import"./PageLayout-BXoaut2N.js";const q=s("arrow-down-up",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]),K=s("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]),Z=s("chart-no-axes-column",[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]]),J=s("chevrons-left-right-ellipsis",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"m17 7 5 5-5 5",key:"1xlxn0"}],["path",{d:"m7 7-5 5 5 5",key:"19njba"}],["path",{d:"M8 12h.01",key:"czm47f"}]]),ee=s("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),te=s("contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]),ne=s("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),re=s("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),se=s("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),ie=s("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),oe=s("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),ae=s("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),Ae=s("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),le=s("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),ce=s("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),ue=s("triangle-right",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]),he=s("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);function de(e,t){const n=Math.max(5,Math.min(e,300)),r=Math.log(5),s=Math.log(300);return 1+(Math.log(n)-r)/(s-r)*5}function fe({label:e,icon:t,status:n,detail:r}){return i.jsxs("div",{className:v("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-success/10","pending"===n&&"opacity-40"),children:[i.jsx("div",{className:v("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-success/20","pending"===n&&"bg-white/5"),children:"complete"===n?i.jsx(P,{className:"w-4 h-4 text-accent-success"}):"active"===n?i.jsx(D,{className:"w-4 h-4 animate-spin text-accent-primary"}):i.jsx("span",{className:"text-text-muted",children:t})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:v("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-success","pending"===n&&"text-text-muted"),children:e}),r&&"pending"!==n&&i.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:r})]})]})}const pe=_.memo(function({isOpen:e,currentStep:t,packetCount:n,onClose:r}){if(_.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r&&r()};window.addEventListener("keydown",t);const n=document.body.style.overflow,s=document.body.style.position,i=document.body.style.width,o=document.body.style.top,a=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${a}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=n,document.body.style.position=s,document.body.style.width=i,document.body.style.top=o,window.scrollTo(0,a)}},[e,r]),!e)return null;const s="complete"===t,a=e=>{const n=["fetching","analyzing","building","discovering","complete"],r=n.indexOf(t),s=n.indexOf(e);return s0?`${n.toLocaleString()} packets`:"Loading database..."}),i.jsx(fe,{label:"Analyzing Database",icon:i.jsx(ne,{className:"w-4 h-4"}),status:a("analyzing"),detail:"Processing packet paths"}),i.jsx(fe,{label:"Building Topology",icon:i.jsx(M,{className:"w-4 h-4"}),status:a("building"),detail:"Computing mesh edges"}),i.jsx(fe,{label:"Discovering Nodes",icon:i.jsx(o,{className:"w-4 h-4"}),status:a("discovering"),detail:"Viterbi HMM ghost detection"})]}),i.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})]}),document.body)}),ge={nodeFill:"#F5F5F0",nodeStroke:"#4A5568",localColor:"#FBBF24",hubColor:"#8B7BAD",mobileColor:"#F97316",roomServerColor:"#E17899",neighborColor:"#FBBF24",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24"},edgeOpacity:.82},me=2e3;function _e({text:e}){return i.jsxs("span",{className:"group relative cursor-help",children:[i.jsx(W,{className:"w-3 h-3 text-text-muted"}),i.jsx("div",{className:"absolute bottom-full left-0 mb-1 hidden group-hover:block w-44 p-2 text-[10px] leading-tight rounded-lg z-10 bg-tooltip-bg border border-border-subtle",children:e})]})}function be(e){const t=new Date(1e3*e);return`${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getDate().toString().padStart(2,"0")}`}function ve({hash:e,hashPrefix:t,name:n,isHub:r,isZeroHop:s,isMobile:o,isRoomServer:l,isStale:c,lastSeenTimestamp:u,centrality:h,affinity:d,meanSnr:f,meanRssi:p,neighbor:g,onRemove:m,txDelayRec:b,onPingResult:v}){const[y,w]=_.useState(!1),[x,E]=_.useState(!1),[T,S]=_.useState(null),[C,R]=_.useState(null),M=_.useCallback(async()=>{if(!x){E(!0),R(null),S(null);try{const t=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,n=await a(t,30);n.success&&n.data?(S(n.data),null==v||v(n.data)):R(n.error||"Ping failed")}catch(t){R(t instanceof Error?t.message:"Ping failed")}finally{E(!1)}}},[e,x,v]),L=s?"Direct":(null==d?void 0:d.typicalHopPosition)?`${d.typicalHopPosition}-hop`:null,N=[{label:"Packets",value:(null==d?void 0:d.frequency)||0},{label:"Adverts",value:g.advert_count||0}];s&&void 0!==f&&N.push({label:"SNR",value:`${f.toFixed(1)} dB`}),s&&void 0!==p&&N.push({label:"RSSI",value:`${Math.round(p)} dBm`});const B=b&&!b.insufficientData,O={hub:{bg:"bg-amber-500/20",text:"text-amber-400",title:"Hub: High-connectivity node (4+ neighbors) that bridges many paths"},backbone:{bg:"bg-purple-500/20",text:"text-purple-400",title:"Backbone: Critical relay with 4+ neighbors and high traffic"},relay:{bg:"bg-cyan-500/20",text:"text-cyan-400",title:"Relay: Standard forwarding node with symmetric traffic"},edge:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Edge: Peripheral node with few connections"}},F={high:{bg:"bg-green-500/20",text:"text-green-400",title:"1000+ packets observed"},medium:{bg:"bg-amber-500/20",text:"text-amber-400",title:"500-999 packets observed"},low:{bg:"bg-red-500/20",text:"text-red-400",title:"100-499 packets observed"},insufficient:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Insufficient data for analysis"}};return i.jsxs("div",{className:"w-[220px] pr-3",children:[i.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-snug truncate mb-0.5",children:n}),i.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[i.jsx("code",{className:"font-mono text-[10px] text-text-muted/70 bg-white/5 px-1 py-px rounded",children:t}),i.jsx("button",{onClick:()=>{navigator.clipboard.writeText(e),w(!0),setTimeout(()=>w(!1),1500)},className:"p-0.5 hover:bg-white/10 rounded transition-colors",title:"Copy full hash",children:y?i.jsx(P,{className:"w-2.5 h-2.5 text-accent-success"}):i.jsx(I,{className:"w-2.5 h-2.5 text-text-muted/50"})}),i.jsx(G,{hash:e,size:"sm"}),r&&i.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded",style:{backgroundColor:"#FBBF24",color:"#000"},children:"Hub"}),L&&i.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded "+(s?"bg-map-neighbor-color text-black":"bg-white/[0.08] text-white/50"),children:L}),o&&i.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-orange-500/25 text-orange-300",children:"Mobile"}),g.is_repeater&&i.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-cyan-500/20 text-cyan-400",children:"Rptr"}),l&&i.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-amber-500/25 text-amber-400",children:"Room"}),c&&u&&i.jsxs("span",{className:"px-1 py-px text-[8px] font-medium rounded bg-gray-500/30 text-gray-300",title:"Neighbor not heard in 7+ days",children:["Idle ",be(u)]})]}),i.jsxs("div",{className:"text-[10px] text-text-muted/60 mb-2 leading-tight",children:[i.jsx("span",{children:A(g.last_seen)}),(null==d?void 0:d.distanceMeters)&&i.jsxs("span",{className:"font-medium text-text-muted/80",children:[" · ",(U=d.distanceMeters,null===U?"—":U<1e3?`${Math.round(U)}m`:`${(U/1e3).toFixed(1)}km`)]}),g.latitude&&g.longitude&&0!==g.latitude&&0!==g.longitude&&i.jsxs("span",{className:"font-mono text-[9px]",children:[" · ",g.latitude.toFixed(4),", ",g.longitude.toFixed(4)]})]}),i.jsx("div",{className:"mb-2",style:{width:200},children:i.jsx(z,{nodeHash:e,width:200,height:28,showArea:!0,showTooltip:!0})}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 text-[11px] mb-2",children:[N.map((e,t)=>i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-text-muted/50",children:e.label}),i.jsx("span",{className:"font-semibold tabular-nums "+("highlight"in e&&e.highlight?"text-amber-400":""),children:e.value})]},t)),B&&b.networkRole&&i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center justify-between col-span-2 mt-1 pt-1 border-t border-white/5",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-text-muted/50",children:"Role"}),i.jsx("span",{className:`px-1.5 py-px text-[8px] font-bold uppercase rounded ${O[b.networkRole].bg} ${O[b.networkRole].text}`,title:O[b.networkRole].title,children:b.networkRole})]}),b.dataConfidence&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-text-muted/50",children:"Data"}),i.jsx("span",{className:`px-1.5 py-px text-[8px] font-bold uppercase rounded ${F[b.dataConfidence].bg} ${F[b.dataConfidence].text}`,title:F[b.dataConfidence].title,children:b.dataConfidence})]})]})})]}),(B||m)&&i.jsxs("div",{className:"pt-1.5 border-t border-white/5",children:[B&&i.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[i.jsx("span",{className:"text-text-muted/50",children:"TX Delay"}),i.jsxs("span",{className:"font-semibold tabular-nums text-amber-400",children:["×",(b.floodFactor??b.txDelayFactor).toFixed(1)]}),i.jsx("span",{className:"text-text-muted/30",children:"flood"}),i.jsxs("span",{className:"font-semibold tabular-nums text-amber-400",children:["×",(b.directFactor??b.directTxDelayFactor).toFixed(1)]}),i.jsx("span",{className:"text-text-muted/30",children:"direct"})]}),i.jsxs("div",{className:"flex items-center justify-between "+(B?"mt-1.5":""),children:[s&&i.jsxs("button",{onClick:M,disabled:x,className:"flex items-center gap-1 px-1.5 py-1 text-[10px] text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:[x?i.jsx(D,{className:"w-3 h-3 animate-spin"}):i.jsx(V,{className:"w-3 h-3"}),i.jsx("span",{children:"Ping"})]}),!s&&i.jsx("div",{}),m&&i.jsx("button",{onClick:m,className:"flex items-center gap-0.5 p-1 text-[10px] text-text-muted/30 hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:i.jsx(k,{className:"w-3 h-3"})})]}),T&&i.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-white/5 text-[10px]",children:[i.jsxs("div",{className:"flex items-center gap-2 text-accent-success",children:[i.jsx(P,{className:"w-3 h-3"}),i.jsx("span",{className:"font-medium",children:"Ping successful"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-0.5 mt-1",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-text-muted/50",children:"RTT"}),i.jsxs("span",{className:"font-semibold tabular-nums",children:[T.rtt_ms.toFixed(0),"ms"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-text-muted/50",children:"SNR"}),i.jsxs("span",{className:"font-semibold tabular-nums",children:[T.snr_db.toFixed(1)," dB"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-text-muted/50",children:"RSSI"}),i.jsxs("span",{className:"font-semibold tabular-nums",children:[T.rssi," dBm"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-text-muted/50",children:"Hops"}),i.jsx("span",{className:"font-semibold tabular-nums",children:T.path.length})]})]})]}),C&&i.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/5 text-[10px] text-red-400",children:i.jsxs("span",{children:["⚠ ",C]})})]})]});var U}function ye({showTopology:e,validatedPolylineCount:t,filteredNeighborCount:n,hasLocalNode:r,meshTopology:s,zeroHopNeighbors:a,neighborsWithLocation:A}){const u=U(),h=l(),d=c(),f=h.filter(e=>e.isLikelyReal).length;return i.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[i.jsxs("div",{className:"text-text-secondary font-medium mb-1.5 flex items-center gap-1",children:["Nodes",i.jsx(_e,{text:"Node type shown by shape. Yellow = direct RF neighbor."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:u.nodeFill}}),i.jsx("span",{className:"text-text-muted",children:"Node"}),i.jsx(_e,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:u.hubColor}}),i.jsx("span",{className:"text-text-muted",children:"Hub"}),i.jsx(_e,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(p=A,p.some(([,e])=>{var t;const n=null==(t=e.contact_type)?void 0:t.toLowerCase();return"room server"===n||"room_server"===n||"room"===n||"server"===n})&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(L,{className:"w-3 h-3 flex-shrink-0",style:{color:u.roomColor},strokeWidth:2.5}),i.jsx("span",{className:"text-text-muted",children:"Room"}),i.jsx(_e,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(H,{className:"w-3 h-3 flex-shrink-0",style:{color:u.localColor},strokeWidth:2.5}),i.jsx("span",{className:"text-text-muted",children:"Local"}),i.jsx(_e,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),a.size>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"rounded flex-shrink-0",style:{width:"12px",height:"8px",backgroundColor:u.neighborColor}}),i.jsx("span",{className:"text-text-muted",children:"Neighbor"}),i.jsx(_e,{text:"Zero-hop direct RF contact. Color indicates we receive their ADVERTs directly."})]}),s.gatewayNodes.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:u.hubColor,opacity:.7}}),i.jsx("span",{className:"text-text-muted",children:"Gateway"}),i.jsx(_e,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),s.mobileNodes.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",background:"transparent",border:`4px solid ${u.mobileColor}`,boxSizing:"border-box"}}),i.jsx("span",{className:"text-text-muted",children:"Mobile"}),i.jsx(_e,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),f>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(o,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-tertiary)"},strokeWidth:2.5}),i.jsxs("span",{className:"text-text-muted",children:["Ghost (",f,")"]}),i.jsx(_e,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]}),a.size>0&&i.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"flex-shrink-0",style:{width:"14px",height:"2px",backgroundImage:`repeating-linear-gradient(90deg, ${ge.edges.neighborRest} 0, ${ge.edges.neighborRest} 3px, transparent 3px, transparent 5px)`,borderRadius:"1px"}}),i.jsx("span",{className:"text-text-muted",children:"Neighbor"}),i.jsx(_e,{text:"Dashed gray → yellow on hover. Direct RF contact with local."})]})}),e&&t>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-text-secondary font-medium mt-2 pt-2 border-t border-white/10 mb-1 flex items-center gap-1",children:["Topology",i.jsx(_e,{text:"Links with 5+ validations. Thickness = relative strength."})]}),i.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted",children:[i.jsxs("div",{className:"flex justify-between tabular-nums",children:[i.jsx("span",{children:"Nodes"}),i.jsx("span",{className:"text-text-secondary",children:n+(r?1:0)})]}),i.jsxs("div",{className:"flex justify-between tabular-nums",children:[i.jsx("span",{children:"Links"}),i.jsx("span",{className:"text-text-secondary",children:t})]}),s.hubNodes.length>0&&i.jsxs("div",{className:"flex justify-between tabular-nums",children:[i.jsx("span",{children:"Hubs"}),i.jsx("span",{style:{color:ge.hubColor},children:s.hubNodes.length})]})]}),i.jsx("div",{className:"flex flex-col gap-1 mt-1.5 pt-1.5 border-t border-white/10",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"flex-shrink-0",style:{width:"14px",height:"3px",backgroundColor:ge.edges.rest,borderRadius:"1px"}}),i.jsx("span",{className:"text-text-muted",children:"Link"}),i.jsx(_e,{text:"Gray at rest. Hover to reveal type (teal=direct, indigo=loop)."})]})}),s.loops.length>0&&i.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx($,{className:"w-3 h-3 flex-shrink-0",style:{color:ge.edges.hoverLoop}}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("span",{style:{color:ge.edges.hoverLoop},className:"font-medium",children:[s.loops.length," ",1===s.loops.length?"Loop":"Loops"]}),i.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),d.totalPaths>0&&i.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(N,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-primary)"}}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("span",{style:{color:"var(--accent-primary)"},className:"font-medium",children:[d.totalPaths.toLocaleString()," Viterbi"]}),i.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})]});var p}const we="rgba(251, 191, 36, 0.2)";function xe({isDeepLoading:e,showDeepAnalysisModal:t,onDeepAnalysis:n,showTopology:r,onToggleTopology:s,hasValidatedPolylines:o,showNeighborLines:a,onToggleNeighborLines:A,hasNeighborPolylines:l,showNodes:c,onToggleNodes:u,soloHubs:h,onToggleSoloHubs:d,hasHubNodes:f,soloDirect:p,onToggleSoloDirect:g,hasZeroHopNeighbors:m,showCoverage:_,onToggleCoverage:b,show3DTerrain:v,onToggle3DTerrain:y,isFullscreen:w,onToggleFullscreen:x,edgeOpacityBias:E=.5,onEdgeOpacityBiasChange:T,edgeWidthMultiplier:S=1,onEdgeWidthMultiplierChange:C,edgeTrafficFilter:k=0,onEdgeTrafficFilterChange:R}){const P=r&&o&&T&&C&&R;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 right-3 z-[600] map-controls-container sm:top-4 sm:right-4",children:[i.jsxs("div",{className:"map-controls-row map-controls-primary",children:[i.jsxs("button",{onClick:n,disabled:e||t,className:"map-control-glass px-2.5 py-1.5 sm:px-3 sm:py-2 flex items-center gap-1.5 sm:gap-2 transition-colors hover:bg-white/10 disabled:opacity-50 disabled:cursor-not-allowed",title:"Deep Analysis - Load full packet history and rebuild topology","aria-label":"Deep Analysis",children:[i.jsx("span",{className:"map-control-label text-xs font-medium text-text-primary",children:"Deep Analysis"}),i.jsx(Z,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-primary"})]}),o&&i.jsx("button",{onClick:s,className:"map-control-btn "+(r?"map-control-glass-active":"map-control-glass"),style:r?{backgroundColor:"rgba(74, 222, 128, 0.2)"}:void 0,title:r?"Hide topology lines":"Show topology lines","aria-label":r?"Hide topology":"Show topology","aria-pressed":r,children:r?i.jsx(M,{className:"map-control-icon text-green-400"}):i.jsx(se,{className:"map-control-icon text-text-secondary"})})]}),P&&i.jsx("div",{className:"map-controls-row map-controls-sliders",children:i.jsxs("div",{className:"map-control-glass map-sliders-panel",children:[i.jsxs("div",{className:"map-slider-group",title:"Contrast - dim edges below brightness threshold",children:[i.jsx(te,{className:"map-slider-icon "+(E>.5?"text-purple-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"0",max:"95",value:100*E,onChange:e=>T(Number(e.target.value)/100),className:"map-slider","aria-label":"Edge contrast"})]}),i.jsxs("div",{className:"map-slider-group",title:"Traffic filter - "+(0===k?"All edges":`Top ${Math.round(100*(1-k))}%`),children:[i.jsx(ie,{className:"map-slider-icon "+(k<.1?"text-green-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"0",max:"95",value:100*k,onChange:e=>R(Number(e.target.value)/100),className:"map-slider","aria-label":"Traffic filter"}),i.jsx(q,{className:"map-slider-icon "+(k>.8?"text-amber-400":"text-text-muted")})]}),i.jsxs("div",{className:"map-slider-group",title:"Thickness - edge line width",children:[i.jsx(ue,{className:"map-slider-icon "+(S>1?"text-blue-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"25",max:"200",value:100*S,onChange:e=>C(Number(e.target.value)/100),className:"map-slider","aria-label":"Edge thickness"})]})]})}),i.jsxs("div",{className:"map-controls-row map-controls-secondary",children:[l&&i.jsx("button",{onClick:A,className:"map-control-btn "+(a?"map-control-glass-active":"map-control-glass"),style:a?{backgroundColor:we}:void 0,title:a?"Hide neighbor lines":"Show neighbor lines","aria-label":a?"Hide neighbor lines":"Show neighbor lines","aria-pressed":a,children:i.jsx(he,{className:"map-control-icon "+(a?"text-amber-400":"text-text-secondary")})}),i.jsx("button",{onClick:u,className:"map-control-btn "+(c?"map-control-glass-active":"map-control-glass"),style:c?{backgroundColor:"rgba(99, 102, 241, 0.2)"}:void 0,title:c?"Hide all nodes":"Show all nodes","aria-label":c?"Hide nodes":"Show nodes","aria-pressed":c,children:c?i.jsx(X,{className:"map-control-icon text-indigo-400"}):i.jsx(se,{className:"map-control-icon text-text-secondary"})}),f&&i.jsx("button",{onClick:d,className:"map-control-btn "+(h?"map-control-glass-active":"map-control-glass"),style:h?{backgroundColor:we}:void 0,title:h?"Show all nodes":"Solo hubs & connections","aria-label":h?"Show all nodes":"Solo hubs","aria-pressed":h,children:i.jsx(B,{className:"map-control-icon "+(h?"text-amber-400":"text-text-secondary")})}),m&&i.jsx("button",{onClick:g,className:"map-control-btn "+(p?"map-control-glass-active":"map-control-glass"),style:p?{backgroundColor:"rgba(67, 56, 202, 0.35)"}:void 0,title:p?"Show all nodes":"Solo direct (0-hop) nodes","aria-label":p?"Show all nodes":"Solo direct neighbors","aria-pressed":p,children:i.jsx(J,{className:"map-control-icon "+(p?"text-indigo-400":"text-text-secondary")})}),i.jsx("button",{onClick:y,className:"map-control-btn "+(v?"map-control-glass-active":"map-control-glass"),style:v?{backgroundColor:"rgba(45, 212, 191, 0.2)"}:void 0,title:v?"Disable 3D terrain":"Enable 3D terrain","aria-label":v?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":v,children:i.jsx(le,{className:"map-control-icon "+(v?"text-teal-400":"text-text-secondary")})}),i.jsx("button",{onClick:x,className:"map-control-btn map-control-glass",title:w?"Exit fullscreen":"Fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen","aria-pressed":w,children:w?i.jsx(ae,{className:"map-control-icon text-text-secondary"}):i.jsx(oe,{className:"map-control-icon text-text-secondary"})})]})]}),P&&i.jsx("div",{className:"map-sliders-bottom",children:i.jsxs("div",{className:"map-control-glass map-sliders-panel-vertical",children:[i.jsxs("div",{className:"map-slider-group-vertical",title:"Contrast - dim edges below brightness threshold",children:[i.jsx(te,{className:"map-slider-icon "+(E>.5?"text-purple-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"0",max:"95",value:100*E,onChange:e=>T(Number(e.target.value)/100),className:"map-slider","aria-label":"Edge contrast"})]}),i.jsxs("div",{className:"map-slider-group-vertical",title:"Traffic filter - "+(0===k?"All edges":`Top ${Math.round(100*(1-k))}%`),children:[i.jsx(ie,{className:"map-slider-icon "+(k<.1?"text-green-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"0",max:"95",value:100*k,onChange:e=>R(Number(e.target.value)/100),className:"map-slider","aria-label":"Traffic filter"})]}),i.jsxs("div",{className:"map-slider-group-vertical",title:"Thickness - edge line width",children:[i.jsx(ue,{className:"map-slider-icon "+(S>1?"text-blue-400":"text-text-muted")}),i.jsx("input",{type:"range",min:"25",max:"200",value:100*S,onChange:e=>C(Number(e.target.value)/100),className:"map-slider","aria-label":"Edge thickness"})]})]})})]})}function Ee({isActive:e,onClick:t,brightness:n=.7,onBrightnessChange:r}){const s=Math.max(.01,Math.min(1,n)),o=s<.999,a=s>.011;return i.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full text-left transition-colors hover:bg-white/5 "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",...e?{backgroundColor:"rgba(245, 158, 11, 0.15)"}:{}},title:e?"Configure wardriving coverage":"Show wardriving coverage",children:[i.jsx(K,{className:"w-3.5 h-3.5 flex-shrink-0 "+(e?"text-amber-400":"text-text-secondary")}),i.jsx("span",{className:"text-xs font-medium "+(e?"text-amber-400":"text-text-secondary"),children:"Wardrive"}),e&&r&&i.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[i.jsx("button",{onClick:e=>{e.stopPropagation();const t=Math.max(.01,s-.2);null==r||r(t)},disabled:!a,className:"p-0.5 rounded transition-colors "+(a?"hover:bg-white/10 text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*s)}%)`,children:i.jsx(Ae,{className:"w-3.5 h-3.5"})}),i.jsx("button",{onClick:e=>{e.stopPropagation();const t=Math.min(1,s+.2);null==r||r(t)},disabled:!o,className:"p-0.5 rounded transition-colors "+(o?"hover:bg-white/10 text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*s)}%)`,children:i.jsx(ce,{className:"w-3.5 h-3.5"})})]})]})}function Te(e){let t=!0,n=-90,r=90,s=-180,i=180;for(const o of e.toLowerCase()){const e="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(o);if(-1!==e)for(let o=4;o>=0;o--){const a=e>>o&1;if(t){const e=(s+i)/2;a?s=e:i=e}else{const e=(n+r)/2;a?n=e:r=e}t=!t}}return{lat:(n+r)/2,lon:(s+i)/2}}function Se(e){return Math.exp(-e*Math.LN2/7)}const Ce="pymc-wardriving-url",ke="pymc-wardriving-enabled",Re="pymc-wardriving-brightness";function Pe(e){"undefined"!=typeof localStorage&&(e?localStorage.setItem(Ce,e):localStorage.removeItem(Ce))}function Ie(e){"undefined"!=typeof localStorage&&localStorage.setItem(ke,String(e))}function Me(){if("undefined"==typeof localStorage)return.7;const e=localStorage.getItem(Re);if(e){const t=parseFloat(e);if(!isNaN(t)&&t>=.01&&t<=1)return t}return.7}function Le(e,t=null){if(null!==e){const n=(Math.max(-12,Math.min(12,e))+12)/24;return null!==t?.8*n+(Math.max(-120,Math.min(-50,t))+120)/70*.2:n}return null!==t?(Math.max(-120,Math.min(-50,t))+120)/70:.5}const Ne=u((e,t)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(ke),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(Ce)||"",brightness:Me(),isModalOpen:!1,openModal:()=>e({isModalOpen:!0}),closeModal:()=>e({isModalOpen:!1}),setUrl:t=>e({url:t}),setBrightness:t=>{const n=Math.max(.01,Math.min(1,t));!function(e){if("undefined"==typeof localStorage)return;const t=Math.max(.01,Math.min(1,e));localStorage.setItem(Re,String(t))}(n),e({brightness:n})},toggleVisibility:()=>{const n=!t().isVisible;Ie(n),e({isVisible:n})},setVisible:t=>{Ie(t),e({isVisible:t})},loadCoverage:async t=>{if(!t.trim())return e({error:"Please enter a URL",status:"error"}),!1;try{new URL(t.trim())}catch{return e({error:"Invalid URL format",status:"error"}),!1}e({error:null,status:"connecting"});try{e({status:"loading"});const n=await async function(e){const t=`${e.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,n=await async function(e,t={},n=8e3){const r=new AbortController,s=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){if(i instanceof Error&&"AbortError"===i.name)throw new Error(`Connection timed out after ${n/1e3}s`);throw i}finally{clearTimeout(s)}}(t,{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to fetch precise samples: ${n.status}`);return n.json()}(t.trim());if(!n||"object"!=typeof n)throw new Error("Invalid response from server");if(!Array.isArray(n.keys))throw new Error("No sample data found in response");e({status:"processing"});const r=function(e){var t;const n=[];for(const r of e.keys){if(!r.observed)continue;const{lat:e,lon:s}=Te(r.hash),i=parseInt(r.time,10),o=isNaN(i)?30:(Date.now()-i)/864e5,a=Se(o),A=Le(r.snr,r.rssi)*(.3+.7*a);n.push({lat:e,lon:s,successRate:r.observed?1:0,weight:A,totalSamples:1,ageDays:o,geohash:r.hash,repeaters:(null==(t=r.path)?void 0:t.map(e=>e.toLowerCase()))||[]})}return n}(n);if(0===r.length)throw new Error("No valid coverage points found");return e({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:t.trim()}),Pe(t.trim()),Ie(!0),!0}catch(n){const t=n instanceof Error?n.message:"Failed to load coverage data";let r=t;return t.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":t.includes("Failed to fetch")||t.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":t.includes("CORS")?r="Server does not allow cross-origin requests.":t.includes("404")?r="Coverage endpoint not found. Check the URL.":(t.includes("ERR_NAME_NOT_RESOLVED")||t.includes("DNS"))&&(r="Server not found. Check the URL for typos."),e({error:r,status:"error"}),!1}},clearCoverage:()=>{e({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),Pe(""),Ie(!1)}}));function Be({status:e}){if("connecting"!==e&&"loading"!==e&&"processing"!==e)return null;const t={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[e];return t?i.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[i.jsx("div",{className:"relative",children:i.jsx(D,{className:"w-5 h-5 text-amber-400 animate-spin"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-amber-400 font-medium",children:t}),i.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all duration-300",style:{width:"connecting"===e?"30%":"loading"===e?"60%":"90%"}})})]})]}):null}function De(){const{isModalOpen:e,closeModal:t,status:n,isVisible:r,stats:s,error:o,url:a,brightness:A,loadCoverage:l,clearCoverage:c,toggleVisibility:u,setUrl:d,setBrightness:f}=Ne(),p="connecting"===n||"loading"===n||"processing"===n,[g,m]=_.useState(a),b=_.useCallback(async()=>{await l(g)},[g,l]),v=_.useCallback(()=>{m(""),c()},[c]),y=_.useCallback(e=>{"Enter"!==e.key||e.shiftKey||p||(e.preventDefault(),b())},[b,p]),w=_.useCallback(e=>{const t=e.target.value;m(t),d(t)},[d]);if(!e)return null;const x=s.coverageCount>0,E=g.trim().length>0&&!p;return i.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:p?void 0:t}),i.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:i.jsx(K,{className:"w-5 h-5 text-amber-400"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),i.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),i.jsx("button",{onClick:t,disabled:p,className:"p-2 rounded-lg hover:bg-white/10 transition-colors disabled:opacity-50",children:i.jsx(h,{className:"w-5 h-5 text-text-secondary"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),i.jsx("input",{type:"url",value:g,onChange:w,onKeyDown:y,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-black/30 border border-border 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:p}),i.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)"})]}),i.jsx(Be,{status:n}),"error"===n&&o&&i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[i.jsx(ee,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),i.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:o})]})]}),"success"===n&&x&&i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[i.jsx(P,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),i.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[s.coverageCount.toLocaleString()," coverage points • ",s.repeaterCount.toLocaleString()," repeaters"]})]})]}),x&&!p&&"success"!==n&&i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[i.jsx(Q,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),i.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[s.coverageCount.toLocaleString()," points •",s.lastUpdated&&` Last updated ${s.lastUpdated.toLocaleTimeString()}`]})]})]}),x&&!p&&i.jsx("div",{className:"p-3 bg-black/20 border border-border-subtle rounded-xl",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ce,{className:"w-4 h-4 flex-shrink-0 "+(A>.5?"text-amber-400":"text-text-muted")}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"text-xs text-text-secondary",children:"Brightness"}),i.jsxs("span",{className:"text-xs text-text-muted font-mono",children:[Math.round(100*A),"%"]})]}),i.jsx("input",{type:"range",min:"1",max:"100",value:100*A,onChange:e=>f(Number(e.target.value)/100),className:"w-full h-1.5 cursor-pointer accent-amber-400"})]})]})})]}),i.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[i.jsx("div",{className:"flex items-center gap-2",children:x&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:u,disabled:p,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-white/5 rounded-lg transition-colors disabled:opacity-50",title:r?"Hide heatmap":"Show heatmap",children:r?i.jsxs(i.Fragment,{children:[i.jsx(se,{className:"w-3.5 h-3.5"})," Hide"]}):i.jsxs(i.Fragment,{children:[i.jsx(N,{className:"w-3.5 h-3.5"})," Show"]})}),i.jsxs("button",{onClick:v,disabled:p,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:[i.jsx(k,{className:"w-3.5 h-3.5"})," Clear"]})]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:t,disabled:p,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-white/10 rounded-lg transition-colors disabled:opacity-50",children:x?"Done":"Cancel"}),i.jsx("button",{onClick:b,disabled:!E,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:p?i.jsxs(i.Fragment,{children:[i.jsx(D,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):x?i.jsxs(i.Fragment,{children:[i.jsx(re,{className:"w-4 h-4"}),"Refresh"]}):i.jsxs(i.Fragment,{children:[i.jsx(Y,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}var Oe=function(e){var t,n=void 0!==(e=e||{})?e:{},r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);var s,i="";"undefined"!=typeof document&&document.currentScript&&(i=document.currentScript.src),i=0!==i.indexOf("blob:")?i.substr(0,i.lastIndexOf("/")+1):"",s=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)t(r.response);else{var s=V(e);s?t(s.buffer):n()}},r.onerror=n,r.send(null)};var o=n.print||function(){}.bind(),a=n.printErr||function(){}.bind();for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t]);r=null,n.arguments&&n.arguments;var A=0,l=!1;function c(e){var t=n["_"+e];return t||ne("Assertion failed: "+("Cannot call unknown function "+e+", make sure it is exported")),t}var u,h,d,f,p,g,m,_="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function b(e,t){return e?function(e,t,n){for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.subarray&&_)return _.decode(e.subarray(t,s));for(var i="";t>10,56320|1023&l)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}(d,e,t):""}function v(e,t){return e%t>0&&(e+=t-e%t),e}function y(e){u=e,n.HEAP8=h=new Int8Array(e),n.HEAP16=f=new Int16Array(e),n.HEAP32=p=new Int32Array(e),n.HEAPU8=d=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=g=new Float32Array(e),n.HEAPF64=m=new Float64Array(e)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var w=n.TOTAL_MEMORY||33554432;function x(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}w=(u=n.buffer?n.buffer:new ArrayBuffer(w)).byteLength,y(u),p[7156]=5271536;var E=[],T=[],S=[],C=[];function k(e){E.unshift(e)}function R(e){C.unshift(e)}var P=Math.abs,I=Math.ceil,M=Math.floor,L=Math.min,N=0,B=null;n.preloadedImages={},n.preloadedAudios={};var D,O,F=null,U="data:application/octet-stream;base64,";function j(e){return String.prototype.startsWith?e.startsWith(U):0===e.indexOf(U)}function G(){return h.length}F="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAA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LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAA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bJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/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/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAA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vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var z="function"==typeof atob?atob:function(e){var t,n,r,s,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",A="",l=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=a.indexOf(e.charAt(l++))<<2|(s=a.indexOf(e.charAt(l++)))>>4,n=(15&s)<<4|(i=a.indexOf(e.charAt(l++)))>>2,r=(3&i)<<6|(o=a.indexOf(e.charAt(l++))),A+=String.fromCharCode(t),64!==i&&(A+=String.fromCharCode(n)),64!==o&&(A+=String.fromCharCode(r))}while(l=0){if((0|n)>13780509){if(0|(a=0|lt(15,A)))break;A=0|s[(l=A)>>2],l=0|s[l+4>>2]}else c=0|Zt(0|n,0|(a=((0|n)<0)<<31>>31),3,0),l=0|T(),a=0|Xt(0|n,0|a,1,0),a=0|Xt(0|(a=0|Zt(0|c,0|l,0|a,0|T())),0|T(),1,0),l=0|T(),s[A>>2]=a,s[A+4>>2]=l,A=a;if(cn(0|r,0,A<<3),0|i){cn(0|i,0,A<<2),a=0|D(e,t,n,r,i,A,l,0);break}(a=0|$t(A,4))?(c=0|D(e,t,n,r,a,A,l,0),Ht(a),a=c):a=13}else a=2}while(0);return M=o,0|a}function B(e,t,n,r,i){e|=0,t|=0,n|=0,r|=0,i|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(a=M,M=M+16|0,g=a+8|0,s[(p=o=a)>>2]=e,s[p+4>>2]=t,(0|n)<0)return M=a,2;if(s[(A=r)>>2]=e,s[A+4>>2]=t,(A=!!(0|i))&&(s[i>>2]=0),0|je(e,t))return M=a,9;s[g>>2]=0;e:do{if((0|n)>=1)if(A)for(d=1,h=0,f=0,p=1,A=e;;){if(!(h|f)){if(0|(A=0|O(A,t,4,g,o)))break e;if(0|je(A=0|s[(t=o)>>2],t=0|s[t+4>>2])){A=9;break e}}if(0|(A=0|O(A,t,0|s[26800+(f<<2)>>2],g,o)))break e;if(A=0|s[(t=o)>>2],t=0|s[t+4>>2],s[(e=r+(d<<3)|0)>>2]=A,s[e+4>>2]=t,s[i+(d<<2)>>2]=p,l=(0|(e=h+1|0))==(0|p),u=6==(0|(c=f+1|0)),0|je(A,t)){A=9;break e}if((0|(p=p+(u&l&1)|0))>(0|n)){A=0;break}d=d+1|0,h=l?0:e,f=l?u?0:c:f}else for(d=1,h=0,f=0,p=1,A=e;;){if(!(h|f)){if(0|(A=0|O(A,t,4,g,o)))break e;if(0|je(A=0|s[(t=o)>>2],t=0|s[t+4>>2])){A=9;break e}}if(0|(A=0|O(A,t,0|s[26800+(f<<2)>>2],g,o)))break e;if(A=0|s[(t=o)>>2],t=0|s[t+4>>2],s[(e=r+(d<<3)|0)>>2]=A,s[e+4>>2]=t,l=(0|(e=h+1|0))==(0|p),u=6==(0|(c=f+1|0)),0|je(A,t)){A=9;break e}if((0|(p=p+(u&l&1)|0))>(0|n)){A=0;break}d=d+1|0,h=l?0:e,f=l?u?0:c:f}else A=0}while(0);return M=a,0|A}function D(e,t,n,r,i,o,a,A){n|=0,r|=0,i|=0,A|=0;var l,c,u,h=0,d=0,f=0,p=0,g=0,m=0,_=0;if(u=M,M=M+16|0,l=u+8|0,c=u,h=0|en(0|(e|=0),0|(t|=0),0|(o|=0),0|(a|=0)),f=0|T(),!(!(0|(_=0|s[(m=p=r+(h<<3)|0)>>2]))&!(0|(m=0|s[m+4>>2]))|(d=(0|_)==(0|e)&(0|m)==(0|t))))do{h=0|Jt(0|(h=0|Xt(0|h,0|f,1,0)),0|T(),0|o,0|a),f=0|T(),d=(0|(m=0|s[(_=p=r+(h<<3)|0)>>2]))==(0|e)&(0|(_=0|s[_+4>>2]))==(0|t)}while(!(!(0|m)&!(0|_)|d));if(h=i+(h<<2)|0,d&&(0|s[h>>2])<=(0|A))return M=u,0;if(s[(_=p)>>2]=e,s[_+4>>2]=t,s[h>>2]=A,(0|A)>=(0|n))return M=u,0;switch(d=A+1|0,s[l>>2]=0,0|(h=0|O(e,t,2,l,c))){case 9:g=9;break;case 0:(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d))||(g=9)}e:do{if(9==(0|g)){switch(s[l>>2]=0,0|(h=0|O(e,t,3,l,c))){case 9:break;case 0:if(0|(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d)))break e;break;default:break e}switch(s[l>>2]=0,0|(h=0|O(e,t,1,l,c))){case 9:break;case 0:if(0|(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d)))break e;break;default:break e}switch(s[l>>2]=0,0|(h=0|O(e,t,5,l,c))){case 9:break;case 0:if(0|(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d)))break e;break;default:break e}switch(s[l>>2]=0,0|(h=0|O(e,t,4,l,c))){case 9:break;case 0:if(0|(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d)))break e;break;default:break e}switch(s[l>>2]=0,0|(h=0|O(e,t,6,l,c))){case 9:break;case 0:if(0|(h=0|D(0|s[(h=c)>>2],0|s[h+4>>2],n,r,i,o,a,d)))break e;break;default:break e}return M=u,0}}while(0);return M=u,0|h}function O(e,t,n,r,i){e|=0,t|=0,i|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0;if((n|=0)>>>0>6)return 1;if(h=(0|s[(r|=0)>>2])%6|0,s[r>>2]=h,(0|h)>0){A=0;do{n=0|be(n),A=A+1|0}while((0|A)<(0|s[r>>2]))}if(h=0|nn(0|e,0|t,45),T(),(a=127&h)>>>0>121)return 5;o=0|Ve(e,t),A=0|nn(0|e,0|t,52),T(),A&=15;e:do{if(A){for(;;){if(c=0|nn(0|e,0|t,0|(l=3*(15-A|0)|0)),T(),7==(0|(c&=7))){t=5;break}if(f=!(0|Qe(A)),A=A+-1|0,d=0|rn(7,0,0|l),t&=~T(),e=0|rn(0|s[(f?432:16)+(28*c|0)+(n<<2)>>2],0,0|l)|e&~d,t|=l=0|T(),!(n=0|s[(f?640:224)+(28*c|0)+(n<<2)>>2])){n=0;break e}if(!A){u=8;break e}}return 0|t}u=8}while(0);8==(0|u)&&(e|=0|rn(0|(f=0|s[848+(28*a|0)+(n<<2)>>2]),0,45),t=T()|-1040385&t,n=0|s[4272+(28*a|0)+(n<<2)>>2],127&~f||(f=0|rn(0|s[848+(28*a|0)+20>>2],0,45),t=T()|-1040385&t,n=0|s[4272+(28*a|0)+20>>2],e=0|He(f|e,t),t=0|T(),s[r>>2]=1+(0|s[r>>2]))),c=0|nn(0|e,0|t,45),T(),c&=127;e:do{if(0|G(c)){t:do{if(1==(0|Ve(e,t))){if((0|a)!=(0|c)){if(0|H(c,0|s[7696+(28*a|0)>>2])){e=0|Xe(e,t),l=1,t=0|T();break}S(27795,26864,533,26872)}switch(0|o){case 3:e=0|He(e,t),t=0|T(),s[r>>2]=1+(0|s[r>>2]),l=0;break t;case 5:e=0|Xe(e,t),t=0|T(),s[r>>2]=5+(0|s[r>>2]),l=0;break t;case 0:return 9;default:return 1}}else l=0}while(0);if((0|n)>0){A=0;do{e=0|We(e,t),t=0|T(),A=A+1|0}while((0|A)!=(0|n))}if((0|a)!=(0|c)){if(!(0|z(c))){if(!!(0|l)|5!=(0|Ve(e,t)))break;s[r>>2]=1+(0|s[r>>2]);break}switch(127&h){case 8:case 118:break e}3!=(0|Ve(e,t))&&(s[r>>2]=1+(0|s[r>>2]))}}else if((0|n)>0){A=0;do{e=0|He(e,t),t=0|T(),A=A+1|0}while((0|A)!=(0|n))}}while(0);return s[r>>2]=((0|s[r>>2])+n|0)%6|0,s[(f=i)>>2]=e,s[f+4>>2]=t,0}function F(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var i,o,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0;if(o=M,M=M+16|0,p=o+8|0,s[(f=i=o)>>2]=e,s[f+4>>2]=t,(0|n)<0)return M=o,2;if(!n)return s[(p=r)>>2]=e,s[p+4>>2]=t,M=o,0;s[p>>2]=0;e:do{if(0|je(e,t))e=9;else{a=0,f=e;do{if(0|(e=0|O(f,t,4,p,i)))break e;if(a=a+1|0,0|je(f=0|s[(t=i)>>2],t=0|s[t+4>>2])){e=9;break e}}while((0|a)<(0|n));s[(d=r)>>2]=f,s[d+4>>2]=t,d=n+-1|0,h=0,e=1;do{if(a=26800+(h<<2)|0,5==(0|h))for(l=0|s[a>>2],A=0,a=e;;){if(0|(e=0|O(0|s[(e=i)>>2],0|s[e+4>>2],l,p,i)))break e;if((0|A)!=(0|d)){if(c=0|s[(u=i)>>2],u=0|s[u+4>>2],s[(e=r+(a<<3)|0)>>2]=c,s[e+4>>2]=u,0|je(c,u)){e=9;break e}e=a+1|0}else e=a;if((0|(A=A+1|0))>=(0|n))break;a=e}else for(l=i,u=0|s[a>>2],c=0,a=e,A=0|s[l>>2],l=0|s[l+4>>2];;){if(0|(e=0|O(A,l,u,p,i)))break e;if(A=0|s[(l=i)>>2],l=0|s[l+4>>2],s[(e=r+(a<<3)|0)>>2]=A,s[e+4>>2]=l,e=a+1|0,0|je(A,l)){e=9;break e}if((0|(c=c+1|0))>=(0|n))break;a=e}h=h+1|0}while(h>>>0<6);e=(0|f)==(0|s[(e=i)>>2])&&(0|t)==(0|s[e+4>>2])?0:9}}while(0);return M=o,0|e}function U(e,t,n,r){n|=0,r|=0;var i,o,a,A=0,l=0;for(a=M,M=M+16|0,i=a,o=a+8|0,A=(A=!(0|je(e|=0,t|=0)))?1:2;;){if(s[o>>2]=0,!(0|O(e,t,A,o,i))&((0|s[(l=i)>>2])==(0|n)?(0|s[l+4>>2])==(0|r):0)){e=4;break}if((A=A+1|0)>>>0>=7){A=7,e=4;break}}return 4==(0|e)?(M=a,0|A):0}function j(e,t,n,r,o,a,A){t|=0,n|=0,r|=0,o|=0,a|=0,A|=0;var l,c,u,h,d,f,p,g,m,_,b=0,v=0,y=0,w=0,x=0,E=0,S=0,C=0,k=0,R=0,P=0,I=0,L=0,N=0,B=0,D=0,O=0,F=0,U=0;if(_=M,M=M+64|0,p=_+48|0,g=_+32|0,m=_+24|0,l=_+8|0,c=_,(0|(v=0|s[(e|=0)>>2]))<=0)return M=_,0;for(u=e+4|0,h=p+8|0,d=g+8|0,f=l+8|0,b=0,L=0;;){I=(y=0|s[u>>2])+(L<<4)|0,s[p>>2]=s[I>>2],s[p+4>>2]=s[I+4>>2],s[p+8>>2]=s[I+8>>2],s[p+12>>2]=s[I+12>>2],(0|L)==(v+-1|0)?(s[g>>2]=s[y>>2],s[g+4>>2]=s[y+4>>2],s[g+8>>2]=s[y+8>>2],s[g+12>>2]=s[y+12>>2]):(I=y+(L+1<<4)|0,s[g>>2]=s[I>>2],s[g+4>>2]=s[I+4>>2],s[g+8>>2]=s[I+8>>2],s[g+12>>2]=s[I+12>>2]),v=0|ne(p,g,r,m);e:do{if(v)y=0,b=v;else if(y=0|s[(v=m)>>2],(0|(v=0|s[v+4>>2]))>0|!(0|v)&y>>>0>0){P=0,I=0;t:for(;;){if(O=1/(+(y>>>0)+4294967296*+(0|v)),U=+i[p>>3],F=+((v=0|Qt(0|y,0|v,0|P,0|I))>>>0)+4294967296*+(0|T()),D=+(P>>>0)+4294967296*+(0|I),i[l>>3]=O*(U*F)+O*(+i[g>>3]*D),i[f>>3]=O*(+i[h>>3]*F)+O*(+i[d>>3]*D),0|(v=0|Ye(l,r,c))){b=v;break}E=0|en(0|(k=0|s[(R=c)>>2]),0|(R=0|s[R+4>>2]),0|t,0|n),w=0|T(),y=0|s[(x=v=A+(E<<3)|0)>>2],x=0|s[x+4>>2];n:do{if(!(0|y)&!(0|x))N=v,B=16;else for(S=0,C=0;;){if((0|S)>(0|n)|(0|S)==(0|n)&C>>>0>t>>>0){b=1;break t}if((0|y)==(0|k)&(0|x)==(0|R))break n;if(E=0|Jt(0|(v=0|Xt(0|E,0|w,1,0)),0|T(),0|t,0|n),w=0|T(),C=0|Xt(0|C,0|S,1,0),S=0|T(),!(0|(y=0|s[(x=v=A+(E<<3)|0)>>2]))&!(0|(x=0|s[x+4>>2]))){N=v,B=16;break}}}while(0);if(16!=(0|B)||(B=0,!(0|k)&!(0|R))||(s[(C=N)>>2]=k,s[C+4>>2]=R,C=a+(s[o>>2]<<3)|0,s[C>>2]=k,s[C+4>>2]=R,C=0|Xt(0|s[(C=o)>>2],0|s[C+4>>2],1,0),k=0|T(),s[(R=o)>>2]=C,s[R+4>>2]=k),P=0|Xt(0|P,0|I,1,0),I=0|T(),y=0|s[(v=m)>>2],!((0|(v=0|s[v+4>>2]))>(0|I)|(0|v)==(0|I)&y>>>0>P>>>0)){y=1;break e}}y=0}else y=1}while(0);if(L=L+1|0,!y){B=21;break}if((0|L)>=(0|(v=0|s[e>>2]))){b=0,B=21;break}}return 21==(0|B)?(M=_,0|b):0}function G(e){return(e|=0)>>>0>121?0|(e=0):0|(e=0|s[7696+(28*e|0)+16>>2])}function z(e){return 4==(0|(e|=0))|117==(0|e)|0}function V(e){return 0|s[11120+(216*(0|s[(e|=0)>>2])|0)+(72*(0|s[e+4>>2])|0)+(24*(0|s[e+8>>2])|0)+(s[e+12>>2]<<3)>>2]}function W(e){return 0|s[11120+(216*(0|s[(e|=0)>>2])|0)+(72*(0|s[e+4>>2])|0)+(24*(0|s[e+8>>2])|0)+(s[e+12>>2]<<3)+4>>2]}function H(e,t){return t|=0,(0|s[7696+(28*(e|=0)|0)+20>>2])==(0|t)?0|(t=1):0|(t=(0|s[7696+(28*e|0)+24>>2])==(0|t))}function $(e,t){return 0|s[848+(28*(e|=0)|0)+((t|=0)<<2)>>2]}function X(e,t){return t|=0,(0|s[848+(28*(e|=0)|0)>>2])==(0|t)?0|(t=0):(0|s[848+(28*e|0)+4>>2])==(0|t)?0|(t=1):(0|s[848+(28*e|0)+8>>2])==(0|t)?0|(t=2):(0|s[848+(28*e|0)+12>>2])==(0|t)?0|(t=3):(0|s[848+(28*e|0)+16>>2])==(0|t)?0|(t=4):(0|s[848+(28*e|0)+20>>2])==(0|t)?0|(t=5):0|((0|s[848+(28*e|0)+24>>2])==(0|t)?6:7)}function Q(e){var t,n,r;return t=(r=+i[16+(e|=0)>>3])-(n=+i[e+24>>3]),+(r>3]<+i[e+24>>3]|0}function q(e){return+(+i[(e|=0)>>3]-+i[e+8>>3])}function K(e,t){e|=0;var n,r,s=0;return(s=+i[(t|=0)>>3])>=+i[e+8>>3]&&s<=+i[e>>3]?(n=+i[e+16>>3],s=+i[e+24>>3],t=(r=+i[t+8>>3])>=s,e=r<=n&1,n>3]<+i[t+8>>3]||+i[e+8>>3]>+i[t>>3]?0|(A=0):(s=(l=+i[e+16>>3])<(u=+i[(n=e+24|0)>>3]),c=(a=+i[(A=t+16|0)>>3])<(o=+i[(r=t+24|0)>>3]),t=u-a>3],t)||(u=+ot(+i[n>>3],e))>+ot(+i[A>>3],t)?0|(c=0):0|(c=1))}function J(e,t){t|=0;var n,r,s,o,a,A=0,l=0,c=0,u=0;return+i[(e|=0)>>3]<+i[t>>3]||+i[e+8>>3]>+i[t+8>>3]?0|(A=0):(s=(o=+i[(A=e+16|0)>>3])<(l=+i[e+24>>3]),c=(u=+i[(n=t+16|0)>>3])<(a=+i[(r=t+24|0)>>3]),t=l-u>3],t)?0|(c=(u=+ot(+i[A>>3],e))>=+ot(+i[n>>3],t)):0|(c=0))}function ee(e,t){e|=0,t|=0;var n,r,o,a,A,l=0;o=M,M=M+176|0,s[(r=o)>>2]=4,l=+i[t>>3],i[r+8>>3]=l,a=+i[t+16>>3],i[r+16>>3]=a,i[r+24>>3]=l,l=+i[t+24>>3],i[r+32>>3]=l,A=+i[t+8>>3],i[r+40>>3]=A,i[r+48>>3]=l,i[r+56>>3]=A,i[r+64>>3]=a,n=96+(t=r+72|0)|0;do{s[t>>2]=0,t=t+4|0}while((0|t)<(0|n));ln(0|e,0|r,168),M=o}function te(e,t,n){e|=0,t|=0,n|=0;var r,a,c,u,h,d,f,p=0,g=0,m=0,_=0,v=0,w=0,x=0;d=M,M=M+288|0,h=d+264|0,_=d+96|0,g=(p=m=d)+96|0;do{s[p>>2]=0,p=p+4|0}while((0|p)<(0|g));return 0|(t=0|et(t,m))?(M=d,0|(w=t)):(Ze(m=0|s[(g=m)>>2],g=0|s[g+4>>2],h),Je(m,g,_),u=+at(h,_+8|0),i[h>>3]=+i[e>>3],i[(g=h+8|0)>>3]=+i[e+16>>3],i[_>>3]=+i[e+8>>3],i[(m=_+8|0)>>3]=+i[e+24>>3],a=+at(h,_),x=+i[g>>3]-+i[m>>3],c=+l(+x),f=+i[h>>3]-+i[_>>3],r=+l(+f),!(0==x|0==f)&&(x=+on(+c,+r),x=+b(+a*a/+an(+x/+an(+c,+r),3)/(u*(2.59807621135*u)*.8)),i[o>>3]=x,v=~~x>>>0,w=+l(x)>=1?x>0?~~+y(+A(x/4294967296),4294967295)>>>0:~~+b((x-+(~~x>>>0))/4294967296)>>>0:0,2146435072&~s[o+4>>2])?(_=!(0|v)&!(0|w),s[(t=n)>>2]=_?1:v,s[t+4>>2]=_?0:w,t=0):t=1,M=d,0|(w=t))}function ne(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var a,c,u,h,d=0,f=0,p=0;h=M,M=M+288|0,c=h+264|0,u=h+96|0,a=(d=f=h)+96|0;do{s[d>>2]=0,d=d+4|0}while((0|d)<(0|a));return 0|(n=0|et(n,f))?(M=h,0|(r=n)):(Ze(d=0|s[(n=f)>>2],n=0|s[n+4>>2],c),Je(d,n,u),p=+at(c,u+8|0),p=+b(+ +at(e,t)/(2*p)),i[o>>3]=p,n=~~p>>>0,d=+l(p)>=1?p>0?~~+y(+A(p/4294967296),4294967295)>>>0:~~+b((p-+(~~p>>>0))/4294967296)>>>0:0,2146435072&~s[o+4>>2]?(f=!(0|n)&!(0|d),s[r>>2]=f?1:n,s[r+4>>2]=f?0:d,M=h,0|(r=0)):(M=h,0|(r=1)))}function re(e,t,n,r){t|=0,n|=0,r|=0,s[(e|=0)>>2]=t,s[e+4>>2]=n,s[e+8>>2]=r}function se(e){var t,n=0,r=0,i=0,o=0,a=0;n=0|s[(e|=0)>>2],r=0|s[(t=e+4|0)>>2],(0|n)<0&&(r=r-n|0,s[t>>2]=r,s[(a=e+8|0)>>2]=(0|s[a>>2])-n,s[e>>2]=0,n=0),(0|r)<0?(n=n-r|0,s[e>>2]=n,o=(0|s[(a=e+8|0)>>2])-r|0,s[a>>2]=o,s[t>>2]=0,r=0):(a=o=e+8|0,o=0|s[o>>2]),(0|o)<0&&(n=n-o|0,s[e>>2]=n,r=r-o|0,s[t>>2]=r,s[a>>2]=0,o=0),(0|(i=(0|o)<(0|(i=(0|r)<(0|n)?r:n))?o:i))<=0||(s[e>>2]=n-i,s[t>>2]=r-i,s[a>>2]=o-i)}function ie(e,t){var n,r;t|=0,r=0|s[8+(e|=0)>>2],n=+((0|s[e+4>>2])-r|0),i[t>>3]=+((0|s[e>>2])-r|0)-.5*n,i[t+8>>3]=.8660254037844386*n}function oe(e,t,n){e|=0,t|=0,s[(n|=0)>>2]=(0|s[t>>2])+(0|s[e>>2]),s[n+4>>2]=(0|s[t+4>>2])+(0|s[e+4>>2]),s[n+8>>2]=(0|s[t+8>>2])+(0|s[e+8>>2])}function ae(e,t,n){e|=0,t|=0,s[(n|=0)>>2]=(0|s[e>>2])-(0|s[t>>2]),s[n+4>>2]=(0|s[e+4>>2])-(0|s[t+4>>2]),s[n+8>>2]=(0|s[e+8>>2])-(0|s[t+8>>2])}function Ae(e,t){t|=0;var n,r=0;r=0|v(0|s[(e|=0)>>2],t),s[e>>2]=r,n=0|v(0|s[(r=e+4|0)>>2],t),s[r>>2]=n,t=0|v(0|s[(e=e+8|0)>>2],t),s[e>>2]=t}function le(e){var t,n,r=0,i=0,o=0,a=0,A=0;A=(0|(n=0|s[(e|=0)>>2]))<0,e=(e=(i=(0|(a=((t=(0|(o=(0|s[e+4>>2])-(A?n:0)|0))<0)?0-o|0:0)+((0|s[e+8>>2])-(A?n:0))|0))<0)?0:a)-((o=(0|(i=(0|e)<(0|(i=(0|(r=(t?0:o)-(i?a:0)|0))<(0|(a=(A?0:n)-(t?o:0)-(i?a:0)|0))?r:a))?e:i))>0)?i:0)|0,r=r-(o?i:0)|0;e:do{switch(a-(o?i:0)|0){case 0:switch(0|r){case 0:return 0|(0|e?1==(0|e)?1:7:0);case 1:return 0|(0|e?1==(0|e)?3:7:2);default:break e}case 1:switch(0|r){case 0:return 0|(0|e?1==(0|e)?5:7:4);case 1:if(e)break e;return 6;default:break e}}}while(0);return 7}function ce(e){var t,n,r=0,i=0,o=0,a=0,A=0,l=0,c=0;if(l=0|s[(n=8+(e|=0)|0)>>2],(t=(0|s[e>>2])-l|0)>>>0>715827881|(l=(0|s[(c=e+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-t|0,A=-2147483648-t|0,(o=(0|t)>0)?(0|a)<(0|t):(0|A)>(0|t))return 1;if(i=t<<1,o?(2147483647-i|0)<(0|t):(-2147483648-i|0)>(0|t))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*t|0,i=l<<1,(o?(0|a)<(0|i):(0|A)>(0|i))||((0|t)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else i=l<<1,r=3*t|0;return o=0|Vt(.14285714285714285*+(r-l|0)),s[e>>2]=o,a=0|Vt(.14285714285714285*+(i+t|0)),s[c>>2]=a,s[n>>2]=0,r=(i=(0|a)<(0|o))?o:a,(0|(i=i?a:o))<0&&((-2147483648==(0|i)||((0|r)>0?(2147483647-r|0)<(0|i):(-2147483648-r|0)>(0|i)))&&S(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|i):(-2147483648^r)<(0|i))&&S(27795,26892,354,26903)),r=a-o|0,(0|o)<0?(i=0-o|0,s[c>>2]=r,s[n>>2]=i,s[e>>2]=0,o=0):(r=a,i=0),(0|r)<0&&(o=o-r|0,s[e>>2]=o,i=i-r|0,s[n>>2]=i,s[c>>2]=0,r=0),A=o-i|0,a=r-i|0,(0|i)<0?(s[e>>2]=A,s[c>>2]=a,s[n>>2]=0,r=a,a=A,i=0):a=o,(0|(o=(0|i)<(0|(o=(0|r)<(0|a)?r:a))?i:o))<=0||(s[e>>2]=a-o,s[c>>2]=r-o,s[n>>2]=i-o),0}function ue(e){var t,n=0,r=0,i=0,o=0,a=0,A=0,l=0;if(o=0|s[(t=8+(e|=0)|0)>>2],(a=(0|s[e>>2])-o|0)>>>0>715827881|(o=(0|s[(A=e+4|0)>>2])-o|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(n=a<<1,(i=(0|o)>0)?(2147483647-o|0)<(0|o):(-2147483648-o|0)>(0|o))return 1;if(l=o<<1,i?(2147483647-l|0)<(0|o):(-2147483648-l|0)>(0|o))return 1;if(r?(2147483647-n|0)<(0|o):(-2147483648-n|0)>(0|o))return 1;if(r=3*o|0,(0|o)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*o|0,n=a<<1;return i=0|Vt(.14285714285714285*+(n+o|0)),s[e>>2]=i,o=0|Vt(.14285714285714285*+(r-a|0)),s[A>>2]=o,s[t>>2]=0,n=(r=(0|o)<(0|i))?i:o,(0|(r=r?o:i))<0&&((-2147483648==(0|r)||((0|n)>0?(2147483647-n|0)<(0|r):(-2147483648-n|0)>(0|r)))&&S(27795,26892,402,26917),((0|n)>-1?(-2147483648|n)>=(0|r):(-2147483648^n)<(0|r))&&S(27795,26892,402,26917)),n=o-i|0,(0|i)<0?(r=0-i|0,s[A>>2]=n,s[t>>2]=r,s[e>>2]=0,i=0):(n=o,r=0),(0|n)<0&&(i=i-n|0,s[e>>2]=i,r=r-n|0,s[t>>2]=r,s[A>>2]=0,n=0),a=i-r|0,o=n-r|0,(0|r)<0?(s[e>>2]=a,s[A>>2]=o,s[t>>2]=0,n=o,o=a,r=0):o=i,(0|(i=(0|r)<(0|(i=(0|n)<(0|o)?n:o))?r:i))<=0||(s[e>>2]=o-i,s[A>>2]=n-i,s[t>>2]=r-i),0}function he(e){var t,n,r=0,i=0,o=0,a=0,A=0;i=0|s[(t=8+(e|=0)|0)>>2],o=0|Vt(.14285714285714285*+((3*(r=(0|s[e>>2])-i|0)|0)-(i=(0|s[(n=e+4|0)>>2])-i|0)|0)),s[e>>2]=o,r=0|Vt(.14285714285714285*+((i<<1)+r|0)),s[n>>2]=r,s[t>>2]=0,i=r-o|0,(0|o)<0?(A=0-o|0,s[n>>2]=i,s[t>>2]=A,s[e>>2]=0,r=i,o=0,i=A):i=0,(0|r)<0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|=0)>>2],a=(i=0|s[(n=e+4|0)>>2])+A|0,A=(o=0|s[(r=e+8|0)>>2])+A|0,s[e>>2]=A,s[n>>2]=a,i=o+i|0,s[r>>2]=i,o=a-A|0,(0|A)<0?(i=i-A|0,s[n>>2]=o,s[r>>2]=i,s[e>>2]=0,a=0):(o=a,a=A),(0|o)<0&&(a=a-o|0,s[e>>2]=a,i=i-o|0,s[r>>2]=i,s[n>>2]=0,o=0),t=a-i|0,A=o-i|0,(0|i)<0?(s[e>>2]=t,s[n>>2]=A,s[r>>2]=0,a=t,i=0):A=o,(0|(o=(0|i)<(0|(o=(0|A)<(0|a)?A:a))?i:o))<=0||(s[e>>2]=a-o,s[n>>2]=A-o,s[r>>2]=i-o)}function _e(e){var t,n,r,i=0,o=0,a=0,A=0;i=0|s[(e|=0)>>2],a=0|s[(n=e+4|0)>>2],o=0|s[(r=e+8|0)>>2],A=a+i|0,s[e>>2]=A,a=o+a|0,s[n>>2]=a,i=o+i|0,s[r>>2]=i,o=a-A|0,(0|A)<0?(i=i-A|0,s[n>>2]=o,s[r>>2]=i,s[e>>2]=0,a=0):(o=a,a=A),(0|o)<0&&(a=a-o|0,s[e>>2]=a,i=i-o|0,s[r>>2]=i,s[n>>2]=0,o=0),t=a-i|0,A=o-i|0,(0|i)<0?(s[e>>2]=t,s[n>>2]=A,s[r>>2]=0,a=t,i=0):A=o,(0|(o=(0|i)<(0|(o=(0|A)<(0|a)?A:a))?i:o))<=0||(s[e>>2]=a-o,s[n>>2]=A-o,s[r>>2]=i-o)}function be(e){switch(0|(e|=0)){case 1:e=5;break;case 5:e=4;break;case 4:e=6;break;case 6:e=2;break;case 2:e=3;break;case 3:e=1}return 0|e}function ve(e){switch(0|(e|=0)){case 1:e=3;break;case 3:e=2;break;case 2:e=6;break;case 6:e=4;break;case 4:e=5;break;case 5:e=1}return 0|e}function ye(e){var t,n,r,i=0,o=0,a=0,A=0;i=0|s[(e|=0)>>2],o=0|s[(n=e+4|0)>>2],a=0|s[(r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i?0:r)-(n?a:0)-(e?A:0)|0))?o:A))?t:e))>0)?e:0)|0,o=o-(a?e:0)|0,0|((0|(e=(0|(e=A-(a?e:0)|0))>-1?e:0-e|0))>(0|(t=(0|(o=(0|o)>-1?o:0-o|0))>(0|(t=(0|t)>-1?t:0-t|0))?o:t))?e:t)}function Ee(e){var t,n,r,i;n=(i=0|s[(t=8+(e|=0)|0)>>2])-(0|s[e>>2])|0,s[e>>2]=n,e=(0|s[(r=e+4|0)>>2])-i|0,s[r>>2]=e,s[t>>2]=0-(e+n)}function Te(e){var t,n,r=0,i=0,o=0,a=0,A=0;r=0-(i=0|s[(e|=0)>>2])|0,s[e>>2]=r,s[(t=e+8|0)>>2]=0,a=(o=0|s[(n=e+4|0)>>2])+i|0,(0|i)>0?(s[n>>2]=a,s[t>>2]=i,s[e>>2]=0,r=0,o=a):i=0,(0|o)<0?(A=r-o|0,s[e>>2]=A,i=i-o|0,s[t>>2]=i,s[n>>2]=0,a=A-i|0,r=0-i|0,(0|i)<0?(s[e>>2]=a,s[n>>2]=r,s[t>>2]=0,o=r,i=0):(o=0,a=A)):a=r,(0|(r=(0|i)<(0|(r=(0|o)<(0|a)?o:a))?i:r))<=0||(s[e>>2]=a-r,s[n>>2]=o-r,s[t>>2]=i-r)}function Se(e,t){var n=0;switch(n=0|nn(0|(e|=0),0|(t|=0),56),T(),7&n){case 0:case 7:return 0}return n=-2130706433&t|134217728,!0&268435456==(2013265920&t)?!0&16777216==(117440512&t)&!!(0|je(e,n))?0|(n=0):0|(n=0|De(e,n)):0|(n=0)}function Ce(e,t,n){n|=0;var r,i,o=0,a=0;return i=M,M=M+16|0,r=i,a=-2130706433&(t|=0)|134217728,!0&268435456==(2013265920&t)?(o=0|nn(0|(e|=0),0|t,56),T(),o=0|function(e,t,n){n|=0;var r,i=0,o=0;if(r=M,M=M+16|0,o=r,i=0|je(e|=0,t|=0),(n+-1|0)>>>0>5)return M=r,-1;if(1==(0|n)&(i=!!(0|i)))return M=r,-1;do{if(!(0|Lt(e,t,o))){if(i){i=(5+(0|s[26352+(n<<2)>>2])-(0|s[o>>2])|0)%5|0;break}i=(6+(0|s[26384+(n<<2)>>2])-(0|s[o>>2])|0)%6|0;break}i=-1}while(0);return M=r,0|(o=i)}(e,a,7&o),-1==(0|o)?(s[n>>2]=0,M=i,0|(a=6)):(0|Ke(e,a,r)&&S(27795,26932,282,26947),t=0|nn(0|e,0|t,52),T(),t&=15,0|je(e,a)?Re(r,t,o,2,n):Le(r,t,o,2,n),M=i,0|(a=0))):(M=i,0|(a=6))}function ke(e,t,n,r,o){t|=0,n|=0,r|=0,o|=0;var a,A=0,u=0;if(A=+function(e){var t,n;return n=+i[(e|=0)>>3],t=+i[e+8>>3],+ +c(+(n*n+t*t))}(e|=0),A<1e-16)return t=15600+(t<<4)|0,s[o>>2]=s[t>>2],s[o+4>>2]=s[t+4>>2],s[o+8>>2]=s[t+8>>2],void(s[o+12>>2]=s[t+12>>2]);if(u=+_(+ +i[e+8>>3],+ +i[e>>3]),(0|n)>0){e=0;do{A*=.37796447300922725,e=e+1|0}while((0|e)!=(0|n))}a=.3333333333333333*A,r?(n=!(0|Qe(n)),A=+m(.381966011250105*(n?a:.37796447300922725*a))):(A=+m(.381966011250105*A),0|Qe(n)&&(u=+st(u+.3334731722518321))),function(e,t,n,r){e|=0,t=+t,r|=0;var o=0,a=0,A=0,c=0;if((n=+n)<1e-16)return s[r>>2]=s[e>>2],s[r+4>>2]=s[e+4>>2],s[r+8>>2]=s[e+8>>2],void(s[r+12>>2]=s[e+12>>2]);a=t<0?t+6.283185307179586:t,a=t>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(o=+l(+(a+-3.141592653589793))<1e-16,t=+i[e>>3],o){t-=n,i[r>>3]=t,o=r;break}if(A=+h(+n),n=+d(+n),t=A*+d(+t)+ +h(+a)*(n*+h(+t)),t=+g(+((t=t>1?1:t)<-1?-1:t)),i[r>>3]=t,+l(+(t+-1.5707963267948966))<1e-16)return i[r>>3]=1.5707963267948966,void(i[r+8>>3]=0);if(+l(+(t+1.5707963267948966))<1e-16)return i[r>>3]=-1.5707963267948966,void(i[r+8>>3]=0);if(c=1/+h(+t),a=n*+d(+a)*c,n=+i[e>>3],t=c*((A-+d(+t)*+d(+n))/+h(+n)),A=a>1?1:a,t=t>1?1:t,(t=+i[e+8>>3]+ +_(+(A<-1?-1:A),+(t<-1?-1:t)))>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);return void(i[r+8>>3]=t)}t=+i[e>>3]+n,i[r>>3]=t,o=r}while(0);if(+l(+(t+-1.5707963267948966))<1e-16)return i[o>>3]=1.5707963267948966,void(i[r+8>>3]=0);if(+l(+(t+1.5707963267948966))<1e-16)return i[o>>3]=-1.5707963267948966,void(i[r+8>>3]=0);if((t=+i[e+8>>3])>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);i[r+8>>3]=t}(15600+(t<<4)|0,+st(+i[15920+(24*t|0)>>3]-u),A,o)}function Re(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var a,A,l,c,u,h,d,f,p,g,m,_,b,v,y,w,x,E,T,C,k,R,P=0,I=0,L=0,N=0,B=0,D=0;if(R=M,M=M+272|0,N=R+240|0,T=R,C=R+224|0,k=R+208|0,m=R+176|0,_=R+160|0,b=R+192|0,v=R+144|0,y=R+128|0,w=R+112|0,x=R+96|0,E=R+80|0,s[(P=R+256|0)>>2]=t,s[N>>2]=s[e>>2],s[N+4>>2]=s[e+4>>2],s[N+8>>2]=s[e+8>>2],s[N+12>>2]=s[e+12>>2],Pe(N,P,T),s[o>>2]=0,(0|(N=r+n+(5==(0|r)&1)|0))<=(0|n))M=R;else{A=C+4|0,l=m+4|0,c=n+5|0,u=16880+((a=0|s[P>>2])<<2)|0,h=16960+(a<<2)|0,d=y+8|0,f=w+8|0,p=x+8|0,g=k+4|0,L=n;e:for(;;){I=T+((0|L)%5<<4)|0,s[k>>2]=s[I>>2],s[k+4>>2]=s[I+4>>2],s[k+8>>2]=s[I+8>>2],s[k+12>>2]=s[I+12>>2];do{}while(2==(0|Ie(k,a,0,1)));if((0|L)>(0|n)&!!(0|Qe(t))){if(s[m>>2]=s[k>>2],s[m+4>>2]=s[k+4>>2],s[m+8>>2]=s[k+8>>2],s[m+12>>2]=s[k+12>>2],ie(A,_),r=0|s[m>>2],P=0|s[17040+(80*r|0)+(s[C>>2]<<2)>>2],s[m>>2]=s[18640+(80*r|0)+(20*P|0)>>2],(0|(I=0|s[18640+(80*r|0)+(20*P|0)+16>>2]))>0){e=0;do{me(l),e=e+1|0}while((0|e)<(0|I))}switch(I=18640+(80*r|0)+(20*P|0)+4|0,s[b>>2]=s[I>>2],s[b+4>>2]=s[I+4>>2],s[b+8>>2]=s[I+8>>2],Ae(b,3*(0|s[u>>2])|0),oe(l,b,l),se(l),ie(l,v),B=+(0|s[h>>2]),i[y>>3]=3*B,i[d>>3]=0,D=-1.5*B,i[w>>3]=D,i[f>>3]=2.598076211353316*B,i[x>>3]=D,i[p>>3]=-2.598076211353316*B,0|s[17040+(80*(0|s[m>>2])|0)+(s[k>>2]<<2)>>2]){case 1:e=w,r=y;break;case 3:e=x,r=w;break;case 2:e=y,r=x;break;default:e=12;break e}Pt(_,v,r,e,E),ke(E,0|s[m>>2],a,1,o+8+(s[o>>2]<<4)|0),s[o>>2]=1+(0|s[o>>2])}if((0|L)<(0|c)&&(ie(g,m),ke(m,0|s[k>>2],a,1,o+8+(s[o>>2]<<4)|0),s[o>>2]=1+(0|s[o>>2])),s[C>>2]=s[k>>2],s[C+4>>2]=s[k+4>>2],s[C+8>>2]=s[k+8>>2],s[C+12>>2]=s[k+12>>2],(0|(L=L+1|0))>=(0|N)){e=3;break}}3!=(0|e)?12==(0|e)&&S(26970,27017,572,27027):M=R}}function Pe(e,t,n){e|=0,t|=0,n|=0;var r,i=0,o=0,a=0,A=0,l=0;r=M,M=M+128|0,o=r,A=20240,l=60+(a=i=r+64|0)|0;do{s[a>>2]=s[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));A=20304,l=(a=o)+60|0;do{s[a>>2]=s[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));i=(l=!(0|Qe(0|s[t>>2])))?i:o,ye(o=e+4|0),we(o),0|Qe(0|s[t>>2])&&(pe(o),s[t>>2]=1+(0|s[t>>2])),s[n>>2]=s[e>>2],oe(o,i,t=n+4|0),se(t),s[n+16>>2]=s[e>>2],oe(o,i+12|0,t=n+20|0),se(t),s[n+32>>2]=s[e>>2],oe(o,i+24|0,t=n+36|0),se(t),s[n+48>>2]=s[e>>2],oe(o,i+36|0,t=n+52|0),se(t),s[n+64>>2]=s[e>>2],oe(o,i+48|0,n=n+68|0),se(n),M=r}function Ie(e,t,n,r){n|=0,r|=0;var i,o,a,A,l,c,u=0,h=0,d=0,f=0,p=0;if(c=M,M=M+32|0,l=c+12|0,o=c,p=4+(e|=0)|0,f=0|s[16960+((t|=0)<<2)>>2],f=(A=!!(0|r))?3*f|0:f,u=0|s[p>>2],i=0|s[(a=e+8|0)>>2],A){if((0|(u=i+u+(r=0|s[(h=e+12|0)>>2])|0))==(0|f))return M=c,1;d=h}else u=i+u+(r=0|s[(d=e+12|0)>>2])|0;if((0|u)<=(0|f))return M=c,0;do{if((0|r)>0){if(r=0|s[e>>2],(0|i)>0){h=18640+(80*r|0)+60|0,r=e;break}r=18640+(80*r|0)+40|0,n?(re(l,f,0,0),ae(p,l,o),_e(o),oe(o,l,p),h=r,r=e):(h=r,r=e)}else h=18640+(80*(0|s[e>>2])|0)+20|0,r=e}while(0);if(s[r>>2]=s[h>>2],(0|s[(u=h+16|0)>>2])>0){r=0;do{me(p),r=r+1|0}while((0|r)<(0|s[u>>2]))}return e=h+4|0,s[l>>2]=s[e>>2],s[l+4>>2]=s[e+4>>2],s[l+8>>2]=s[e+8>>2],t=0|s[16880+(t<<2)>>2],Ae(l,A?3*t|0:t),oe(p,l,p),se(p),r=A&&((0|s[a>>2])+(0|s[p>>2])+(0|s[d>>2])|0)==(0|f)?1:2,M=c,0|r}function Me(e,t){e|=0,t|=0;var n=0;do{n=0|Ie(e,t,0,1)}while(2==(0|n));return 0|n}function Le(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var a,A,l,c,u,h,d,f,p,g,m,_,b,v,y,w,x,E,T=0,C=0,k=0,R=0,P=0;if(E=M,M=M+240|0,v=E+208|0,y=E,w=E+192|0,x=E+176|0,p=E+160|0,g=E+144|0,m=E+128|0,_=E+112|0,b=E+96|0,s[(T=E+224|0)>>2]=t,s[v>>2]=s[e>>2],s[v+4>>2]=s[e+4>>2],s[v+8>>2]=s[e+8>>2],s[v+12>>2]=s[e+12>>2],Ne(v,T,y),s[o>>2]=0,(0|(f=r+n+(6==(0|r)&1)|0))<=(0|n))M=E;else{A=n+6|0,l=16960+((a=0|s[T>>2])<<2)|0,c=g+8|0,u=m+8|0,h=_+8|0,d=w+4|0,C=0,k=n,r=-1;e:for(;;){if(e=y+((T=(0|k)%6|0)<<4)|0,s[w>>2]=s[e>>2],s[w+4>>2]=s[e+4>>2],s[w+8>>2]=s[e+8>>2],s[w+12>>2]=s[e+12>>2],e=C,C=0|Ie(w,a,0,1),(0|k)>(0|n)&!!(0|Qe(t))&&1!=(0|e)&&(0|s[w>>2])!=(0|r)){switch(ie(y+((T+5|0)%6<<4)+4|0,x),ie(y+(T<<4)+4|0,p),R=+(0|s[l>>2]),i[g>>3]=3*R,i[c>>3]=0,P=-1.5*R,i[m>>3]=P,i[u>>3]=2.598076211353316*R,i[_>>3]=P,i[h>>3]=-2.598076211353316*R,T=0|s[v>>2],0|s[17040+(80*T|0)+(((0|r)==(0|T)?s[w>>2]:r)<<2)>>2]){case 1:e=m,r=g;break;case 3:e=_,r=m;break;case 2:e=g,r=_;break;default:e=8;break e}Pt(x,p,r,e,b),0|It(x,b)||0|It(p,b)||(ke(b,0|s[v>>2],a,1,o+8+(s[o>>2]<<4)|0),s[o>>2]=1+(0|s[o>>2]))}if((0|k)<(0|A)&&(ie(d,x),ke(x,0|s[w>>2],a,1,o+8+(s[o>>2]<<4)|0),s[o>>2]=1+(0|s[o>>2])),(0|(k=k+1|0))>=(0|f)){e=3;break}r=0|s[w>>2]}3!=(0|e)?8==(0|e)&&S(27054,27017,737,27099):M=E}}function Ne(e,t,n){e|=0,t|=0,n|=0;var r,i=0,o=0,a=0,A=0,l=0;r=M,M=M+160|0,o=r,A=20368,l=72+(a=i=r+80|0)|0;do{s[a>>2]=s[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));A=20448,l=(a=o)+72|0;do{s[a>>2]=s[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));i=(l=!(0|Qe(0|s[t>>2])))?i:o,ye(o=e+4|0),we(o),0|Qe(0|s[t>>2])&&(pe(o),s[t>>2]=1+(0|s[t>>2])),s[n>>2]=s[e>>2],oe(o,i,t=n+4|0),se(t),s[n+16>>2]=s[e>>2],oe(o,i+12|0,t=n+20|0),se(t),s[n+32>>2]=s[e>>2],oe(o,i+24|0,t=n+36|0),se(t),s[n+48>>2]=s[e>>2],oe(o,i+36|0,t=n+52|0),se(t),s[n+64>>2]=s[e>>2],oe(o,i+48|0,t=n+68|0),se(t),s[n+80>>2]=s[e>>2],oe(o,i+60|0,n=n+84|0),se(n),M=r}function Be(e,t){return t=0|nn(0|(e|=0),0|(t|=0),45),T(),127&t}function De(e,t){e|=0;var n=0,s=0,i=0,o=0;return!0&134217728==(-16777216&(t|=0))?(s=0|nn(0|e,0|t,52),T(),s&=15,n=0|nn(0|e,0|t,45),T(),(n&=127)>>>0>121?0|(e=0):!(613566756&(o=0|rn(0|(i=0|nn(0|e,0|t,0|(o=3*(15^s)|0))),0|T(),0|o))&Qt(-1227133514,-1171,0|o,0|(i=0|T())))&!(4681&i&T())&&15==(0|s)|!(0|(o=0|nn(0|rn(0|~e,0|~t,0|(o=19+(3*s|0)|0)),0|T(),0|o)))&!(0|T())?0|r[20528+n|0]?!(0|e)&!(0|(t&=8191))?0|(o=1):(o=0|sn(0|e,0|t),T(),0|!!((63-o|0)%3|0)):0|(o=1):0|(o=0)):0|(e=0)}function Oe(e,t,n,r){e|=0,n|=0,r|=0;var i=0,o=0,a=0,A=0;if(i=0|rn(0|(t|=0),0,52),o=0|T(),n=0|rn(0|n,0,45),n=0|o|T()|134225919,(0|t)<1)return o=-1,r=n,s[(t=e)>>2]=o,void(s[(e=e+4|0)>>2]=r);for(o=1,i=-1;A=0|rn(7,0,0|(a=3*(15-o|0)|0)),n&=~T(),i=i&~A|(a=0|rn(0|r,0,0|a)),n=0|n|T(),(0|o)!=(0|t);)o=o+1|0;s[(a=A=e)>>2]=i,s[(A=A+4|0)>>2]=n}function Fe(e,t,n,r){n|=0,r|=0;var i=0,o=0;if(o=0|nn(0|(e|=0),0|(t|=0),52),T(),n>>>0>15)return 4;if((0|(o&=15))<(0|n))return 12;if((0|o)==(0|n))return s[r>>2]=e,s[r+4>>2]=t,0;if(i=0|rn(0|n,0,52),i|=e,e=T()|-15728641&t,(0|o)>(0|n))do{t=0|rn(7,0,3*(14-n|0)|0),n=n+1|0,i|=t,e=0|T()|e}while((0|n)<(0|o));return s[r>>2]=i,s[r+4>>2]=e,0}function Ue(e,t,n,r){n|=0,r|=0;var i=0,o=0,a=0;if(o=0|nn(0|(e|=0),0|(t|=0),52),T(),!((0|n)<16&(0|(o&=15))<=(0|n)))return 4;i=n-o|0,n=0|nn(0|e,0|t,45),T();e:do{if(0|G(127&n)){t:do{if(0|o){for(n=1;!((a=0|rn(7,0,3*(15-n|0)|0))&e)&!((0|T())&t);){if(!(n>>>0>>0))break t;n=n+1|0}n=0|_t(7,0,i,((0|i)<0)<<31>>31),i=0|T();break e}}while(0);n=0|Xt(0|(n=0|Zt(0|(n=0|_t(7,0,i,((0|i)<0)<<31>>31)),0|T(),5,0)),0|T(),-5,-1),n=0|Xt(0|(n=0|Kt(0|n,0|T(),6,0)),0|T(),1,0),i=0|T()}else n=0|_t(7,0,i,((0|i)<0)<<31>>31),i=0|T()}while(0);return s[(a=r)>>2]=n,s[a+4>>2]=i,0}function je(e,t){var n=0,r=0,s=0;if(s=0|nn(0|(e|=0),0|(t|=0),45),T(),!(0|G(127&s)))return 0;s=0|nn(0|e,0|t,52),T(),s&=15;e:do{if(s)for(r=1;;){if(n=0|nn(0|e,0|t,3*(15-r|0)|0),T(),0|(n&=7))break e;if(!(r>>>0>>0)){n=0;break}r=r+1|0}else n=0}while(0);return 1&!(0|n)}function Ge(e,t,n,r){return e|=0,t|=0,(0|(r|=0))<(0|(n|=0))?(r=e,E(0|(n=t)),0|r):(n=0|rn(-1,-1,3+(3*(r-n|0)|0)|0),r=0|rn(0|~n,0|~T(),3*(15-r|0)|0),n=~T()&t,r=~r&e,E(0|n),0|r)}function ze(e,t,n,r){n|=0,r|=0;var i=0;return i=0|nn(0|(e|=0),0|(t|=0),52),T(),(0|n)<16&(0|(i&=15))<=(0|n)?((0|i)<(0|n)&&(i=0|rn(-1,-1,3+(3*(n+-1-i|0)|0)|0),i=0|rn(0|~i,0|~T(),3*(15-n|0)|0),t=~T()&t,e&=~i),i=0|rn(0|n,0,52),n=-15728641&t|T(),s[r>>2]=e|i,s[r+4>>2]=n,0|(r=0)):0|(r=4)}function Ve(e,t){var n=0,r=0,s=0;if(s=0|nn(0|(e|=0),0|(t|=0),52),T(),!(s&=15))return 0;for(r=1;;){if(n=0|nn(0|e,0|t,3*(15-r|0)|0),T(),0|(n&=7)){r=5;break}if(!(r>>>0>>0)){n=0,r=5;break}r=r+1|0}return 5==(0|r)?0|n:0}function We(e,t){var n=0,r=0,s=0,i=0,o=0,a=0,A=0;if(A=0|nn(0|(e|=0),0|(t|=0),52),T(),!(A&=15))return A=e,E(0|(a=t)),0|A;for(a=1,n=0;;){r=0|rn(7,0,0|(i=3*(15-a|0)|0)),s=0|T(),o=0|nn(0|e,0|t,0|i),T(),e=(i=0|rn(0|be(7&o),0,0|i))|e&~r,t=(o=0|T())|t&~s;e:do{if(!n)if(!(i&r|0)&!(o&s|0))n=0;else if(r=0|nn(0|e,0|t,52),T(),r&=15){n=1;t:for(;;){switch(o=0|nn(0|e,0|t,3*(15-n|0)|0),T(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(s=0|nn(0|e,0|t,0|(o=3*(15-n|0)|0)),T(),i=0|rn(7,0,0|o),t&=~T(),e=e&~i|(o=0|rn(0|be(7&s),0,0|o)),t=0|t|T(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return E(0|t),0|e}function He(e,t){var n=0,r=0,s=0,i=0,o=0;if(r=0|nn(0|(e|=0),0|(t|=0),52),T(),!(r&=15))return r=e,E(0|(n=t)),0|r;for(n=1;o=0|nn(0|e,0|t,0|(i=3*(15-n|0)|0)),T(),s=0|rn(7,0,0|i),t&=~T(),e=(i=0|rn(0|be(7&o),0,0|i))|e&~s,t=0|T()|t,n>>>0>>0;)n=n+1|0;return E(0|t),0|e}function $e(e,t){var n=0,r=0,s=0,i=0,o=0,a=0,A=0;if(A=0|nn(0|(e|=0),0|(t|=0),52),T(),!(A&=15))return A=e,E(0|(a=t)),0|A;for(a=1,n=0;;){r=0|rn(7,0,0|(i=3*(15-a|0)|0)),s=0|T(),o=0|nn(0|e,0|t,0|i),T(),e=(i=0|rn(0|ve(7&o),0,0|i))|e&~r,t=(o=0|T())|t&~s;e:do{if(!n)if(!(i&r|0)&!(o&s|0))n=0;else if(r=0|nn(0|e,0|t,52),T(),r&=15){n=1;t:for(;;){switch(o=0|nn(0|e,0|t,3*(15-n|0)|0),T(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(i=0|rn(7,0,0|(s=3*(15-n|0)|0)),o=t&~T(),t=0|nn(0|e,0|t,0|s),T(),e=e&~i|(t=0|rn(0|ve(7&t),0,0|s)),t=0|o|T(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return E(0|t),0|e}function Xe(e,t){var n=0,r=0,s=0,i=0,o=0;if(r=0|nn(0|(e|=0),0|(t|=0),52),T(),!(r&=15))return r=e,E(0|(n=t)),0|r;for(n=1;i=0|rn(7,0,0|(o=3*(15-n|0)|0)),s=t&~T(),t=0|nn(0|e,0|t,0|o),T(),e=(t=0|rn(0|ve(7&t),0,0|o))|e&~i,t=0|T()|s,n>>>0>>0;)n=n+1|0;return E(0|t),0|e}function Qe(e){return(0|(e|=0))%2|0}function Ye(e,t,n){n|=0;var r,o=0;return r=M,M=M+16|0,o=r,(t|=0)>>>0>15?(M=r,0|(o=4)):2146435072&~s[4+(e|=0)>>2]&&2146435072&~s[e+8+4>>2]?(function(e,t,n){var r,o;r=M,M=M+16|0,function(e,t,n,r){t|=0,r|=0;var o,a=0,A=0,l=0,c=0;if(o=M,M=M+16|0,function(e,t,n){t|=0,n|=0;var r,o,a=0;o=M,M=M+32|0,function(e,t){t|=0;var n,r,s=0;s=+i[(e|=0)>>3],n=+h(+s),s=+d(+s),i[t+16>>3]=s,s=+i[e+8>>3],r=n*+h(+s),i[t>>3]=r,s=n*+d(+s),i[t+8>>3]=s}(e|=0,r=o),s[t>>2]=0,i[n>>3]=5,(a=+Mt(16400,r))<+i[n>>3]&&(s[t>>2]=0,i[n>>3]=a),(a=+Mt(16424,r))<+i[n>>3]&&(s[t>>2]=1,i[n>>3]=a),(a=+Mt(16448,r))<+i[n>>3]&&(s[t>>2]=2,i[n>>3]=a),(a=+Mt(16472,r))<+i[n>>3]&&(s[t>>2]=3,i[n>>3]=a),(a=+Mt(16496,r))<+i[n>>3]&&(s[t>>2]=4,i[n>>3]=a),(a=+Mt(16520,r))<+i[n>>3]&&(s[t>>2]=5,i[n>>3]=a),(a=+Mt(16544,r))<+i[n>>3]&&(s[t>>2]=6,i[n>>3]=a),(a=+Mt(16568,r))<+i[n>>3]&&(s[t>>2]=7,i[n>>3]=a),(a=+Mt(16592,r))<+i[n>>3]&&(s[t>>2]=8,i[n>>3]=a),(a=+Mt(16616,r))<+i[n>>3]&&(s[t>>2]=9,i[n>>3]=a),(a=+Mt(16640,r))<+i[n>>3]&&(s[t>>2]=10,i[n>>3]=a),(a=+Mt(16664,r))<+i[n>>3]&&(s[t>>2]=11,i[n>>3]=a),(a=+Mt(16688,r))<+i[n>>3]&&(s[t>>2]=12,i[n>>3]=a),(a=+Mt(16712,r))<+i[n>>3]&&(s[t>>2]=13,i[n>>3]=a),(a=+Mt(16736,r))<+i[n>>3]&&(s[t>>2]=14,i[n>>3]=a),(a=+Mt(16760,r))<+i[n>>3]&&(s[t>>2]=15,i[n>>3]=a),(a=+Mt(16784,r))<+i[n>>3]&&(s[t>>2]=16,i[n>>3]=a),(a=+Mt(16808,r))<+i[n>>3]&&(s[t>>2]=17,i[n>>3]=a),(a=+Mt(16832,r))<+i[n>>3]&&(s[t>>2]=18,i[n>>3]=a),(a=+Mt(16856,r))<+i[n>>3]?(s[t>>2]=19,i[n>>3]=a,M=o):M=o}(e|=0,n|=0,c=o),(A=+p(+(1-.5*+i[c>>3])))<1e-16)return s[r>>2]=0,s[r+4>>2]=0,s[r+8>>2]=0,s[r+12>>2]=0,void(M=o);if(c=0|s[n>>2],a=+st((a=+i[15920+(24*c|0)>>3])-+st(+function(e,t){var n,r,s,o,a;return e|=0,o=+i[(t|=0)>>3],r=+h(+o),s=+i[t+8>>3]-+i[e+8>>3],a=r*+d(+s),n=+i[e>>3],+ +_(+a,+(+d(+o)*+h(+n)-+h(+s)*(r*+d(+n))))}(15600+(c<<4)|0,e))),l=0|Qe(t)?+st(a+-.3334731722518321):a,a=2.618033988749896*+f(+A),(0|t)>0){e=0;do{a*=2.6457513110645907,e=e+1|0}while((0|e)!=(0|t))}A=+h(+l)*a,i[r>>3]=A,l=+d(+l)*a,i[r+8>>3]=l,M=o}(e|=0,t|=0,n|=0,o=r),function(e,t){e|=0;var n,r,o,a,A=0,c=0,u=0,h=0,d=0,f=0,p=0;s[(a=8+(t|=0)|0)>>2]=0,r=+i[e>>3],h=+l(+r),o=+i[e+8>>3],h+=.5*(d=1.1547005383792515*+l(+o)),h-=+(0|(A=~~h)),d-=+(0|(e=~~d));do{if(h<.5){if(h<.3333333333333333){if(s[t>>2]=A,d<.5*(h+1)){s[t+4>>2]=e;break}e=e+1|0,s[t+4>>2]=e;break}if(e=(1&!(d<(p=1-h)))+e|0,s[t+4>>2]=e,p<=d&d<2*h){A=A+1|0,s[t>>2]=A;break}s[t>>2]=A;break}if(!(h<.6666666666666666)){if(A=A+1|0,s[t>>2]=A,d<.5*h){s[t+4>>2]=e;break}e=e+1|0,s[t+4>>2]=e;break}if(d<1-h){if(s[t+4>>2]=e,2*h-1>2]=A;break}}else e=e+1|0,s[t+4>>2]=e;A=A+1|0,s[t>>2]=A}while(0);do{if(r<0){if(1&e){A=~~(+(0|A)-(2*(+((f=0|Qt(0|A,((0|A)<0)<<31>>31,0|(f=(e+1|0)/2|0),((0|f)<0)<<31>>31))>>>0)+4294967296*+(0|T()))+1)),s[t>>2]=A;break}A=~~(+(0|A)-2*(+((f=0|Qt(0|A,((0|A)<0)<<31>>31,0|(f=(0|e)/2|0),((0|f)<0)<<31>>31))>>>0)+4294967296*+(0|T()))),s[t>>2]=A;break}}while(0);f=t+4|0,o<0&&(A=A-((1|e<<1)/2|0)|0,s[t>>2]=A,e=0-e|0,s[f>>2]=e),c=e-A|0,(0|A)<0?(u=0-A|0,s[f>>2]=c,s[a>>2]=u,s[t>>2]=0,e=c,A=0):u=0,(0|e)<0&&(A=A-e|0,s[t>>2]=A,u=u-e|0,s[a>>2]=u,s[f>>2]=0,e=0),n=A-u|0,c=e-u|0,(0|u)<0&&(s[t>>2]=n,s[f>>2]=c,s[a>>2]=0,e=c,A=n,u=0),(0|(c=(0|u)<(0|(c=(0|e)<(0|A)?e:A))?u:c))<=0||(s[t>>2]=A-c,s[f>>2]=e-c,s[a>>2]=u-c)}(o,n+4|0),M=r}(e,t,o),t=0|function(e,t){e|=0;var n,r=0,i=0,o=0,a=0,A=0,l=0,c=0,u=0;if(n=M,M=M+64|0,l=n+40|0,i=n+24|0,o=n+12|0,a=n,rn(0|(t|=0),0,52),r=134225919|T(),!t)return(0|s[e+4>>2])>2||(0|s[e+8>>2])>2||(0|s[e+12>>2])>2?(l=0,E(0|(A=0)),M=n,0|l):(rn(0|V(e),0,45),A=0|T()|r,l=-1,E(0|A),M=n,0|l);if(s[l>>2]=s[e>>2],s[l+4>>2]=s[e+4>>2],s[l+8>>2]=s[e+8>>2],s[l+12>>2]=s[e+12>>2],A=l+4|0,(0|t)>0)for(e=-1;s[i>>2]=s[A>>2],s[i+4>>2]=s[A+4>>2],s[i+8>>2]=s[A+8>>2],1&t?(he(A),s[o>>2]=s[A>>2],s[o+4>>2]=s[A+4>>2],s[o+8>>2]=s[A+8>>2],fe(o)):(de(A),s[o>>2]=s[A>>2],s[o+4>>2]=s[A+4>>2],s[o+8>>2]=s[A+8>>2],pe(o)),ae(i,o,a),se(a),c=0|rn(7,0,0|(u=3*(15-t|0)|0)),r&=~T(),e=(u=0|rn(0|le(a),0,0|u))|e&~c,r=0|T()|r,(0|t)>1;)t=t+-1|0;else e=-1;e:do{if((0|s[A>>2])<=2&&(0|s[l+8>>2])<=2&&(0|s[l+12>>2])<=2){if(t=0|rn(0|(i=0|V(l)),0,45),t|=e,e=T()|-1040385&r,a=0|W(l),!(0|G(i))){if((0|a)<=0)break;for(o=0;;){if(i=0|nn(0|t,0|e,52),T(),i&=15)for(r=1;l=0|nn(0|t,0|e,0|(u=3*(15-r|0)|0)),T(),c=0|rn(7,0,0|u),e&=~T(),t=t&~c|(u=0|rn(0|be(7&l),0,0|u)),e=0|e|T(),r>>>0>>0;)r=r+1|0;if((0|(o=o+1|0))==(0|a))break e}}o=0|nn(0|t,0|e,52),T(),o&=15;t:do{if(o){r=1;n:for(;;){switch(u=0|nn(0|t,0|e,3*(15-r|0)|0),T(),7&u){case 1:break n;case 0:break;default:break t}if(!(r>>>0>>0))break t;r=r+1|0}if(0|H(i,0|s[l>>2]))for(r=1;c=0|rn(7,0,0|(l=3*(15-r|0)|0)),u=e&~T(),e=0|nn(0|t,0|e,0|l),T(),t=t&~c|(e=0|rn(0|ve(7&e),0,0|l)),e=0|u|T(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|nn(0|t,0|e,0|(u=3*(15-r|0)|0)),T(),c=0|rn(7,0,0|u),e&=~T(),t=t&~c|(u=0|rn(0|be(7&l),0,0|u)),e=0|e|T(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{t=0|We(t,e),e=0|T(),r=r+1|0}while((0|r)!=(0|a))}}else t=0,e=0}while(0);return u=t,E(0|(c=e)),M=n,0|u}(o,t),o=0|T(),s[n>>2]=t,s[n+4>>2]=o,!(0|t)&!(0|o)&&S(27795,27122,1050,27145),M=r,0|(o=0)):(M=r,0|(o=3))}function qe(e,t,n){var r,i=0,o=0,a=0;if(r=4+(n|=0)|0,o=0|nn(0|(e|=0),0|(t|=0),52),T(),o&=15,a=0|nn(0|e,0|t,45),T(),i=!(0|o),0|G(127&a)){if(i)return 1;i=1}else{if(i)return 0;i=0|s[r>>2]||0|s[n+8>>2]?1:1&!!(0|s[n+12>>2])}for(n=1;1&n?fe(r):pe(r),a=0|nn(0|e,0|t,3*(15-n|0)|0),T(),ge(r,7&a),n>>>0>>0;)n=n+1|0;return 0|i}function Ke(e,t,n){n|=0;var r,i,o=0,a=0,A=0,l=0,c=0,u=0;if(i=M,M=M+16|0,r=i,u=0|nn(0|(e|=0),0|(t|=0),45),T(),(u&=127)>>>0>121)return s[n>>2]=0,s[n+4>>2]=0,s[n+8>>2]=0,s[n+12>>2]=0,M=i,5;e:do{if(0|G(u)&&(A=0|nn(0|e,0|t,52),T(),0|(A&=15))){o=1;t:for(;;){switch(c=0|nn(0|e,0|t,3*(15-o|0)|0),T(),7&c){case 5:break t;case 0:break;default:o=t;break e}if(!(o>>>0>>0)){o=t;break e}o=o+1|0}for(a=1,o=t;l=0|rn(7,0,0|(t=3*(15-a|0)|0)),c=o&~T(),o=0|nn(0|e,0|o,0|t),T(),e=e&~l|(o=0|rn(0|ve(7&o),0,0|t)),o=0|c|T(),a>>>0>>0;)a=a+1|0}else o=t}while(0);if(c=7696+(28*u|0)|0,s[n>>2]=s[c>>2],s[n+4>>2]=s[c+4>>2],s[n+8>>2]=s[c+8>>2],s[n+12>>2]=s[c+12>>2],!(0|qe(e,o,n)))return M=i,0;if(l=n+4|0,s[r>>2]=s[l>>2],s[r+4>>2]=s[l+4>>2],s[r+8>>2]=s[l+8>>2],A=0|nn(0|e,0|o,52),T(),c=15&A,1&A?(pe(l),A=c+1|0):A=c,0|G(u)){e:do{if(c)for(t=1;;){if(a=0|nn(0|e,0|o,3*(15-t|0)|0),T(),0|(a&=7)){o=a;break e}if(!(t>>>0>>0)){o=0;break}t=t+1|0}else o=0}while(0);o=4==(0|o)&1}else o=0;if(0|Ie(n,A,o,0)){if(0|G(u))do{}while(0|Ie(n,A,0,0));(0|A)!=(0|c)&&de(l)}else(0|A)!=(0|c)&&(s[l>>2]=s[r>>2],s[l+4>>2]=s[r+4>>2],s[l+8>>2]=s[r+8>>2]);return M=i,0}function Ze(e,t,n){n|=0;var r,i,o=0;return i=M,M=M+16|0,0|(o=0|Ke(e|=0,t|=0,r=i))?(M=i,0|o):(o=0|nn(0|e,0|t,52),T(),function(e,t,n){var r,i;t|=0,n|=0,r=M,M=M+16|0,ie(4+(e|=0)|0,i=r),ke(i,0|s[e>>2],t,0,n),M=r}(r,15&o,n),M=i,0|(o=0))}function Je(e,t,n){n|=0;var r,s=0,i=0,o=0;if(r=M,M=M+16|0,0|(s=0|Ke(e|=0,t|=0,o=r)))return M=r,0|s;s=0|nn(0|e,0|t,45),T(),s=!(0|G(127&s)),i=0|nn(0|e,0|t,52),T(),i&=15;e:do{if(!s){if(0|i)for(s=1;;){if(!(!((0|rn(7,0,3*(15-s|0)|0))&e)&!((0|T())&t)))break e;if(!(s>>>0>>0))break;s=s+1|0}return Re(o,i,0,5,n),M=r,0}}while(0);return Le(o,i,0,6,n),M=r,0}function et(e,t){t|=0;var n=0,r=0,i=0,o=0,a=0,A=0,l=0;if((e|=0)>>>0>15)return 4;if(rn(0|e,0,52),A=134225919|T(),!e){n=0,r=0;do{0|G(r)&&(rn(0|r,0,45),a=0|A|T(),s[(e=t+(n<<3)|0)>>2]=-1,s[e+4>>2]=a,n=n+1|0),r=r+1|0}while(122!=(0|r));return 0}n=0,a=0;do{if(0|G(a)){for(rn(0|a,0,45),r=1,i=-1,o=0|A|T();i&=~(l=0|rn(7,0,3*(15-r|0)|0)),o&=~T(),(0|r)!=(0|e);)r=r+1|0;s[(l=t+(n<<3)|0)>>2]=i,s[l+4>>2]=o,n=n+1|0}a=a+1|0}while(122!=(0|a));return 0}function tt(e,t,n,r){e|=0,r|=0;var i=0,o=0,a=0;i=0|nn(0|(t|=0),0|(n|=0),52),T(),!(0|t)&!(0|n)|(0|r)>15|(0|(i&=15))>(0|r)?(o=-1,t=-1,n=0,i=0):(t=0|Ge(t,n,i+1|0,r),a=-15728641&T(),n=0|rn(0|r,0,52),o=i,t=(t=!(0|je(n|=t,a=0|a|T())))?-1:r,i=a),s[(a=e)>>2]=n,s[a+4>>2]=i,s[e+8>>2]=o,s[e+12>>2]=t}function nt(e,t,n,r){n|=0,r|=0;var i=0,o=0;return i=0|nn(0|(e|=0),0|(t|=0),52),T(),i&=15,s[(o=r+8|0)>>2]=i,!(0|e)&!(0|t)|(0|n)>15|(0|i)>(0|n)?(s[(n=r)>>2]=0,s[n+4>>2]=0,s[o>>2]=-1,void(s[r+12>>2]=-1)):(e=0|Ge(e,t,i+1|0,n),o=-15728641&T(),i=0|rn(0|n,0,52),i|=e,o=0|o|T(),s[(e=r)>>2]=i,s[e+4>>2]=o,e=r+12|0,0|je(i,o)?void(s[e>>2]=n):void(s[e>>2]=-1))}function rt(e){var t,n=0,r=0,i=0,o=0,a=0,A=0,l=0,c=0;if(!(!(0|(n=0|s[(r=e|=0)>>2]))&!(0|(r=0|s[r+4>>2]))||(i=0|nn(0|n,0|r,52),T(),n=0|Xt(0|(l=0|rn(1,0,3*(15^(i&=15))|0)),0|T(),0|n,0|r),r=0|T(),s[(l=e)>>2]=n,s[l+4>>2]=r,(0|i)<(0|(A=0|s[(l=e+8|0)>>2]))))){for(t=e+12|0,a=i;;){if((0|a)==(0|A)){i=5;break}if(c=(0|a)==(0|s[t>>2]),i=0|nn(0|n,0|r,0|(o=3*(15-a|0)|0)),T(),c&1==(0|(i&=7))&!0){i=7;break}if(!(7==(0|i)&!0)){i=10;break}if(n=0|Xt(0|n,0|r,0|(c=0|rn(1,0,0|o)),0|T()),r=0|T(),s[(c=e)>>2]=n,s[c+4>>2]=r,!((0|a)>(0|A))){i=10;break}a=a+-1|0}if(5==(0|i))return s[(c=e)>>2]=0,s[c+4>>2]=0,s[l>>2]=-1,void(s[t>>2]=-1);if(7==(0|i))return A=0|Xt(0|n,0|r,0|(A=0|rn(1,0,0|o)),0|T()),l=0|T(),s[(c=e)>>2]=A,s[c+4>>2]=l,void(s[t>>2]=a+-1)}}function st(e){var t;return t=(e=+e)<0?e+6.283185307179586:e,+(e>=6.283185307179586?t+-6.283185307179586:t)}function it(e,t){return t|=0,+l(+(+i[(e|=0)>>3]-+i[t>>3]))<17453292519943298e-27?0|(t=+l(+(+i[e+8>>3]-+i[t+8>>3]))<17453292519943298e-27):0|(t=0)}function ot(e,t){switch(e=+e,0|(t|=0)){case 1:e=e<0?e+6.283185307179586:e;break;case 2:e=e>0?e+-6.283185307179586:e}return+e}function at(e,t){e|=0;var n,r,s,o=0;return r=+i[(t|=0)>>3],n=+i[e>>3],o=(s=+d(.5*(r-n)))*s+(o=+d(.5*(+i[t+8>>3]-+i[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))*6371.007180918475}function At(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(i[t>>3]=+i[20656+(e<<3)>>3],0|(t=0))}function lt(e,t){t|=0;var n=0;return(e|=0)>>>0>15?0|(t=4):(n=0|Zt(0|(n=0|_t(7,0,e,((0|e)<0)<<31>>31)),0|T(),120,0),e=0|T(),s[t>>2]=2|n,s[t+4>>2]=e,0|(t=0))}function ct(e,t,n){e|=0,n|=0;var r,s,o,a,A=0,l=0,u=0,p=0,g=0,b=0;return b=+i[(t|=0)>>3],o=+i[e>>3],g=+d(.5*(b-o)),u=+i[t+8>>3],s=+i[e+8>>3],p=+d(.5*(u-s)),r=+h(+o),a=+h(+b),p=2*+_(+ +c(+(p=g*g+p*(a*r*p))),+ +c(+(1-p))),g=+i[n>>3],b=+d(.5*(g-b)),A=+i[n+8>>3],u=+d(.5*(A-u)),l=+h(+g),u=2*+_(+ +c(+(u=b*b+u*(a*l*u))),+ +c(+(1-u))),g=+d(.5*(o-g)),A=+d(.5*(s-A)),A=2*+_(+ +c(+(A=g*g+A*(r*l*A))),+ +c(+(1-A))),4*+m(+ +c(+ +f(.5*(l=.5*(p+u+A)))*+f(.5*(l-p))*+f(.5*(l-u))*+f(.5*(l-A))))}function ut(e,t,n){n|=0;var r,o,a,A=0,l=0;if(a=M,M=M+192|0,o=a,0|(l=0|Ze(e|=0,t|=0,r=a+168|0)))return M=a,0|l;if(0|Je(e,t,o)&&S(27795,27190,415,27199),(0|(t=0|s[o>>2]))>0){if(A=+ct(o+8|0,o+8+((1!=(0|t)&1)<<4)|0,r)+0,1!=(0|t)){e=1;do{A+=+ct(o+8+((l=e)<<4)|0,o+8+((0|(e=e+1|0))%(0|t)<<4)|0,r)}while((0|e)<(0|t))}}else A=0;return i[n>>3]=A,M=a,0}function ht(e){e|=0;var t,n,r=0;return(t=0|$t(1,12))||S(27280,27235,49,27293),0|(r=0|s[(n=e+4|0)>>2])?(s[(r=r+8|0)>>2]=t,s[n>>2]=t,0|t):(0|s[e>>2]&&S(27310,27235,61,27333),s[(r=e)>>2]=t,s[n>>2]=t,0|t)}function dt(e,t){var n,r;return e|=0,t|=0,(r=0|Wt(24))||S(27347,27235,78,27361),s[r>>2]=s[t>>2],s[r+4>>2]=s[t+4>>2],s[r+8>>2]=s[t+8>>2],s[r+12>>2]=s[t+12>>2],s[r+16>>2]=0,0|(n=0|s[(t=e+4|0)>>2])?(s[n+16>>2]=r,s[t>>2]=r,0|r):(0|s[e>>2]&&S(27376,27235,82,27361),s[e>>2]=r,s[t>>2]=r,0|r)}function ft(e){var t=0,n=0,r=0,i=0;if(e|=0)for(r=1;;){if(0|(t=0|s[e>>2]))do{if(0|(n=0|s[t>>2]))do{i=n,n=0|s[n+16>>2],Ht(i)}while(0|n);i=t,t=0|s[t+8>>2],Ht(i)}while(0|t);if(t=e,e=0|s[e+8>>2],r||Ht(t),!e)break;r=0}}function pt(e,t,n){e|=0;var r=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0;if(!(0|K(t|=0,n|=0)))return 0;if(t=0|Y(t),r=+i[n>>3],o=t&(o=+i[n+8>>3])<0?o+6.283185307179586:o,!(e=0|s[e>>2]))return 0;if(t){t=0,u=o,n=e;e:for(;;){for(;A=+i[n>>3],o=+i[n+8>>3],h=0|s[(n=n+16|0)>>2],a=+i[(h=0|h?h:e)>>3],l=+i[h+8>>3],A>a?(c=A,A=l):(c=a,a=A,A=o,o=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|s[n>>2])){n=22;break e}if(((c=(l=A<0?A+6.283185307179586:A)+(r-a)/(c-a)*((A=o<0?o+6.283185307179586:o)-l))<0?c+6.283185307179586:c)>(u=l==u|A==u?u+-2220446049250313e-31:u)&&(t^=1),!(n=0|s[n>>2])){n=22;break}}if(22==(0|n))return 0|t}else{t=0,u=o,n=e;e:for(;;){for(;A=+i[n>>3],o=+i[n+8>>3],h=0|s[(n=n+16|0)>>2],a=+i[(h=0|h?h:e)>>3],l=+i[h+8>>3],A>a?(c=A,A=l):(c=a,a=A,A=o,o=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|s[n>>2])){n=22;break e}if(A+(r-a)/(c-a)*(o-A)>(u=A==u|o==u?u+-2220446049250313e-31:u)&&(t^=1),!(n=0|s[n>>2])){n=22;break}}if(22==(0|n))return 0|t}return 0}function gt(e,t,n,i,o){n|=0,i|=0,o|=0;var a,A,l,c,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(c=M,M=M+32|0,v=c+16|0,l=c,u=0|nn(0|(e|=0),0|(t|=0),52),T(),u&=15,m=0|nn(0|n,0|i,52),T(),(0|u)!=(15&m))return M=c,12;if(p=0|nn(0|e,0|t,45),T(),p&=127,g=0|nn(0|n,0|i,45),T(),p>>>0>121|(g&=127)>>>0>121)return M=c,5;if(m=(0|p)!=(0|g)){if(7==(0|(d=0|X(p,g))))return M=c,1;7==(0|(f=0|X(g,p)))?S(27514,27538,161,27548):(_=d,h=f)}else _=0,h=0;a=0|G(p),A=0|G(g),s[v>>2]=0,s[v+4>>2]=0,s[v+8>>2]=0,s[v+12>>2]=0;do{if(_){if(d=(0|(g=0|s[4272+(28*p|0)+(_<<2)>>2]))>0,A)if(d){p=0,f=n,d=i;do{f=0|$e(f,d),d=0|T(),1==(0|(h=0|ve(h)))&&(h=0|ve(1)),p=p+1|0}while((0|p)!=(0|g));g=h,p=f,f=d}else g=h,p=n,f=i;else if(d){p=0,f=n,d=i;do{f=0|Xe(f,d),d=0|T(),h=0|ve(h),p=p+1|0}while((0|p)!=(0|g));g=h,p=f,f=d}else g=h,p=n,f=i;if(qe(p,f,v),m||S(27563,27538,191,27548),(d=!!(0|a))&(h=!!(0|A))&&S(27590,27538,192,27548),d){if(7==(0|(h=0|Ve(e,t)))){u=5;break}if(0|r[22e3+(7*h|0)+_|0]){u=1;break}p=f=0|s[21168+(28*h|0)+(_<<2)>>2]}else if(h){if(7==(0|(h=0|Ve(p,f)))){u=5;break}if(0|r[22e3+(7*h|0)+g|0]){u=1;break}p=0,f=0|s[21168+(28*g|0)+(h<<2)>>2]}else p=0,f=0;if((p|f|0)<0)u=5;else{if((0|f)>0){d=v+4|0,h=0;do{_e(d),h=h+1|0}while((0|h)!=(0|f))}if(s[l>>2]=0,s[l+4>>2]=0,s[l+8>>2]=0,ge(l,_),0|u)for(;0|Qe(u)?fe(l):pe(l),(0|u)>1;)u=u+-1|0;if((0|p)>0){u=0;do{_e(l),u=u+1|0}while((0|u)!=(0|p))}oe(b=v+4|0,l,b),se(b),b=51}}else if(qe(n,i,v),!!(0|a)&!!(0|A))if((0|g)!=(0|p)&&S(27621,27538,261,27548),7==(0|(h=0|Ve(e,t)))|7==(0|(u=0|Ve(n,i))))u=5;else if(0|r[22e3+(7*h|0)+u|0])u=1;else if((0|(h=0|s[21168+(28*h|0)+(u<<2)>>2]))>0){d=v+4|0,u=0;do{_e(d),u=u+1|0}while((0|u)!=(0|h));b=51}else b=51;else b=51}while(0);return 51==(0|b)&&(u=v+4|0,s[o>>2]=s[u>>2],s[o+4>>2]=s[u+4>>2],s[o+8>>2]=s[u+8>>2],u=0),M=c,0|u}function mt(e,t,n,r){n|=0,r|=0;var i,o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(a=M,M=M+48|0,i=a+36|0,c=a+24|0,u=a+12|0,h=a,A=0|nn(0|(e|=0),0|(t|=0),52),T(),A&=15,f=0|nn(0|e,0|t,45),T(),(f&=127)>>>0>121)return M=a,5;if(o=0|G(f),rn(0|A,0,52),m=134225919|T(),s[(l=r)>>2]=-1,s[l+4>>2]=m,!A)return 7==(0|(A=0|le(n)))||127==(0|(A=0|$(f,A)))?(M=a,0|(m=1)):(p=0|rn(0|A,0,45),g=0|T(),g=-1040385&s[(f=r)+4>>2]|g,s[(m=r)>>2]=s[f>>2]|p,s[m+4>>2]=g,M=a,0|(m=0));for(s[i>>2]=s[n>>2],s[i+4>>2]=s[n+4>>2],s[i+8>>2]=s[n+8>>2],n=A;;){if(l=n,n=n+-1|0,s[c>>2]=s[i>>2],s[c+4>>2]=s[i+4>>2],s[c+8>>2]=s[i+8>>2],0|Qe(l)){if(0|(A=0|ce(i))){n=13;break}s[u>>2]=s[i>>2],s[u+4>>2]=s[i+4>>2],s[u+8>>2]=s[i+8>>2],fe(u)}else{if(0|(A=0|ue(i))){n=13;break}s[u>>2]=s[i>>2],s[u+4>>2]=s[i+4>>2],s[u+8>>2]=s[i+8>>2],pe(u)}if(ae(c,u,h),se(h),b=0|s[(A=r)>>2],A=0|s[A+4>>2],_=0|rn(7,0,0|(v=3*(15-l|0)|0)),A&=~T(),v=0|rn(0|le(h),0,0|v),A=0|T()|A,s[(m=r)>>2]=v|b&~_,s[m+4>>2]=A,(0|l)<=1){n=14;break}}e:do{if(13!=(0|n)&&14==(0|n))if((0|s[i>>2])<=1&&(0|s[i+4>>2])<=1&&(0|s[i+8>>2])<=1){h=127==(0|(A=0|$(f,n=0|le(i))))?0:0|G(A);t:do{if(n){if(o){if(7==(0|(A=0|Ve(e,t)))){A=5;break e}if((0|(l=0|s[21376+(28*A|0)+(n<<2)>>2]))>0){A=n,n=0;do{A=0|be(A),n=n+1|0}while((0|n)!=(0|l))}else A=n;if(1==(0|A)){A=9;break e}127==(0|(n=0|$(f,A)))&&S(27648,27538,411,27678),0|G(n)?S(27693,27538,412,27678):(g=n,p=l,d=A)}else g=A,p=0,d=n;if((0|(u=0|s[4272+(28*f|0)+(d<<2)>>2]))<=-1&&S(27724,27538,419,27678),!h){if((0|p)<0){A=5;break e}if(0|p){A=0,n=0|s[(l=r)>>2],l=0|s[l+4>>2];do{n=0|He(n,l),l=0|T(),s[(v=r)>>2]=n,s[v+4>>2]=l,A=A+1|0}while((0|A)<(0|p))}if((0|u)<=0){A=g,n=58;break}for(A=0,n=0|s[(l=r)>>2],l=0|s[l+4>>2];;)if(n=0|He(n,l),l=0|T(),s[(v=r)>>2]=n,s[v+4>>2]=l,(0|(A=A+1|0))==(0|u)){A=g,n=58;break t}}if(7==(0|(c=0|X(g,f)))&&S(27514,27538,428,27678),n=0|s[(A=r)>>2],A=0|s[A+4>>2],(0|u)>0){l=0;do{n=0|He(n,A),A=0|T(),s[(v=r)>>2]=n,s[v+4>>2]=A,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(A=0|Ve(n,A)))&&S(27795,27538,440,27678),n=0|z(g),(0|(n=0|s[(n?21792:21584)+(28*c|0)+(A<<2)>>2]))<0&&S(27795,27538,454,27678),n){A=0,l=0|s[(c=r)>>2],c=0|s[c+4>>2];do{l=0|We(l,c),c=0|T(),s[(v=r)>>2]=l,s[v+4>>2]=c,A=A+1|0}while((0|A)<(0|n));A=g,n=58}else A=g,n=58}else if(!!(0|o)&!!(0|h)){if(7==(0|(n=0|Ve(e,t)))|7==(0|(l=0|Ve(0|s[(l=r)>>2],0|s[l+4>>2])))){A=5;break e}if((0|(l=0|s[21376+(28*n|0)+(l<<2)>>2]))<0){A=5;break e}if(l){n=0,c=0|s[(u=r)>>2],u=0|s[u+4>>2];do{c=0|He(c,u),u=0|T(),s[(v=r)>>2]=c,s[v+4>>2]=u,n=n+1|0}while((0|n)<(0|l));n=58}else n=59}else n=58}while(0);if(58==(0|n)&&h&&(n=59),59==(0|n)&&1==(0|Ve(0|s[(v=r)>>2],0|s[v+4>>2]))){A=9;break}_=0|s[(v=r)>>2],v=-1040385&s[v+4>>2],b=0|rn(0|A,0,45),v=0|v|T(),s[(A=r)>>2]=_|b,s[A+4>>2]=v,A=0}else A=1}while(0);return M=a,0|A}function _t(e,t,n,r){e|=0,t|=0;var s=0,i=0,o=0;if(!(0|(n|=0))&!(0|(r|=0)))return i=1,E(0|(s=0)),0|i;i=e,s=t,e=1,t=0;do{e=0|Zt(0|((o=!0&!(1&n))?1:i),0|(o?0:s),0|e,0|t),t=0|T(),n=0|tn(0|n,0|r,1),r=0|T(),i=0|Zt(0|i,0|s,0|i,0|s),s=0|T()}while(!(!(0|n)&!(0|r)));return E(0|t),0|e}function bt(e,t,n,r){n|=0,r|=0;var o,a=0,A=0,l=0,c=0,u=0,d=0;o=M,M=M+16|0,A=o,l=0|nn(0|(e|=0),0|(t|=0),52),T(),l&=15;do{if(l){if(!(a=0|Ze(e,t,A))){u=+i[A>>3],c=1/+h(+u),d=+i[25968+(l<<3)>>3],i[n>>3]=u+d,i[n+8>>3]=u-d,u=+i[A+8>>3],c*=d,i[n+16>>3]=c+u,i[n+24>>3]=u-c;break}return M=o,0|a}if(a=0|nn(0|e,0|t,45),T(),(a&=127)>>>0>121)return M=o,5;A=22064+(a<<5)|0,s[n>>2]=s[A>>2],s[n+4>>2]=s[A+4>>2],s[n+8>>2]=s[A+8>>2],s[n+12>>2]=s[A+12>>2],s[n+16>>2]=s[A+16>>2],s[n+20>>2]=s[A+20>>2],s[n+24>>2]=s[A+24>>2],s[n+28>>2]=s[A+28>>2];break}while(0);return function(e,t){t=+t;var n,r,s,o,a,A,l,c=0,u=0;c=(o=+i[(s=16+(e|=0)|0)>>3])-(r=+i[(n=e+24|0)>>3]),c=o>3],c=.5*(c*t-c),u+=t=.5*((l=u-(A=+i[(a=e+8|0)>>3]))*t-l),i[e>>3]=u>1.5707963267948966?1.5707963267948966:u,t=A-t,i[a>>3]=t<-1.5707963267948966?-1.5707963267948966:t,t=(t=o+c)>3.141592653589793?t+-6.283185307179586:t,i[s>>3]=t<-3.141592653589793?t+6.283185307179586:t,t=(t=r-c)>3.141592653589793?t+-6.283185307179586:t,i[n>>3]=t<-3.141592653589793?t+6.283185307179586:t}(n,r?1.4:1.1),(0|s[(r=26096+(l<<3)|0)>>2])==(0|e)&&(0|s[r+4>>2])==(0|t)&&(i[n>>3]=1.5707963267948966),(0|s[(l=26224+(l<<3)|0)>>2])==(0|e)&&(0|s[l+4>>2])==(0|t)&&(i[n+8>>3]=-1.5707963267948966),1.5707963267948966!=+i[n>>3]&&-1.5707963267948966!=+i[n+8>>3]?(M=o,0|(l=0)):(i[n+16>>3]=3.141592653589793,i[n+24>>3]=-3.141592653589793,M=o,0|(l=0))}function vt(e){var t,n,i,o,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0;if(o=M,M=M+336|0,t=o+168|0,n=o,!(0|(A=0|s[(l=e|=0)>>2]))&!(0|(l=0|s[l+4>>2])))M=o;else{if(0|r[0|(a=e+28|0)]?(A=0|yt(A,l),l=0|T()):r[0|a]=1,!(0|s[s[(i=e+20|0)>>2]>>2]))return 0|(A=0|s[(a=e+24|0)>>2])&&Ht(A),s[(w=e)>>2]=0,s[w+4>>2]=0,s[e+8>>2]=0,s[i>>2]=0,s[e+12>>2]=-1,s[e+16>>2]=0,s[a>>2]=0,void(M=o);c=15&(a=0|s[(w=e+16|0)>>2]);e:do{if(!(0|A)&!(0|l))y=e+24|0;else{b=e+12|0,m=3==(0|c),g=255&a,f=3==(1|c),_=e+24|0,p=(c+-1|0)>>>0<3,h=3==(2|c),d=n+8|0;t:for(;;){if(u=0|nn(0|A,0|l,52),T(),(0|(u&=15))==(0|s[b>>2])){switch(15&g){case 0:case 2:case 3:if(0|(c=0|Ze(A,l,t))){v=15;break t}if(0|St(0|s[i>>2],0|s[_>>2],t)){v=19;break t}}if(f&&(c=0|s[4+(0|s[i>>2])>>2],s[t>>2]=s[c>>2],s[t+4>>2]=s[c+4>>2],s[t+8>>2]=s[c+8>>2],s[t+12>>2]=s[c+12>>2],0|K(26832,t))){if(0|Ye(0|s[4+(0|s[i>>2])>>2],u,n)){v=25;break}if((0|s[(c=n)>>2])==(0|A)&&(0|s[c+4>>2])==(0|l)){v=29;break}}if(p){if(0|(c=0|Je(A,l,t))){v=32;break}if(0|bt(A,l,n,0)){v=36;break}if(h&&0|Ct(0|s[i>>2],0|s[_>>2],t,n)){v=42;break}if(f&&0|Rt(0|s[i>>2],0|s[_>>2],t,n)){v=42;break}}if(m){if(a=0|bt(A,l,t,1),c=0|s[_>>2],0|a){v=45;break}if(0|Z(c,t)){if(ee(n,t),0|J(t,0|s[_>>2])){v=53;break}if(0|St(0|s[i>>2],0|s[_>>2],d)){v=53;break}if(0|Rt(0|s[i>>2],0|s[_>>2],n,t)){v=53;break}}}}do{if((0|u)<(0|s[b>>2])){if(a=0|bt(A,l,t,1),c=0|s[_>>2],0|a){v=58;break t}if(!(0|Z(c,t))){v=73;break}if(0|J(0|s[_>>2],t)&&(ee(n,t),0|Ct(0|s[i>>2],0|s[_>>2],n,t))){v=65;break t}if(0|(A=0|ze(A,l,u+1|0,n))){v=67;break t}A=0|s[(l=n)>>2],l=0|s[l+4>>2]}else v=73}while(0);if(73==(0|v)&&(v=0,A=0|yt(A,l),l=0|T()),!(0|A)&!(0|l)){y=_;break e}}switch(0|v){case 15:0|(a=0|s[_>>2])&&Ht(a),s[(v=e)>>2]=0,s[v+4>>2]=0,s[i>>2]=0,s[b>>2]=-1,s[w>>2]=0,s[_>>2]=0,s[e+8>>2]=c,v=20;break;case 19:s[e>>2]=A,s[e+4>>2]=l,v=20;break;case 25:S(27795,27761,470,27772);break;case 29:case 42:return s[e>>2]=A,s[e+4>>2]=l,void(M=o);case 32:return 0|(a=0|s[_>>2])&&Ht(a),s[(y=e)>>2]=0,s[y+4>>2]=0,s[i>>2]=0,s[b>>2]=-1,s[w>>2]=0,s[_>>2]=0,s[e+8>>2]=c,void(M=o);case 36:S(27795,27761,493,27772);break;case 45:0|c&&Ht(c),s[(v=e)>>2]=0,s[v+4>>2]=0,s[i>>2]=0,s[b>>2]=-1,s[w>>2]=0,s[_>>2]=0,s[e+8>>2]=a,v=55;break;case 53:s[e>>2]=A,s[e+4>>2]=l,v=55;break;case 58:0|c&&Ht(c),s[(v=e)>>2]=0,s[v+4>>2]=0,s[i>>2]=0,s[b>>2]=-1,s[w>>2]=0,s[_>>2]=0,s[e+8>>2]=a,v=71;break;case 65:s[e>>2]=A,s[e+4>>2]=l,v=71;break;case 67:return 0|(a=0|s[_>>2])&&Ht(a),s[(y=e)>>2]=0,s[y+4>>2]=0,s[i>>2]=0,s[b>>2]=-1,s[w>>2]=0,s[_>>2]=0,s[e+8>>2]=A,void(M=o)}if(20==(0|v))return void(M=o);if(55==(0|v))return void(M=o);if(71==(0|v))return void(M=o)}}while(0);0|(a=0|s[y>>2])&&Ht(a),s[(v=e)>>2]=0,s[v+4>>2]=0,s[e+8>>2]=0,s[i>>2]=0,s[e+12>>2]=-1,s[w>>2]=0,s[y>>2]=0,M=o}}function yt(e,t){var n,r=0,i=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0;n=M,M=M+16|0,h=n,i=0|nn(0|(e|=0),0|(t|=0),52),T(),i&=15,r=0|nn(0|e,0|t,45),T();do{if(i){for(;r=0|rn(i+4095|0,0,52),o=T()|-15728641&t,r=r|e|(A=0|rn(7,0,0|(a=3*(15-i|0)|0))),o|=l=0|T(),c=0|nn(0|e,0|t,0|a),T(),i=i+-1|0,!((c&=7)>>>0<6);){if(!i){u=4;break}t=o,e=r}if(4==(0|u)){r=0|nn(0|r,0|o,45),T();break}return h=0|rn(((h=!(0|c)&!!(0|je(r,o)))?2:1)+c|0,0,0|a),u=0|T()|t&~l,h|=e&~A,E(0|u),M=n,0|h}}while(0);return(r&=127)>>>0>120?(h=0,E(0|(u=0)),M=n,0|h):(Oe(h,0,r+1|0,0),u=0|s[h+4>>2],h=0|s[h>>2],E(0|u),M=n,0|h)}function wt(e,t,n){e|=0;var r,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0;if(!(0|K(t|=0,n|=0)))return 0;if(t=0|Y(t),o=+i[n>>3],a=t&(a=+i[n+8>>3])<0?a+6.283185307179586:a,(0|(f=0|s[e>>2]))<=0)return 0;if(r=0|s[e+4>>2],t){t=0,d=a,n=-1,e=0;e:for(;;){for(h=e;l=+i[r+(h<<4)>>3],a=+i[r+(h<<4)+8>>3],A=+i[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],c=+i[r+(e<<4)+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=a,a=c),(o=o==A|o==u?o+2220446049250313e-31:o)u;){if((0|(n=h+1|0))>=(0|f)){n=22;break e}e=h,h=n,n=e}if(((u=(c=l<0?l+6.283185307179586:l)+(o-A)/(u-A)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(d=c==d|l==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=h+1|0))>=(0|f)){n=22;break}n=h}if(22==(0|n))return 0|t}else{t=0,d=a,n=-1,e=0;e:for(;;){for(h=e;l=+i[r+(h<<4)>>3],a=+i[r+(h<<4)+8>>3],A=+i[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],c=+i[r+(e<<4)+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=a,a=c),(o=o==A|o==u?o+2220446049250313e-31:o)u;){if((0|(n=h+1|0))>=(0|f)){n=22;break e}e=h,h=n,n=e}if(l+(o-A)/(u-A)*(a-l)>(d=l==d|a==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=h+1|0))>=(0|f)){n=22;break}n=h}if(22==(0|n))return 0|t}return 0}function xt(e,t){t|=0;var n,r,o,a,A,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0;if(!(r=0|s[(e|=0)>>2]))return s[t>>2]=0,s[t+4>>2]=0,s[t+8>>2]=0,s[t+12>>2]=0,s[t+16>>2]=0,s[t+20>>2]=0,s[t+24>>2]=0,void(s[t+28>>2]=0);if(i[(o=t+8|0)>>3]=17976931348623157e292,i[(a=t+24|0)>>3]=17976931348623157e292,i[t>>3]=-17976931348623157e292,i[(A=t+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(n=0|s[e+4>>2],m=17976931348623157e292,_=-17976931348623157e292,b=0,e=-1,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,u=-17976931348623157e292,v=0;c=+i[n+(v<<4)>>3],p=+i[n+(v<<4)+8>>3],h=+i[n+(((0|(e=e+2|0))==(0|r)?0:e)<<4)+8>>3],c>3]=c,d=c),p>3]=p,f=p),c>g?i[t>>3]=c:c=g,p>u&&(i[A>>3]=p,u=p),m=p>0&p_?p:_,b|=+l(+(p-h))>3.141592653589793,(0|(e=v+1|0))!=(0|r);)y=v,g=c,v=e,e=y;b&&(i[A>>3]=_,i[a>>3]=m)}}function Et(e){return 0|((e|=0)>>>0<4?0:15)}function Tt(e,t){t|=0;var n,r=0,o=0,a=0,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,S=0;if(_=0|s[(e|=0)>>2]){if(i[(b=t+8|0)>>3]=17976931348623157e292,i[(v=t+24|0)>>3]=17976931348623157e292,i[t>>3]=-17976931348623157e292,i[(y=t+16|0)>>3]=-17976931348623157e292,(0|_)>0){for(a=0|s[e+4>>2],g=17976931348623157e292,m=-17976931348623157e292,o=0,r=-1,h=17976931348623157e292,d=17976931348623157e292,p=-17976931348623157e292,c=-17976931348623157e292,w=0;A=+i[a+(w<<4)>>3],f=+i[a+(w<<4)+8>>3],u=+i[a+(((0|(T=r+2|0))==(0|_)?0:T)<<4)+8>>3],A>3]=A,h=A),f>3]=f,d=f),A>p?i[t>>3]=A:A=p,f>c&&(i[y>>3]=f,c=f),g=f>0&fm?f:m,o|=+l(+(f-u))>3.141592653589793,(0|(r=w+1|0))!=(0|_);)T=w,p=A,w=r,r=T;o&&(i[y>>3]=m,i[v>>3]=g)}}else s[t>>2]=0,s[t+4>>2]=0,s[t+8>>2]=0,s[t+12>>2]=0,s[t+16>>2]=0,s[t+20>>2]=0,s[t+24>>2]=0,s[t+28>>2]=0;if(!((0|(r=0|s[(T=e+8|0)>>2]))<=0)){n=e+12|0,E=0;do{if(a=0|s[n>>2],o=E,v=t+((E=E+1|0)<<5)|0,y=0|s[a+(o<<3)>>2]){if(i[(w=t+(E<<5)+8|0)>>3]=17976931348623157e292,i[(e=t+(E<<5)+24|0)>>3]=17976931348623157e292,i[v>>3]=-17976931348623157e292,i[(x=t+(E<<5)+16|0)>>3]=-17976931348623157e292,(0|y)>0){for(_=0|s[a+(o<<3)+4>>2],g=17976931348623157e292,m=-17976931348623157e292,a=0,o=-1,b=0,h=17976931348623157e292,d=17976931348623157e292,f=-17976931348623157e292,c=-17976931348623157e292;A=+i[_+(b<<4)>>3],p=+i[_+(b<<4)+8>>3],u=+i[_+(((0|(o=o+2|0))==(0|y)?0:o)<<4)+8>>3],A>3]=A,h=A),p>3]=p,d=p),A>f?i[v>>3]=A:A=f,p>c&&(i[x>>3]=p,c=p),g=p>0&pm?p:m,a|=+l(+(p-u))>3.141592653589793,(0|(o=b+1|0))!=(0|y);)S=b,b=o,f=A,o=S;a&&(i[x>>3]=m,i[e>>3]=g)}}else s[v>>2]=0,s[v+4>>2]=0,s[v+8>>2]=0,s[v+12>>2]=0,s[v+16>>2]=0,s[v+20>>2]=0,s[v+24>>2]=0,s[v+28>>2]=0,r=0|s[T>>2]}while((0|E)<(0|r))}}function St(e,t,n){var r=0,i=0,o=0;if(!(0|wt(e|=0,t|=0,n|=0)))return 0;if((0|s[(i=e+8|0)>>2])<=0)return 1;for(r=e+12|0,e=0;;){if(o=e,e=e+1|0,0|wt((0|s[r>>2])+(o<<3)|0,t+(e<<5)|0,n)){e=0,r=6;break}if((0|e)>=(0|s[i>>2])){e=1,r=6;break}}return 6==(0|r)?0|e:0}function Ct(e,t,n,r){r|=0;var i,o,a=0,A=0,l=0,c=0,u=0;if(o=M,M=M+16|0,i=o,!(0|wt(e|=0,t|=0,l=8+(n|=0)|0)))return M=o,0;c=e+8|0;e:do{if((0|s[c>>2])>0){for(A=e+12|0,a=0;;){if(u=a,a=a+1|0,0|wt((0|s[A>>2])+(u<<3)|0,t+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|s[c>>2]))break e}return M=o,0|a}}while(0);if(0|kt(e,t,n,r))return M=o,0;s[i>>2]=s[n>>2],s[i+4>>2]=l,a=0|s[c>>2];e:do{if((0|a)>0)for(e=e+12|0,l=0,A=a;;){if(a=0|s[e>>2],(0|s[a+(l<<3)>>2])>0){if(0|wt(i,r,0|s[a+(l<<3)+4>>2])){a=0;break e}if(a=l+1|0,0|kt((0|s[e>>2])+(l<<3)|0,t+(a<<5)|0,n,r)){a=0;break e}A=0|s[c>>2]}else a=l+1|0;if(!((0|a)<(0|A))){a=1;break}l=a}else a=1}while(0);return M=o,0|a}function kt(e,t,n,r){e|=0,n|=0;var o,a,A,l,c,u,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,S=0;if(u=M,M=M+176|0,l=u+172|0,h=u+168|0,c=u,!(0|Z(t|=0,r|=0)))return M=u,0;if(function(e,t,n,r){var o,a,A,l,c;t|=0,n|=0,r|=0,e=(a=+i[16+(e|=0)>>3])<(c=+i[e+24>>3]),o=(l=+i[t+16>>3])<(A=+i[t+24>>3]),t=c-l>2]=e?o|t?1:2:0,s[r>>2]=o?e?1:t?2:1:0}(t,r,l,h),ln(0|c,0|n,168),(0|s[n>>2])>0){t=0;do{w=+ot(+i[(T=c+8+(t<<4)+8|0)>>3],0|s[h>>2]),i[T>>3]=w,t=t+1|0}while((0|t)<(0|s[n>>2]))}a=+i[r>>3],A=+i[r+8>>3],w=+ot(+i[r+16>>3],0|s[h>>2]),o=+ot(+i[r+24>>3],0|s[h>>2]);e:do{if((0|s[e>>2])>0){if(r=e+4|0,(0|(h=0|s[c>>2]))<=0)for(t=0;;)if((0|(t=t+1|0))>=(0|s[e>>2])){t=0;break e}for(n=0;;){if(t=0|s[r>>2],v=+i[t+(n<<4)>>3],y=+ot(+i[t+(n<<4)+8>>3],0|s[l>>2]),t=0|s[r>>2],T=(0|(n=n+1|0))%(0|s[e>>2])|0,d=+i[t+(T<<4)>>3],f=+ot(+i[t+(T<<4)+8>>3],0|s[l>>2]),!(v>=a)|!(d>=a)&&!(v<=A)|!(d<=A)&&!(y<=o)|!(f<=o)&&!(y>=w)|!(f>=w)){b=d-v,m=f-y,t=0;do{if(S=t,T=(0|(t=t+1|0))==(0|h)?0:t,d=+i[c+8+(S<<4)+8>>3],f=+i[c+8+(T<<4)+8>>3]-d,p=+i[c+8+(S<<4)>>3],!(0==(_=b*f-m*(g=+i[c+8+(T<<4)>>3]-p))||(x=y-d,E=v-p,g=(x*g-f*E)/_,g<0|g>1))&&(_=(b*x-m*E)/_)>=0&_<=1){t=1;break e}}while((0|t)<(0|h))}if((0|n)>=(0|s[e>>2])){t=0;break}}}else t=0}while(0);return M=u,0|t}function Rt(e,t,n,r){var i=0,o=0,a=0;if(0|kt(e|=0,t|=0,n|=0,r|=0))return 1;if((0|s[(o=e+8|0)>>2])<=0)return 0;for(i=e+12|0,e=0;;){if(a=e,e=e+1|0,0|kt((0|s[i>>2])+(a<<3)|0,t+(e<<5)|0,n,r)){e=1,i=6;break}if((0|e)>=(0|s[o>>2])){e=0,i=6;break}}return 6==(0|i)?0|e:0}function Pt(e,t,n,r,s){t|=0,n|=0,r|=0,s|=0;var o,a,A,l,c,u,h,d=0;l=+i[(e|=0)>>3],A=+i[t>>3]-l,a=+i[e+8>>3],o=+i[t+8>>3]-a,u=+i[n>>3],d=((d=+i[r>>3]-u)*(a-(h=+i[n+8>>3]))-(l-u)*(c=+i[r+8>>3]-h))/(A*c-o*d),i[s>>3]=l+A*d,i[s+8>>3]=a+o*d}function It(e,t){return t|=0,+l(+(+i[(e|=0)>>3]-+i[t>>3]))<1.1920928955078125e-7?0|(t=+l(+(+i[e+8>>3]-+i[t+8>>3]))<1.1920928955078125e-7):0|(t=0)}function Mt(e,t){var n,r,s;return t|=0,+((s=+i[(e|=0)>>3]-+i[t>>3])*s+(r=+i[e+8>>3]-+i[t+8>>3])*r+(n=+i[e+16>>3]-+i[t+16>>3])*n)}function Lt(e,t,n){n|=0;var r,i,o,a,A=0,l=0,c=0,u=0;if(a=M,M=M+32|0,u=a,0|(A=0|Ke(e|=0,t|=0,i=a+16|0)))return M=a,0|A;r=0|Be(e,t),o=0|Ve(e,t),function(e,t){e=7696+(28*(e|=0)|0)|0,s[(t|=0)>>2]=s[e>>2],s[t+4>>2]=s[e+4>>2],s[t+8>>2]=s[e+8>>2],s[t+12>>2]=s[e+12>>2]}(r,u),A=0|function(e,t){e|=0;var n=0,r=0;if((t|=0)>>>0>20)return-1;do{if((0|s[11120+(216*t|0)>>2])!=(0|e))if((0|s[11120+(216*t|0)+8>>2])!=(0|e))if((0|s[11120+(216*t|0)+16>>2])!=(0|e))if((0|s[11120+(216*t|0)+24>>2])!=(0|e))if((0|s[11120+(216*t|0)+32>>2])!=(0|e))if((0|s[11120+(216*t|0)+40>>2])!=(0|e))if((0|s[11120+(216*t|0)+48>>2])!=(0|e))if((0|s[11120+(216*t|0)+56>>2])!=(0|e))if((0|s[11120+(216*t|0)+64>>2])!=(0|e))if((0|s[11120+(216*t|0)+72>>2])!=(0|e))if((0|s[11120+(216*t|0)+80>>2])!=(0|e))if((0|s[11120+(216*t|0)+88>>2])!=(0|e))if((0|s[11120+(216*t|0)+96>>2])!=(0|e))if((0|s[11120+(216*t|0)+104>>2])!=(0|e))if((0|s[11120+(216*t|0)+112>>2])!=(0|e))if((0|s[11120+(216*t|0)+120>>2])!=(0|e))if((0|s[11120+(216*t|0)+128>>2])!=(0|e)){if((0|s[11120+(216*t|0)+136>>2])!=(0|e)){if((0|s[11120+(216*t|0)+144>>2])==(0|e)){e=0,n=2,r=0;break}if((0|s[11120+(216*t|0)+152>>2])==(0|e)){e=0,n=2,r=1;break}if((0|s[11120+(216*t|0)+160>>2])==(0|e)){e=0,n=2,r=2;break}if((0|s[11120+(216*t|0)+168>>2])==(0|e)){e=1,n=2,r=0;break}if((0|s[11120+(216*t|0)+176>>2])==(0|e)){e=1,n=2,r=1;break}if((0|s[11120+(216*t|0)+184>>2])==(0|e)){e=1,n=2,r=2;break}if((0|s[11120+(216*t|0)+192>>2])==(0|e)){e=2,n=2,r=0;break}if((0|s[11120+(216*t|0)+200>>2])==(0|e)){e=2,n=2,r=1;break}if((0|s[11120+(216*t|0)+208>>2])==(0|e)){e=2,n=2,r=2;break}return-1}e=2,n=1,r=2}else e=2,n=1,r=1;else e=2,n=1,r=0;else e=1,n=1,r=2;else e=1,n=1,r=1;else e=1,n=1,r=0;else e=0,n=1,r=2;else e=0,n=1,r=1;else e=0,n=1,r=0;else e=2,n=0,r=2;else e=2,n=0,r=1;else e=2,n=0,r=0;else e=1,n=0,r=2;else e=1,n=0,r=1;else e=1,n=0,r=0;else e=0,n=0,r=2;else e=0,n=0,r=1;else e=0,n=0,r=0}while(0);return 0|s[11120+(216*t|0)+(72*n|0)+(24*e|0)+(r<<3)+4>>2]}(r,0|s[i>>2]);do{if(0|G(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:S(27795,27797,75,27806)}if(c=0|s[26416+(24*l|0)+8>>2],t=0|s[26416+(24*l|0)+16>>2],(0|(e=0|s[i>>2]))!=(0|s[u>>2])&&(u=0|z(r))|(0|(e=0|s[i>>2]))==(0|t)&&(A=(A+1|0)%6|0),3==(0|o)&(0|e)==(0|t)){A=(A+5|0)%6|0;break}5==(0|o)&(0|e)==(0|c)&&(A=(A+1|0)%6|0)}}while(0);return s[n>>2]=A,M=a,0}function Nt(e,t,n,r){n|=0,r|=0;var i,o,a,A,l,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(l=M,M=M+32|0,v=l+24|0,A=l+20|0,a=l+8|0,o=l+16|0,i=l,f=(f=!(0|je(e|=0,t|=0)))?6:5,g=0|nn(0|e,0|t,52),T(),f>>>0<=n>>>0)return M=l,2;!(m=!(0|(g&=15)))&&!((_=0|rn(7,0,3*(15^g)|0))&e)&!((0|T())&t)?c=n:u=4;e:do{if(4==(0|u)){if((0|((c=!!(0|je(e,t)))?4:5))<(0|n))return M=l,1;if(0|Lt(e,t,v))return M=l,1;if(u=(0|s[v>>2])+n|0,7==(0|(_=0|s[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return M=l,1;s[A>>2]=0,c=0|O(e,t,_,A,a);do{if(!c){if(p=0|s[(d=a)>>2],u=(h=(d=0|s[d+4>>2])>>>0>>0|(0|d)==(0|t)&p>>>0>>0)?p:e,h=h?d:t,!m&&!(p&(m=0|rn(7,0,3*(15^g)|0)))&!(d&(0|T())))c=n;else{if(d=(n+-1+f|0)%(0|f)|0,c=0|je(e,t),(0|d)<0&&S(27795,27797,248,27822),(0|((f=!!(0|c))?4:5))<(0|d)&&S(27795,27797,248,27822),0|Lt(e,t,v)&&S(27795,27797,248,27822),c=(0|s[v>>2])+d|0,7==(0|(d=0|s[(c=f?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&S(27795,27797,248,27822),s[o>>2]=0,0|(c=0|O(e,t,d,o,i)))break;f=0|s[(p=i)>>2],p=0|s[p+4>>2];do{if(p>>>0>>0|(0|p)==(0|h)&f>>>0>>0){if(u=0|je(f,p)?0|U(f,p,e,t):0|s[26800+(((0|s[o>>2])+(0|s[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|je(f,p),(u+-1|0)>>>0>5){c=-1,u=f,h=p;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=f,h=p;break}do{if(!(0|Lt(f,p,v))){if(c){c=(5+(0|s[26352+(u<<2)>>2])-(0|s[v>>2])|0)%5|0;break}c=(6+(0|s[26384+(u<<2)>>2])-(0|s[v>>2])|0)%6|0;break}c=-1}while(0);u=f,h=p}else c=n}while(0);p=0|s[(d=a)>>2],d=0|s[d+4>>2]}if((0|u)==(0|p)&(0|h)==(0|d)){if(e=(f=!!(0|je(p,d)))?0|U(p,d,e,t):0|s[26800+(((0|s[A>>2])+(0|s[26768+(_<<2)>>2])|0)%6<<2)>>2],c=0|je(p,d),(e+-1|0)>>>0<=5&&!(1==(0|e)&(b=!!(0|c))))do{if(!(0|Lt(p,d,v))){if(b){c=(5+(0|s[26352+(e<<2)>>2])-(0|s[v>>2])|0)%5|0;break}c=(6+(0|s[26384+(e<<2)>>2])-(0|s[v>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|f&5==(0|c)?0:c}t=h,e=u;break e}}while(0);return M=l,0|c}}while(0);return b=0|rn(0|c,0,56),v=T()|-2130706433&t|536870912,s[r>>2]=b|e,s[r+4>>2]=v,M=l,0}function Bt(e,t){e|=0;var n,r,i=0,o=0;return r=M,M=M+16|0,n=r,!0&536870912==(2013265920&(t|=0))&&0|De(e,i=-2130706433&t|134217728)?(o=0|nn(0|e,0|t,56),T(),i=(o=!(0|Nt(e,i,7&o,n)))&((0|s[(i=n)>>2])==(0|e)?(0|s[i+4>>2])==(0|t):0)&1,M=r,0|i):(M=r,0|(i=0))}function Dt(e,t,n){e|=0,n|=0;var r=0;(0|(t|=0))>0?(r=0|$t(t,4),s[e>>2]=r,r||S(27835,27858,40,27872)):s[e>>2]=0,s[e+4>>2]=t,s[e+8>>2]=0,s[e+12>>2]=n}function Ot(e){var t,n,r,o=0,a=0,A=0,c=0;t=4+(e|=0)|0,n=e+12|0,r=e+8|0;e:for(;;){for(a=0|s[t>>2],o=0;;){if((0|o)>=(0|a))break e;if(A=0|s[e>>2],c=0|s[A+(o<<2)>>2])break;o=o+1|0}o=A+(~~(+l(+ +u(10,+ +(15-(0|s[n>>2])|0))*(+i[c>>3]+ +i[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|s[o>>2];t:do{if(0|a){if(A=c+32|0,(0|a)==(0|c))s[o>>2]=s[A>>2];else{if(!(o=0|s[(a=a+32|0)>>2]))break;for(;(0|o)!=(0|c);)if(!(o=0|s[(a=o+32|0)>>2]))break t;s[a>>2]=s[A>>2]}Ht(c),s[r>>2]=(0|s[r>>2])-1}}while(0)}Ht(0|s[e>>2])}function Ft(e){var t,n=0,r=0;for(t=0|s[4+(e|=0)>>2],r=0;;){if((0|r)>=(0|t)){n=0,r=4;break}if(n=0|s[(0|s[e>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|n:0}function Ut(e,t){t|=0;var n=0,r=0,o=0,a=0;if(n=~~(+l(+ +u(10,+ +(15-(0|s[12+(e|=0)>>2])|0))*(+i[t>>3]+ +i[t+8>>3]))%+(0|s[e+4>>2]))>>>0,n=(0|s[e>>2])+(n<<2)|0,!(r=0|s[n>>2]))return 1;a=t+32|0;do{if((0|r)!=(0|t)){if(!(n=0|s[r+32>>2]))return 1;for(o=n;;){if((0|o)==(0|t)){o=8;break}if(!(n=0|s[o+32>>2])){n=1,o=10;break}r=o,o=n}if(8==(0|o)){s[r+32>>2]=s[a>>2];break}if(10==(0|o))return 0|n}else s[n>>2]=s[a>>2]}while(0);return Ht(t),s[(a=e+8|0)>>2]=(0|s[a>>2])-1,0}function jt(e,t,n){e|=0,t|=0,n|=0;var r,o=0,a=0,A=0;(r=0|Wt(40))||S(27888,27858,98,27901),s[r>>2]=s[t>>2],s[r+4>>2]=s[t+4>>2],s[r+8>>2]=s[t+8>>2],s[r+12>>2]=s[t+12>>2],s[(a=r+16|0)>>2]=s[n>>2],s[a+4>>2]=s[n+4>>2],s[a+8>>2]=s[n+8>>2],s[a+12>>2]=s[n+12>>2],s[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|s[e+12>>2])|0))*(+i[t>>3]+ +i[t+8>>3]))%+(0|s[e+4>>2]))>>>0,a=(0|s[e>>2])+(a<<2)|0,o=0|s[a>>2];do{if(o){for(;!(0|it(o,t)&&0|it(o+16|0,n));)if(a=0|s[o+32>>2],!(0|s[(o=0|a?a:o)+32>>2])){A=10;break}if(10==(0|A)){s[o+32>>2]=r;break}return Ht(r),0|o}s[a>>2]=r}while(0);return s[(A=e+8|0)>>2]=1+(0|s[A>>2]),0|r}function Gt(e,t,n){t|=0,n|=0;var r=0,o=0;if(o=~~(+l(+ +u(10,+ +(15-(0|s[12+(e|=0)>>2])|0))*(+i[t>>3]+ +i[t+8>>3]))%+(0|s[e+4>>2]))>>>0,!(o=0|s[(0|s[e>>2])+(o<<2)>>2]))return 0;if(!n){for(e=o;;){if(0|it(e,t)){r=10;break}if(!(e=0|s[e+32>>2])){e=0,r=10;break}}if(10==(0|r))return 0|e}for(e=o;;){if(0|it(e,t)&&0|it(e+16|0,n)){r=10;break}if(!(e=0|s[e+32>>2])){e=0,r=10;break}}return 10==(0|r)?0|e:0}function zt(e,t){t|=0;var n=0;if(n=~~(+l(+ +u(10,+ +(15-(0|s[12+(e|=0)>>2])|0))*(+i[t>>3]+ +i[t+8>>3]))%+(0|s[e+4>>2]))>>>0,!(e=0|s[(0|s[e>>2])+(n<<2)>>2]))return 0;for(;;){if(0|it(e,t)){t=5;break}if(!(e=0|s[e+32>>2])){e=0,t=5;break}}return 5==(0|t)?0|e:0}function Vt(e){return 0|+un(+(e=+e))}function Wt(e){e|=0;var t,n=0,r=0,i=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0;t=M,M=M+16|0,f=t;do{if(e>>>0<245){if(e=(u=e>>>0<11?16:e+11&-8)>>>3,3&(r=(d=0|s[6981])>>>e))return i=0|s[(r=8+(e=27964+((n=(1&r^1)+e|0)<<1<<2)|0)|0)>>2],(0|(a=0|s[(o=i+8|0)>>2]))==(0|e)?s[6981]=d&~(1<>2]=e,s[r>>2]=a),w=n<<3,s[i+4>>2]=3|w,s[(w=i+w+4|0)>>2]=1|s[w>>2],M=t,0|o;if(u>>>0>(h=0|s[6983])>>>0){if(0|r)return n=((n=r<>>=l=n>>>12&16)>>>5&8)|l|(a=(n>>>=r)>>>2&4)|(e=(n>>>=a)>>>1&2)|(i=(n>>>=e)>>>1&1))+(n>>>i)|0)<<1<<2)|0)|0)>>2],(0|(r=0|s[(l=a+8|0)>>2]))==(0|n)?(e=d&~(1<>2]=n,s[e>>2]=r,e=d),A=(w=i<<3)-u|0,s[a+4>>2]=3|u,s[4+(o=a+u|0)>>2]=1|A,s[a+w>>2]=A,0|h&&(i=0|s[6986],r=27964+((n=h>>>3)<<1<<2)|0,e&(n=1<>2]:(s[6981]=e|n,n=r,e=r+8|0),s[e>>2]=i,s[n+12>>2]=i,s[i+8>>2]=n,s[i+12>>2]=r),s[6983]=A,s[6986]=o,M=t,0|l;if(a=0|s[6982]){for(r=(a&0-a)-1|0,r=c=0|s[28228+(((i=(r>>>=o=r>>>12&16)>>>5&8)|o|(A=(r>>>=i)>>>2&4)|(l=(r>>>=A)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&s[c+4>>2])-u|0;(e=0|s[r+16>>2])||(e=0|s[r+20>>2]);)r=e,l=(o=(A=(-8&s[e+4>>2])-u|0)>>>0>>0)?e:l,c=o?A:c;if((A=l+u|0)>>>0>l>>>0){o=0|s[l+24>>2],n=0|s[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|s[(e=l+20|0)>>2])&&!(n=0|s[(e=l+16|0)>>2])){r=0;break}for(;;)if(r=0|s[(i=n+20|0)>>2])n=r,e=i;else{if(!(r=0|s[(i=n+16|0)>>2]))break;n=r,e=i}s[e>>2]=0,r=n}else r=0|s[l+8>>2],s[r+12>>2]=n,s[n+8>>2]=r,r=n}while(0);do{if(0|o){if(n=0|s[l+28>>2],(0|l)==(0|s[(e=28228+(n<<2)|0)>>2])){if(s[e>>2]=r,!r){s[6982]=a&~(1<>2])==(0|l)?w:o+20)>>2]=r,!r)break;s[r+24>>2]=o,0|(n=0|s[l+16>>2])&&(s[r+16>>2]=n,s[n+24>>2]=r),0|(n=0|s[l+20>>2])&&(s[r+20>>2]=n,s[n+24>>2]=r)}}while(0);return c>>>0<16?(w=c+u|0,s[l+4>>2]=3|w,s[(w=l+w+4|0)>>2]=1|s[w>>2]):(s[l+4>>2]=3|u,s[A+4>>2]=1|c,s[A+c>>2]=c,0|h&&(i=0|s[6986],r=27964+((n=h>>>3)<<1<<2)|0,(n=1<>2]:(s[6981]=n|d,n=r,e=r+8|0),s[e>>2]=i,s[n+12>>2]=i,s[i+8>>2]=n,s[i+12>>2]=r),s[6983]=c,s[6986]=A),M=t,0|l+8}d=u}else d=u}else d=u}else if(e>>>0<=4294967231)if(u=-8&(e=e+11|0),i=0|s[6982]){o=0-u|0,c=(e>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(m=e<<(d=(e+1048320|0)>>>16&8))|0)>>>16&4)|d|(c=(245760+(m<<=l)|0)>>>16&2))+(m<>>15)|0)|0)&1|c<<1:0,r=0|s[28228+(c<<2)>>2];e:do{if(r)for(e=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((A=(-8&s[r+4>>2])-u|0)>>>0>>0){if(!A){e=r,o=0,m=65;break e}e=r,o=A}if(a=!(0|(m=0|s[r+20>>2]))|(0|m)==(0|(r=0|s[r+16+(l>>>31<<2)>>2]))?a:m,!r){r=a,m=61;break}l<<=1}else r=0,e=0,m=61}while(0);if(61==(0|m)){if(!(0|r)&!(0|e)){if(!(e=((e=2<>>=A=d>>>12&16)>>>5&8)|A|(l=(d>>>=a)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?m=65:(l=e,A=o)}if(65==(0|m))for(a=r;;){if(o=(r=(d=(-8&s[a+4>>2])-u|0)>>>0>>0)?d:o,e=r?a:e,(r=0|s[a+16>>2])||(r=0|s[a+20>>2]),!r){l=e,A=o;break}a=r}if(0|l&&A>>>0<((0|s[6983])-u|0)>>>0&&(h=l+u|0)>>>0>l>>>0){a=0|s[l+24>>2],n=0|s[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|s[(e=l+20|0)>>2])&&!(n=0|s[(e=l+16|0)>>2])){n=0;break}for(;;)if(r=0|s[(o=n+20|0)>>2])n=r,e=o;else{if(!(r=0|s[(o=n+16|0)>>2]))break;n=r,e=o}s[e>>2]=0}else w=0|s[l+8>>2],s[w+12>>2]=n,s[n+8>>2]=w}while(0);do{if(a){if(e=0|s[l+28>>2],(0|l)==(0|s[(r=28228+(e<<2)|0)>>2])){if(s[r>>2]=n,!n){i&=~(1<>2])==(0|l)?w:a+20)>>2]=n,!n)break;s[n+24>>2]=a,0|(e=0|s[l+16>>2])&&(s[n+16>>2]=e,s[e+24>>2]=n),(e=0|s[l+20>>2])&&(s[n+20>>2]=e,s[e+24>>2]=n)}}while(0);e:do{if(A>>>0<16)w=A+u|0,s[l+4>>2]=3|w,s[(w=l+w+4|0)>>2]=1|s[w>>2];else{if(s[l+4>>2]=3|u,s[h+4>>2]=1|A,s[h+A>>2]=A,n=A>>>3,A>>>0<256){r=27964+(n<<1<<2)|0,(e=0|s[6981])&(n=1<>2]:(s[6981]=e|n,n=r,e=r+8|0),s[e>>2]=h,s[n+12>>2]=h,s[h+8>>2]=n,s[h+12>>2]=r;break}if(n=28228+((r=(n=A>>>8)?A>>>0>16777215?31:A>>>(7+(r=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(r=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|r<<1:0)<<2)|0,s[h+28>>2]=r,s[4+(e=h+16|0)>>2]=0,s[e>>2]=0,!(i&(e=1<>2]=h,s[h+24>>2]=n,s[h+12>>2]=h,s[h+8>>2]=h;break}n=0|s[n>>2];t:do{if((-8&s[n+4>>2])!=(0|A)){for(i=A<<(31==(0|r)?0:25-(r>>>1)|0);e=0|s[(r=n+16+(i>>>31<<2)|0)>>2];){if((-8&s[e+4>>2])==(0|A)){n=e;break t}i<<=1,n=e}s[r>>2]=h,s[h+24>>2]=n,s[h+12>>2]=h,s[h+8>>2]=h;break e}}while(0);w=0|s[(y=n+8|0)>>2],s[w+12>>2]=h,s[y>>2]=h,s[h+8>>2]=w,s[h+12>>2]=n,s[h+24>>2]=0}}while(0);return M=t,0|l+8}d=u}else d=u;else d=-1}while(0);if((r=0|s[6983])>>>0>=d>>>0)return n=r-d|0,e=0|s[6986],n>>>0>15?(w=e+d|0,s[6986]=w,s[6983]=n,s[w+4>>2]=1|n,s[e+r>>2]=n,s[e+4>>2]=3|d):(s[6983]=0,s[6986]=0,s[e+4>>2]=3|r,s[(w=e+r+4|0)>>2]=1|s[w>>2]),M=t,0|e+8;if((A=0|s[6984])>>>0>d>>>0)return v=A-d|0,s[6984]=v,y=(w=0|s[6987])+d|0,s[6987]=y,s[y+4>>2]=1|v,s[w+4>>2]=3|d,M=t,0|w+8;if(0|s[7099]?e=0|s[7101]:(s[7101]=4096,s[7100]=4096,s[7102]=-1,s[7103]=-1,s[7104]=0,s[7092]=0,s[7099]=-16&f^1431655768,e=4096),l=d+48|0,(u=(a=e+(c=d+47|0)|0)&(o=0-e|0))>>>0<=d>>>0)return M=t,0;if(0|(e=0|s[7091])&&(f=(h=0|s[7089])+u|0)>>>0<=h>>>0|f>>>0>e>>>0)return M=t,0;e:do{if(4&s[7092])n=0,m=143;else{r=0|s[6987];t:do{if(r){for(i=28372;!((f=0|s[i>>2])>>>0<=r>>>0&&(f+(0|s[i+4>>2])|0)>>>0>r>>>0);){if(!(e=0|s[i+8>>2])){m=128;break t}i=e}if((n=a-A&o)>>>0<2147483647)if((0|(e=0|hn(0|n)))==((0|s[i>>2])+(0|s[i+4>>2])|0)){if(-1!=(0|e)){A=n,a=e,m=145;break e}}else i=e,m=136;else n=0}else m=128}while(0);do{if(128==(0|m))if(-1!=(0|(r=0|hn(0)))&&(n=r,g=(n=((g=(p=0|s[7100])-1|0)&n?(g+n&0-p)-n|0:0)+u|0)+(p=0|s[7089])|0,n>>>0>d>>>0&n>>>0<2147483647)){if(0|(f=0|s[7091])&&g>>>0<=p>>>0|g>>>0>f>>>0){n=0;break}if((0|(e=0|hn(0|n)))==(0|r)){A=n,a=r,m=145;break e}i=e,m=136}else n=0}while(0);do{if(136==(0|m)){if(r=0-n|0,!(l>>>0>n>>>0&n>>>0<2147483647&-1!=(0|i))){if(-1==(0|i)){n=0;break}A=n,a=i,m=145;break e}if((e=c-n+(e=0|s[7101])&0-e)>>>0>=2147483647){A=n,a=i,m=145;break e}if(-1==(0|hn(0|e))){hn(0|r),n=0;break}A=e+n|0,a=i,m=145;break e}}while(0);s[7092]=4|s[7092],m=143}}while(0);if(143==(0|m)&&u>>>0<2147483647&&!(-1==(0|(v=0|hn(0|u)))|1^(b=(_=(g=0|hn(0))-v|0)>>>0>(d+40|0)>>>0)|v>>>0>>0&-1!=(0|v)&-1!=(0|g)^1)&&(A=b?_:n,a=v,m=145),145==(0|m)){n=(0|s[7089])+A|0,s[7089]=n,n>>>0>(0|s[7090])>>>0&&(s[7090]=n),c=0|s[6987];e:do{if(c){for(n=28372;;){if((0|a)==((e=0|s[n>>2])+(r=0|s[n+4>>2])|0)){m=154;break}if(!(i=0|s[n+8>>2]))break;n=i}if(!(154!=(0|m)||(y=n+4|0,8&s[n+12>>2]))&&a>>>0>c>>>0&e>>>0<=c>>>0){s[y>>2]=r+A,y=c+(v=7&(v=c+8|0)?0-v&7:0)|0,v=(w=(0|s[6984])+A|0)-v|0,s[6987]=y,s[6984]=v,s[y+4>>2]=1|v,s[c+w+4>>2]=40,s[6988]=s[7103];break}for(a>>>0<(0|s[6985])>>>0&&(s[6985]=a),r=a+A|0,n=28372;;){if((0|s[n>>2])==(0|r)){m=162;break}if(!(e=0|s[n+8>>2]))break;n=e}if(162==(0|m)&&!(8&s[n+12>>2])){s[n>>2]=a,s[(h=n+4|0)>>2]=(0|s[h>>2])+A,u=(h=a+(7&(h=a+8|0)?0-h&7:0)|0)+d|0,l=(n=r+(7&(n=r+8|0)?0-n&7:0)|0)-h-d|0,s[h+4>>2]=3|d;t:do{if((0|c)==(0|n))w=(0|s[6984])+l|0,s[6984]=w,s[6987]=u,s[u+4>>2]=1|w;else{if((0|s[6986])==(0|n)){w=(0|s[6983])+l|0,s[6983]=w,s[6986]=u,s[u+4>>2]=1|w,s[u+w>>2]=w;break}if(1==(3&(e=0|s[n+4>>2]))){A=-8&e,i=e>>>3;n:do{if(e>>>0<256){if(e=0|s[n+8>>2],(0|(r=0|s[n+12>>2]))==(0|e)){s[6981]=s[6981]&~(1<>2]=r,s[r+8>>2]=e;break}a=0|s[n+24>>2],e=0|s[n+12>>2];do{if((0|e)==(0|n)){if(e=0|s[(i=4+(r=n+16|0)|0)>>2])r=i;else if(!(e=0|s[r>>2])){e=0;break}for(;;)if(i=0|s[(o=e+20|0)>>2])e=i,r=o;else{if(!(i=0|s[(o=e+16|0)>>2]))break;e=i,r=o}s[r>>2]=0}else w=0|s[n+8>>2],s[w+12>>2]=e,s[e+8>>2]=w}while(0);if(!a)break;i=28228+((r=0|s[n+28>>2])<<2)|0;do{if((0|s[i>>2])==(0|n)){if(s[i>>2]=e,0|e)break;s[6982]=s[6982]&~(1<>2])==(0|n)?w:a+20)>>2]=e,!e)break n}while(0);if(s[e+24>>2]=a,0|(i=0|s[(r=n+16|0)>>2])&&(s[e+16>>2]=i,s[i+24>>2]=e),!(r=0|s[r+4>>2]))break;s[e+20>>2]=r,s[r+24>>2]=e}while(0);n=n+A|0,o=A+l|0}else o=l;if(s[(n=n+4|0)>>2]=-2&s[n>>2],s[u+4>>2]=1|o,s[u+o>>2]=o,n=o>>>3,o>>>0<256){r=27964+(n<<1<<2)|0,(e=0|s[6981])&(n=1<>2]:(s[6981]=e|n,n=r,e=r+8|0),s[e>>2]=u,s[n+12>>2]=u,s[u+8>>2]=n,s[u+12>>2]=r;break}n=o>>>8;do{if(n){if(o>>>0>16777215){i=31;break}i=o>>>(7+(i=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(i=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|i<<1}else i=0}while(0);if(n=28228+(i<<2)|0,s[u+28>>2]=i,s[4+(e=u+16|0)>>2]=0,s[e>>2]=0,!((e=0|s[6982])&(r=1<>2]=u,s[u+24>>2]=n,s[u+12>>2]=u,s[u+8>>2]=u;break}n=0|s[n>>2];n:do{if((-8&s[n+4>>2])!=(0|o)){for(i=o<<(31==(0|i)?0:25-(i>>>1)|0);e=0|s[(r=n+16+(i>>>31<<2)|0)>>2];){if((-8&s[e+4>>2])==(0|o)){n=e;break n}i<<=1,n=e}s[r>>2]=u,s[u+24>>2]=n,s[u+12>>2]=u,s[u+8>>2]=u;break t}}while(0);w=0|s[(y=n+8|0)>>2],s[w+12>>2]=u,s[y>>2]=u,s[u+8>>2]=w,s[u+12>>2]=n,s[u+24>>2]=0}}while(0);return M=t,0|h+8}for(n=28372;!((e=0|s[n>>2])>>>0<=c>>>0&&(w=e+(0|s[n+4>>2])|0)>>>0>c>>>0);)n=0|s[n+8>>2];n=(e=(e=(o=w+-47|0)+(7&(e=o+8|0)?0-e&7:0)|0)>>>0<(o=c+16|0)>>>0?c:e)+8|0,y=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(r=A+-40|0)-v|0,s[6987]=y,s[6984]=v,s[y+4>>2]=1|v,s[a+r+4>>2]=40,s[6988]=s[7103],s[(r=e+4|0)>>2]=27,s[n>>2]=s[7093],s[n+4>>2]=s[7094],s[n+8>>2]=s[7095],s[n+12>>2]=s[7096],s[7093]=a,s[7094]=A,s[7096]=0,s[7095]=n,n=e+24|0;do{y=n,s[(n=n+4|0)>>2]=7}while((y+8|0)>>>0>>0);if((0|e)!=(0|c)){if(a=e-c|0,s[r>>2]=-2&s[r>>2],s[c+4>>2]=1|a,s[e>>2]=a,n=a>>>3,a>>>0<256){r=27964+(n<<1<<2)|0,(e=0|s[6981])&(n=1<>2]:(s[6981]=e|n,n=r,e=r+8|0),s[e>>2]=c,s[n+12>>2]=c,s[c+8>>2]=n,s[c+12>>2]=r;break}if(r=28228+((i=(n=a>>>8)?a>>>0>16777215?31:a>>>(7+(i=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(i=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|i<<1:0)<<2)|0,s[c+28>>2]=i,s[c+20>>2]=0,s[o>>2]=0,!((n=0|s[6982])&(e=1<>2]=c,s[c+24>>2]=r,s[c+12>>2]=c,s[c+8>>2]=c;break}n=0|s[r>>2];t:do{if((-8&s[n+4>>2])!=(0|a)){for(i=a<<(31==(0|i)?0:25-(i>>>1)|0);e=0|s[(r=n+16+(i>>>31<<2)|0)>>2];){if((-8&s[e+4>>2])==(0|a)){n=e;break t}i<<=1,n=e}s[r>>2]=c,s[c+24>>2]=n,s[c+12>>2]=c,s[c+8>>2]=c;break e}}while(0);w=0|s[(y=n+8|0)>>2],s[w+12>>2]=c,s[y>>2]=c,s[c+8>>2]=w,s[c+12>>2]=n,s[c+24>>2]=0}}else!(0|(w=0|s[6985]))|a>>>0>>0&&(s[6985]=a),s[7093]=a,s[7094]=A,s[7096]=0,s[6990]=s[7099],s[6989]=-1,s[6994]=27964,s[6993]=27964,s[6996]=27972,s[6995]=27972,s[6998]=27980,s[6997]=27980,s[7e3]=27988,s[6999]=27988,s[7002]=27996,s[7001]=27996,s[7004]=28004,s[7003]=28004,s[7006]=28012,s[7005]=28012,s[7008]=28020,s[7007]=28020,s[7010]=28028,s[7009]=28028,s[7012]=28036,s[7011]=28036,s[7014]=28044,s[7013]=28044,s[7016]=28052,s[7015]=28052,s[7018]=28060,s[7017]=28060,s[7020]=28068,s[7019]=28068,s[7022]=28076,s[7021]=28076,s[7024]=28084,s[7023]=28084,s[7026]=28092,s[7025]=28092,s[7028]=28100,s[7027]=28100,s[7030]=28108,s[7029]=28108,s[7032]=28116,s[7031]=28116,s[7034]=28124,s[7033]=28124,s[7036]=28132,s[7035]=28132,s[7038]=28140,s[7037]=28140,s[7040]=28148,s[7039]=28148,s[7042]=28156,s[7041]=28156,s[7044]=28164,s[7043]=28164,s[7046]=28172,s[7045]=28172,s[7048]=28180,s[7047]=28180,s[7050]=28188,s[7049]=28188,s[7052]=28196,s[7051]=28196,s[7054]=28204,s[7053]=28204,s[7056]=28212,s[7055]=28212,y=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(w=A+-40|0)-v|0,s[6987]=y,s[6984]=v,s[y+4>>2]=1|v,s[a+w+4>>2]=40,s[6988]=s[7103]}while(0);if((n=0|s[6984])>>>0>d>>>0)return v=n-d|0,s[6984]=v,y=(w=0|s[6987])+d|0,s[6987]=y,s[y+4>>2]=1|v,s[w+4>>2]=3|d,M=t,0|w+8}return s[(w=27920)>>2]=12,M=t,0}function Ht(e){var t=0,n=0,r=0,i=0,o=0,a=0,A=0,l=0;if(e|=0){n=e+-8|0,i=0|s[6985],l=n+(t=-8&(e=0|s[e+-4>>2]))|0;do{if(1&e)A=n,a=n;else{if(r=0|s[n>>2],!(3&e))return;if(o=r+t|0,(a=n+(0-r)|0)>>>0>>0)return;if((0|s[6986])==(0|a)){if(3&~(t=0|s[(e=l+4|0)>>2])){A=a,t=o;break}return s[6983]=o,s[e>>2]=-2&t,s[a+4>>2]=1|o,void(s[a+o>>2]=o)}if(n=r>>>3,r>>>0<256){if(e=0|s[a+8>>2],(0|(t=0|s[a+12>>2]))==(0|e)){s[6981]=s[6981]&~(1<>2]=t,s[t+8>>2]=e,A=a,t=o;break}i=0|s[a+24>>2],e=0|s[a+12>>2];do{if((0|e)==(0|a)){if(e=0|s[(n=4+(t=a+16|0)|0)>>2])t=n;else if(!(e=0|s[t>>2])){e=0;break}for(;;)if(n=0|s[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|s[(r=e+16|0)>>2]))break;e=n,t=r}s[t>>2]=0}else A=0|s[a+8>>2],s[A+12>>2]=e,s[e+8>>2]=A}while(0);if(i){if(t=0|s[a+28>>2],(0|s[(n=28228+(t<<2)|0)>>2])==(0|a)){if(s[n>>2]=e,!e){s[6982]=s[6982]&~(1<>2])==(0|a)?A:i+20)>>2]=e,!e){A=a,t=o;break}s[e+24>>2]=i,0|(n=0|s[(t=a+16|0)>>2])&&(s[e+16>>2]=n,s[n+24>>2]=e),(t=0|s[t+4>>2])?(s[e+20>>2]=t,s[t+24>>2]=e,A=a,t=o):(A=a,t=o)}else A=a,t=o}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|s[(e=l+4|0)>>2])){if(2&r)s[e>>2]=-2&r,s[A+4>>2]=1|t,s[a+t>>2]=t,i=t;else{if((0|s[6987])==(0|l)){if(l=(0|s[6984])+t|0,s[6984]=l,s[6987]=A,s[A+4>>2]=1|l,(0|A)!=(0|s[6986]))return;return s[6986]=0,void(s[6983]=0)}if((0|s[6986])==(0|l))return l=(0|s[6983])+t|0,s[6983]=l,s[6986]=a,s[A+4>>2]=1|l,void(s[a+l>>2]=l);i=(-8&r)+t|0,n=r>>>3;do{if(r>>>0<256){if(t=0|s[l+8>>2],(0|(e=0|s[l+12>>2]))==(0|t)){s[6981]=s[6981]&~(1<>2]=e,s[e+8>>2]=t;break}o=0|s[l+24>>2],e=0|s[l+12>>2];do{if((0|e)==(0|l)){if(e=0|s[(n=4+(t=l+16|0)|0)>>2])t=n;else if(!(e=0|s[t>>2])){n=0;break}for(;;)if(n=0|s[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|s[(r=e+16|0)>>2]))break;e=n,t=r}s[t>>2]=0,n=e}else n=0|s[l+8>>2],s[n+12>>2]=e,s[e+8>>2]=n,n=e}while(0);if(0|o){if(e=0|s[l+28>>2],(0|s[(t=28228+(e<<2)|0)>>2])==(0|l)){if(s[t>>2]=n,!n){s[6982]=s[6982]&~(1<>2])==(0|l)?r:o+20)>>2]=n,!n)break;s[n+24>>2]=o,0|(t=0|s[(e=l+16|0)>>2])&&(s[n+16>>2]=t,s[t+24>>2]=n),0|(e=0|s[e+4>>2])&&(s[n+20>>2]=e,s[e+24>>2]=n)}}while(0);if(s[A+4>>2]=1|i,s[a+i>>2]=i,(0|A)==(0|s[6986]))return void(s[6983]=i)}if(e=i>>>3,i>>>0<256)return n=27964+(e<<1<<2)|0,(t=0|s[6981])&(e=1<>2]:(s[6981]=t|e,e=n,t=n+8|0),s[t>>2]=A,s[e+12>>2]=A,s[A+8>>2]=e,void(s[A+12>>2]=n);e=28228+((r=(e=i>>>8)?i>>>0>16777215?31:i>>>(7+(r=14-((o=(520192+(l=e<<(a=(e+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=o)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,s[A+28>>2]=r,s[A+20>>2]=0,s[A+16>>2]=0,t=0|s[6982],n=1<>2];t:do{if((-8&s[e+4>>2])!=(0|i)){for(r=i<<(31==(0|r)?0:25-(r>>>1)|0);t=0|s[(n=e+16+(r>>>31<<2)|0)>>2];){if((-8&s[t+4>>2])==(0|i)){e=t;break t}r<<=1,e=t}s[n>>2]=A,s[A+24>>2]=e,s[A+12>>2]=A,s[A+8>>2]=A;break e}}while(0);l=0|s[(a=e+8|0)>>2],s[l+12>>2]=A,s[a>>2]=A,s[A+8>>2]=l,s[A+12>>2]=e,s[A+24>>2]=0}else s[6982]=t|n,s[e>>2]=A,s[A+24>>2]=e,s[A+12>>2]=A,s[A+8>>2]=A}while(0);if(l=(0|s[6989])-1|0,s[6989]=l,!(0|l)){for(e=28380;e=0|s[e>>2];)e=e+8|0;s[6989]=-1}}}}function $t(e,t){t|=0;var n=0;return(e|=0)?(n=0|v(t,e),(t|e)>>>0>65535&&(n=((n>>>0)/(e>>>0)|0)==(0|t)?n:-1)):n=0,(e=0|Wt(n))&&3&s[e+-4>>2]?(cn(0|e,0,0|n),0|e):0|e}function Xt(e,t,n,r){return 0|(E((t|=0)+(r|=0)+((n=(e|=0)+(n|=0)>>>0)>>>0>>0|0)>>>0|0),n)}function Qt(e,t,n,r){return 0|(E(0|(r=(t|=0)-(r|=0)-((n|=0)>>>0>(e|=0)>>>0|0)>>>0)),e-n>>>0)}function Yt(e){return 0|((e|=0)?31-(0|x(e^e-1)):32)}function qt(e,t,n,r,i){i|=0;var o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0;if(u=e|=0,a=n|=0,A=d=r|=0,!(c=l=t|=0))return o=!!(0|i),A?o?(s[i>>2]=0|e,s[i+4>>2]=0&t,i=0,0|(E(0|(d=0)),i)):(i=0,0|(E(0|(d=0)),i)):(o&&(s[i>>2]=(u>>>0)%(a>>>0),s[i+4>>2]=0),i=(u>>>0)/(a>>>0)>>>0,0|(E(0|(d=0)),i));o=!(0|A);do{if(a){if(!o){if((o=(0|x(0|A))-(0|x(0|c))|0)>>>0<=31){a=h=o+1|0,e=u>>>(h>>>0)&(t=o-31>>31)|c<<(A=31-o|0),t&=c>>>(h>>>0),o=0,A=u<>2]=0|e,s[i+4>>2]=l|0&t,i=0,0|(E(0|(d=0)),i)):(i=0,0|(E(0|(d=0)),i))}if((o=a-1|0)&a){a=A=33+(0|x(0|a))-(0|x(0|c))|0,e=(h=32-A|0)-1>>31&c>>>((f=A-32|0)>>>0)|(c<>>(A>>>0))&(t=f>>31),t&=c>>>(A>>>0),o=u<<(p=64-A|0)&(l=h>>31),A=(c<>>(f>>>0))&l|u<>31;break}return 0|i&&(s[i>>2]=o&u,s[i+4>>2]=0),1==(0|a)?(p=0|e,0|(E(0|(f=l|0&t)),p)):(f=c>>>((p=0|Yt(0|a))>>>0)|0,p=c<<32-p|u>>>(p>>>0),0|(E(0|f),p))}if(o)return 0|i&&(s[i>>2]=(c>>>0)%(a>>>0),s[i+4>>2]=0),p=(c>>>0)/(a>>>0)>>>0,0|(E(0|(f=0)),p);if(!u)return 0|i&&(s[i>>2]=0,s[i+4>>2]=(c>>>0)%(A>>>0)),p=(c>>>0)/(A>>>0)>>>0,0|(E(0|(f=0)),p);if(!((o=A-1|0)&A))return 0|i&&(s[i>>2]=0|e,s[i+4>>2]=o&c|0&t),f=0,p=c>>>((0|Yt(0|A))>>>0),0|(E(0|f),p);if((o=(0|x(0|A))-(0|x(0|c))|0)>>>0<=30){a=t=o+1|0,e=c<<(A=31-o|0)|u>>>(t>>>0),t=c>>>(t>>>0),o=0,A=u<>2]=0|e,s[i+4>>2]=l|0&t,p=0,0|(E(0|(f=0)),p)):(p=0,0|(E(0|(f=0)),p))}while(0);if(a){c=0|Xt(0|(h=0|n),0|(u=d|0&r),-1,-1),n=0|T(),l=A,A=0;do{r=l,l=o>>>31|l<<1,o=A|o<<1,Qt(0|c,0|n,0|(r=e<<1|r>>>31),0|(d=e>>>31|t<<1)),A=1&(f=(p=0|T())>>31|((0|p)<0?-1:0)<<1),e=0|Qt(0|r,0|d,f&h|0,(((0|p)<0?-1:0)>>31|((0|p)<0?-1:0)<<1)&u),t=0|T(),a=a-1|0}while(0|a);c=l,l=0}else c=A,l=0,A=0;return a=0,0|i&&(s[i>>2]=e,s[i+4>>2]=t),p=o<<1&-2|A,0|(E(0|(f=(0|o)>>>31|(c|a)<<1|l)),p)}function Kt(e,t,n,r){var s,i,o,a,A;return n|=0,i=(r|=0)>>31|((0|r)<0?-1:0)<<1,s=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,o=0|Qt((A=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0),(a=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t,0|A,0|a),e=i^A,t=s^a,0|Qt((0|qt(o,0|T(),0|Qt(i^n|0,s^r|0,0|i,0|s),0|T(),0))^e,(0|T())^t,0|e,0|t)}function Zt(e,t,n,r){var s,i;return t|=0,r|=0,n=0|function(e,t){var n,r,s,i=0;return e=((n=0|v(i=65535&(t|=0),s=65535&(e|=0)))>>>16)+(0|v(i,r=e>>>16))|0,t=0|v(i=t>>>16,s),0|(E((e>>>16)+(0|v(i,r))+(((65535&e)+t|0)>>>16)|0),e+t<<16|65535&n)}(s=e|=0,i=n|=0),e=0|T(),0|(E((0|v(t,i))+(0|v(r,s))+e|0&e),n)}function Jt(e,t,n,r){var i,o,a,A,l,c;return n|=0,i=M,M=M+16|0,A=0|i,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,qt(e=0|Qt((a=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0),(o=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t,0|a,0|o),t=0|T(),0|Qt(c^n|0,l^r|0,0|c,0|l),0|T(),A),r=0|Qt(s[A>>2]^a|0,s[A+4>>2]^o|0,0|a,0|o),n=0|T(),M=i,0|(E(0|n),r)}function en(e,t,n,r){var i,o;return o=M,M=M+16|0,qt(e|=0,t|=0,n|=0,r|=0,i=0|o),M=o,0|(E(0|s[i+4>>2]),s[i>>2])}function tn(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(E(t>>n|0),e>>>n|(t&(1<>n-32)}function nn(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(E(t>>>n|0),e>>>n|(t&(1<>>n-32|0)}function rn(e,t,n){return e|=0,(0|(n|=0))<32?(E((t|=0)<>>32-n),e<=0?+A(e+.5):+b(e-.5)}function ln(e,t,n){e|=0,t|=0;var i,o,a=0;if((0|(n|=0))>=8192)return R(0|e,0|t,0|n),0|e;if(o=0|e,i=e+n|0,(3&e)==(3&t)){for(;3&e;){if(!n)return 0|o;r[0|e]=0|r[0|t],e=e+1|0,t=t+1|0,n=n-1|0}for(a=(n=-4&i)-64|0;(0|e)<=(0|a);)s[e>>2]=s[t>>2],s[e+4>>2]=s[t+4>>2],s[e+8>>2]=s[t+8>>2],s[e+12>>2]=s[t+12>>2],s[e+16>>2]=s[t+16>>2],s[e+20>>2]=s[t+20>>2],s[e+24>>2]=s[t+24>>2],s[e+28>>2]=s[t+28>>2],s[e+32>>2]=s[t+32>>2],s[e+36>>2]=s[t+36>>2],s[e+40>>2]=s[t+40>>2],s[e+44>>2]=s[t+44>>2],s[e+48>>2]=s[t+48>>2],s[e+52>>2]=s[t+52>>2],s[e+56>>2]=s[t+56>>2],s[e+60>>2]=s[t+60>>2],e=e+64|0,t=t+64|0;for(;(0|e)<(0|n);)s[e>>2]=s[t>>2],e=e+4|0,t=t+4|0}else for(n=i-4|0;(0|e)<(0|n);)r[0|e]=0|r[0|t],r[e+1|0]=0|r[t+1|0],r[e+2|0]=0|r[t+2|0],r[e+3|0]=0|r[t+3|0],e=e+4|0,t=t+4|0;for(;(0|e)<(0|i);)r[0|e]=0|r[0|t],e=e+1|0,t=t+1|0;return 0|o}function cn(e,t,n){t|=0;var i,o=0,a=0,A=0;if(i=(e|=0)+(n|=0)|0,t&=255,(0|n)>=67){for(;3&e;)r[0|e]=t,e=e+1|0;for(A=t|t<<8|t<<16|t<<24,a=(o=-4&i)-64|0;(0|e)<=(0|a);)s[e>>2]=A,s[e+4>>2]=A,s[e+8>>2]=A,s[e+12>>2]=A,s[e+16>>2]=A,s[e+20>>2]=A,s[e+24>>2]=A,s[e+28>>2]=A,s[e+32>>2]=A,s[e+36>>2]=A,s[e+40>>2]=A,s[e+44>>2]=A,s[e+48>>2]=A,s[e+52>>2]=A,s[e+56>>2]=A,s[e+60>>2]=A,e=e+64|0;for(;(0|e)<(0|o);)s[e>>2]=A,e=e+4|0}for(;(0|e)<(0|i);)r[0|e]=t,e=e+1|0;return i-n|0}function un(e){return(e=+e)>=0?+A(e+.5):+b(e-.5)}function hn(e){var t,n,r;return e|=0,r=0|k(),(0|e)>0&(0|(t=(n=0|s[a>>2])+e|0))<(0|n)|(0|t)<0?(I(0|t),C(12),-1):(0|t)>(0|r)&&!(0|P(0|t))?(C(12),-1):(s[a>>2]=t,0|n)}return{___divdi3:Kt,___muldi3:Zt,___remdi3:Jt,___uremdi3:en,_areNeighborCells:function(e,t,n,r,i){i|=0;var o,a,A,l=0,c=0,u=0,h=0;if(A=M,M=M+64|0,a=A,o=A+56|0,!(!0&134217728==(2013265920&(t|=0))&!0&134217728==(2013265920&(r|=0))))return M=A,5;if((0|(e|=0))==(0|(n|=0))&(0|t)==(0|r))return s[i>>2]=0,M=A,0;if(c=0|nn(0|e,0|t,52),T(),c&=15,h=0|nn(0|n,0|r,52),T(),(0|c)!=(15&h))return M=A,12;if(l=c+-1|0,c>>>0>1){Fe(e,t,l,a),Fe(n,r,l,o),u=0|s[(h=a)>>2],h=0|s[h+4>>2];e:do{if((0|u)==(0|s[o>>2])&&(0|h)==(0|s[o+4>>2])){l=0|nn(0|e,0|t,0|(c=3*(15^c)|0)),T(),l&=7,c=0|nn(0|n,0|r,0|c),T(),c&=7;do{if(!(0|l)|!(0|c))s[i>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|je(u,h)){l=5;break}if((0|s[15536+(l<<2)>>2])!=(0|c)&&(0|s[15568+(l<<2)>>2])!=(0|c))break e;s[i>>2]=1,l=0}}while(0);return M=A,0|l}}while(0)}c=(l=a)+56|0;do{s[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return L(e,t,1,a),l=(0|s[(t=a)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)||(0|s[(t=a+8|0)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)||(0|s[(t=a+16|0)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)||(0|s[(t=a+24|0)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)||(0|s[(t=a+32|0)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)||(0|s[(t=a+40|0)>>2])==(0|n)&&(0|s[t+4>>2])==(0|r)?1:1&((0|s[(l=a+48|0)>>2])==(0|n)?(0|s[l+4>>2])==(0|r):0),s[i>>2]=l,M=A,0},_bitshift64Ashr:tn,_bitshift64Lshr:nn,_bitshift64Shl:rn,_calloc:$t,_cellAreaKm2:function(e,t,n){return 0|(e=0|ut(e|=0,t|=0,n|=0))||(i[n>>3]=6371.007180918475*+i[n>>3]*6371.007180918475),0|e},_cellAreaM2:function(e,t,n){return 0|(e=0|ut(e|=0,t|=0,n|=0))||(i[n>>3]=6371.007180918475*+i[n>>3]*6371.007180918475*1e3*1e3),0|e},_cellAreaRads2:ut,_cellToBoundary:Je,_cellToCenterChild:ze,_cellToChildPos:function(e,t,n,r){n|=0,r|=0;var i,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0;if(i=M,M=M+16|0,_=i,b=0|nn(0|(e|=0),0|(t|=0),52),T(),n>>>0>15)return M=i,4;if((0|(b&=15))<(0|n))return M=i,12;if((0|b)!=(0|n))if(a=0|rn(0|n,0,52),a|=e,l=T()|-15728641&t,(0|b)>(0|n)){c=n;do{m=0|rn(7,0,3*(14-c|0)|0),c=c+1|0,a|=m,l=0|T()|l}while((0|c)<(0|b));m=a}else m=a;else m=e,l=t;g=0|nn(0|m,0|l,45),T();e:do{if(0|G(127&g)){if(c=0|nn(0|m,0|l,52),T(),0|(c&=15))for(a=1;;){if(!(!((g=0|rn(7,0,3*(15-a|0)|0))&m)&!((0|T())&l))){u=33;break e}if(!(a>>>0>>0))break;a=a+1|0}if(s[(g=r)>>2]=0,s[g+4>>2]=0,(0|b)>(0|n)){for(g=-15728641&t,p=b;;){if(f=p,(p=p+-1|0)>>>0>15|(0|b)<(0|p)){u=19;break}if((0|b)!=(0|p))if(a=0|rn(0|p,0,52),a|=e,c=0|T()|g,(0|b)<(0|f))d=a;else{u=p;do{d=0|rn(7,0,3*(14-u|0)|0),u=u+1|0,a|=d,c=0|T()|c}while((0|u)<(0|b));d=a}else d=e,c=t;if(h=0|nn(0|d,0|c,45),T(),0|G(127&h)){h=0|nn(0|d,0|c,52),T(),h&=15;t:do{if(h)for(u=1;;){if(a=0|nn(0|d,0|c,3*(15-u|0)|0),T(),0|(a&=7))break t;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|nn(0|e,0|t,3*(15-f|0)|0),T(),7==(0|(c&=7))){o=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){o=5,u=42;break}if(0|(d=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|_t(7,0,u=b-f|0,((0|u)<0)<<31>>31),h=0|T(),a?(a=0|Xt(0|(a=0|Zt(0|u,0|h,5,0)),0|T(),-5,-1),a=0|Xt(0|(a=0|Kt(0|a,0|T(),6,0)),0|T(),1,0),c=0|T()):(a=u,c=h),f=0|Xt(0|a,0|c,0|(f=0|Zt(0|u,0|h,0|(f=d+-1|0),((0|f)<0)<<31>>31)),0|T()),h=0|Xt(0|f,0|(d=0|T()),0|s[(h=r)>>2],0|s[h+4>>2]),d=0|T(),s[(f=r)>>2]=h,s[f+4>>2]=d),(0|p)<=(0|n)){u=37;break}}if(19==(0|u))S(27795,27122,1367,27158);else{if(37==(0|u)){o=0|s[(A=r)+4>>2],A=0|s[A>>2];break}if(42==(0|u))return M=i,0|o}}else o=0,A=0}else u=33}while(0);e:do{if(33==(0|u)){if(s[(g=r)>>2]=0,s[g+4>>2]=0,(0|b)>(0|n)){for(a=b;;){if(o=0|nn(0|e,0|t,3*(15-a|0)|0),T(),7==(0|(o&=7))){o=5;break}if(o=0|Zt(0|(A=0|_t(7,0,A=b-a|0,((0|A)<0)<<31>>31)),0|T(),0|o,0),A=0|T(),A=0|Xt(0|s[(g=r)>>2],0|s[g+4>>2],0|o,0|A),o=0|T(),s[(g=r)>>2]=A,s[g+4>>2]=o,(0|(a=a+-1|0))<=(0|n))break e}return M=i,0|o}o=0,A=0}}while(0);return 0|Ue(m,l,b,_)&&S(27795,27122,1327,27173),((0|o)>-1|-1==(0|o)&A>>>0>4294967295)&((0|(_=0|s[(b=_)+4>>2]))>(0|o)|((0|_)==(0|o)?(0|s[b>>2])>>>0>A>>>0:0))?(M=i,0|(b=0)):(S(27795,27122,1407,27158),0)},_cellToChildren:function(e,t,n,r){r|=0;var i,o,a=0,A=0;if(o=M,M=M+16|0,tt(i=o,e|=0,t|=0,n|=0),!(0|(e=0|s[(t=i)>>2]))&!(0|(t=0|s[t+4>>2])))return M=o,0;a=0,n=0;do{s[(A=r+(a<<3)|0)>>2]=e,s[A+4>>2]=t,a=0|Xt(0|a,0|n,1,0),n=0|T(),rt(i),e=0|s[(A=i)>>2],t=0|s[A+4>>2]}while(!(!(0|e)&!(0|t)));return M=o,0},_cellToChildrenSize:Ue,_cellToLatLng:Ze,_cellToLocalIj:function(e,t,n,r,i,o){var a,A;return e|=0,o|=0,A=M,M=M+16|0,a=A,(i|=0)?e=15:(e=0|gt(e,t|=0,n|=0,r|=0,a))||(function(e,t){var n;t|=0,n=0|s[8+(e|=0)>>2],s[t>>2]=(0|s[e>>2])-n,s[t+4>>2]=(0|s[e+4>>2])-n}(a,o),e=0),M=A,0|e},_cellToParent:Fe,_cellToVertex:Nt,_cellToVertexes:function(e,t,n){n|=0;var r,i=0,o=0;return o=!(0|je(e|=0,t|=0)),r=!(0|(i=0|Nt(e,t,0,n))),o?r?0|(i=0|Nt(e,t,1,n+8|0))||0|(i=0|Nt(e,t,2,n+16|0))||0|(i=0|Nt(e,t,3,n+24|0))||(i=0|Nt(e,t,4,n+32|0))?0|(o=i):0|Nt(e,t,5,n+40|0):0|(o=i):r?0|(i=0|Nt(e,t,1,n+8|0))||0|(i=0|Nt(e,t,2,n+16|0))||0|(i=0|Nt(e,t,3,n+24|0))||0|(i=0|Nt(e,t,4,n+32|0))?0|(o=i):(s[(o=n+40|0)>>2]=0,s[o+4>>2]=0,0|(o=0)):0|(o=i)},_cellsToDirectedEdge:function(e,t,n,r,i){return i|=0,7==(0|(n=0|U(e|=0,t|=0,n|=0,r|=0)))?0|(i=11):(r=0|rn(0|n,0,56),t=-2130706433&t|T()|268435456,s[i>>2]=e|r,s[i+4>>2]=t,0|(i=0))},_cellsToLinkedMultiPolygon:function(e,t,n){n|=0;var r,o,a,A=0;if(a=M,M=M+32|0,r=a,0|(e=0|function(e,t,n){e|=0,n|=0;var r,i,o=0,a=0,A=0,l=0,c=0,u=0;if(i=M,M=M+176|0,r=i,(0|(t|=0))<1)return Dt(n,0,0),M=i,0;for(c=0|nn(0|s[(c=e)>>2],0|s[c+4>>2],52),T(),Dt(n,(0|t)>6?t:6,15&c),c=0;!(0|(o=0|Je(0|s[(o=e+(c<<3)|0)>>2],0|s[o+4>>2],r)));){if((0|(o=0|s[r>>2]))>0){l=0;do{A=r+8+(l<<4)|0,(a=0|Gt(n,o=r+8+((0|(l=l+1|0))%(0|o)<<4)|0,A))?Ut(n,a):jt(n,A,o),o=0|s[r>>2]}while((0|l)<(0|o))}if((0|(c=c+1|0))>=(0|t)){o=0,u=13;break}}return 13==(0|u)?(M=i,0|o):(Ot(n),M=i,0|(u=o))}(e|=0,t|=0,o=a+16|0)))return M=a,0|e;if(s[n>>2]=0,s[n+4>>2]=0,s[n+8>>2]=0,0|(e=0|Ft(o)))do{t=0|ht(n);do{dt(t,e),A=e+16|0,s[r>>2]=s[A>>2],s[r+4>>2]=s[A+4>>2],s[r+8>>2]=s[A+8>>2],s[r+12>>2]=s[A+12>>2],Ut(o,e),e=0|zt(o,r)}while(0|e);e=0|Ft(o)}while(0|e);return Ot(o),(e=0|function(e){var t,n,r=0,o=0,a=0,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,C=0,k=0,R=0,P=0,I=0,M=0,L=0,N=0,B=0,D=0;if(0|s[(A=(e|=0)+8|0)>>2])return 1;if(!(a=0|s[e>>2]))return 0;r=a,o=0;do{o=o+1|0,r=0|s[r+8>>2]}while(0|r);if(o>>>0<2)return 0;(n=0|Wt(o<<2))||S(27396,27235,317,27415),(t=0|Wt(o<<5))||S(27437,27235,321,27415),s[e>>2]=0,s[(k=e+4|0)>>2]=0,s[A>>2]=0,o=0,N=0,C=0,g=0;e:for(;;){if(p=0|s[a>>2]){c=0,u=p;do{if(d=+i[u+8>>3],r=u,u=0|s[u+16>>2],h=+i[(A=(f=!(0|u))?p:u)+8>>3],+l(+(d-h))>3.141592653589793){D=14;break}c+=(h-d)*(+i[r>>3]+ +i[A>>3])}while(!f);if(14==(0|D)){D=0,c=0,r=p;do{T=+i[r+8>>3],M=0|s[(L=r+16|0)>>2],E=+i[(M=0|M?M:p)+8>>3],c+=(+i[r>>3]+ +i[M>>3])*((E<0?E+6.283185307179586:E)-(T<0?T+6.283185307179586:T)),r=0|s[(0|r?L:a)>>2]}while(0|r)}c>0?(s[n+(N<<2)>>2]=a,N=N+1|0,A=C,r=g):D=19}else D=19;if(19==(0|D)){D=0;do{if(!o){if(g){A=k,u=g+8|0,r=a,o=e;break}if(0|s[e>>2]){D=27;break e}A=k,u=e,r=a,o=e;break}if(0|s[(r=o+8|0)>>2]){D=21;break e}if(!(o=0|$t(1,12))){D=23;break e}s[r>>2]=o,A=o+4|0,u=o,r=g}while(0);if(s[u>>2]=a,s[A>>2]=a,u=t+(C<<5)|0,f=0|s[a>>2]){for(i[(p=t+(C<<5)+8|0)>>3]=17976931348623157e292,i[(g=t+(C<<5)+24|0)>>3]=17976931348623157e292,i[u>>3]=-17976931348623157e292,i[(m=t+(C<<5)+16|0)>>3]=-17976931348623157e292,w=17976931348623157e292,x=-17976931348623157e292,A=0,_=f,d=17976931348623157e292,v=17976931348623157e292,y=-17976931348623157e292,h=-17976931348623157e292;c=+i[_>>3],T=+i[_+8>>3],_=0|s[_+16>>2],E=+i[((b=!(0|_))?f:_)+8>>3],c>3]=c,d=c),T>3]=T,v=T),c>y?i[u>>3]=c:c=y,T>h&&(i[m>>3]=T,h=T),w=T>0&Tx?T:x,A|=+l(+(T-E))>3.141592653589793,!b;)y=c;A&&(i[m>>3]=x,i[g>>3]=w)}else s[u>>2]=0,s[u+4>>2]=0,s[u+8>>2]=0,s[u+12>>2]=0,s[u+16>>2]=0,s[u+20>>2]=0,s[u+24>>2]=0,s[u+28>>2]=0;A=C+1|0}if(a=0|s[(L=a+8|0)>>2],s[L>>2]=0,!a){D=45;break}C=A,g=r}if(21==(0|D))S(27213,27235,35,27247);else if(23==(0|D))S(27267,27235,37,27247);else if(27==(0|D))S(27310,27235,61,27333);else if(45==(0|D)){e:do{if((0|N)>0){for(L=!(0|A),I=A<<2,M=!(0|e),P=0,r=0;;){if(R=0|s[n+(P<<2)>>2],L)D=73;else{if(!(C=0|Wt(I))){D=50;break}if(!(k=0|Wt(I))){D=52;break}t:do{if(M)o=0;else{for(A=0,o=0,u=e;a=t+(A<<5)|0,0|pt(0|s[u>>2],a,0|s[R>>2])?(s[C+(o<<2)>>2]=u,s[k+(o<<2)>>2]=a,b=o+1|0):b=o,u=0|s[u+8>>2];)A=A+1|0,o=b;if((0|b)>0)if(a=0|s[C>>2],1==(0|b))o=a;else for(m=0,_=-1,o=a,g=a;;){for(f=0|s[g>>2],a=0,u=0;p=(0|(A=0|s[s[C+(u<<2)>>2]>>2]))==(0|f)?a:a+(1&pt(A,0|s[k+(u<<2)>>2],0|s[f>>2]))|0,(0|(u=u+1|0))!=(0|b);)a=p;if(o=(A=(0|p)>(0|_))?g:o,(0|(a=m+1|0))==(0|b))break t;m=a,_=A?p:_,g=0|s[C+(a<<2)>>2]}else o=0}}while(0);if(Ht(C),Ht(k),o){if(a=0|s[(A=o+4|0)>>2])o=a+8|0;else if(0|s[o>>2]){D=70;break}s[o>>2]=R,s[A>>2]=R}else D=73}if(73==(0|D)){if(D=0,0|(r=0|s[R>>2]))do{k=r,r=0|s[r+16>>2],Ht(k)}while(0|r);Ht(R),r=1}if((0|(P=P+1|0))>=(0|N)){B=r;break e}}50==(0|D)?S(27452,27235,249,27471):52==(0|D)?S(27490,27235,252,27471):70==(0|D)&&S(27310,27235,61,27333)}else B=0}while(0);return Ht(n),Ht(t),0|B}return 0}(n))?(ft(n),M=a,0|(A=e)):(M=a,0|(A=0))},_childPosToCell:function(e,t,n,r,i,o){e|=0,t|=0,o|=0;var a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(a=M,M=M+16|0,A=a,(i|=0)>>>0>15)return M=a,4;if(l=0|nn(0|(n|=0),0|(r|=0),52),T(),(0|(l&=15))>(0|i))return M=a,12;if(0|Ue(n,r,i,A)&&S(27795,27122,1327,27173),!(((0|t)>-1|-1==(0|t)&e>>>0>4294967295)&((0|(u=0|s[(h=A)+4>>2]))>(0|t)|((0|u)==(0|t)?(0|s[h>>2])>>>0>e>>>0:0))))return M=a,2;h=i-l|0,i=0|rn(0|i,0,52),c=T()|-15728641&r,s[(u=o)>>2]=i|n,s[u+4>>2]=c,u=0|nn(0|n,0|r,45),T();e:do{if(0|G(127&u)){if(0|l)for(A=1;;){if(!(!((u=0|rn(7,0,3*(15-A|0)|0))&n)&!((0|T())&r)))break e;if(!(A>>>0>>0))break;A=A+1|0}if((0|h)<1)return M=a,0;for(u=15^l,r=-1,c=1,A=1;;){l=0|_t(7,0,l=h-c|0,((0|l)<0)<<31>>31),n=0|T();do{if(A){if(A=0|Kt(0|(A=0|Xt(0|(A=0|Zt(0|l,0|n,5,0)),0|T(),-5,-1)),0|T(),6,0),(0|t)>(0|(i=0|T()))|(0|t)==(0|i)&e>>>0>A>>>0){t=0|Qt(0|(t=0|Xt(0|e,0|t,-1,-1)),0|T(),0|A,0|i),A=0|T(),p=0|s[(d=o)>>2],d=0|s[d+4>>2],f=0|rn(7,0,0|(g=3*(u+r|0)|0)),d&=~T(),g=0|rn(0|(i=0|Xt(0|(r=0|Kt(0|t,0|A,0|l,0|n)),0|(e=0|T()),2,0)),0|T(),0|g),d=0|T()|d,s[(i=o)>>2]=g|p&~f,s[i+4>>2]=d,e=0|Qt(0|t,0|A,0|(e=0|Zt(0|r,0|e,0|l,0|n)),0|T()),A=0,t=0|T();break}f=0|s[(g=o)>>2],g=0|s[g+4>>2],p=0|rn(7,0,3*(u+r|0)|0),g&=~T(),s[(A=o)>>2]=f&~p,s[A+4>>2]=g,A=1;break}i=0|s[(f=o)>>2],f=0|s[f+4>>2],d=0|rn(7,0,0|(r=3*(u+r|0)|0)),f&=~T(),r=0|rn(0|(g=0|Kt(0|e,0|t,0|l,0|n)),0|(A=0|T()),0|r),f=0|T()|f,s[(p=o)>>2]=r|i&~d,s[p+4>>2]=f,e=0|Qt(0|e,0|t,0|(A=0|Zt(0|g,0|A,0|l,0|n)),0|T()),A=0,t=0|T()}while(0);if(!((0|h)>(0|c))){t=0;break}r=~c,c=c+1|0}return M=a,0|t}}while(0);if((0|h)<1)return M=a,0;for(i=15^l,A=1;;){if(p=0|_t(7,0,p=h-A|0,((0|p)<0)<<31>>31),g=0|T(),n=0|s[(c=o)>>2],c=0|s[c+4>>2],r=0|rn(7,0,0|(l=3*(i-A|0)|0)),c&=~T(),l=0|rn(0|(d=0|Kt(0|e,0|t,0|p,0|g)),0|(f=0|T()),0|l),c=0|T()|c,s[(u=o)>>2]=l|n&~r,s[u+4>>2]=c,e=0|Qt(0|e,0|t,0|(g=0|Zt(0|d,0|f,0|p,0|g)),0|T()),t=0|T(),(0|h)<=(0|A)){t=0;break}A=A+1|0}return M=a,0|t},_compactCells:function(e,t,n,r){t|=0;var i,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,C=0,k=0,R=0,P=0,I=0,M=0;if(!(0|(n|=0))&!(0|(r|=0)))return 0;if(a=0|s[(o=e|=0)>>2],!0&!(15728640&(o=0|s[o+4>>2]))){if(!((0|r)>0|!(0|r)&n>>>0>0))return 0;if(s[(M=t)>>2]=a,s[M+4>>2]=o,1==(0|n)&!(0|r))return 0;o=1,a=0;do{I=0|s[4+(P=e+(o<<3)|0)>>2],s[(M=t+(o<<3)|0)>>2]=s[P>>2],s[M+4>>2]=I,o=0|Xt(0|o,0|a,1,0),a=0|T()}while((0|a)<(0|r)|(0|a)==(0|r)&o>>>0>>0);return 0}if(!(I=0|Wt(i=n<<3)))return 13;if(ln(0|I,0|e,0|i),!(P=0|$t(n,8)))return Ht(I),13;e:for(;;){k=0|nn(0|(u=0|s[(o=I)>>2]),0|(o=0|s[o+4>>2]),52),T(),R=(k&=15)-1|0,C=!!(0|k),E=(0|r)>0|!(0|r)&n>>>0>0;t:do{if(C&E){if(v=0|rn(0|R,0,52),y=0|T(),R>>>0>15){if(!(!(0|u)&!(0|o))){M=16;break e}for(a=0,e=0;;){if(a=0|Xt(0|a,0|e,1,0),!((0|(e=0|T()))<(0|r)|(0|e)==(0|r)&a>>>0>>0))break t;if(!(!(0|(x=0|s[(A=I+(a<<3)|0)>>2]))&!(0|(A=0|s[A+4>>2])))){o=A,M=16;break e}}}for(l=u,e=o,a=0,A=0;;){if(!(!(0|l)&!(0|e))){if(!(!0&!(117440512&e))){M=21;break e}if(h=0|nn(0|l,0|e,52),T(),(0|(h&=15))<(0|R)){o=12,M=27;break e}if((0|h)!=(0|R)&&(l|=v,e=-15728641&e|y,h>>>0>=k>>>0)){c=R;do{x=0|rn(7,0,3*(14-c|0)|0),c=c+1|0,l|=x,e=0|T()|e}while(c>>>0>>0)}if(f=0|en(0|l,0|e,0|n,0|r),p=0|T(),!(!(0|(d=0|s[(h=c=P+(f<<3)|0)>>2]))&!(0|(h=0|s[h+4>>2])))){_=0,b=0;do{if((0|_)>(0|r)|(0|_)==(0|r)&b>>>0>n>>>0){M=31;break e}if((0|d)==(0|l)&(-117440513&h)==(0|e)){g=0|nn(0|d,0|h,56),T(),m=1+(g&=7)|0,x=0|nn(0|d,0|h,45),T();n:do{if(0|G(127&x)){if(d=0|nn(0|d,0|h,52),T(),!(d&=15)){h=6;break}for(h=1;;){if(!(!((x=0|rn(7,0,3*(15-h|0)|0))&l)&!((0|T())&e))){h=7;break n}if(!(h>>>0>>0)){h=6;break}h=h+1|0}}else h=7}while(0);if((g+2|0)>>>0>h>>>0){M=41;break e}x=0|rn(0|m,0,56),e=T()|-117440513&e,s[(w=c)>>2]=0,s[w+4>>2]=0,l|=x}else f=0|Jt(0|(f=0|Xt(0|f,0|p,1,0)),0|T(),0|n,0|r),p=0|T();b=0|Xt(0|b,0|_,1,0),_=0|T(),d=0|s[(h=c=P+(f<<3)|0)>>2],h=0|s[h+4>>2]}while(!(!(0|d)&!(0|h)))}s[(x=c)>>2]=l,s[x+4>>2]=e}if(a=0|Xt(0|a,0|A,1,0),!((0|(A=0|T()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break t;l=0|s[(e=I+(a<<3)|0)>>2],e=0|s[e+4>>2]}}}while(0);if(x=0|Xt(0|n,0|r,5,0),(w=0|T())>>>0<0|!(0|w)&x>>>0<11){M=85;break}if(x=0|Kt(0|n,0|r,6,0),T(),!(x=0|$t(x,8))){M=48;break}do{if(E){for(m=0,e=0,g=0,_=0;;){if(!(0|(a=0|s[(A=h=P+(m<<3)|0)>>2]))&!(0|(A=0|s[A+4>>2])))w=g;else{d=0|nn(0|a,0|A,56),T(),l=1+(d&=7)|0,f=-117440513&A,w=0|nn(0|a,0|A,45),T();t:do{if(0|G(127&w)){if(p=0|nn(0|a,0|A,52),T(),0|(p&=15))for(c=1;;){if(!(!(a&(w=0|rn(7,0,3*(15-c|0)|0)))&!(f&(0|T()))))break t;if(!(c>>>0

>>0))break;c=c+1|0}a|=A=0|rn(0|l,0,56),A=0|T()|f,s[(l=h)>>2]=a,s[l+4>>2]=A,l=d+2|0}}while(0);7==(0|l)?(s[(w=x+(e<<3)|0)>>2]=a,s[w+4>>2]=-117440513&A,e=0|Xt(0|e,0|g,1,0),w=0|T()):w=g}if(m=0|Xt(0|m,0|_,1,0),!((0|(_=0|T()))<(0|r)|(0|_)==(0|r)&m>>>0>>0))break;g=w}if(E){if(b=R>>>0>15,v=0|rn(0|R,0,52),y=0|T(),!C){for(a=0,c=0,l=0,A=0;!(0|u)&!(0|o)||(s[(R=t+(a<<3)|0)>>2]=u,s[R+4>>2]=o,a=0|Xt(0|a,0|c,1,0),c=0|T()),l=0|Xt(0|l,0|A,1,0),(0|(A=0|T()))<(0|r)|(0|A)==(0|r)&l>>>0>>0;)u=0|s[(o=I+(l<<3)|0)>>2],o=0|s[o+4>>2];o=w;break}for(a=0,c=0,A=0,l=0;;){do{if(!(!(0|u)&!(0|o))){if(p=0|nn(0|u,0|o,52),T(),b|(0|(p&=15))<(0|R)){M=80;break e}if((0|p)!=(0|R)){if(h=u|v,d=-15728641&o|y,p>>>0>=k>>>0){f=R;do{C=0|rn(7,0,3*(14-f|0)|0),f=f+1|0,h|=C,d=0|T()|d}while(f>>>0

>>0)}}else h=u,d=o;g=0|en(0|h,0|d,0|n,0|r),f=0,p=0,_=0|T();do{if((0|f)>(0|r)|(0|f)==(0|r)&p>>>0>n>>>0){M=81;break e}if((-117440513&(m=0|s[4+(C=P+(g<<3)|0)>>2]))==(0|d)&&(0|s[C>>2])==(0|h)){M=65;break}g=0|Jt(0|(C=0|Xt(0|g,0|_,1,0)),0|T(),0|n,0|r),_=0|T(),p=0|Xt(0|p,0|f,1,0),f=0|T(),C=P+(g<<3)|0}while((0|s[C>>2])!=(0|h)||(0|s[C+4>>2])!=(0|d));if(65==(0|M)&&(M=0,!0&100663296==(117440512&m)))break;s[(C=t+(a<<3)|0)>>2]=u,s[C+4>>2]=o,a=0|Xt(0|a,0|c,1,0),c=0|T()}}while(0);if(A=0|Xt(0|A,0|l,1,0),!((0|(l=0|T()))<(0|r)|(0|l)==(0|r)&A>>>0>>0))break;u=0|s[(o=I+(A<<3)|0)>>2],o=0|s[o+4>>2]}o=w}else a=0,o=w}else a=0,e=0,o=0}while(0);if(cn(0|P,0,0|i),ln(0|I,0|x,e<<3),Ht(x),!(0|e)&!(0|o)){M=89;break}t=t+(a<<3)|0,r=o,n=e}if(16==(0|M))!0&!(117440512&o)?(o=4,M=27):M=21;else if(31==(0|M))S(27795,27122,620,27132);else{if(41==(0|M))return Ht(I),Ht(P),10;if(48==(0|M))return Ht(I),Ht(P),13;80==(0|M)?S(27795,27122,711,27132):81==(0|M)?S(27795,27122,723,27132):85==(0|M)&&(ln(0|t,0|I,n<<3),M=89)}return 21==(0|M)?(Ht(I),Ht(P),0|(M=5)):27==(0|M)?(Ht(I),Ht(P),0|(M=o)):89==(0|M)?(Ht(I),Ht(P),0|(M=0)):0},_constructCell:function(e,t,n,i){n|=0,i|=0;var o=0,a=0,A=0,l=0,c=0,u=0;if((e|=0)>>>0>15)return 4;if((t|=0)>>>0>121)return 17;A=0|rn(0|e,0,52),o=0|T(),l=0|rn(0|t,0,45),o=0|o|T()|134225919;e:do{if((0|e)>=1){for(l=1,A=!!(0|r[20528+t|0]),a=-1;;){if((t=0|s[n+(l+-1<<2)>>2])>>>0>6){o=18,t=10;break}if(!(!(0|t)|1^A)){if(1==(0|t)){o=19,t=10;break}A=0}if(c=0|rn(7,0,0|(u=3*(15-l|0)|0)),o&=~T(),a=(t=0|rn(0|t,((0|t)<0)<<31>>31,0|u))|a&~c,o=0|T()|o,!((0|l)<(0|e)))break e;l=l+1|0}if(10==(0|t))return 0|o}else a=-1}while(0);return s[(u=i)>>2]=a,s[u+4>>2]=o,0},_destroyLinkedMultiPolygon:ft,_directedEdgeToBoundary:Ce,_directedEdgeToCells:function(e,t,n){e|=0;var r,i,o,a=0;return r=M,M=M+16|0,a=r,!0&268435456==(2013265920&(t|=0))?(i=-2130706433&t|134217728,s[(o=n|=0)>>2]=e,s[o+4>>2]=i,s[a>>2]=0,t=0|nn(0|e,0|t,56),T(),a=0|O(e,i,7&t,a,n+8|0),M=r,0|a):(M=r,0|(a=6))},_edgeLengthKm:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return l=e,A=+i[n>>3],A*=6371.007180918475,i[n>>3]=A,M=r,0|l;if(i[n>>3]=0,(0|(e=0|s[l>>2]))<=1)return l=0,A=0,A*=6371.007180918475,i[n>>3]=A,M=r,0|l;t=e+-1|0,e=0,o=+i[l+8>>3],a=+i[l+16>>3],A=0;do{f=o,o=+i[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+i[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+f)*+h(+o)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)!=(0|t));return i[n>>3]=A,l=0,p=A,p*=6371.007180918475,i[n>>3]=p,M=r,0|l},_edgeLengthM:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return l=e,A=+i[n>>3],A*=6371.007180918475,A*=1e3,i[n>>3]=A,M=r,0|l;if(i[n>>3]=0,(0|(e=0|s[l>>2]))<=1)return l=0,A=0,A*=6371.007180918475,A*=1e3,i[n>>3]=A,M=r,0|l;t=e+-1|0,e=0,o=+i[l+8>>3],a=+i[l+16>>3],A=0;do{f=o,o=+i[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+i[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+f)*+h(+o)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)!=(0|t));return i[n>>3]=A,l=0,p=A,p*=6371.007180918475,p*=1e3,i[n>>3]=p,M=r,0|l},_edgeLengthRads:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return M=r,0|e;if(i[n>>3]=0,(0|(e=0|s[l>>2]))<=1)return M=r,0;t=e+-1|0,e=0,o=+i[l+8>>3],a=+i[l+16>>3],A=0;do{f=o,o=+i[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+i[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+o)*+h(+f)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)<(0|t));return i[n>>3]=A,M=r,0},_emscripten_replace_memory:function(e){return r=new Int8Array(e),s=new Int32Array(e),i=new Float64Array(e),n=e,!0},_free:Ht,_getBaseCellNumber:Be,_getDirectedEdgeDestination:function(e,t,n){e|=0,t|=0,n|=0;var r,i,o=0;return r=M,M=M+16|0,s[(o=r)>>2]=0,!0&268435456==(2013265920&t)?(i=0|nn(0|e,0|t,56),T(),o=0|O(e,-2130706433&t|134217728,7&i,o,n),M=r,0|o):(M=r,0|(o=6))},_getDirectedEdgeOrigin:function(e,t,n){return e|=0,n|=0,!0&268435456==(2013265920&(t|=0))?(s[n>>2]=e,s[n+4>>2]=-2130706433&t|134217728,0|(n=0)):0|(n=6)},_getHexagonAreaAvgKm2:At,_getHexagonAreaAvgM2:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(i[t>>3]=+i[20784+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgKm:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(i[t>>3]=+i[20912+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgM:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(i[t>>3]=+i[21040+(e<<3)>>3],0|(t=0))},_getIcosahedronFaces:function e(t,n,r){r|=0;var i,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0;i=M,M=M+128|0,h=i+112|0,A=i+96|0,d=i,a=0|nn(0|(t|=0),0|(n|=0),52),T(),c=15&a,s[h>>2]=c,l=0|nn(0|t,0|n,45),T(),l&=127;e:do{if(0|G(l)){if(0|c)for(o=1;;){if(!(!((u=0|rn(7,0,3*(15-o|0)|0))&t)&!((0|T())&n))){a=0;break e}if(!(o>>>0>>0))break;o=o+1|0}if(!(1&a))return u=0|rn(c+1|0,0,52),d=T()|-15728641&n,d=0|e((u|t)&~(h=0|rn(7,0,3*(14-c|0)|0)),d&~T(),r),M=i,0|d;a=1}else a=0}while(0);if(!(o=0|Ke(t,n,A))){a?(Pe(A,h,d),u=5):(Ne(A,h,d),u=6);e:do{if(0|G(l))if(c)for(o=1;;){if(!(!((l=0|rn(7,0,3*(15-o|0)|0))&t)&!((0|T())&n))){t=2;break e}if(!(o>>>0>>0)){t=5;break}o=o+1|0}else t=5;else t=2}while(0);cn(0|r,-1,t<<2);e:do{if(a)for(A=0;;){if(Me(l=d+(A<<4)|0,0|s[h>>2]),l=0|s[l>>2],-1==(0|(c=0|s[r>>2]))|(0|c)==(0|l))o=r;else{a=0;do{if((a=a+1|0)>>>0>=t>>>0){o=1;break e}c=0|s[(o=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(s[o>>2]=l,(A=A+1|0)>>>0>=u>>>0){o=0;break}}else for(A=0;;){if(Ie(l=d+(A<<4)|0,0|s[h>>2],0,1),l=0|s[l>>2],-1==(0|(c=0|s[r>>2]))|(0|c)==(0|l))o=r;else{a=0;do{if((a=a+1|0)>>>0>=t>>>0){o=1;break e}c=0|s[(o=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(s[o>>2]=l,(A=A+1|0)>>>0>=u>>>0){o=0;break}}}while(0)}return M=i,0|o},_getIndexDigit:function(e,t,n,r){return r|=0,((n|=0)-1|0)>>>0>14?0|(r=4):(n=0|nn(0|(e|=0),0|(t|=0),3*(15-n|0)|0),T(),s[r>>2]=7&n,0|(r=0))},_getNumCells:lt,_getPentagons:et,_getRes0Cells:function(e){e|=0;var t=0,n=0,r=0;t=0;do{rn(0|t,0,45),r=134225919|T(),s[(n=e+(t<<3)|0)>>2]=-1,s[n+4>>2]=r,t=t+1|0}while(122!=(0|t));return 0},_getResolution:function(e,t){return t=0|nn(0|(e|=0),0|(t|=0),52),T(),15&t},_greatCircleDistanceKm:at,_greatCircleDistanceM:function(e,t){e|=0;var n,r,s,o=0;return r=+i[(t|=0)>>3],n=+i[e>>3],o=(s=+d(.5*(r-n)))*s+(o=+d(.5*(+i[t+8>>3]-+i[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(e,t){e|=0;var n,r,s,o=0;return r=+i[(t|=0)>>3],n=+i[e>>3],o=(s=+d(.5*(r-n)))*s+(o=+d(.5*(+i[t+8>>3]-+i[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))},_gridDisk:L,_gridDiskDistances:N,_gridDistance:function(e,t,n,r,i){n|=0,r|=0,i|=0;var o,a,A=0,l=0;return a=M,M=M+32|0,l=a,0|(o=0|gt(e|=0,t|=0,e,t,A=a+12|0))?(M=a,0|(l=o)):0|(e=0|gt(e,t,n,r,l))?(M=a,0|(l=e)):(A=0|xe(A,l),s[(l=i)>>2]=A,s[l+4>>2]=((0|A)<0)<<31>>31,M=a,0|(l=0))},_gridPathCells:function(e,t,n,r,i){n|=0,r|=0,i|=0;var o,a,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,C=0,k=0;if(a=M,M=M+48|0,c=a+12|0,C=a,!(A=0|gt(e|=0,t|=0,e,t,o=a+24|0))&&!(A=0|gt(e,t,n,r,c))){E=((0|(x=0|xe(o,c)))<0)<<31>>31,s[o>>2]=0,s[o+4>>2]=0,s[o+8>>2]=0,s[c>>2]=0,s[c+4>>2]=0,s[c+8>>2]=0,0|gt(e,t,e,t,o)&&S(27795,27538,692,27747),0|gt(e,t,n,r,c)&&S(27795,27538,697,27747),Ee(o),Ee(c),f=0|x?1/+(0|x):0,n=0|s[o>>2],b=f*+((0|s[c>>2])-n|0),r=0|s[(v=o+4|0)>>2],y=f*+((0|s[c+4>>2])-r|0),A=0|s[(w=o+8|0)>>2],f*=+((0|s[c+8>>2])-A|0),s[C>>2]=n,s[(p=C+4|0)>>2]=r,s[(g=C+8|0)>>2]=A;e:do{if((0|x)<0)A=0;else for(m=0,_=0;;){k=b*(h=+(_>>>0)+4294967296*+(0|m))+ +(0|n),u=y*h+ +(0|r),h=f*h+ +(0|A),n=~~+An(+k),c=~~+An(+u),A=~~+An(+h),k=+l(+(+(0|n)-k)),u=+l(+(+(0|c)-u)),h=+l(+(+(0|A)-h));do{if(!(k>u&k>h)){if(d=0-n|0,u>h){r=d-A|0;break}r=c,A=d-c|0;break}n=0-(c+A)|0,r=c}while(0);if(s[C>>2]=n,s[p>>2]=r,s[g>>2]=A,Te(C),0|(A=0|mt(e,t,C,i+(_<<3)|0)))break e;if(!((0|m)<(0|E)|(0|m)==(0|E)&_>>>0>>0)){A=0;break e}n=0|Xt(0|_,0|m,1,0),m=r=0|T(),_=n,n=0|s[o>>2],r=0|s[v>>2],A=0|s[w>>2]}}while(0);return M=a,0|A}return M=a,0|A},_gridPathCellsSize:function(e,t,n,r,i){n|=0,r|=0,i|=0;var o,a=0,A=0,l=0;return o=M,M=M+32|0,l=o,(a=0|gt(e|=0,t|=0,e,t,A=o+12|0))||(a=0|gt(e,t,n,r,l))?(M=o,0|(l=a)):(r=0|Xt(0|(r=0|xe(A,l)),((0|r)<0)<<31>>31,1,0),A=0|T(),s[(l=i)>>2]=r,s[l+4>>2]=A,M=o,0|(l=0))},_gridRing:function(e,t,n,r){return 0|F(e|=0,t|=0,n|=0,r|=0)?(cn(0|r,0,48*n|0),0|(r=0|function(e,t,n,r){e|=0,t|=0,r|=0;var i,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0;if(i=M,M=M+16|0,A=i,!(n|=0))return s[r>>2]=e,s[r+4>>2]=t,M=i,0;do{if((0|n)>=0){if((0|n)>13780509){if(0|(o=0|lt(15,A)))break;o=0|s[(a=A)>>2],a=0|s[a+4>>2]}else h=0|Zt(0|n,0|(o=((0|n)<0)<<31>>31),3,0),a=0|T(),o=0|Xt(0|n,0|o,1,0),o=0|Xt(0|(o=0|Zt(0|h,0|a,0|o,0|T())),0|T(),1,0),a=0|T(),s[(h=A)>>2]=o,s[h+4>>2]=a;if(u=0|$t(o,8)){if(!(h=0|$t(o,4))){Ht(u),o=13;break}if(0|(o=0|D(e,t,n,u,h,o,a,0))){Ht(u),Ht(h);break}if(t=0|s[A>>2],(0|(A=0|s[A+4>>2]))>0|!(0|A)&t>>>0>0){o=0,l=0,c=0;do{!(0|(a=0|s[(e=u+(l<<3)|0)>>2]))&!(0|(e=0|s[e+4>>2]))||(0|s[h+(l<<2)>>2])!=(0|n)||(s[(d=r+(o<<3)|0)>>2]=a,s[d+4>>2]=e,o=o+1|0),l=0|Xt(0|l,0|c,1,0),c=0|T()}while((0|c)<(0|A)|(0|c)==(0|A)&l>>>0>>0)}Ht(u),Ht(h),o=0}else o=13}else o=2}while(0);return M=i,0|o}(e,t,n,r))):0|(r=0)},_gridRingUnsafe:F,_i64Add:Xt,_i64Subtract:Qt,_isPentagon:je,_isResClassIII:function(e,t){return t=0|nn(0|(e|=0),0|(t|=0),52),T(),1&t},_isValidCell:De,_isValidDirectedEdge:Se,_isValidIndex:function(e,t){e|=0;var n=0,s=0,i=0,o=0;if(!0&134217728==(-16777216&(t|=0))&&(s=0|nn(0|e,0|t,52),T(),s&=15,n=0|nn(0|e,0|t,45),T(),(n&=127)>>>0<=121)&&!(613566756&(o=0|rn(0|(i=0|nn(0|e,0|t,0|(o=3*(15^s)|0))),0|T(),0|o))&Qt(-1227133514,-1171,0|o,0|(i=0|T())))&!(4681&i&T())&&15==(0|s)|!(0|(o=0|nn(0|rn(0|~e,0|~t,0|(o=19+(3*s|0)|0)),0|T(),0|o)))&!(0|T())){if(!(0|r[20528+n|0]))return 1;if(!(0|e)&!(0|(n=8191&t)))return 1;if(o=0|sn(0|e,0|n),T(),(63-o|0)%3|0)return 1}return 0|Se(e,t)?0|(o=1):0|(o=1&!!(0|Bt(e,t)))},_isValidVertex:Bt,_latLngToCell:Ye,_llvm_ctlz_i64:sn,_llvm_maxnum_f64:on,_llvm_minnum_f64:an,_llvm_round_f64:An,_localIjToCell:function(e,t,n,r,i){var o,a;return e|=0,t|=0,n|=0,i|=0,a=M,M=M+16|0,o=a,(r|=0)?n=15:(n=0|function(e,t){t|=0;var n,r,i,o=0,a=0,A=0;if(a=0|s[(e|=0)>>2],s[t>>2]=a,A=0|s[e+4>>2],s[(r=t+4|0)>>2]=A,s[(i=t+8|0)>>2]=0,e=(o=(0|A)<(0|a))?a:A,(0|(o=o?A:a))<0){if(-2147483648==(0|o)||((0|e)>0?(2147483647-e|0)<(0|o):(-2147483648-e|0)>(0|o)))return 1;if((0|e)>-1?(-2147483648|e)>=(0|o):(-2147483648^e)<(0|o))return 1}return e=A-a|0,(0|a)<0?(o=0-a|0,s[r>>2]=e,s[i>>2]=o,s[t>>2]=0,a=0):(e=A,o=0),(0|e)<0&&(a=a-e|0,s[t>>2]=a,o=o-e|0,s[i>>2]=o,s[r>>2]=0,e=0),n=a-o|0,A=e-o|0,(0|o)<0?(s[t>>2]=n,s[r>>2]=A,s[i>>2]=0,e=A,A=n,o=0):A=a,(0|(a=(0|o)<(0|(a=(0|e)<(0|A)?e:A))?o:a))<=0||(s[t>>2]=A-a,s[r>>2]=e-a,s[i>>2]=o-a),0}(n,o))||(n=0|mt(e,t,o,i)),M=a,0|n},_malloc:Wt,_maxFaceCount:function(e,t,n){n|=0;var r=0,i=0;if(i=0|nn(0|(e|=0),0|(t|=0),45),T(),!(0|G(127&i)))return i=2,s[n>>2]=i,0;if(i=0|nn(0|e,0|t,52),T(),!(i&=15))return i=5,s[n>>2]=i,0;for(r=1;;){if(!(!((0|rn(7,0,3*(15-r|0)|0))&e)&!((0|T())&t))){r=2,e=6;break}if(!(r>>>0>>0)){r=5,e=6;break}r=r+1|0}return 6==(0|e)?(s[n>>2]=r,0):0},_maxGridDiskSize:function(e,t){t|=0;var n=0,r=0,i=0;return(0|(e|=0))<0?0|(t=2):(0|e)>13780509?0|(t=0|lt(15,t)):(i=0|Zt(0|e,0|(n=((0|e)<0)<<31>>31),3,0),r=0|T(),n=0|Xt(0|e,0|n,1,0),n=0|Xt(0|(n=0|Zt(0|i,0|r,0|n,0|T())),0|T(),1,0),e=0|T(),s[t>>2]=n,s[t+4>>2]=e,0|(t=0))},_maxPolygonToCellsSize:function(e,t,n,r){e|=0,t|=0,r|=0;var i,o=0,a=0,A=0,l=0,c=0;if(i=M,M=M+48|0,o=i+16|0,a=i+8|0,A=i,0|(n=0|Et(n|=0)))return M=i,0|n;if(l=0|s[(c=e)+4>>2],s[(n=a)>>2]=s[c>>2],s[n+4>>2]=l,xt(a,o),!(n=0|te(o,t,A))){if(t=0|s[a>>2],(0|(a=0|s[e+8>>2]))>0){o=0|s[e+12>>2],n=0;do{t=(0|s[o+(n<<3)>>2])+t|0,n=n+1|0}while((0|n)<(0|a))}o=0|s[(n=A)>>2],(0|(n=0|s[n+4>>2]))<(0|(a=((0|t)<0)<<31>>31))|(0|n)==(0|a)&o>>>0>>0?(s[(n=A)>>2]=t,s[n+4>>2]=a,n=a):t=o,l=0|Xt(0|t,0|n,12,0),c=0|T(),s[(n=A)>>2]=l,s[n+4>>2]=c,s[(n=r)>>2]=l,s[n+4>>2]=c,n=0}return M=i,0|n},_maxPolygonToCellsSizeExperimental:function(e,t,n,o){t|=0,n|=0,o|=0;var a,A,c=0,u=0,d=0,f=0,p=0,g=0,m=0,_=0;if(A=M,M=M+48|0,p=A+32|0,f=A+40|0,a=A,!(0|s[(e|=0)>>2]))return s[(g=o)>>2]=0,s[g+4>>2]=0,M=A,0;Oe(p,0,0,0),c=0|s[(d=p)>>2],d=0|s[d+4>>2];do{if(t>>>0>15)s[(g=a)>>2]=0,s[g+4>>2]=0,s[a+8>>2]=4,s[a+12>>2]=-1,n=a+29|0,s[(g=a+16|0)>>2]=0,s[g+4>>2]=0,s[g+8>>2]=0,r[g+12|0]=0,r[0|n]=0|r[0|f],r[n+1|0]=0|r[f+1|0],r[n+2|0]=0|r[f+2|0],n=4,g=9;else{if(0|(n=0|Et(n))){s[(p=a)>>2]=0,s[p+4>>2]=0,s[a+8>>2]=n,s[a+12>>2]=-1,g=a+29|0,s[(p=a+16|0)>>2]=0,s[p+4>>2]=0,s[p+8>>2]=0,r[p+12|0]=0,r[0|g]=0|r[0|f],r[g+1|0]=0|r[f+1|0],r[g+2|0]=0|r[f+2|0],g=9;break}if(!(n=0|$t(1+(0|s[e+8>>2])|0,32))){s[(g=a)>>2]=0,s[g+4>>2]=0,s[a+8>>2]=13,s[a+12>>2]=-1,n=a+29|0,s[(g=a+16|0)>>2]=0,s[g+4>>2]=0,s[g+8>>2]=0,r[g+12|0]=0,r[0|n]=0|r[0|f],r[n+1|0]=0|r[f+1|0],r[n+2|0]=0|r[f+2|0],n=13,g=9;break}Tt(e,n),s[(_=a)>>2]=c,s[_+4>>2]=d,s[(d=a+8|0)>>2]=0,s[a+12>>2]=t,s[a+20>>2]=e,s[a+24>>2]=n,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|f],r[c+1|0]=0|r[f+1|0],r[c+2|0]=0|r[f+2|0],s[a+16>>2]=3,m=+q(n),m*=+Q(n),u=+l(+ +i[n>>3]),u=m/+h(+ +an(+u,+ +l(+ +i[n+8>>3])))*6371.007180918475*6371.007180918475,n=0|s[(c=a+12|0)>>2];e:do{if((0|n)>0)do{if(At(n+-1|0,p),!(u/+i[p>>3]>10))break e;n=(_=0|s[c>>2])-1|0,s[c>>2]=n}while((0|_)>1)}while(0);if(vt(a),s[(c=o)>>2]=0,s[c+4>>2]=0,!(!(0|(n=0|s[(c=a)>>2]))&!(0|(c=0|s[c+4>>2]))))do{Ue(n,c,t,p),f=p,f=0|Xt(0|s[(e=o)>>2],0|s[e+4>>2],0|s[f>>2],0|s[f+4>>2]),e=0|T(),s[(_=o)>>2]=f,s[_+4>>2]=e,vt(a),n=0|s[(_=a)>>2],c=0|s[_+4>>2]}while(!(!(0|n)&!(0|c)));n=0|s[d>>2]}}while(0);return M=A,0|n},_memcpy:ln,_memset:cn,_originToDirectedEdges:function(e,t,n){n|=0;var r,i=0;return r=!(0|je(e|=0,t|=0)),t&=-2130706433,s[(i=n)>>2]=r?e:0,s[i+4>>2]=r?285212672|t:0,s[(i=n+8|0)>>2]=e,s[i+4>>2]=301989888|t,s[(i=n+16|0)>>2]=e,s[i+4>>2]=318767104|t,s[(i=n+24|0)>>2]=e,s[i+4>>2]=335544320|t,s[(i=n+32|0)>>2]=e,s[i+4>>2]=352321536|t,s[(n=n+40|0)>>2]=e,s[n+4>>2]=369098752|t,0},_pentagonCount:function(){return 12},_polygonToCells:function(e,t,n,r){e|=0,t|=0,r|=0;var i,o,a,A,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,S=0,C=0,k=0,R=0,P=0,I=0,L=0,N=0,O=0,F=0,U=0;if(A=M,M=M+112|0,i=A+80|0,d=A+72|0,o=A,a=A+56|0,0|(l=0|Et(n|=0)))return M=A,0|l;if(!(U=0|Wt(32+(s[(f=e+8|0)>>2]<<5)|0)))return M=A,13;if(Tt(e,U),!(l=0|Et(n))){if(F=0|s[(O=e)+4>>2],s[(l=d)>>2]=s[O>>2],s[l+4>>2]=F,xt(d,i),l=0|te(i,t,o))O=0,F=0;else{if(l=0|s[d>>2],(0|(c=0|s[f>>2]))>0){u=0|s[e+12>>2],n=0;do{l=(0|s[u+(n<<3)>>2])+l|0,n=n+1|0}while((0|n)!=(0|c));n=l}else n=l;c=0|s[(l=o)>>2],(0|(l=0|s[l+4>>2]))<(0|(u=((0|n)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(s[(l=o)>>2]=n,s[l+4>>2]=u,l=u):n=c,O=0|Xt(0|n,0|l,12,0),F=0|T(),s[(l=o)>>2]=O,s[l+4>>2]=F,l=0}if(!l){if(!(n=0|$t(O,8)))return Ht(U),M=A,13;if(!(h=0|$t(O,8)))return Ht(U),Ht(n),M=A,13;s[(L=i)>>2]=0,s[L+4>>2]=0,N=0|s[(L=e)+4>>2],s[(l=d)>>2]=s[L>>2],s[l+4>>2]=N,l=0|j(d,O,F,t,i,n,h);e:do{if(l)Ht(n),Ht(h),Ht(U);else{t:do{if((0|s[f>>2])>0){for(u=e+12|0,c=0;l=0|j((0|s[u>>2])+(c<<3)|0,O,F,t,i,n,h),c=c+1|0,!(0|l);)if((0|c)>=(0|s[f>>2]))break t;Ht(n),Ht(h),Ht(U);break e}}while(0);(0|F)>0|!(0|F)&O>>>0>0&&cn(0|h,0,O<<3),L=0|s[(N=i)+4>>2];t:do{if((0|L)>0|!(0|L)&(0|s[N>>2])>>>0>0){R=n,P=h,I=n,L=h,N=n,l=n,S=n,C=h,k=h,n=h;n:for(;;){for(y=0,w=0,x=0,E=0,c=0,u=0;;){d=(h=o)+56|0;do{s[h>>2]=0,h=h+4|0}while((0|h)<(0|d));if(0|B(f=0|s[(t=R+(y<<3)|0)>>2],t=0|s[t+4>>2],1,o,0)){d=(h=o)+56|0;do{s[h>>2]=0,h=h+4|0}while((0|h)<(0|d));0|(h=0|$t(7,4))&&(D(f,t,1,o,h,7,0,0),Ht(h))}for(v=0;;){_=0|s[(b=o+(v<<3)|0)>>2],b=0|s[b+4>>2];r:do{if(!(0|_)&!(0|b))h=c,d=u;else{if(p=0|en(0|_,0|b,0|O,0|F),f=0|T(),!(!(0|(d=0|s[(t=h=r+(p<<3)|0)>>2]))&!(0|(t=0|s[t+4>>2])))){g=0,m=0;do{if((0|g)>(0|F)|(0|g)==(0|F)&m>>>0>O>>>0)break n;if((0|d)==(0|_)&(0|t)==(0|b)){h=c,d=u;break r}p=0|Jt(0|(h=0|Xt(0|p,0|f,1,0)),0|T(),0|O,0|F),f=0|T(),m=0|Xt(0|m,0|g,1,0),g=0|T(),d=0|s[(t=h=r+(p<<3)|0)>>2],t=0|s[t+4>>2]}while(!(!(0|d)&!(0|t)))}if(!(0|_)&!(0|b)){h=c,d=u;break}Ze(_,b,a),0|St(e,U,a)&&(m=0|Xt(0|c,0|u,1,0),u=0|T(),s[(g=h)>>2]=_,s[g+4>>2]=b,s[(c=P+(c<<3)|0)>>2]=_,s[c+4>>2]=b,c=m),h=c,d=u}}while(0);if((v=v+1|0)>>>0>=7)break;c=h,u=d}if(y=0|Xt(0|y,0|w,1,0),w=0|T(),x=0|Xt(0|x,0|E,1,0),E=0|T(),c=0|s[(u=i)>>2],!((0|E)<(0|(u=0|s[u+4>>2]))|(0|E)==(0|u)&x>>>0>>0))break;c=h,u=d}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{s[(E=R+(c<<3)|0)>>2]=0,s[E+4>>2]=0,c=0|Xt(0|c,0|u,1,0),u=0|T(),x=0|s[(E=i)+4>>2]}while((0|u)<(0|x)|((0|u)==(0|x)?c>>>0<(0|s[E>>2])>>>0:0))}if(s[(E=i)>>2]=h,s[E+4>>2]=d,!((0|d)>0|!(0|d)&h>>>0>0))break t;v=n,y=k,w=N,x=C,E=P,n=S,k=l,C=I,S=v,l=y,N=L,L=w,I=x,P=R,R=E}Ht(I),Ht(L),Ht(U),l=1;break e}l=h}while(0);Ht(U),Ht(n),Ht(l),l=0}}while(0);return M=A,0|l}}return Ht(U),M=A,0|l},_polygonToCellsExperimental:function(e,t,n,i,o,a){i|=0,o|=0,a|=0;var A,l,c,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0;c=M,M=M+160|0,h=c+64|0,p=c+112|0,_=c,function(e,t,n,i){e|=0,t|=0,n|=0,i|=0;var o,a,A,l=0,c=0,u=0,h=0;A=M,M=M+48|0,o=A+40|0,a=A,Oe(c=A+32|0,0,0,0),u=0|s[c>>2],c=0|s[c+4>>2];do{if(n>>>0<=15){if(0|(l=0|Et(i))){s[(i=a)>>2]=0,s[i+4>>2]=0,s[a+8>>2]=l,s[a+12>>2]=-1,u=a+29|0,s[(i=a+16|0)>>2]=0,s[i+4>>2]=0,s[i+8>>2]=0,r[i+12|0]=0,r[0|u]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}if(l=0|$t(1+(0|s[t+8>>2])|0,32)){Tt(t,l),s[(h=a)>>2]=u,s[h+4>>2]=c,s[a+8>>2]=0,s[a+12>>2]=n,s[a+16>>2]=i,s[a+20>>2]=t,s[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}s[(i=a)>>2]=0,s[i+4>>2]=0,s[a+8>>2]=13,s[a+12>>2]=-1,u=a+29|0,s[(i=a+16|0)>>2]=0,s[i+4>>2]=0,s[i+8>>2]=0,r[i+12|0]=0,r[0|u]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}s[(u=a)>>2]=0,s[u+4>>2]=0,s[a+8>>2]=4,s[a+12>>2]=-1,h=a+29|0,s[(u=a+16|0)>>2]=0,s[u+4>>2]=0,s[u+8>>2]=0,r[u+12|0]=0,r[0|h]=0|r[0|o],r[h+1|0]=0|r[o+1|0],r[h+2|0]=0|r[o+2|0]}while(0);vt(a),s[e>>2]=s[a>>2],s[e+4>>2]=s[a+4>>2],s[e+8>>2]=s[a+8>>2],s[e+12>>2]=s[a+12>>2],s[e+16>>2]=s[a+16>>2],s[e+20>>2]=s[a+20>>2],s[e+24>>2]=s[a+24>>2],s[e+28>>2]=s[a+28>>2],M=A}(f=c+80|0,e|=0,t|=0,n|=0),tt(h,0|s[(d=f)>>2],0|s[d+4>>2],t),A=0|s[(d=h)>>2],d=0|s[d+4>>2],u=0|s[f+8>>2],s[(g=p+4|0)>>2]=s[f>>2],s[g+4>>2]=s[f+4>>2],s[g+8>>2]=s[f+8>>2],s[g+12>>2]=s[f+12>>2],s[g+16>>2]=s[f+16>>2],s[g+20>>2]=s[f+20>>2],s[g+24>>2]=s[f+24>>2],s[g+28>>2]=s[f+28>>2],s[(g=_)>>2]=A,s[g+4>>2]=d,s[(g=_+8|0)>>2]=u,t=p,n=36+(e=_+12|0)|0;do{s[e>>2]=s[t>>2],e=e+4|0,t=t+4|0}while((0|e)<(0|n));if(s[(p=_+48|0)>>2]=s[h>>2],s[p+4>>2]=s[h+4>>2],s[p+8>>2]=s[h+8>>2],s[p+12>>2]=s[h+12>>2],!(0|A)&!(0|d))return M=c,0|u;n=_+16|0,l=_+24|0,f=_+28|0,u=0,h=0,t=A,e=d;do{if(!((0|u)<(0|o)|(0|u)==(0|o)&h>>>0>>0)){m=4;break}if(d=h,h=0|Xt(0|h,0|u,1,0),u=0|T(),s[(d=a+(d<<3)|0)>>2]=t,s[d+4>>2]=e,rt(p),!(0|(t=0|s[(e=p)>>2]))&!(0|(e=0|s[e+4>>2]))){if(vt(n),!(0|(e=0|s[(t=n)>>2]))&!(0|(t=0|s[t+4>>2]))){m=10;break}nt(e,t,0|s[f>>2],p),t=0|s[(e=p)>>2],e=0|s[e+4>>2]}s[(d=_)>>2]=t,s[d+4>>2]=e}while(!(!(0|t)&!(0|e)));return 4==(0|m)?(0|(t=0|s[(e=_+40|0)>>2])&&Ht(t),s[(m=_+16|0)>>2]=0,s[m+4>>2]=0,s[l>>2]=0,s[_+36>>2]=0,s[f>>2]=-1,s[_+32>>2]=0,s[e>>2]=0,nt(0,0,0,p),s[_>>2]=0,s[_+4>>2]=0,s[g>>2]=0,M=c,0|(_=14)):(10==(0|m)&&(s[_>>2]=0,s[_+4>>2]=0,s[g>>2]=s[l>>2]),_=0|s[g>>2],M=c,0|_)},_readInt64AsDoubleFromPointer:function(e){return+(+((0|s[(e|=0)>>2])>>>0)+4294967296*+(0|s[e+4>>2]))},_res0CellCount:function(){return 122},_round:un,_sbrk:hn,_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(e,t,n,r,i,o,a){e|=0,r|=0,i|=0,o|=0;var A,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(A=M,M=M+16|0,g=A,!((0|(n|=0))>0|!(0|n)&(t|=0)>>>0>0))return M=A,0;if((0|(a|=0))>=16)return M=A,12;f=0,p=0,d=0,l=0;e:for(;;){if(h=0|nn(0|(c=0|s[(u=e+(f<<3)|0)>>2]),0|(u=0|s[u+4>>2]),52),T(),(15&h)>(0|a)){l=12,c=11;break}if(tt(g,c,u,a),!(0|(u=0|s[(h=g)>>2]))&!(0|(h=0|s[h+4>>2])))c=d;else{c=d;do{if(!((0|l)<(0|o)|(0|l)==(0|o)&c>>>0>>0)){c=10;break e}s[(d=r+(c<<3)|0)>>2]=u,s[d+4>>2]=h,c=0|Xt(0|c,0|l,1,0),l=0|T(),rt(g),u=0|s[(d=g)>>2],h=0|s[d+4>>2]}while(!(!(0|u)&!(0|h)))}if(f=0|Xt(0|f,0|p,1,0),!((0|(p=0|T()))<(0|n)|(0|p)==(0|n)&f>>>0>>0)){l=0,c=11;break}d=c}return 10==(0|c)?(M=A,0|(g=14)):11==(0|c)?(M=A,0|l):0},_uncompactCellsSize:function(e,t,n,r,i){e|=0,t|=0,n|=0,r|=0,i|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0;a=M,M=M+16|0,o=a;e:do{if((0|n)>0|!(0|n)&t>>>0>0){for(h=0,l=0,A=0,d=0;;){if(!(!(0|(c=0|s[(u=e+(h<<3)|0)>>2]))&!(0|(u=0|s[u+4>>2]))||(u=!(0|Ue(c,u,r,o)),l=0|Xt(0|s[(c=o)>>2],0|s[c+4>>2],0|l,0|A),A=0|T(),u))){A=12;break}if(h=0|Xt(0|h,0|d,1,0),!((0|(d=0|T()))<(0|n)|(0|d)==(0|n)&h>>>0>>0))break e}return M=a,0|A}l=0,A=0}while(0);return s[i>>2]=l,s[i+4>>2]=A,M=a,0},_vertexToLatLng:function(e,t,n){n|=0;var r,i,o,a,A=0,l=0;return a=M,M=M+192|0,i=a,o=a+168|0,A=0|nn(0|(e|=0),0|(t|=0),56),T(),A&=7,0|(r=0|Ke(e,l=-2130706433&t|134217728,o))?(M=a,0|(l=r)):(t=0|nn(0|e,0|t,52),T(),t&=15,0|je(e,l)?Re(o,t,A,1,i):Le(o,t,A,1,i),l=i+8|0,s[n>>2]=s[l>>2],s[n+4>>2]=s[l+4>>2],s[n+8>>2]=s[l+8>>2],s[n+12>>2]=s[l+12>>2],M=a,0|(l=0))},establishStackSpace:function(e,t){M=e|=0},stackAlloc:function(e){var t;return t=M,M=15+(M=M+(e|=0)|0)&-16,0|t},stackRestore:function(e){M=e|=0},stackSave:function(){return 0|M}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(e){A=e},c:function(){return A},d:function(e,t,n,r){ne("Assertion failed: "+b(e)+", at: "+[t?b(t):"unknown filename",n,r?b(r):"unknown function"])},e:function(e){return n.___errno_location&&(p[n.___errno_location()>>2]=e),e},f:G,g:function(e,t,n){d.set(d.subarray(t,t+n),e)},h:function(e){var t=G(),n=16777216,r=2130706432;if(e>r)return!1;for(var s=Math.max(t,16777216);s0))return 0;for(var s=n+r-1,i=0;i=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),o<=127){if(n>=s)break;t[n++]=o}else if(o<=2047){if(n+1>=s)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=s)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=s)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,d,t,n)}(e,t=Q(n),n)}return t},array:function(e){var t,n,r=Q(e.length);return t=e,n=r,h.set(t,n),r}},i=c(e),o=[],a=0;if(r)for(var A=0;A>1]=t;break;case"i32":p[e>>2]=t;break;case"i64":O=[t>>>0,(D=t,+P(D)>=1?D>0?(0|L(+M(D/4294967296),4294967295))>>>0:~~+I((D-+(~~D>>>0))/4294967296)>>>0:0)],p[e>>2]=O[0],p[e+4>>2]=O[1];break;case"float":g[e>>2]=t;break;case"double":m[e>>3]=t;break;default:ne("invalid type for setValue: "+n)}},n.getValue=function(e,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return h[0|e];case"i16":return f[e>>1];case"i32":case"i64":return p[e>>2];case"float":return g[e>>2];case"double":return m[e>>3];default:ne("invalid type for getValue: "+t)}return null},F){j(F)||($=F,F=n.locateFile?n.locateFile($,i):i+$),N++,n.monitorRunDependencies&&n.monitorRunDependencies(N);var K=function(e){e.byteLength&&(e=new Uint8Array(e)),d.set(e,8),n.memoryInitializerRequest&&delete n.memoryInitializerRequest.response,function(){if(N--,n.monitorRunDependencies&&n.monitorRunDependencies(N),0==N&&B){var e=B;B=null,e()}}()},Z=function(){s(F,K,function(){throw"could not load memory initializer "+F})},J=V(F);if(J)K(J.buffer);else if(n.memoryInitializerRequest){var ee=function(){var e=n.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var r=V(n.memoryInitializerRequestURL);if(!r)return void Z();t=r.buffer}K(t)};n.memoryInitializerRequest.response?setTimeout(ee,0):n.memoryInitializerRequest.addEventListener("load",ee)}else Z()}function te(e){function t(){X||(X=!0,l||(x(T),x(S),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)R(n.postRun.shift());x(C)}()))}N>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)k(n.preRun.shift());x(E)}(),N>0||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),t()},1)):t()))}function ne(e){throw n.onAbort&&n.onAbort(e),o(e+=""),a(e),l=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(B=function e(){X||te(),X||(B=e)},n.run=te,n.abort=ne,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return te(),e}("object"==typeof Oe?Oe:{}),Fe="number",Ue={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"},je={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function Ge(e,t,n){var r=n&&"value"in n,s=new Error((e[t]||"Unknown error")+" (code: "+t+(r?", value: "+n.value:"")+")");return s.code=t,s}function ze(e){if(0!==e)throw function(e,t){return Ge(Ue,e,2===arguments.length?{value:t}:{})}(e)}var Ve={};[["sizeOfH3Index",Fe],["sizeOfLatLng",Fe],["sizeOfCellBoundary",Fe],["sizeOfGeoLoop",Fe],["sizeOfGeoPolygon",Fe],["sizeOfLinkedGeoPolygon",Fe],["sizeOfCoordIJ",Fe],["readInt64AsDoubleFromPointer",Fe],["isValidCell",Fe,[Fe,Fe]],["isValidIndex",Fe,[Fe,Fe]],["latLngToCell",Fe,[Fe,Fe,Fe,Fe]],["cellToLatLng",Fe,[Fe,Fe,Fe]],["cellToBoundary",Fe,[Fe,Fe,Fe]],["maxGridDiskSize",Fe,[Fe,Fe]],["gridDisk",Fe,[Fe,Fe,Fe,Fe]],["gridDiskDistances",Fe,[Fe,Fe,Fe,Fe,Fe]],["gridRing",Fe,[Fe,Fe,Fe,Fe]],["gridRingUnsafe",Fe,[Fe,Fe,Fe,Fe]],["maxPolygonToCellsSize",Fe,[Fe,Fe,Fe,Fe]],["polygonToCells",Fe,[Fe,Fe,Fe,Fe]],["maxPolygonToCellsSizeExperimental",Fe,[Fe,Fe,Fe,Fe]],["polygonToCellsExperimental",Fe,[Fe,Fe,Fe,Fe,Fe,Fe]],["cellsToLinkedMultiPolygon",Fe,[Fe,Fe,Fe]],["destroyLinkedMultiPolygon",null,[Fe]],["compactCells",Fe,[Fe,Fe,Fe,Fe]],["uncompactCells",Fe,[Fe,Fe,Fe,Fe,Fe,Fe]],["uncompactCellsSize",Fe,[Fe,Fe,Fe,Fe,Fe]],["isPentagon",Fe,[Fe,Fe]],["isResClassIII",Fe,[Fe,Fe]],["getBaseCellNumber",Fe,[Fe,Fe]],["getResolution",Fe,[Fe,Fe]],["getIndexDigit",Fe,[Fe,Fe,Fe]],["constructCell",Fe,[Fe,Fe,Fe,Fe]],["maxFaceCount",Fe,[Fe,Fe,Fe]],["getIcosahedronFaces",Fe,[Fe,Fe,Fe]],["cellToParent",Fe,[Fe,Fe,Fe,Fe]],["cellToChildren",Fe,[Fe,Fe,Fe,Fe]],["cellToCenterChild",Fe,[Fe,Fe,Fe,Fe]],["cellToChildrenSize",Fe,[Fe,Fe,Fe,Fe]],["cellToChildPos",Fe,[Fe,Fe,Fe,Fe]],["childPosToCell",Fe,[Fe,Fe,Fe,Fe,Fe,Fe]],["areNeighborCells",Fe,[Fe,Fe,Fe,Fe,Fe]],["cellsToDirectedEdge",Fe,[Fe,Fe,Fe,Fe,Fe]],["getDirectedEdgeOrigin",Fe,[Fe,Fe,Fe]],["getDirectedEdgeDestination",Fe,[Fe,Fe,Fe]],["isValidDirectedEdge",Fe,[Fe,Fe]],["directedEdgeToCells",Fe,[Fe,Fe,Fe]],["originToDirectedEdges",Fe,[Fe,Fe,Fe]],["directedEdgeToBoundary",Fe,[Fe,Fe,Fe]],["gridDistance",Fe,[Fe,Fe,Fe,Fe,Fe]],["gridPathCells",Fe,[Fe,Fe,Fe,Fe,Fe]],["gridPathCellsSize",Fe,[Fe,Fe,Fe,Fe,Fe]],["cellToLocalIj",Fe,[Fe,Fe,Fe,Fe,Fe,Fe]],["localIjToCell",Fe,[Fe,Fe,Fe,Fe,Fe]],["getHexagonAreaAvgM2",Fe,[Fe,Fe]],["getHexagonAreaAvgKm2",Fe,[Fe,Fe]],["getHexagonEdgeLengthAvgM",Fe,[Fe,Fe]],["getHexagonEdgeLengthAvgKm",Fe,[Fe,Fe]],["greatCircleDistanceM",Fe,[Fe,Fe]],["greatCircleDistanceKm",Fe,[Fe,Fe]],["greatCircleDistanceRads",Fe,[Fe,Fe]],["cellAreaM2",Fe,[Fe,Fe,Fe]],["cellAreaKm2",Fe,[Fe,Fe,Fe]],["cellAreaRads2",Fe,[Fe,Fe,Fe]],["edgeLengthM",Fe,[Fe,Fe,Fe]],["edgeLengthKm",Fe,[Fe,Fe,Fe]],["edgeLengthRads",Fe,[Fe,Fe,Fe]],["getNumCells",Fe,[Fe,Fe]],["getRes0Cells",Fe,[Fe]],["res0CellCount",Fe],["getPentagons",Fe,[Fe,Fe]],["pentagonCount",Fe],["cellToVertex",Fe,[Fe,Fe,Fe,Fe]],["cellToVertexes",Fe,[Fe,Fe,Fe]],["vertexToLatLng",Fe,[Fe,Fe,Fe]],["isValidVertex",Fe,[Fe,Fe]]].forEach(function(e){Ve[e[0]]=Oe.cwrap.apply(Oe,e)});var We=16,He=Ve.sizeOfH3Index(),$e=Ve.sizeOfLatLng(),Xe=Ve.sizeOfCellBoundary();Ve.sizeOfGeoPolygon(),Ve.sizeOfGeoLoop(),Ve.sizeOfLinkedGeoPolygon(),Ve.sizeOfCoordIJ();var Qe=/[^0-9a-fA-F]/;function Ye(e){if(e>=0)return e.toString(We);var t=qe(8,(e&=2147483647).toString(We));return(parseInt(t[0],We)+8).toString(We)+t.substring(1)}function qe(e,t){for(var n=e-t.length,r="",s=0;s.85?.9+(o-.85)/.15*.1:.1+(o-.15)/.7*.8;var o;return it(r[Math.min(23,Math.floor(24*i))])}function at({coveragePoints:e,visible:t,terrainEnabled:n=!1,brightness:r=.7}){const{current:s}=w(),[o,a]=_.useState(null),[A,l]=_.useState(!1),c=_.useRef({aborted:!1}),u=_.useRef(0),h=function(e){const[t,n]=_.useState(e);return _.useEffect(()=>{const t=setTimeout(()=>n(e),300);return()=>clearTimeout(t)},[e,300]),t}(e),d=_.useMemo(()=>function(){var e;const t=j();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:st}(),[]);_.useEffect(()=>{if(!h||!Array.isArray(h)||0===h.length)return a(null),void(u.current=0);if(h.length===u.current&&o)return;u.current=h.length,c.current.aborted=!0,c.current={aborted:!1};const e=c.current;l(!0);const{cells:t,minQuality:n,maxQuality:r}=function(e){const t=new Map;for(const i of e){if("number"!=typeof i.lat||"number"!=typeof i.lon||isNaN(i.lat)||isNaN(i.lon))continue;const e=Je(i.lat,i.lon,8),n=t.get(e),r=i.weight;n?(n.count++,n.qualitySum+=r):t.set(e,{count:1,qualitySum:r})}const n=[];let r=1/0,s=-1/0;for(const[i,o]of t.entries()){const e=o.qualitySum/o.count;n.push({hexId:i,count:o.count,avgQuality:e}),r=Math.min(r,e),s=Math.max(s,e)}return{cells:n,minQuality:n.length>0?r:0,maxQuality:n.length>0?s:0}}(h);if(0===t.length)return a(null),void l(!1);if(t.length<500){const s=function(e,t,n,r){const s=[];for(const i of e){const e=et(i.hexId).map(([e,t])=>[t,e]);e.push(e[0]);const o=ot(i.avgQuality,t,n,r);s.push({type:"Feature",properties:{color:o,quality:i.avgQuality,count:i.count},geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:s}}(t,n,r,d);return void(e.aborted||(a(s),l(!1)))}return async function(e,t,n,r,s){const i=[];let o=0;for(;o[t,e]);a.push(a[0]);const A=ot(s.avgQuality,t,n,r);i.push({type:"Feature",properties:{color:A,quality:s.avgQuality,count:s.count},geometry:{type:"Polygon",coordinates:[a]}})}orequestAnimationFrame(e))}return{type:"FeatureCollection",features:i}}(t,n,r,d,e).then(t=>{!e.aborted&&t&&a(t)}).finally(()=>{e.aborted||l(!1)}),()=>{e.aborted=!0}},[h,d]),_.useEffect(()=>{var e;const n=null==(e=null==s?void 0:s.getMap)?void 0:e.call(s);if(!n)return;const i=()=>{var e,s;try{const i=n.getLayer(rt),a=n.getSource(nt);if(t&&o&&o.features.length>0){if(a?n.getSource(nt).setData(o):n.addSource(nt,{type:"geojson",data:o}),!i){const t=null==(s=null==(e=n.getStyle())?void 0:e.layers)?void 0:s.find(e=>"symbol"===e.type);n.addLayer({id:rt,type:"fill",source:nt,paint:{"fill-color":["get","color"],"fill-opacity":r}},null==t?void 0:t.id)}}else i&&n.removeLayer(rt),a&&n.removeSource(nt)}catch(i){}};n.isStyleLoaded()?i():n.once("style.load",i)},[s,t,o,n]),_.useEffect(()=>{var e;const n=null==(e=null==s?void 0:s.getMap)?void 0:e.call(s);if(n&&t)try{n.getLayer(rt)&&n.setPaintProperty(rt,"fill-opacity",r)}catch{}},[s,r,t]),_.useEffect(()=>()=>{var e;const t=null==(e=null==s?void 0:s.getMap)?void 0:e.call(s);if(t)try{t.getLayer(rt)&&t.removeLayer(rt),t.getSource(nt)&&t.removeSource(nt)}catch{}},[s]);const f=(null==o?void 0:o.features.length)??0;return f>0&&t?i.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==e?void 0:e.length)||0,"data-cell-count":f,"data-terrain-enabled":n,"data-is-processing":A,style:{display:"none"}}):null}const At="terrain-dem",lt="terrain-hillshade";function ct({enabled:e,exaggeration:t=2}){const{current:n}=w();return _.useEffect(()=>{var r;const s=null==(r=null==n?void 0:n.getMap)?void 0:r.call(n);if(!s)return;const i=()=>{var n,r;try{if(s.getSource(At)||s.addSource(At,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256,maxzoom:10}),e){if(s.setCenterClampedToGround(!1),s.setTerrain({source:At,exaggeration:t}),!s.getLayer(lt)){const e=null==(r=null==(n=s.getStyle())?void 0:n.layers)?void 0:r.find(e=>"symbol"===e.type);s.addLayer({id:lt,type:"hillshade",source:At,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.5)","hillshade-highlight-color":"rgba(200, 195, 185, 0.4)","hillshade-accent-color":"rgba(80, 65, 55, 0.35)","hillshade-illumination-direction":315,"hillshade-exaggeration":.25}},null==e?void 0:e.id)}s.setMaxPitch(70),s.getPitch()<30&&!s.isMoving()&&setTimeout(()=>{!s.isMoving()&&s.getPitch()<30&&s.easeTo({pitch:45,duration:1e3})},200)}else s.setTerrain(null),s.setCenterClampedToGround(!0),s.getLayer(lt)&&s.removeLayer(lt),s.getPitch()>0&&!s.isMoving()&&s.easeTo({pitch:0,duration:800}),s.setMaxPitch(60)}catch(i){}};return s.isStyleLoaded()?i():s.once("style.load",i),()=>{var e;try{const t=null==(e=null==n?void 0:n.getMap)?void 0:e.call(n);if(!t)return;t.isStyleLoaded()&&(t.setTerrain(null),t.getLayer(lt)&&t.removeLayer(lt))}catch{}}},[n,e,t]),null}function ut(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ht(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}var dt,ft={},pt={};var gt,mt,_t={};var bt,vt,yt=(mt||(mt=1,bt=function(){if(dt)return pt;dt=1;var e=y();function t(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n