From 68f89ea0b9dbda9fdd9a9e0f85b9034e90a86ef4 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Tue, 3 Mar 2026 05:54:52 +0000 Subject: [PATCH] Release v0.9.306 Automated sync from private repository. Built with obfuscation enabled. --- frontend/dist/VERSION | 2 +- ...2dr.js => AnalyzerFilterPanel-veLXRfDg.js} | 2 +- frontend/dist/assets/BasemapLayer-BaN23fEz.js | 2 + frontend/dist/assets/BasemapLayer-hMJnmB0N.js | 2 - ...ble-BxObXDA9.js => ChatBubble-BgE9nam_.js} | 2 +- ....js => CollisionExplorerModal-CGe2meHQ.js} | 4 +- ...-VOGqgrTj.js => Configuration-CeI9X6pm.js} | 2 +- ...l-BBgfDQz0.js => ConfirmModal-BsKnU4PL.js} | 2 +- ...tacts-BDcsbVpm.js => Contacts-CzvSrbCz.js} | 6 +- .../assets/ContactsMapMapLibre-BLoRVnyK.js | 125 +++++++++++++++++ .../assets/ContactsMapMapLibre-Cscp8bKT.js | 126 ----------------- ...oard-CDL_GULF.js => Dashboard-e8rLMhIB.js} | 16 +-- ...ataBox-DuDZS_-R.js => DataBox-VKzAgqy6.js} | 2 +- ...alue-0rWcvT5B.js => DataValue-DWPg5kts.js} | 2 +- .../{Grid-T0h8M_5J.js => Grid-DsElbcI9.js} | 2 +- ...n-CL-NBi5a.js => KeycapButton-D8qv0n_i.js} | 2 +- ...Bb_4UjX-.js => LightSparkline-BTQUkuf1.js} | 2 +- .../{Login-BNeopDHJ.js => Login-CoKmaY4r.js} | 2 +- .../{Logs-ejlaKYc8.js => Logs-3njCwThd.js} | 2 +- ...raph-BMLILv8F.js => MeshGraph-CbbGajic.js} | 6 +- .../{Mqtt-BMbZ-BH7.js => Mqtt-BhuPT5rU.js} | 2 +- ...-ByDcIOTs.js => MqttModeBadge-B2gdgHRr.js} | 4 +- ...B6e.js => NodeInformationCard-CK3ykNEr.js} | 2 +- ...ist-CvlDtsn5.js => PacketList-CEzR-sgv.js} | 6 +- ...DHp8D.js => PacketObservatory-DhWLTyQy.js} | 4 +- ...ackets-DfizAnIe.js => Packets-CgtUHlQo.js} | 2 +- ...out-BF99wokG.js => PageLayout-9jTb5LQy.js} | 2 +- ...i8fgMRD.js => PathMapMapLibre-5kFunyh4.js} | 4 +- ...ver-C3OYFQ4q.js => RoomServer-CbzNiuqr.js} | 4 +- ...sions-C9egkdK1.js => Sessions-BFG7OdP5.js} | 4 +- ...-LrLHEf.js => SignalIndicator-3GFNHm8Y.js} | 2 +- ...ics-c7Qv68as.js => Statistics-CaX_6ZpX.js} | 2 +- ...{System-B8LGiwko.js => System-DkmAUSyq.js} | 2 +- ...minal-C7ORojTx.js => Terminal-Cym8yCt2.js} | 4 +- ...ivity-08bcdFU3.js => activity-CuCWwHCn.js} | 2 +- ...ntenna-B73eC1vt.js => antenna-D6YaR-Hz.js} | 2 +- ...ow-up-CWwfgPRA.js => arrow-up-D_8r83O6.js} | 2 +- ...s-CWWef4JL.js => badge-colors-YFzbsFdv.js} | 2 +- ...ils-C9wMoZzY.js => chat-utils-C_Ic_Z3G.js} | 2 +- ...-P-ozZjJy.js => chevron-right-2z1sXpRw.js} | 2 +- ...k-CjNYatNq.js => circle-check-B2q_hZxl.js} | 2 +- ...9u.js => circle-question-mark-DyqPGIeM.js} | 2 +- ...op-BkiNSg5w.js => circle-stop-Ckt_bSp2.js} | 2 +- ...cle-x-BxPoy0G0.js => circle-x-BmclMjp7.js} | 2 +- ...xx-eO.js => consumer-registry-PC_rDaZ7.js} | 2 +- .../{cpu-BjlCxaxB.js => cpu-BPc-R9Wj.js} | 2 +- ...abase-CBR7LpGS.js => database-ClxUxDRV.js} | 2 +- ...nload-C2xaKTRC.js => download-4oqud7e0.js} | 2 +- ...{easing-DrjZ68sV.js => easing-Pi1r2b4f.js} | 2 +- ...k2fgXx.js => element-movement-DMWTrEpo.js} | 2 +- ...{funnel-Dj8Jz3oI.js => funnel-3o6m8jr6.js} | 2 +- .../{hash-BqTulYI1.js => hash-BCj2eZsz.js} | 2 +- .../{index-BJ3pSX9x.js => index-BxXoqIwr.js} | 128 +++++++++--------- frontend/dist/assets/index-CmjqgMwf.css | 1 - frontend/dist/assets/index-_7WU03XB.css | 1 + .../{index-Cxi5n-VD.js => index-m2ldcO9a.js} | 2 +- ...ound-CRU12yi8.js => key-round-BvvsJJ9N.js} | 2 +- ...{layers-BKFLdcCx.js => layers-C3QFCg7c.js} | 2 +- ...g-2ZJLNC-s.js => link-scoring-ChgSAej1.js} | 2 +- ...istbox-D436DP3r.js => listbox-DObLFkCK.js} | 2 +- ...ap-pin-DGJa4N8v.js => map-pin-CfgGK3Nu.js} | 2 +- ...gl-DqXvXKp9.js => maplibre-gl-CLMc4B3E.js} | 2 +- .../{max-_Me6WRUh.js => max-DXCf6XMj.js} | 4 +- ...CcRi93Yt.js => message-square-C_Wmi9pe.js} | 2 +- ...0RA7.js => monitor-smartphone-CGoLFRac.js} | 2 +- ...etwork-DZ9mLFR5.js => network-CkO3-tWX.js} | 2 +- ...pes-BWXpGa25.js => node-types-CUctjdbw.js} | 2 +- .../{ping-Qm7CcMEW.js => ping-Bv_lBCYg.js} | 2 +- .../{plus-i1_A57qD.js => plus-CpcpAQLp.js} | 2 +- ...ves-lYEYopIB.js => primitives-B1zZjGMM.js} | 2 +- ...-cw-B_Kb9_IU.js => refresh-cw-D1AU1e6s.js} | 2 +- ...{search-DZl1pHjp.js => search-odjRG97X.js} | 2 +- ...s-2-BCy5emee.js => settings-2-BQx7UDx0.js} | 2 +- ...{shield-D_cjSeBk.js => shield-u1IrX4Oq.js} | 2 +- ...{system-BP-ATTWa.js => system-IO5o3m3L.js} | 2 +- ...{target-BKK0y-ex.js => target-CkWLrgj4.js} | 2 +- ...rash-2-CS4Hf6qp.js => trash-2-DXpoExCg.js} | 2 +- ...BfeDdufA.js => triangle-alert-s7OFBXSQ.js} | 2 +- ...zKWsccB.js => useMapViewStore-Dx0tAQ0a.js} | 2 +- ...u7OvpY.js => usePipelineStore-CThQspLf.js} | 4 +- ...7.js => webgl-device-QoBMYpnS-BBb8PAEr.js} | 2 +- .../{wifi-Ch4xubzc.js => wifi-CIRTj44S.js} | 2 +- ...i-off-LIR5tvs8.js => wifi-off-Cd0xYy6R.js} | 2 +- .../{zap-vLwXh2k-.js => zap-I-XGbFMB.js} | 2 +- frontend/dist/index.html | 4 +- frontend/package.json | 2 +- 86 files changed, 294 insertions(+), 295 deletions(-) rename frontend/dist/assets/{AnalyzerFilterPanel-ds_922dr.js => AnalyzerFilterPanel-veLXRfDg.js} (98%) create mode 100644 frontend/dist/assets/BasemapLayer-BaN23fEz.js delete mode 100644 frontend/dist/assets/BasemapLayer-hMJnmB0N.js rename frontend/dist/assets/{ChatBubble-BxObXDA9.js => ChatBubble-BgE9nam_.js} (93%) rename frontend/dist/assets/{CollisionExplorerModal-C3NMSLnt.js => CollisionExplorerModal-CGe2meHQ.js} (92%) rename frontend/dist/assets/{Configuration-VOGqgrTj.js => Configuration-CeI9X6pm.js} (98%) rename frontend/dist/assets/{ConfirmModal-BBgfDQz0.js => ConfirmModal-BsKnU4PL.js} (76%) rename frontend/dist/assets/{Contacts-BDcsbVpm.js => Contacts-CzvSrbCz.js} (92%) create mode 100644 frontend/dist/assets/ContactsMapMapLibre-BLoRVnyK.js delete mode 100644 frontend/dist/assets/ContactsMapMapLibre-Cscp8bKT.js rename frontend/dist/assets/{Dashboard-CDL_GULF.js => Dashboard-e8rLMhIB.js} (91%) rename frontend/dist/assets/{DataBox-DuDZS_-R.js => DataBox-VKzAgqy6.js} (91%) rename frontend/dist/assets/{DataValue-0rWcvT5B.js => DataValue-DWPg5kts.js} (92%) rename frontend/dist/assets/{Grid-T0h8M_5J.js => Grid-DsElbcI9.js} (95%) rename frontend/dist/assets/{KeycapButton-CL-NBi5a.js => KeycapButton-D8qv0n_i.js} (98%) rename frontend/dist/assets/{LightSparkline-Bb_4UjX-.js => LightSparkline-BTQUkuf1.js} (96%) rename frontend/dist/assets/{Login-BNeopDHJ.js => Login-CoKmaY4r.js} (99%) rename frontend/dist/assets/{Logs-ejlaKYc8.js => Logs-3njCwThd.js} (86%) rename frontend/dist/assets/{MeshGraph-BMLILv8F.js => MeshGraph-CbbGajic.js} (99%) rename frontend/dist/assets/{Mqtt-BMbZ-BH7.js => Mqtt-BhuPT5rU.js} (98%) rename frontend/dist/assets/{MqttModeBadge-ByDcIOTs.js => MqttModeBadge-B2gdgHRr.js} (90%) rename frontend/dist/assets/{NodeInformationCard-Cgww6B6e.js => NodeInformationCard-CK3ykNEr.js} (90%) rename frontend/dist/assets/{PacketList-CvlDtsn5.js => PacketList-CEzR-sgv.js} (99%) rename frontend/dist/assets/{PacketObservatory-BSUDHp8D.js => PacketObservatory-DhWLTyQy.js} (98%) rename frontend/dist/assets/{Packets-DfizAnIe.js => Packets-CgtUHlQo.js} (96%) rename frontend/dist/assets/{PageLayout-BF99wokG.js => PageLayout-9jTb5LQy.js} (89%) rename frontend/dist/assets/{PathMapMapLibre-Bi8fgMRD.js => PathMapMapLibre-5kFunyh4.js} (86%) rename frontend/dist/assets/{RoomServer-C3OYFQ4q.js => RoomServer-CbzNiuqr.js} (95%) rename frontend/dist/assets/{Sessions-C9egkdK1.js => Sessions-BFG7OdP5.js} (94%) rename frontend/dist/assets/{SignalIndicator-D-LrLHEf.js => SignalIndicator-3GFNHm8Y.js} (99%) rename frontend/dist/assets/{Statistics-c7Qv68as.js => Statistics-CaX_6ZpX.js} (98%) rename frontend/dist/assets/{System-B8LGiwko.js => System-DkmAUSyq.js} (97%) rename frontend/dist/assets/{Terminal-C7ORojTx.js => Terminal-Cym8yCt2.js} (99%) rename frontend/dist/assets/{activity-08bcdFU3.js => activity-CuCWwHCn.js} (89%) rename frontend/dist/assets/{antenna-B73eC1vt.js => antenna-D6YaR-Hz.js} (90%) rename frontend/dist/assets/{arrow-up-CWwfgPRA.js => arrow-up-D_8r83O6.js} (92%) rename frontend/dist/assets/{badge-colors-CWWef4JL.js => badge-colors-YFzbsFdv.js} (96%) rename frontend/dist/assets/{chat-utils-C9wMoZzY.js => chat-utils-C_Ic_Z3G.js} (94%) rename frontend/dist/assets/{chevron-right-P-ozZjJy.js => chevron-right-2z1sXpRw.js} (85%) rename frontend/dist/assets/{circle-check-CjNYatNq.js => circle-check-B2q_hZxl.js} (87%) rename frontend/dist/assets/{circle-question-mark-DFRPEv9u.js => circle-question-mark-DyqPGIeM.js} (89%) rename frontend/dist/assets/{circle-stop-BkiNSg5w.js => circle-stop-Ckt_bSp2.js} (94%) rename frontend/dist/assets/{circle-x-BxPoy0G0.js => circle-x-BmclMjp7.js} (99%) rename frontend/dist/assets/{consumer-registry-DQXxx-eO.js => consumer-registry-PC_rDaZ7.js} (92%) rename frontend/dist/assets/{cpu-BjlCxaxB.js => cpu-BPc-R9Wj.js} (94%) rename frontend/dist/assets/{database-CBR7LpGS.js => database-ClxUxDRV.js} (89%) rename frontend/dist/assets/{download-C2xaKTRC.js => download-4oqud7e0.js} (89%) rename frontend/dist/assets/{easing-DrjZ68sV.js => easing-Pi1r2b4f.js} (90%) rename frontend/dist/assets/{element-movement-CCk2fgXx.js => element-movement-DMWTrEpo.js} (78%) rename frontend/dist/assets/{funnel-Dj8Jz3oI.js => funnel-3o6m8jr6.js} (89%) rename frontend/dist/assets/{hash-BqTulYI1.js => hash-BCj2eZsz.js} (90%) rename frontend/dist/assets/{index-BJ3pSX9x.js => index-BxXoqIwr.js} (78%) delete mode 100644 frontend/dist/assets/index-CmjqgMwf.css create mode 100644 frontend/dist/assets/index-_7WU03XB.css rename frontend/dist/assets/{index-Cxi5n-VD.js => index-m2ldcO9a.js} (94%) rename frontend/dist/assets/{key-round-CRU12yi8.js => key-round-BvvsJJ9N.js} (91%) rename frontend/dist/assets/{layers-BKFLdcCx.js => layers-C3QFCg7c.js} (92%) rename frontend/dist/assets/{link-scoring-2ZJLNC-s.js => link-scoring-ChgSAej1.js} (94%) rename frontend/dist/assets/{listbox-D436DP3r.js => listbox-DObLFkCK.js} (90%) rename frontend/dist/assets/{map-pin-DGJa4N8v.js => map-pin-CfgGK3Nu.js} (99%) rename frontend/dist/assets/{maplibre-gl-DqXvXKp9.js => maplibre-gl-CLMc4B3E.js} (99%) rename frontend/dist/assets/{max-_Me6WRUh.js => max-DXCf6XMj.js} (86%) rename frontend/dist/assets/{message-square-CcRi93Yt.js => message-square-C_Wmi9pe.js} (89%) rename frontend/dist/assets/{monitor-smartphone-0Yxe0RA7.js => monitor-smartphone-CGoLFRac.js} (91%) rename frontend/dist/assets/{network-DZ9mLFR5.js => network-CkO3-tWX.js} (92%) rename frontend/dist/assets/{node-types-BWXpGa25.js => node-types-CUctjdbw.js} (95%) rename frontend/dist/assets/{ping-Qm7CcMEW.js => ping-Bv_lBCYg.js} (94%) rename frontend/dist/assets/{plus-i1_A57qD.js => plus-CpcpAQLp.js} (86%) rename frontend/dist/assets/{primitives-lYEYopIB.js => primitives-B1zZjGMM.js} (88%) rename frontend/dist/assets/{refresh-cw-B_Kb9_IU.js => refresh-cw-D1AU1e6s.js} (91%) rename frontend/dist/assets/{search-DZl1pHjp.js => search-odjRG97X.js} (87%) rename frontend/dist/assets/{settings-2-BCy5emee.js => settings-2-BQx7UDx0.js} (89%) rename frontend/dist/assets/{shield-D_cjSeBk.js => shield-u1IrX4Oq.js} (90%) rename frontend/dist/assets/{system-BP-ATTWa.js => system-IO5o3m3L.js} (91%) rename frontend/dist/assets/{target-BKK0y-ex.js => target-CkWLrgj4.js} (94%) rename frontend/dist/assets/{trash-2-CS4Hf6qp.js => trash-2-DXpoExCg.js} (91%) rename frontend/dist/assets/{triangle-alert-BfeDdufA.js => triangle-alert-s7OFBXSQ.js} (89%) rename frontend/dist/assets/{useMapViewStore-BzKWsccB.js => useMapViewStore-Dx0tAQ0a.js} (97%) rename frontend/dist/assets/{usePipelineStore-Chu7OvpY.js => usePipelineStore-CThQspLf.js} (84%) rename frontend/dist/assets/{webgl-device-QoBMYpnS-Clv_7Pw7.js => webgl-device-QoBMYpnS-BBb8PAEr.js} (99%) rename frontend/dist/assets/{wifi-Ch4xubzc.js => wifi-CIRTj44S.js} (90%) rename frontend/dist/assets/{wifi-off-LIR5tvs8.js => wifi-off-Cd0xYy6R.js} (93%) rename frontend/dist/assets/{zap-vLwXh2k-.js => zap-I-XGbFMB.js} (89%) diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 3c5a7bac..f1c4f0a4 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.305 +0.9.306 diff --git a/frontend/dist/assets/AnalyzerFilterPanel-ds_922dr.js b/frontend/dist/assets/AnalyzerFilterPanel-veLXRfDg.js similarity index 98% rename from frontend/dist/assets/AnalyzerFilterPanel-ds_922dr.js rename to frontend/dist/assets/AnalyzerFilterPanel-veLXRfDg.js index 5d87ebbe..fa6e0c11 100644 --- a/frontend/dist/assets/AnalyzerFilterPanel-ds_922dr.js +++ b/frontend/dist/assets/AnalyzerFilterPanel-veLXRfDg.js @@ -1,4 +1,4 @@ -import{d as U,a8 as J,R as q,c0 as G,r as d,j as n,bo as K,B as Q}from"./index-BJ3pSX9x.js";import{c as V}from"./node-types-BWXpGa25.js";import{M as Y}from"./monitor-smartphone-0Yxe0RA7.js";import{C as Z}from"./circle-question-mark-DFRPEv9u.js";import{F as W}from"./funnel-Dj8Jz3oI.js";import{S as ee}from"./search-DZl1pHjp.js";/** +import{d as U,a8 as J,R as q,c0 as G,r as d,j as n,bo as K,B as Q}from"./index-BxXoqIwr.js";import{c as V}from"./node-types-CUctjdbw.js";import{M as Y}from"./monitor-smartphone-CGoLFRac.js";import{C as Z}from"./circle-question-mark-DyqPGIeM.js";import{F as W}from"./funnel-3o6m8jr6.js";import{S as ee}from"./search-odjRG97X.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/BasemapLayer-BaN23fEz.js b/frontend/dist/assets/BasemapLayer-BaN23fEz.js new file mode 100644 index 00000000..5d8cd978 --- /dev/null +++ b/frontend/dist/assets/BasemapLayer-BaN23fEz.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BxXoqIwr.js","assets/index-_7WU03XB.css"])))=>i.map(i=>d[i]); +import{r as a,_ as Z,aO as j}from"./index-BxXoqIwr.js";const W=a.createContext(null);function B(){var s;const e=(s=a.useContext(W))==null?void 0:s.maps,t=a.useContext(w);return a.useMemo(()=>({...e,current:t==null?void 0:t.map}),[e,t])}function V(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&s===r}function v(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in s&&(o=Object.assign({},s),delete o.interactive);const r=t[s.ref];if(r){o=o||Object.assign({},s),delete o.ref;for(const i of q)i in r&&(o[i]=r[i])}return o||s});return{...e,layers:n}}const U={version:8,sources:{},layers:[]},A={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},N={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},F={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},$=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],G=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class b{constructor(t,n,s){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=o=>{const r=this.props[F[o.type]];r?r(o):o.type==="error"&&console.error(o.error)},this._onCameraEvent=o=>{if(this._internalUpdate)return;o.viewState=this._propsedCameraUpdate||T(this._map.transform);const r=this.props[N[o.type]];r&&r(o)},this._onCameraUpdate=o=>this._internalUpdate?o:(this._propsedCameraUpdate=T(o),z(o,this.props)),this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const r=this.props[A[o.type]];r&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),r(o),delete o.features)},this._MapClass=t,this.props=n,this._initialize(s)}get map(){return this._map}setProps(t){const n=this.props;this.props=t;const s=this._updateSettings(t,n),o=this._updateSize(t),r=this._updateViewState(t);this._updateStyle(t,n),this._updateStyleComponents(t),this._updateHandlers(t,n),(s||o||r&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const s=b.savedMaps.pop();if(!s)return null;const o=s.map,r=o.getContainer();for(n.className=r.className;r.childNodes.length>0;)n.appendChild(r.childNodes[0]);o._container=n;const i=o._resizeObserver;i&&(i.disconnect(),i.observe(n)),s.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:c}=t;return c&&(c.bounds?o.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):s._updateViewState(c)),o.isStyleLoaded()?o.fire("load"):o.once("style.load",()=>o.fire("load")),o._update(),s}_initialize(t){const{props:n}=this,{mapStyle:s=U}=n,o={...n,...n.initialViewState,container:t,style:O(s)},r=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),n.gl){const c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=c,n.gl)}const i=new this._MapClass(o);r.padding&&i.setPadding(r.padding),n.cursor&&(i.getCanvas().style.cursor=n.cursor),i.transformCameraUpdate=this._onCameraUpdate,i.on("style.load",()=>{var c;this._styleComponents={light:i.getLight(),sky:i.getSky(),projection:(c=i.getProjection)==null?void 0:c.call(i),terrain:i.getTerrain()},this._updateStyleComponents(this.props)}),i.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const c in A)i.on(c,this._onPointerEvent);for(const c in N)i.on(c,this._onCameraEvent);for(const c in F)i.on(c,this._onEvent);this._map=i}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),b.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:n}=t;if(n){const s=this._map;if(n.width!==s.transform.width||n.height!==s.transform.height)return s.resize(),!0}return!1}_updateViewState(t){const n=this._map,s=n.transform;if(!n.isMoving()){const r=z(s,t);if(Object.keys(r).length>0)return this._internalUpdate=!0,n.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateSettings(t,n){const s=this._map;let o=!1;for(const r of $)if(r in t&&!v(t[r],n[r])){o=!0;const i=s[`set${r[0].toUpperCase()}${r.slice(1)}`];i==null||i.call(s,t[r])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:s=U,styleDiffing:o=!0}=t,r={diff:o};"localIdeographFontFamily"in t&&(r.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(O(s),r)}}_updateStyleComponents({light:t,projection:n,sky:s,terrain:o}){var c,u;const r=this._map,i=this._styleComponents;r.style._loaded&&(t&&!v(t,i.light)&&(i.light=t,r.setLight(t)),n&&!v(n,i.projection)&&n!==((c=i.projection)==null?void 0:c.type)&&(i.projection=typeof n=="string"?{type:n}:n,(u=r.setProjection)==null||u.call(r,i.projection)),s&&!v(s,i.sky)&&(i.sky=s,r.setSky(s)),o!==void 0&&!v(o,i.terrain)&&(!o||r.getSource(o.source))&&(i.terrain=o,r.setTerrain(o)))}_updateHandlers(t,n){const s=this._map;for(const o of G){const r=t[o]??!0,i=n[o]??!0;v(r,i)||(r?s[o].enable(r):s[o].disable())}}_queryRenderedFeatures(t){const n=this._map,{interactiveLayerIds:s=[]}=this.props;try{return n.queryRenderedFeatures(t,{layers:s.filter(n.getLayer.bind(n))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const r=t.type,i=((o=this._hoveredFeatures)==null?void 0:o.length)>0,c=this._queryRenderedFeatures(t.point),u=c.length>0;!u&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=c,u&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}b.savedMaps=[];const K=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function J(e){if(!e)return null;const t=e.map,n={getMap:()=>t};for(const s of Y(t))!(s in n)&&!K.includes(s)&&(n[s]=t[s].bind(t));return n}function Y(e){const t=new Set;let n=e;for(;n;){for(const s of Object.getOwnPropertyNames(n))s[0]!=="_"&&typeof e[s]=="function"&&s!=="fire"&&s!=="setEventedParent"&&t.add(s);n=Object.getPrototypeOf(n)}return Array.from(t)}const X=typeof document<"u"?a.useLayoutEffect:a.useEffect;function Q(e,t){const{RTLTextPlugin:n,maxParallelImageRequests:s,workerCount:o,workerUrl:r}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:i,lazy:c=!0}=typeof n=="string"?{pluginUrl:n}:n;e.setRTLTextPlugin(i,u=>{u&&console.error(u)},c)}s!==void 0&&e.setMaxParallelImageRequests(s),o!==void 0&&e.setWorkerCount(o),r!==void 0&&e.setWorkerUrl(r)}const w=a.createContext(null);function ee(e,t){const n=a.useContext(W),[s,o]=a.useState(null),r=a.useRef(),{current:i}=a.useRef({mapLib:null,map:null});a.useEffect(()=>{const l=e.mapLib;let d=!0,f;return Promise.resolve(l||Z(()=>import("./maplibre-gl-CLMc4B3E.js").then(m=>m.m),__vite__mapDeps([0,1]))).then(m=>{if(!d)return;if(!m)throw new Error("Invalid mapLib");const y="Map"in m?m:m.default;if(!y.Map)throw new Error("Invalid mapLib");Q(y,e),e.reuseMaps&&(f=b.reuse(e,r.current)),f||(f=new b(y.Map,e,r.current)),i.map=J(f),i.mapLib=y,o(f),n==null||n.onMapMount(i.map,e.id)}).catch(m=>{const{onError:y}=e;y?y({type:"error",target:null,originalEvent:null,error:m}):console.error(m)}),()=>{d=!1,f&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?f.recycle():f.destroy())}},[]),X(()=>{s&&s.setProps(e)}),a.useImperativeHandle(t,()=>i.map,[s]);const c=a.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),u={height:"100%"};return a.createElement("div",{id:e.id,ref:r,style:c},s&&a.createElement(w.Provider,{value:i},a.createElement("div",{"mapboxgl-children":"",style:u},e.children)))}const _e=a.forwardRef(ee),te=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function L(e,t){if(!e||!t)return;const n=e.style;for(const s in t){const o=t[s];Number.isFinite(o)&&!te.test(s)?n[s]=`${o}px`:n[s]=o}}function H(e,t){if(e===t)return null;const n=D(e),s=D(t),o=[];for(const r of s)n.has(r)||o.push(r);for(const r of n)s.has(r)||o.push(r);return o.length===0?null:o}function D(e){return new Set(e?e.trim().split(/\s+/):[])}const Le=a.memo(a.forwardRef((e,t)=>{const{map:n,mapLib:s}=a.useContext(w),o=a.useRef({props:e}),r=a.useMemo(()=>{let E=!1;a.Children.forEach(e.children,g=>{g&&(E=!0)});const k={...e,element:E?document.createElement("div"):void 0},p=new s.Marker(k);return p.setLngLat([e.longitude,e.latitude]),p.getElement().addEventListener("click",g=>{var h,_;(_=(h=o.current.props).onClick)==null||_.call(h,{type:"click",target:p,originalEvent:g})}),p.on("dragstart",g=>{var _,S;const h=g;h.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragStart)==null||S.call(_,h)}),p.on("drag",g=>{var _,S;const h=g;h.lngLat=r.getLngLat(),(S=(_=o.current.props).onDrag)==null||S.call(_,h)}),p.on("dragend",g=>{var _,S;const h=g;h.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragEnd)==null||S.call(_,h)}),p},[]);a.useEffect(()=>(r.addTo(n.getMap()),()=>{r.remove()}),[]);const{longitude:i,latitude:c,offset:u,style:l,draggable:d=!1,popup:f=null,rotation:m=0,rotationAlignment:y="auto",pitchAlignment:C="auto"}=e;a.useEffect(()=>{L(r.getElement(),l)},[l]),a.useImperativeHandle(t,()=>r,[]);const P=o.current.props;(r.getLngLat().lng!==i||r.getLngLat().lat!==c)&&r.setLngLat([i,c]),u&&!V(r.getOffset(),u)&&r.setOffset(u),r.isDraggable()!==d&&r.setDraggable(d),r.getRotation()!==m&&r.setRotation(m),r.getRotationAlignment()!==y&&r.setRotationAlignment(y),r.getPitchAlignment()!==C&&r.setPitchAlignment(C),r.getPopup()!==f&&r.setPopup(f);const x=H(P.className,e.className);if(x)for(const E of x)r.toggleClassName(E);return o.current.props=e,j.createPortal(e.children,r.getElement())})),Ce=a.memo(a.forwardRef((e,t)=>{const{map:n,mapLib:s}=a.useContext(w),o=a.useMemo(()=>document.createElement("div"),[]),r=a.useRef({props:e}),i=a.useMemo(()=>{const c={...e},u=new s.Popup(c);return u.setLngLat([e.longitude,e.latitude]),u.once("open",l=>{var d,f;(f=(d=r.current.props).onOpen)==null||f.call(d,l)}),u},[]);if(a.useEffect(()=>{const c=u=>{var l,d;(d=(l=r.current.props).onClose)==null||d.call(l,u)};return i.on("close",c),i.setDOMContent(o).addTo(n.getMap()),()=>{i.off("close",c),i.isOpen()&&i.remove()}},[]),a.useEffect(()=>{L(i.getElement(),e.style)},[e.style]),a.useImperativeHandle(t,()=>i,[]),i.isOpen()){const c=r.current.props;(i.getLngLat().lng!==e.longitude||i.getLngLat().lat!==e.latitude)&&i.setLngLat([e.longitude,e.latitude]),e.offset&&!v(c.offset,e.offset)&&i.setOffset(e.offset),(c.anchor!==e.anchor||c.maxWidth!==e.maxWidth)&&(i.options.anchor=e.anchor,i.setMaxWidth(e.maxWidth));const u=H(c.className,e.className);if(u)for(const l of u)i.toggleClassName(l);r.current.props=e}return j.createPortal(e.children,o)}));function M(e,t,n,s){const o=a.useContext(w),r=a.useMemo(()=>e(o),[]);return a.useEffect(()=>{const i=t,c=null,u=typeof t=="function"?t:null,{map:l}=o;return l.hasControl(r)||(l.addControl(r,i==null?void 0:i.position),c&&c(o)),()=>{u&&u(o),l.hasControl(r)&&l.removeControl(r)}},[]),r}function ne(e){const t=M(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return a.useEffect(()=>{L(t._container,e.style)},[e.style]),null}a.memo(ne);function oe(e){const t=M(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return a.useEffect(()=>{L(t._controlContainer,e.style)},[e.style]),null}a.memo(oe);function re(e,t){const n=a.useRef({props:e}),s=M(({mapLib:o})=>{const r=new o.GeolocateControl(e),i=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||i()},r.on("geolocate",c=>{var u,l;(l=(u=n.current.props).onGeolocate)==null||l.call(u,c)}),r.on("error",c=>{var u,l;(l=(u=n.current.props).onError)==null||l.call(u,c)}),r.on("outofmaxbounds",c=>{var u,l;(l=(u=n.current.props).onOutOfMaxBounds)==null||l.call(u,c)}),r.on("trackuserlocationstart",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationStart)==null||l.call(u,c)}),r.on("trackuserlocationend",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationEnd)==null||l.call(u,c)}),r},{position:e.position});return n.current.props=e,a.useImperativeHandle(t,()=>s,[]),a.useEffect(()=>{L(s._container,e.style)},[e.style]),null}a.memo(a.forwardRef(re));function se(e){const t=M(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return a.useEffect(()=>{L(t._container,e.style)},[e.style]),null}a.memo(se);function ie(e){const t=M(({mapLib:r})=>new r.ScaleControl(e),{position:e.position}),n=a.useRef(e),s=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==s.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==s.unit&&t.setUnit(e.unit),a.useEffect(()=>{L(t._container,o)},[o]),null}const Se=a.memo(ie);function ae(e){const t=M(({mapLib:n})=>new n.TerrainControl(e),{position:e.position});return a.useEffect(()=>{L(t._container,e.style)},[e.style]),null}a.memo(ae);function ce(e){const t=M(({mapLib:n})=>new n.LogoControl(e),{position:e.position});return a.useEffect(()=>{L(t._container,e.style)},[e.style]),null}a.memo(ce);function R(e,t){if(!e)throw new Error(t)}let le=0;function ue(e,t,n){if(e.style&&e.style._loaded){const s={...n};return delete s.id,delete s.children,e.addSource(t,s),e.getSource(t)}return null}function fe(e,t,n){var i,c,u;R(t.id===n.id,"source id changed"),R(t.type===n.type,"source type changed");let s="",o=0;for(const l in t)l!=="children"&&l!=="id"&&!v(n[l],t[l])&&(s=l,o++);if(!o)return;const r=t.type;if(r==="geojson")e.setData(t.data);else if(r==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(s){case"coordinates":(i=e.setCoordinates)==null||i.call(e,t.coordinates);break;case"url":(c=e.setUrl)==null||c.call(e,t.url);break;case"tiles":(u=e.setTiles)==null||u.call(e,t.tiles);break;default:console.warn(`Unable to update prop: ${s}`)}}function Ee(e){const t=a.useContext(w).map.getMap(),n=a.useRef(e),[,s]=a.useState(0),o=a.useMemo(()=>e.id||`jsx-source-${le++}`,[]);a.useEffect(()=>{if(t){const i=()=>setTimeout(()=>s(c=>c+1),0);return t.on("styledata",i),i(),()=>{var c;if(t.off("styledata",i),t.style&&t.style._loaded&&t.getSource(o)){const u=(c=t.getStyle())==null?void 0:c.layers;if(u)for(const l of u)l.source===o&&t.removeLayer(l.id);t.removeSource(o)}}}},[t]);let r=t&&t.style&&t.getSource(o);return r?fe(r,e,n.current):r=ue(t,o,e),n.current=e,r&&a.Children.map(e.children,i=>i&&a.cloneElement(i,{source:o}))||null}function de(e,t,n,s){if(R(n.id===s.id,"layer id changed"),R(n.type===s.type,"layer type changed"),n.type==="custom"||s.type==="custom")return;const{layout:o={},paint:r={},filter:i,minzoom:c,maxzoom:u,beforeId:l}=n;if(l!==s.beforeId&&e.moveLayer(t,l),o!==s.layout){const d=s.layout||{};for(const f in o)v(o[f],d[f])||e.setLayoutProperty(t,f,o[f]);for(const f in d)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(r!==s.paint){const d=s.paint||{};for(const f in r)v(r[f],d[f])||e.setPaintProperty(t,f,r[f]);for(const f in d)r.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}v(i,s.filter)||e.setFilter(t,i),(c!==s.minzoom||u!==s.maxzoom)&&e.setLayerZoomRange(t,c,u)}function me(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const s={...n,id:t};delete s.beforeId,e.addLayer(s,n.beforeId)}}let ye=0;function we(e){const t=a.useContext(w).map.getMap(),n=a.useRef(e),[,s]=a.useState(0),o=a.useMemo(()=>e.id||`jsx-layer-${ye++}`,[]);if(a.useEffect(()=>{if(t){const i=()=>s(c=>c+1);return t.on("styledata",i),i(),()=>{t.off("styledata",i),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{de(t,o,e,n.current)}catch(i){console.warn(i)}else me(t,o,e);return n.current=e,null}const he={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},ge={light:"basemap-light-",dark:"basemap-dark-"},I={};async function pe(e){if(I[e])return I[e];const n=await(await fetch(he[e])).json();return I[e]=n,n}function Me({mode:e}){const{current:t}=B(),[n,s]=a.useState(null),o=a.useRef({light:!1,dark:!1}),r=a.useRef({light:[],dark:[]});a.useEffect(()=>{const l=()=>{var y;const m=(y=t==null?void 0:t.getMap)==null?void 0:y.call(t);m&&!n&&s(m)};l();const d=setInterval(l,50),f=setTimeout(()=>clearInterval(d),5e3);return()=>{clearInterval(d),clearTimeout(f)}},[t,n]);const i=a.useCallback(async(l,d,f)=>{var E,k;if(o.current[d])return;const m=ge[d],y=await pe(d),C=[];for(const[p,g]of Object.entries(y.sources||{})){const h=m+p;l.getSource(h)||l.addSource(h,g)}const x=(k=(((E=l.getStyle())==null?void 0:E.layers)||[]).find(p=>!p.id.startsWith("basemap-light-")&&!p.id.startsWith("basemap-dark-")))==null?void 0:k.id;for(const p of y.layers||[]){const g=m+p.id;if(C.push(g),l.getLayer(g))continue;const h={...p,id:g};"source"in h&&typeof h.source=="string"&&(h.source=m+h.source),h.layout||(h.layout={}),h.layout.visibility=f?"visible":"none";try{l.addLayer(h,x)}catch(_){console.warn(`[BasemapLayer] Failed to add layer ${g}:`,_)}}r.current[d]=C,o.current[d]=!0},[]),c=a.useCallback((l,d,f)=>{const m=r.current[d],y=f?"visible":"none";for(const C of m)if(l.getLayer(C))try{l.setLayoutProperty(C,"visibility",y)}catch{}},[]),u=a.useCallback(l=>{var m;const f=(((m=l.getStyle())==null?void 0:m.layers)||[]).filter(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-"));for(const y of f)try{l.moveLayer(y.id)}catch{}},[]);return a.useEffect(()=>{if(!n)return;const l=d=>{n.hasImage(d.id)||n.addImage(d.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return n.on("styleimagemissing",l),()=>{n.off("styleimagemissing",l)}},[n]),a.useEffect(()=>{if(!n)return;let l=!1;const d=async()=>{if(!l)try{await Promise.all([i(n,"light",e==="light"),i(n,"dark",e==="dark")]),l||u(n)}catch(m){console.error("[BasemapLayer] Setup error:",m)}};n.isStyleLoaded()?d():(n.once("style.load",d),n.once("load",()=>{!l&&!o.current.light&&d()}));const f=()=>{l||setTimeout(()=>{!l&&o.current.light&&o.current.dark&&u(n)},100)};return n.on("styledata",f),()=>{l=!0,n.off("styledata",f)}},[n,i,u,e]),a.useEffect(()=>{n&&(!o.current.light||!o.current.dark||(c(n,"light",e==="light"),c(n,"dark",e==="dark")))},[n,e,c]),null}export{Me as B,we as L,_e as M,Ce as P,Ee as S,Le as a,Se as b,B as u}; diff --git a/frontend/dist/assets/BasemapLayer-hMJnmB0N.js b/frontend/dist/assets/BasemapLayer-hMJnmB0N.js deleted file mode 100644 index a55be71a..00000000 --- a/frontend/dist/assets/BasemapLayer-hMJnmB0N.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BJ3pSX9x.js","assets/index-CmjqgMwf.css"])))=>i.map(i=>d[i]); -import{r as i,_ as $,aO as B,e as G}from"./index-BJ3pSX9x.js";const H=i.createContext(null);function K(){var s;const e=(s=i.useContext(H))==null?void 0:s.maps,t=i.useContext(w);return i.useMemo(()=>({...e,current:t==null?void 0:t.map}),[e,t])}function Y(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&s===r}function v(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in s&&(o=Object.assign({},s),delete o.interactive);const r=t[s.ref];if(r){o=o||Object.assign({},s),delete o.ref;for(const a of J)a in r&&(o[a]=r[a])}return o||s});return{...e,layers:n}}const A={version:8,sources:{},layers:[]},U={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},F={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},N={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},X=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Q=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class b{constructor(t,n,s){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=o=>{const r=this.props[N[o.type]];r?r(o):o.type==="error"&&console.error(o.error)},this._onCameraEvent=o=>{if(this._internalUpdate)return;o.viewState=this._propsedCameraUpdate||P(this._map.transform);const r=this.props[F[o.type]];r&&r(o)},this._onCameraUpdate=o=>this._internalUpdate?o:(this._propsedCameraUpdate=P(o),z(o,this.props)),this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const r=this.props[U[o.type]];r&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),r(o),delete o.features)},this._MapClass=t,this.props=n,this._initialize(s)}get map(){return this._map}setProps(t){const n=this.props;this.props=t;const s=this._updateSettings(t,n),o=this._updateSize(t),r=this._updateViewState(t);this._updateStyle(t,n),this._updateStyleComponents(t),this._updateHandlers(t,n),(s||o||r&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const s=b.savedMaps.pop();if(!s)return null;const o=s.map,r=o.getContainer();for(n.className=r.className;r.childNodes.length>0;)n.appendChild(r.childNodes[0]);o._container=n;const a=o._resizeObserver;a&&(a.disconnect(),a.observe(n)),s.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:c}=t;return c&&(c.bounds?o.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):s._updateViewState(c)),o.isStyleLoaded()?o.fire("load"):o.once("style.load",()=>o.fire("load")),o._update(),s}_initialize(t){const{props:n}=this,{mapStyle:s=A}=n,o={...n,...n.initialViewState,container:t,style:O(s)},r=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),n.gl){const c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=c,n.gl)}const a=new this._MapClass(o);r.padding&&a.setPadding(r.padding),n.cursor&&(a.getCanvas().style.cursor=n.cursor),a.transformCameraUpdate=this._onCameraUpdate,a.on("style.load",()=>{var c;this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:(c=a.getProjection)==null?void 0:c.call(a),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const c in U)a.on(c,this._onPointerEvent);for(const c in F)a.on(c,this._onCameraEvent);for(const c in N)a.on(c,this._onEvent);this._map=a}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),b.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:n}=t;if(n){const s=this._map;if(n.width!==s.transform.width||n.height!==s.transform.height)return s.resize(),!0}return!1}_updateViewState(t){const n=this._map,s=n.transform;if(!n.isMoving()){const r=z(s,t);if(Object.keys(r).length>0)return this._internalUpdate=!0,n.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateSettings(t,n){const s=this._map;let o=!1;for(const r of X)if(r in t&&!v(t[r],n[r])){o=!0;const a=s[`set${r[0].toUpperCase()}${r.slice(1)}`];a==null||a.call(s,t[r])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:s=A,styleDiffing:o=!0}=t,r={diff:o};"localIdeographFontFamily"in t&&(r.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(O(s),r)}}_updateStyleComponents({light:t,projection:n,sky:s,terrain:o}){var c,u;const r=this._map,a=this._styleComponents;r.style._loaded&&(t&&!v(t,a.light)&&(a.light=t,r.setLight(t)),n&&!v(n,a.projection)&&n!==((c=a.projection)==null?void 0:c.type)&&(a.projection=typeof n=="string"?{type:n}:n,(u=r.setProjection)==null||u.call(r,a.projection)),s&&!v(s,a.sky)&&(a.sky=s,r.setSky(s)),o!==void 0&&!v(o,a.terrain)&&(!o||r.getSource(o.source))&&(a.terrain=o,r.setTerrain(o)))}_updateHandlers(t,n){const s=this._map;for(const o of Q){const r=t[o]??!0,a=n[o]??!0;v(r,a)||(r?s[o].enable(r):s[o].disable())}}_queryRenderedFeatures(t){const n=this._map,{interactiveLayerIds:s=[]}=this.props;try{return n.queryRenderedFeatures(t,{layers:s.filter(n.getLayer.bind(n))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const r=t.type,a=((o=this._hoveredFeatures)==null?void 0:o.length)>0,c=this._queryRenderedFeatures(t.point),u=c.length>0;!u&&a&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=c,u&&!a&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}b.savedMaps=[];const ee=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function te(e){if(!e)return null;const t=e.map,n={getMap:()=>t};for(const s of ne(t))!(s in n)&&!ee.includes(s)&&(n[s]=t[s].bind(t));return n}function ne(e){const t=new Set;let n=e;for(;n;){for(const s of Object.getOwnPropertyNames(n))s[0]!=="_"&&typeof e[s]=="function"&&s!=="fire"&&s!=="setEventedParent"&&t.add(s);n=Object.getPrototypeOf(n)}return Array.from(t)}const oe=typeof document<"u"?i.useLayoutEffect:i.useEffect;function re(e,t){const{RTLTextPlugin:n,maxParallelImageRequests:s,workerCount:o,workerUrl:r}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:a,lazy:c=!0}=typeof n=="string"?{pluginUrl:n}:n;e.setRTLTextPlugin(a,u=>{u&&console.error(u)},c)}s!==void 0&&e.setMaxParallelImageRequests(s),o!==void 0&&e.setWorkerCount(o),r!==void 0&&e.setWorkerUrl(r)}const w=i.createContext(null);function se(e,t){const n=i.useContext(H),[s,o]=i.useState(null),r=i.useRef(),{current:a}=i.useRef({mapLib:null,map:null});i.useEffect(()=>{const l=e.mapLib;let d=!0,f;return Promise.resolve(l||$(()=>import("./maplibre-gl-DqXvXKp9.js").then(m=>m.m),__vite__mapDeps([0,1]))).then(m=>{if(!d)return;if(!m)throw new Error("Invalid mapLib");const y="Map"in m?m:m.default;if(!y.Map)throw new Error("Invalid mapLib");re(y,e),e.reuseMaps&&(f=b.reuse(e,r.current)),f||(f=new b(y.Map,e,r.current)),a.map=te(f),a.mapLib=y,o(f),n==null||n.onMapMount(a.map,e.id)}).catch(m=>{const{onError:y}=e;y?y({type:"error",target:null,originalEvent:null,error:m}):console.error(m)}),()=>{d=!1,f&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?f.recycle():f.destroy())}},[]),oe(()=>{s&&s.setProps(e)}),i.useImperativeHandle(t,()=>a.map,[s]);const c=i.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),u={height:"100%"};return i.createElement("div",{id:e.id,ref:r,style:c},s&&i.createElement(w.Provider,{value:a},i.createElement("div",{"mapboxgl-children":"",style:u},e.children)))}const Me=i.forwardRef(se),ae=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function L(e,t){if(!e||!t)return;const n=e.style;for(const s in t){const o=t[s];Number.isFinite(o)&&!ae.test(s)?n[s]=`${o}px`:n[s]=o}}function Z(e,t){if(e===t)return null;const n=D(e),s=D(t),o=[];for(const r of s)n.has(r)||o.push(r);for(const r of n)s.has(r)||o.push(r);return o.length===0?null:o}function D(e){return new Set(e?e.trim().split(/\s+/):[])}const be=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useRef({props:e}),r=i.useMemo(()=>{let E=!1;i.Children.forEach(e.children,h=>{h&&(E=!0)});const k={...e,element:E?document.createElement("div"):void 0},p=new s.Marker(k);return p.setLngLat([e.longitude,e.latitude]),p.getElement().addEventListener("click",h=>{var g,_;(_=(g=o.current.props).onClick)==null||_.call(g,{type:"click",target:p,originalEvent:h})}),p.on("dragstart",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragStart)==null||S.call(_,g)}),p.on("drag",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDrag)==null||S.call(_,g)}),p.on("dragend",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragEnd)==null||S.call(_,g)}),p},[]);i.useEffect(()=>(r.addTo(n.getMap()),()=>{r.remove()}),[]);const{longitude:a,latitude:c,offset:u,style:l,draggable:d=!1,popup:f=null,rotation:m=0,rotationAlignment:y="auto",pitchAlignment:C="auto"}=e;i.useEffect(()=>{L(r.getElement(),l)},[l]),i.useImperativeHandle(t,()=>r,[]);const T=o.current.props;(r.getLngLat().lng!==a||r.getLngLat().lat!==c)&&r.setLngLat([a,c]),u&&!Y(r.getOffset(),u)&&r.setOffset(u),r.isDraggable()!==d&&r.setDraggable(d),r.getRotation()!==m&&r.setRotation(m),r.getRotationAlignment()!==y&&r.setRotationAlignment(y),r.getPitchAlignment()!==C&&r.setPitchAlignment(C),r.getPopup()!==f&&r.setPopup(f);const x=Z(T.className,e.className);if(x)for(const E of x)r.toggleClassName(E);return o.current.props=e,B.createPortal(e.children,r.getElement())})),xe=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useMemo(()=>document.createElement("div"),[]),r=i.useRef({props:e}),a=i.useMemo(()=>{const c={...e},u=new s.Popup(c);return u.setLngLat([e.longitude,e.latitude]),u.once("open",l=>{var d,f;(f=(d=r.current.props).onOpen)==null||f.call(d,l)}),u},[]);if(i.useEffect(()=>{const c=u=>{var l,d;(d=(l=r.current.props).onClose)==null||d.call(l,u)};return a.on("close",c),a.setDOMContent(o).addTo(n.getMap()),()=>{a.off("close",c),a.isOpen()&&a.remove()}},[]),i.useEffect(()=>{L(a.getElement(),e.style)},[e.style]),i.useImperativeHandle(t,()=>a,[]),a.isOpen()){const c=r.current.props;(a.getLngLat().lng!==e.longitude||a.getLngLat().lat!==e.latitude)&&a.setLngLat([e.longitude,e.latitude]),e.offset&&!v(c.offset,e.offset)&&a.setOffset(e.offset),(c.anchor!==e.anchor||c.maxWidth!==e.maxWidth)&&(a.options.anchor=e.anchor,a.setMaxWidth(e.maxWidth));const u=Z(c.className,e.className);if(u)for(const l of u)a.toggleClassName(l);r.current.props=e}return B.createPortal(e.children,o)}));function M(e,t,n,s){const o=i.useContext(w),r=i.useMemo(()=>e(o),[]);return i.useEffect(()=>{const a=t,c=null,u=typeof t=="function"?t:null,{map:l}=o;return l.hasControl(r)||(l.addControl(r,a==null?void 0:a.position),c&&c(o)),()=>{u&&u(o),l.hasControl(r)&&l.removeControl(r)}},[]),r}function ie(e){const t=M(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ie);function ce(e){const t=M(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return i.useEffect(()=>{L(t._controlContainer,e.style)},[e.style]),null}i.memo(ce);function le(e,t){const n=i.useRef({props:e}),s=M(({mapLib:o})=>{const r=new o.GeolocateControl(e),a=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||a()},r.on("geolocate",c=>{var u,l;(l=(u=n.current.props).onGeolocate)==null||l.call(u,c)}),r.on("error",c=>{var u,l;(l=(u=n.current.props).onError)==null||l.call(u,c)}),r.on("outofmaxbounds",c=>{var u,l;(l=(u=n.current.props).onOutOfMaxBounds)==null||l.call(u,c)}),r.on("trackuserlocationstart",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationStart)==null||l.call(u,c)}),r.on("trackuserlocationend",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationEnd)==null||l.call(u,c)}),r},{position:e.position});return n.current.props=e,i.useImperativeHandle(t,()=>s,[]),i.useEffect(()=>{L(s._container,e.style)},[e.style]),null}i.memo(i.forwardRef(le));function ue(e){const t=M(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ue);function fe(e){const t=M(({mapLib:r})=>new r.ScaleControl(e),{position:e.position}),n=i.useRef(e),s=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==s.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==s.unit&&t.setUnit(e.unit),i.useEffect(()=>{L(t._container,o)},[o]),null}const ke=i.memo(fe);function de(e){const t=M(({mapLib:n})=>new n.TerrainControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(de);function me(e){const t=M(({mapLib:n})=>new n.LogoControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(me);function R(e,t){if(!e)throw new Error(t)}let ye=0;function ge(e,t,n){if(e.style&&e.style._loaded){const s={...n};return delete s.id,delete s.children,e.addSource(t,s),e.getSource(t)}return null}function he(e,t,n){var a,c,u;R(t.id===n.id,"source id changed"),R(t.type===n.type,"source type changed");let s="",o=0;for(const l in t)l!=="children"&&l!=="id"&&!v(n[l],t[l])&&(s=l,o++);if(!o)return;const r=t.type;if(r==="geojson")e.setData(t.data);else if(r==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(s){case"coordinates":(a=e.setCoordinates)==null||a.call(e,t.coordinates);break;case"url":(c=e.setUrl)==null||c.call(e,t.url);break;case"tiles":(u=e.setTiles)==null||u.call(e,t.tiles);break;default:console.warn(`Unable to update prop: ${s}`)}}function Re(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-source-${ye++}`,[]);i.useEffect(()=>{if(t){const a=()=>setTimeout(()=>s(c=>c+1),0);return t.on("styledata",a),a(),()=>{var c;if(t.off("styledata",a),t.style&&t.style._loaded&&t.getSource(o)){const u=(c=t.getStyle())==null?void 0:c.layers;if(u)for(const l of u)l.source===o&&t.removeLayer(l.id);t.removeSource(o)}}}},[t]);let r=t&&t.style&&t.getSource(o);return r?he(r,e,n.current):r=ge(t,o,e),n.current=e,r&&i.Children.map(e.children,a=>a&&i.cloneElement(a,{source:o}))||null}function pe(e,t,n,s){if(R(n.id===s.id,"layer id changed"),R(n.type===s.type,"layer type changed"),n.type==="custom"||s.type==="custom")return;const{layout:o={},paint:r={},filter:a,minzoom:c,maxzoom:u,beforeId:l}=n;if(l!==s.beforeId&&e.moveLayer(t,l),o!==s.layout){const d=s.layout||{};for(const f in o)v(o[f],d[f])||e.setLayoutProperty(t,f,o[f]);for(const f in d)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(r!==s.paint){const d=s.paint||{};for(const f in r)v(r[f],d[f])||e.setPaintProperty(t,f,r[f]);for(const f in d)r.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}v(a,s.filter)||e.setFilter(t,a),(c!==s.minzoom||u!==s.maxzoom)&&e.setLayerZoomRange(t,c,u)}function ve(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const s={...n,id:t};delete s.beforeId,e.addLayer(s,n.beforeId)}}let _e=0;function Ie(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-layer-${_e++}`,[]);if(i.useEffect(()=>{if(t){const a=()=>s(c=>c+1);return t.on("styledata",a),a(),()=>{t.off("styledata",a),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{pe(t,o,e,n.current)}catch(a){console.warn(a)}else ve(t,o,e);return n.current=e,null}const V="pymc-basemap-mode",j="dark";function Le(){if(typeof window>"u")return j;try{const e=localStorage.getItem(V);if(e==="light"||e==="dark")return e}catch{}return j}function W(e){if(!(typeof window>"u"))try{localStorage.setItem(V,e)}catch{}}const q=G(e=>({mode:Le(),toggle:()=>e(t=>{const n=t.mode==="light"?"dark":"light";return W(n),{mode:n}}),setMode:t=>{W(t),e({mode:t})}})),Te=()=>q(e=>e.mode),Pe=()=>q(e=>e.toggle),Ce={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},Se={light:"basemap-light-",dark:"basemap-dark-"},I={};async function Ee(e){if(I[e])return I[e];const n=await(await fetch(Ce[e])).json();return I[e]=n,n}function ze({mode:e}){const{current:t}=K(),[n,s]=i.useState(null),o=i.useRef({light:!1,dark:!1}),r=i.useRef({light:[],dark:[]});i.useEffect(()=>{const l=()=>{var y;const m=(y=t==null?void 0:t.getMap)==null?void 0:y.call(t);m&&!n&&s(m)};l();const d=setInterval(l,50),f=setTimeout(()=>clearInterval(d),5e3);return()=>{clearInterval(d),clearTimeout(f)}},[t,n]);const a=i.useCallback(async(l,d,f)=>{var E,k;if(o.current[d])return;const m=Se[d],y=await Ee(d),C=[];for(const[p,h]of Object.entries(y.sources||{})){const g=m+p;l.getSource(g)||l.addSource(g,h)}const x=(k=(((E=l.getStyle())==null?void 0:E.layers)||[]).find(p=>!p.id.startsWith("basemap-light-")&&!p.id.startsWith("basemap-dark-")))==null?void 0:k.id;for(const p of y.layers||[]){const h=m+p.id;if(C.push(h),l.getLayer(h))continue;const g={...p,id:h};"source"in g&&typeof g.source=="string"&&(g.source=m+g.source),g.layout||(g.layout={}),g.layout.visibility=f?"visible":"none";try{l.addLayer(g,x)}catch(_){console.warn(`[BasemapLayer] Failed to add layer ${h}:`,_)}}r.current[d]=C,o.current[d]=!0},[]),c=i.useCallback((l,d,f)=>{const m=r.current[d],y=f?"visible":"none";for(const C of m)if(l.getLayer(C))try{l.setLayoutProperty(C,"visibility",y)}catch{}},[]),u=i.useCallback(l=>{var m;const f=(((m=l.getStyle())==null?void 0:m.layers)||[]).filter(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-"));for(const y of f)try{l.moveLayer(y.id)}catch{}},[]);return i.useEffect(()=>{if(!n)return;const l=d=>{n.hasImage(d.id)||n.addImage(d.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return n.on("styleimagemissing",l),()=>{n.off("styleimagemissing",l)}},[n]),i.useEffect(()=>{if(!n)return;let l=!1;const d=async()=>{if(!l)try{await Promise.all([a(n,"light",e==="light"),a(n,"dark",e==="dark")]),l||u(n)}catch(m){console.error("[BasemapLayer] Setup error:",m)}};n.isStyleLoaded()?d():(n.once("style.load",d),n.once("load",()=>{!l&&!o.current.light&&d()}));const f=()=>{l||setTimeout(()=>{!l&&o.current.light&&o.current.dark&&u(n)},100)};return n.on("styledata",f),()=>{l=!0,n.off("styledata",f)}},[n,a,u,e]),i.useEffect(()=>{n&&(!o.current.light||!o.current.dark||(c(n,"light",e==="light"),c(n,"dark",e==="dark")))},[n,e,c]),null}export{ze as B,Ie as L,Me as M,xe as P,Re as S,be as a,K as b,Pe as c,ke as d,Te as u}; diff --git a/frontend/dist/assets/ChatBubble-BxObXDA9.js b/frontend/dist/assets/ChatBubble-BgE9nam_.js similarity index 93% rename from frontend/dist/assets/ChatBubble-BxObXDA9.js rename to frontend/dist/assets/ChatBubble-BgE9nam_.js index 82590118..ef62deb8 100644 --- a/frontend/dist/assets/ChatBubble-BxObXDA9.js +++ b/frontend/dist/assets/ChatBubble-BgE9nam_.js @@ -1,4 +1,4 @@ -import{d as h,r as u,j as e,c as t}from"./index-BJ3pSX9x.js";import{e as f,g as p,a as g,b as j,f as b}from"./chat-utils-C9wMoZzY.js";/** +import{d as h,r as u,j as e,c as t}from"./index-BxXoqIwr.js";import{e as f,g as p,a as g,b as j,f as b}from"./chat-utils-C_Ic_Z3G.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/CollisionExplorerModal-C3NMSLnt.js b/frontend/dist/assets/CollisionExplorerModal-CGe2meHQ.js similarity index 92% rename from frontend/dist/assets/CollisionExplorerModal-C3NMSLnt.js rename to frontend/dist/assets/CollisionExplorerModal-CGe2meHQ.js index cab47f08..98936627 100644 --- a/frontend/dist/assets/CollisionExplorerModal-C3NMSLnt.js +++ b/frontend/dist/assets/CollisionExplorerModal-CGe2meHQ.js @@ -1,6 +1,6 @@ -import{d as k,r as c,K as L,bS as S,P as H,j as e,am as R,an as B,bD as E,c as N,x as w,F as T,D,E as _,c0 as P}from"./index-BJ3pSX9x.js";import{u as I,M as z,B as W,S as q,L as F,a as U}from"./BasemapLayer-hMJnmB0N.js";import{T as A}from"./triangle-alert-BfeDdufA.js";import{M as Y}from"./map-pin-DGJa4N8v.js";import{M as $}from"./monitor-smartphone-0Yxe0RA7.js";/** +import{d as k,r as c,K as L,bS as S,P as H,j as e,am as R,an as B,cx as E,bD as T,c as N,x as w,F as D,D as _,E as P,c0 as I}from"./index-BxXoqIwr.js";import{M as z,B as W,S as q,L as F,a as U}from"./BasemapLayer-BaN23fEz.js";import{T as A}from"./triangle-alert-s7OFBXSQ.js";import{M as Y}from"./map-pin-CfgGK3Nu.js";import{M as $}from"./monitor-smartphone-CGoLFRac.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G=[["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"}]],J=k("share-2",G),K={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"};function M({node:o,isHovered:v,onHover:f}){const[g,p]=c.useState(!1),b=c.useCallback(async d=>{d.stopPropagation(),await T(o.hash),p(!0),setTimeout(()=>p(!1),2e3)},[o.hash]),h=o.contactType.toLowerCase(),m=h.includes("room")||h.includes("server"),l=h==="companion"||h==="client";let n=J,r="text-sys-blue";return m?(n=P,r="text-signal-fair"):l?(n=$,r="text-fg-muted"):o.isNeighbor&&(r="text-sys-green"),e.jsxs("div",{className:N("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",v?"bg-sys-blue/10":"hover:bg-subtle-fill"),onMouseEnter:()=>f(o.hash),onMouseLeave:()=>f(null),children:[e.jsx(n,{className:N("w-4 h-4 flex-shrink-0",r)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"type-label text-fg-primary truncate",children:o.name}),o.isNeighbor&&e.jsx(w,{color:"green",compact:!0,children:"NBR"}),o.isRepeater&&e.jsx(w,{color:"zinc",compact:!0,children:"RPT"}),o.isHub&&e.jsx(w,{color:"indigo",compact:!0,children:"HUB"})]}),e.jsxs("button",{onClick:b,className:N("mt-1 inline-flex items-center gap-1 type-data-xs px-1.5 py-0.5 rounded","border transition-all cursor-pointer",g?"border-sys-green/50 bg-sys-green/10 text-sys-green":"border-edge-subtle bg-subtle/50 text-fg-muted hover:border-edge-strong"),title:`Copy: ${o.hash}`,children:[o.hash.slice(0,12),"…",g?e.jsx(D,{className:"w-2.5 h-2.5"}):e.jsx(_,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function C({nodes:o,hoveredHash:v,onHover:f}){const g=I(),p=c.useRef(null),b=E(),[h,m]=c.useState(!1),l=c.useMemo(()=>o.filter(a=>a.latitude!=null&&a.longitude!=null&&(a.latitude!==0||a.longitude!==0)),[o]),n=c.useMemo(()=>{if(l.length===0)return null;let a=1/0,s=-1/0,t=1/0,i=-1/0;for(const x of l)a=Math.min(a,x.longitude),s=Math.max(s,x.longitude),t=Math.min(t,x.latitude),i=Math.max(i,x.latitude);const u=.01;if(i-tn?{longitude:(n[0][0]+n[1][0])/2,latitude:(n[0][1]+n[1][1])/2}:{longitude:0,latitude:0},[n]),d=c.useMemo(()=>{if(l.length<2)return null;const a=[];for(let s=0;s{var s;const a=(s=p.current)==null?void 0:s.getMap();if(!a||!n){m(!0);return}a.fitBounds(n,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>m(!0),50)},[n]),y=b&&h;return l.length===0?e.jsx("div",{className:"h-full flex items-center justify-center bg-subtle/30 radius-inner",children:e.jsxs("div",{className:"text-center text-fg-secondary p-4",children:[e.jsx(Y,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No location data available"})]})}):e.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden bg-elevated",children:[e.jsx("div",{className:N("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",y?"opacity-0":"opacity-100 bg-elevated"),children:e.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),e.jsx("div",{className:N("h-full w-full transition-opacity duration-200",y?"opacity-100":"opacity-0"),children:e.jsxs(z,{ref:p,initialViewState:{longitude:r.longitude,latitude:r.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:K,attributionControl:!1,onLoad:j,children:[e.jsx(W,{mode:g}),d&&e.jsx(q,{id:"collision-edges",type:"geojson",data:d,children:e.jsx(F,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),l.map(a=>{const s=a.hash===v,t=a.hash.startsWith("0x")?a.hash.slice(2,4).toUpperCase():a.hash.slice(0,2).toUpperCase();return e.jsx(U,{longitude:a.longitude,latitude:a.latitude,anchor:"center",children:e.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>f(a.hash),onMouseLeave:()=>f(null),style:{pointerEvents:"auto"},children:e.jsxs(w,{color:"amber",filled:!0,className:"type-data-xs shadow-lg",children:[t,s&&e.jsx("span",{className:"ml-1 opacity-75 font-sans",children:a.name})]})})},a.hash)})]})})]})}function Q({isOpen:o,prefix:v,candidateHashes:f,onClose:g}){const p=L(),b=S(),h=H(),[m,l]=c.useState(null),n=c.useMemo(()=>new Set(h.map(s=>s.hash)),[h]),r=(p==null?void 0:p.neighbors)??{},d=c.useMemo(()=>{const s=t=>{if(r[t])return r[t];if(!t.startsWith("0x")&&r["0x"+t])return r["0x"+t];if(t.startsWith("0x")&&r[t.slice(2)])return r[t.slice(2)]};return f.map(t=>{var u;const i=s(t);return{hash:t,name:(i==null?void 0:i.node_name)||(i==null?void 0:i.name)||`Unknown (${t.slice(0,8)}…)`,contactType:(i==null?void 0:i.contact_type)||"",isRepeater:(i==null?void 0:i.is_repeater)||((u=i==null?void 0:i.contact_type)==null?void 0:u.toLowerCase())==="repeater"||!1,isNeighbor:n.has(t)||n.has("0x"+t)||n.has(t.replace(/^0x/,"")),isHub:b.has(t),latitude:i==null?void 0:i.latitude,longitude:i==null?void 0:i.longitude}}).sort((t,i)=>t.isNeighbor!==i.isNeighbor?t.isNeighbor?-1:1:t.isHub!==i.isHub?t.isHub?-1:1:t.name.localeCompare(i.name))},[f,r,n,b]),j=c.useMemo(()=>d.some(s=>s.latitude!=null&&s.longitude!=null&&(s.latitude!==0||s.longitude!==0)),[d]),y=c.useCallback(s=>{l(s)},[]),a=j?"4xl":"lg";return o?e.jsxs(R,{open:o,onClose:g,size:a,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 radius-inner bg-signal-fair/10",children:e.jsx(A,{className:"w-5 h-5 text-signal-fair"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"type-micro",children:["Prefix Collision: ",e.jsx("span",{className:"font-mono text-sys-blue",children:v})]}),e.jsxs("p",{className:"text-xs text-fg-secondary",children:[d.length," nodes share this prefix"]})]})]}),e.jsx("button",{onClick:g,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),e.jsx("button",{onClick:g,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs(B,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[j&&e.jsx("div",{className:"h-64 p-2 border-b border-edge-subtle",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:y})}),e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})]}),j?e.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[e.jsx("div",{className:"overflow-y-auto border-r border-edge-subtle",children:e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})}),e.jsx("div",{className:"overflow-hidden p-2",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:y})})]}):e.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})})]})]}):null}const se=c.memo(Q);export{se as C,J as S}; + */const G=[["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"}]],J=k("share-2",G),K={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"};function M({node:o,isHovered:v,onHover:f}){const[g,p]=c.useState(!1),b=c.useCallback(async d=>{d.stopPropagation(),await D(o.hash),p(!0),setTimeout(()=>p(!1),2e3)},[o.hash]),h=o.contactType.toLowerCase(),m=h.includes("room")||h.includes("server"),l=h==="companion"||h==="client";let n=J,r="text-sys-blue";return m?(n=I,r="text-signal-fair"):l?(n=$,r="text-fg-muted"):o.isNeighbor&&(r="text-sys-green"),e.jsxs("div",{className:N("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",v?"bg-sys-blue/10":"hover:bg-subtle-fill"),onMouseEnter:()=>f(o.hash),onMouseLeave:()=>f(null),children:[e.jsx(n,{className:N("w-4 h-4 flex-shrink-0",r)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"type-label text-fg-primary truncate",children:o.name}),o.isNeighbor&&e.jsx(w,{color:"green",compact:!0,children:"NBR"}),o.isRepeater&&e.jsx(w,{color:"zinc",compact:!0,children:"RPT"}),o.isHub&&e.jsx(w,{color:"indigo",compact:!0,children:"HUB"})]}),e.jsxs("button",{onClick:b,className:N("mt-1 inline-flex items-center gap-1 type-data-xs px-1.5 py-0.5 rounded","border transition-all cursor-pointer",g?"border-sys-green/50 bg-sys-green/10 text-sys-green":"border-edge-subtle bg-subtle/50 text-fg-muted hover:border-edge-strong"),title:`Copy: ${o.hash}`,children:[o.hash.slice(0,12),"…",g?e.jsx(_,{className:"w-2.5 h-2.5"}):e.jsx(P,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function C({nodes:o,hoveredHash:v,onHover:f}){const g=E(),p=c.useRef(null),b=T(),[h,m]=c.useState(!1),l=c.useMemo(()=>o.filter(a=>a.latitude!=null&&a.longitude!=null&&(a.latitude!==0||a.longitude!==0)),[o]),n=c.useMemo(()=>{if(l.length===0)return null;let a=1/0,s=-1/0,t=1/0,i=-1/0;for(const x of l)a=Math.min(a,x.longitude),s=Math.max(s,x.longitude),t=Math.min(t,x.latitude),i=Math.max(i,x.latitude);const u=.01;if(i-tn?{longitude:(n[0][0]+n[1][0])/2,latitude:(n[0][1]+n[1][1])/2}:{longitude:0,latitude:0},[n]),d=c.useMemo(()=>{if(l.length<2)return null;const a=[];for(let s=0;s{var s;const a=(s=p.current)==null?void 0:s.getMap();if(!a||!n){m(!0);return}a.fitBounds(n,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>m(!0),50)},[n]),y=b&&h;return l.length===0?e.jsx("div",{className:"h-full flex items-center justify-center bg-subtle/30 radius-inner",children:e.jsxs("div",{className:"text-center text-fg-secondary p-4",children:[e.jsx(Y,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No location data available"})]})}):e.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden bg-elevated",children:[e.jsx("div",{className:N("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",y?"opacity-0":"opacity-100 bg-elevated"),children:e.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),e.jsx("div",{className:N("h-full w-full transition-opacity duration-200",y?"opacity-100":"opacity-0"),children:e.jsxs(z,{ref:p,initialViewState:{longitude:r.longitude,latitude:r.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:K,attributionControl:!1,onLoad:j,children:[e.jsx(W,{mode:g}),d&&e.jsx(q,{id:"collision-edges",type:"geojson",data:d,children:e.jsx(F,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),l.map(a=>{const s=a.hash===v,t=a.hash.startsWith("0x")?a.hash.slice(2,4).toUpperCase():a.hash.slice(0,2).toUpperCase();return e.jsx(U,{longitude:a.longitude,latitude:a.latitude,anchor:"center",children:e.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>f(a.hash),onMouseLeave:()=>f(null),style:{pointerEvents:"auto"},children:e.jsxs(w,{color:"amber",filled:!0,className:"type-data-xs shadow-lg",children:[t,s&&e.jsx("span",{className:"ml-1 opacity-75 font-sans",children:a.name})]})})},a.hash)})]})})]})}function Q({isOpen:o,prefix:v,candidateHashes:f,onClose:g}){const p=L(),b=S(),h=H(),[m,l]=c.useState(null),n=c.useMemo(()=>new Set(h.map(s=>s.hash)),[h]),r=(p==null?void 0:p.neighbors)??{},d=c.useMemo(()=>{const s=t=>{if(r[t])return r[t];if(!t.startsWith("0x")&&r["0x"+t])return r["0x"+t];if(t.startsWith("0x")&&r[t.slice(2)])return r[t.slice(2)]};return f.map(t=>{var u;const i=s(t);return{hash:t,name:(i==null?void 0:i.node_name)||(i==null?void 0:i.name)||`Unknown (${t.slice(0,8)}…)`,contactType:(i==null?void 0:i.contact_type)||"",isRepeater:(i==null?void 0:i.is_repeater)||((u=i==null?void 0:i.contact_type)==null?void 0:u.toLowerCase())==="repeater"||!1,isNeighbor:n.has(t)||n.has("0x"+t)||n.has(t.replace(/^0x/,"")),isHub:b.has(t),latitude:i==null?void 0:i.latitude,longitude:i==null?void 0:i.longitude}}).sort((t,i)=>t.isNeighbor!==i.isNeighbor?t.isNeighbor?-1:1:t.isHub!==i.isHub?t.isHub?-1:1:t.name.localeCompare(i.name))},[f,r,n,b]),j=c.useMemo(()=>d.some(s=>s.latitude!=null&&s.longitude!=null&&(s.latitude!==0||s.longitude!==0)),[d]),y=c.useCallback(s=>{l(s)},[]),a=j?"4xl":"lg";return o?e.jsxs(R,{open:o,onClose:g,size:a,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 radius-inner bg-signal-fair/10",children:e.jsx(A,{className:"w-5 h-5 text-signal-fair"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"type-micro",children:["Prefix Collision: ",e.jsx("span",{className:"font-mono text-sys-blue",children:v})]}),e.jsxs("p",{className:"text-xs text-fg-secondary",children:[d.length," nodes share this prefix"]})]})]}),e.jsx("button",{onClick:g,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),e.jsx("button",{onClick:g,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs(B,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[j&&e.jsx("div",{className:"h-64 p-2 border-b border-edge-subtle",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:y})}),e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})]}),j?e.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[e.jsx("div",{className:"overflow-y-auto border-r border-edge-subtle",children:e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})}),e.jsx("div",{className:"overflow-hidden p-2",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:y})})]}):e.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(M,{node:s,isHovered:m===s.hash,onHover:y},s.hash))})})]})]}):null}const se=c.memo(Q);export{se as C,J as S}; diff --git a/frontend/dist/assets/Configuration-VOGqgrTj.js b/frontend/dist/assets/Configuration-CeI9X6pm.js similarity index 98% rename from frontend/dist/assets/Configuration-VOGqgrTj.js rename to frontend/dist/assets/Configuration-CeI9X6pm.js index 3f0ab47b..2f4f6bb9 100644 --- a/frontend/dist/assets/Configuration-VOGqgrTj.js +++ b/frontend/dist/assets/Configuration-CeI9X6pm.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/latin-400-BcR6IdUc.css","assets/latin-500-DCnAHIrw.css","assets/latin-600-CnkPk-vb.css","assets/latin-700-UC1i-VSI.css"])))=>i.map(i=>d[i]); -import{d as ue,r as t,j as e,c as l,L as H,D as B,bo as J,ao as Ts,dT as Re,dU as ss,dV as Ze,_ as Te,T as ie,M as et,S as st,dW as tt,N as X,cr as Qe,c2 as at,dX as nt,z as lt,dY as _s,dZ as rt,d_ as it,d$ as ot,R as ct,B as F,e0 as qe,I as dt,E as ut,F as mt}from"./index-BJ3pSX9x.js";import{g as xt,a as ft,c as ht,r as pt,s as yt,b as gt,u as bt,d as jt}from"./system-BP-ATTWa.js";import{C as vt}from"./ConfirmModal-BBgfDQz0.js";import{N as Nt}from"./NodeInformationCard-Cgww6B6e.js";import{i as kt,g as wt,s as Ct,a as St,k as Tt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as _t,a as Ft,B as Et}from"./PageLayout-BF99wokG.js";import{T as Is}from"./trash-2-CS4Hf6qp.js";import{R as te,C as _e}from"./Grid-T0h8M_5J.js";import{A as Rt}from"./antenna-B73eC1vt.js";import{P as Fs}from"./plus-i1_A57qD.js";import{K as Ge}from"./key-round-CRU12yi8.js";import{C as Pt}from"./circle-check-CjNYatNq.js";import{T as Be}from"./triangle-alert-BfeDdufA.js";import{R as Dt}from"./refresh-cw-B_Kb9_IU.js";import{C as It}from"./chevron-right-P-ozZjJy.js";import"./DataBox-DuDZS_-R.js";/** +import{d as ue,r as t,j as e,c as l,L as H,D as B,bo as J,ao as Ts,dU as Re,dV as ss,dW as Ze,_ as Te,T as ie,M as et,S as st,dX as tt,N as X,cr as Qe,c2 as at,dY as nt,z as lt,dZ as _s,d_ as rt,d$ as it,e0 as ot,R as ct,B as F,e1 as qe,I as dt,E as ut,F as mt}from"./index-BxXoqIwr.js";import{g as xt,a as ft,c as ht,r as pt,s as yt,b as gt,u as bt,d as jt}from"./system-IO5o3m3L.js";import{C as vt}from"./ConfirmModal-BsKnU4PL.js";import{N as Nt}from"./NodeInformationCard-CK3ykNEr.js";import{i as kt,g as wt,s as Ct,a as St,k as Tt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as _t,a as Ft,B as Et}from"./PageLayout-9jTb5LQy.js";import{T as Is}from"./trash-2-DXpoExCg.js";import{R as te,C as _e}from"./Grid-DsElbcI9.js";import{A as Rt}from"./antenna-D6YaR-Hz.js";import{P as Fs}from"./plus-CpcpAQLp.js";import{K as Ge}from"./key-round-BvvsJJ9N.js";import{C as Pt}from"./circle-check-B2q_hZxl.js";import{T as Be}from"./triangle-alert-s7OFBXSQ.js";import{R as Dt}from"./refresh-cw-D1AU1e6s.js";import{C as It}from"./chevron-right-2z1sXpRw.js";import"./DataBox-VKzAgqy6.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/ConfirmModal-BBgfDQz0.js b/frontend/dist/assets/ConfirmModal-BsKnU4PL.js similarity index 76% rename from frontend/dist/assets/ConfirmModal-BBgfDQz0.js rename to frontend/dist/assets/ConfirmModal-BsKnU4PL.js index 76b061c5..e07d35d0 100644 --- a/frontend/dist/assets/ConfirmModal-BBgfDQz0.js +++ b/frontend/dist/assets/ConfirmModal-BsKnU4PL.js @@ -1 +1 @@ -import{r as d,j as s,am as m,dK as x,c as f,an as g,e2 as C,B as a}from"./index-BJ3pSX9x.js";import{T as j}from"./triangle-alert-BfeDdufA.js";const p={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},u={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:o="default",onConfirm:c,onCancel:e}){return s.jsxs(m,{open:n,onClose:e,size:"sm",children:[s.jsx(x,{icon:s.jsx(j,{className:f("w-5 h-5",p[o])}),title:r,onClose:e}),s.jsx(g,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(C,{children:[s.jsx(a,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(a,{color:u[o],onClick:c,className:"flex-1",children:t})]})]})}const A=d.memo(N);export{A as C}; +import{r as d,j as s,am as m,dL as x,c as f,an as g,e3 as C,B as a}from"./index-BxXoqIwr.js";import{T as j}from"./triangle-alert-s7OFBXSQ.js";const p={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},u={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:o="default",onConfirm:c,onCancel:e}){return s.jsxs(m,{open:n,onClose:e,size:"sm",children:[s.jsx(x,{icon:s.jsx(j,{className:f("w-5 h-5",p[o])}),title:r,onClose:e}),s.jsx(g,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(C,{children:[s.jsx(a,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(a,{color:u[o],onClick:c,className:"flex-1",children:t})]})]})}const A=d.memo(N);export{A as C}; diff --git a/frontend/dist/assets/Contacts-BDcsbVpm.js b/frontend/dist/assets/Contacts-CzvSrbCz.js similarity index 92% rename from frontend/dist/assets/Contacts-BDcsbVpm.js rename to frontend/dist/assets/Contacts-CzvSrbCz.js index e56aef19..e91dc6cd 100644 --- a/frontend/dist/assets/Contacts-BDcsbVpm.js +++ b/frontend/dist/assets/Contacts-CzvSrbCz.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-Cscp8bKT.js","assets/index-BJ3pSX9x.js","assets/BasemapLayer-hMJnmB0N.js","assets/consumer-registry-DQXxx-eO.js","assets/link-scoring-2ZJLNC-s.js","assets/ConfirmModal-BBgfDQz0.js","assets/triangle-alert-BfeDdufA.js","assets/max-_Me6WRUh.js","assets/download-C2xaKTRC.js","assets/database-CBR7LpGS.js","assets/useMapViewStore-BzKWsccB.js","assets/index-Cxi5n-VD.js","assets/refresh-cw-B_Kb9_IU.js","assets/target-BKK0y-ex.js","assets/funnel-Dj8Jz3oI.js","assets/plus-i1_A57qD.js","assets/easing-DrjZ68sV.js","assets/zap-vLwXh2k-.js","assets/trash-2-CS4Hf6qp.js","assets/wifi-off-LIR5tvs8.js","assets/wifi-Ch4xubzc.js","assets/badge-colors-CWWef4JL.js","assets/chevron-right-P-ozZjJy.js","assets/LightSparkline-Bb_4UjX-.js","assets/map-pin-DGJa4N8v.js","assets/node-types-BWXpGa25.js","assets/usePipelineStore-Chu7OvpY.js","assets/ping-Qm7CcMEW.js","assets/PageLayout-BF99wokG.js","assets/listbox-D436DP3r.js","assets/element-movement-CCk2fgXx.js","assets/MqttModeBadge-ByDcIOTs.js","assets/chat-utils-C9wMoZzY.js","assets/SignalIndicator-D-LrLHEf.js","assets/CollisionExplorerModal-C3NMSLnt.js","assets/monitor-smartphone-0Yxe0RA7.js","assets/DataBox-DuDZS_-R.js","assets/circle-question-mark-DFRPEv9u.js","assets/network-DZ9mLFR5.js","assets/activity-08bcdFU3.js","assets/search-DZl1pHjp.js","assets/index-CmjqgMwf.css","assets/BasemapLayer-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); -import{d as P,ab as ss,j as e,r as a,_ as ts,bZ as Ee,b_ as Fe,a8 as oe,D as ke,aj as Pe,b$ as ns,c0 as he,R as pe,x as k,c1 as as,L as Oe,c2 as rs,Q as os,c3 as cs,c4 as is,c5 as ls,P as ds,c6 as ms,c7 as xs,V as us,ak as ps,W as Ne,c8 as hs,c9 as fs,bj as re,v as gs,I as js,bo as ys,c as we}from"./index-BJ3pSX9x.js";import{useDiscoveredNodes as bs}from"./usePipelineStore-Chu7OvpY.js";import{p as Ns}from"./ping-Qm7CcMEW.js";import{c as Ce}from"./node-types-BWXpGa25.js";import{P as vs,a as ws,B as ks}from"./PageLayout-BF99wokG.js";import{L as Cs,a as ue}from"./listbox-D436DP3r.js";import{T as Te,M as Ms}from"./MqttModeBadge-ByDcIOTs.js";import{u as Ss,e as _s,f as Rs,r as Ps}from"./consumer-registry-DQXxx-eO.js";import{e as Ts,g as Ls,a as $s}from"./chat-utils-C9wMoZzY.js";import{A as Es,b as Fs}from"./SignalIndicator-D-LrLHEf.js";import{C as Os,S as zs}from"./CollisionExplorerModal-C3NMSLnt.js";import{E as Ds,T as Hs}from"./target-BKK0y-ex.js";import{D as As}from"./DataBox-DuDZS_-R.js";import{a as Z,C as Is}from"./badge-colors-CWWef4JL.js";import{C as ze}from"./circle-question-mark-DFRPEv9u.js";import{N as Bs}from"./network-DZ9mLFR5.js";import{A as De}from"./activity-08bcdFU3.js";import{T as Vs}from"./trash-2-CS4Hf6qp.js";import{C as qs}from"./ConfirmModal-BBgfDQz0.js";import{M as Le}from"./monitor-smartphone-0Yxe0RA7.js";import{M as Us}from"./map-pin-DGJa4N8v.js";import{S as Ws}from"./search-DZl1pHjp.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-BLoRVnyK.js","assets/index-BxXoqIwr.js","assets/BasemapLayer-BaN23fEz.js","assets/consumer-registry-PC_rDaZ7.js","assets/link-scoring-ChgSAej1.js","assets/ConfirmModal-BsKnU4PL.js","assets/triangle-alert-s7OFBXSQ.js","assets/max-DXCf6XMj.js","assets/download-4oqud7e0.js","assets/database-ClxUxDRV.js","assets/useMapViewStore-Dx0tAQ0a.js","assets/index-m2ldcO9a.js","assets/refresh-cw-D1AU1e6s.js","assets/target-CkWLrgj4.js","assets/funnel-3o6m8jr6.js","assets/plus-CpcpAQLp.js","assets/easing-Pi1r2b4f.js","assets/zap-I-XGbFMB.js","assets/trash-2-DXpoExCg.js","assets/wifi-off-Cd0xYy6R.js","assets/wifi-CIRTj44S.js","assets/badge-colors-YFzbsFdv.js","assets/chevron-right-2z1sXpRw.js","assets/LightSparkline-BTQUkuf1.js","assets/map-pin-CfgGK3Nu.js","assets/node-types-CUctjdbw.js","assets/usePipelineStore-CThQspLf.js","assets/ping-Bv_lBCYg.js","assets/PageLayout-9jTb5LQy.js","assets/listbox-DObLFkCK.js","assets/element-movement-DMWTrEpo.js","assets/MqttModeBadge-B2gdgHRr.js","assets/chat-utils-C_Ic_Z3G.js","assets/SignalIndicator-3GFNHm8Y.js","assets/CollisionExplorerModal-CGe2meHQ.js","assets/monitor-smartphone-CGoLFRac.js","assets/DataBox-VKzAgqy6.js","assets/circle-question-mark-DyqPGIeM.js","assets/network-CkO3-tWX.js","assets/activity-CuCWwHCn.js","assets/search-odjRG97X.js","assets/index-_7WU03XB.css","assets/BasemapLayer-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); +import{d as P,ab as ss,j as e,r as a,_ as ts,bZ as Ee,b_ as Fe,a8 as oe,D as ke,aj as Pe,b$ as ns,c0 as he,R as pe,x as k,c1 as as,L as Oe,c2 as rs,Q as os,c3 as cs,c4 as is,c5 as ls,P as ds,c6 as ms,c7 as xs,V as us,ak as ps,W as Ne,c8 as hs,c9 as fs,bj as re,v as gs,I as js,bo as ys,c as we}from"./index-BxXoqIwr.js";import{useDiscoveredNodes as bs}from"./usePipelineStore-CThQspLf.js";import{p as Ns}from"./ping-Bv_lBCYg.js";import{c as Ce}from"./node-types-CUctjdbw.js";import{P as vs,a as ws,B as ks}from"./PageLayout-9jTb5LQy.js";import{L as Cs,a as ue}from"./listbox-DObLFkCK.js";import{T as Te,M as Ms}from"./MqttModeBadge-B2gdgHRr.js";import{u as Ss,e as _s,f as Rs,r as Ps}from"./consumer-registry-PC_rDaZ7.js";import{e as Ts,g as Ls,a as $s}from"./chat-utils-C_Ic_Z3G.js";import{A as Es,b as Fs}from"./SignalIndicator-3GFNHm8Y.js";import{C as Os,S as zs}from"./CollisionExplorerModal-CGe2meHQ.js";import{E as Ds,T as Hs}from"./target-CkWLrgj4.js";import{D as As}from"./DataBox-VKzAgqy6.js";import{a as Z,C as Is}from"./badge-colors-YFzbsFdv.js";import{C as ze}from"./circle-question-mark-DyqPGIeM.js";import{N as Bs}from"./network-CkO3-tWX.js";import{A as De}from"./activity-CuCWwHCn.js";import{T as Vs}from"./trash-2-DXpoExCg.js";import{C as qs}from"./ConfirmModal-BsKnU4PL.js";import{M as Le}from"./monitor-smartphone-CGoLFRac.js";import{M as Us}from"./map-pin-CfgGK3Nu.js";import{S as Ws}from"./search-odjRG97X.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -49,4 +49,4 @@ import{d as P,ab as ss,j as e,r as a,_ as ts,bZ as Ee,b_ as Fe,a8 as oe,D as ke, * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dt=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],mt=P("trending-down",dt);class xt extends a.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(c){return{hasError:!0,error:c}}render(){var c;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:((c=this.state.error)==null?void 0:c.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const ut=a.lazy(()=>ts(()=>import("./ContactsMapMapLibre-Cscp8bKT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),$e=()=>e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})});function pt({neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d}){return ss()===!1?e.jsx($e,{}):e.jsx(xt,{children:e.jsx(a.Suspense,{fallback:e.jsx($e,{}),children:e.jsx(ut,{neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d})})})}function ht({hash:o,className:c="",size:f="sm",collisionInfo:x,isViterbiResolved:g}){const v=Ee(),p=Fe(),[d,T]=a.useState(!1),S=a.useMemo(()=>oe(o),[o]),L=a.useMemo(()=>x!==void 0?x:S?v.find(j=>j.prefix===S)??null:null,[S,v,x]),$=g??(p.totalPaths>0&&p.avgPathConfidence>=.7),O=a.useCallback(j=>{j.preventDefault(),j.stopPropagation(),T(!0)},[]),B=a.useCallback(()=>{T(!1)},[]);if(!L)return null;const w=f==="sm"?"w-3.5 h-3.5":"w-4 h-4",H=$?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",_=$?`Prefix conflict resolved by Viterbi HMM (${(p.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${L.candidateCount} nodes share prefix "${S}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:O,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${H} ${c}`,title:_,"aria-label":`View prefix conflict for ${S}${$?" (Viterbi resolved)":""}`,children:$?e.jsxs("span",{className:"relative",children:[e.jsx(Ds,{className:w}),e.jsx(ke,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(et,{className:w})}),e.jsx(Os,{isOpen:d,prefix:L.prefix,candidateHashes:L.candidateHashes,onClose:B})]})}const ft=a.memo(ht),Ae=[{target:"Contacts",fn:"name",minStage:1,when:_s},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Rs}];Ps(Ae);function gt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function jt({hash:o,contact:c,isHub:f,isNeighbor:x,distance:g,centrality:v,sparklineData:p,neighborSignal:d,collisionInfo:T,isViterbiResolved:S,isPinging:L,isPingingThis:$,pingResult:O,pingError:B,gatewayInfo:w,lastForwarderPrefix:H,isMobile:_,pathStability:j,onRowClick:E,onPing:fe,onRemove:V}){Ss(Ae);const X=c.latitude&&c.longitude&&c.latitude!==0&&c.longitude!==0,h=c.node_name||c.name||"Unknown",q=x&&d,z=Ce(c),{isRepeater:U,isCompanion:b,isRoomServer:W,isClient:J,label:ee}=z,ge=x?`${ee} — Direct RF contact (zero-hop neighbor)`:`${ee} — Flood routing (multi-hop via mesh)`,G=c.first_seen?Pe(c.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${f?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${X?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>E(o),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[q&&(d==null?void 0:d.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ns(d.avgSnr)}`}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:ge,children:(()=>{if(W&&U)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(he,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(zs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(W)return e.jsx(he,{className:"w-5 h-5 text-sys-pink"});if(U)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"})});if((b||J)&&h!=="Unknown"){const{emoji:y,cleanName:D}=Ts(h);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:Ls(D)},children:y?e.jsx("span",{className:"text-sm leading-none",children:y}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:$s(h)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:h,children:h}),x&&e.jsx(k,{color:Z.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),f&&e.jsxs(k,{color:Z.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Bs,{className:"w-3 h-3"}),"HUB"]}),U&&e.jsx(k,{color:Z.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),W&&e.jsx(k,{color:Z.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),b&&e.jsx(k,{color:Z.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),J&&e.jsx(k,{color:Z.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),_&&e.jsxs(k,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ot,{className:"w-2.5 h-2.5"}),"MOBILE"]}),!X&&e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0 text-fg-muted/50",title:"No GPS location provided",children:e.jsx(at,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(As,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(ft,{hash:o,collisionInfo:T,isViterbiResolved:S}),!x&&w&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${w.name||w.prefix} (${w.hopCount} hop${w.hopCount!==1?"s":""})`,children:[e.jsx(Es,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:w.prefix}),w.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",w.hopCount-1]})]}),H&&!x&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${H}`,children:[e.jsx(Qs,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:H})]}),j!=null&&j!==0&&e.jsx(k,{color:j>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:j>0?"Path stability improving":"Path stability declining",children:j>0?e.jsx(as,{className:"w-2.5 h-2.5"}):e.jsx(mt,{className:"w-2.5 h-2.5"})}),p.length>0&&(()=>{const y=p.reduce((je,se)=>je+se.count,0);if(y===0)return null;const D=y/24;return e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${y} packets in last 24h (~${D.toFixed(1)}/hr)`,children:[e.jsx(it,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[D<1?"<1":D.toFixed(0),"/hr"]})]})})(),G&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${G}`,children:[e.jsx(Xs,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:G})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[q&&(d==null?void 0:d.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fs,{rssi:d.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(d.avgRssi)})]}),q&&(d==null?void 0:d.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[d.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:g!=null&&e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:gt(g)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:v>0&&e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(v*100).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:c.last_seen?Pe(c.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[x&&e.jsx(e.Fragment,{children:O?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${O.rtt_ms.toFixed(0)}ms`,children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[O.snr_db.toFixed(1),"dB"]})]}):B?e.jsx("span",{className:"text-sys-red text-xs",title:B,children:"✗"}):e.jsx("button",{onClick:y=>fe(o,y),disabled:L,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:$?e.jsx(Oe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Hs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:y=>{y.stopPropagation(),V(o,h)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const yt=a.memo(jt),bt=6371e3,Nt=[],vt=[{field:"lastHeard",icon:Is,label:"Recent"},{field:"distance",icon:He,label:"Distance"},{field:"centrality",icon:De,label:"Centrality"}];function wt(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function kt(o){const c=Ce(o);return wt(c.type)}function ve(o,c){const{color:f="primary",border:x=!1}=c??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?f==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",x&&(o?f==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function Ct(o,c,f,x){const g=(f-o)*Math.PI/180,v=(x-c)*Math.PI/180,p=Math.sin(g/2)*Math.sin(g/2)+Math.cos(o*Math.PI/180)*Math.cos(f*Math.PI/180)*Math.sin(v/2)*Math.sin(v/2),d=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return bt*d}function Mt(){const{stats:o}=rs(),c=os(),f=cs(),x=is(),g=ls(),v=ds(),p=ms(),d=xs(),T=us(),S=ps(),L=Ne[T],$=Ee(),O=Fe(),B=hs(),w=O.totalPaths>0&&O.avgPathConfidence>=.7,H=a.useMemo(()=>{const s=new Map;for(const t of $)s.set(t.prefix,t);return s},[$]),[_,j]=a.useState(null),[E,fe]=a.useState("lastHeard"),[V,X]=a.useState("desc"),[h,q]=a.useState(""),[z,U]=a.useState(!1),[b,W]=a.useState(new Set),[J,ee]=a.useState(!1),[ge,G]=a.useState(null),[y,D]=a.useState(null),[je,se]=a.useState(new Map),[Ie,te]=a.useState(new Map),[C,Be]=a.useState(25),[Q,ce]=a.useState(25),ye=a.useRef(null),ne=a.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),be=bs(),ie=a.useMemo(()=>{if(be.size===0)return ne;const s=new Set;for(const n of Object.keys(ne))s.add((n.startsWith("0x")?n.slice(2):n).toLowerCase());let t=null;for(const[n,r]of be){const i=(n.startsWith("0x")?n.slice(2):n).toLowerCase();s.has(i)||(t||(t={...ne}),t[n]={last_seen:r.lastSeen,name:r.name??void 0,node_name:r.name??void 0,latitude:r.latitude,longitude:r.longitude,is_repeater:r.nodeType==="repeater",contact_type:r.nodeType==="repeater"?"Repeater":r.nodeType==="companion"?"Companion":r.nodeType==="room_server"?"Room Server":void 0})}return t??ne},[ne,be]),A=a.useMemo(()=>{const t=Date.now()/1e3-L.minutes*60;return Object.fromEntries(Object.entries(ie).filter(([n,r])=>c.has(n)?!1:(r.last_seen??0)>=t))},[ie,c,L.minutes]),R=fs(),K=o==null?void 0:o.local_hash,Ve=a.useMemo(()=>{const s=new Map;if(!K||p.size===0)return s;for(const[t,n]of p)if(t.endsWith(`→${K}`)&&n.hops.length>1){const r=t.split("→")[0],i=n.hops[n.hops.length-1];s.set(r,i)}return s},[p,K]),le=a.useMemo(()=>{const s=new Map;if(!(R!=null&&R.latitude)||!(R!=null&&R.longitude))return s;for(const[t,n]of Object.entries(A))n.latitude&&n.longitude&&n.latitude!==0&&n.longitude!==0?s.set(t,Ct(R.latitude,R.longitude,n.latitude,n.longitude)):s.set(t,null);return s},[A,R]),{neighborHashSet:de,neighborSignalMap:qe}=a.useMemo(()=>{const s=new Set,t=new Map;for(const n of v)s.add(n.hash),t.set(n.hash,{avgRssi:n.avgRssi,avgSnr:n.avgSnr});return{neighborHashSet:s,neighborSignalMap:t}},[v]),Me=a.useMemo(()=>{const s=h.toLowerCase().trim(),t=s==="neighbor"||s==="neighbors",n=z||t,r=b.size>0;return Object.fromEntries(Object.entries(A).filter(([i,l])=>{if(r){const M=kt(l);if(!b.has(M))return!1}if(n&&!de.has(i))return!1;if(t||!s)return!0;const I=(l.node_name||l.name||"").toLowerCase(),N=oe(i).toLowerCase();return I.includes(s)||N.includes(s)||i.toLowerCase().includes(s)}))},[A,h,z,de,b]),u=a.useMemo(()=>{const s=Object.entries(Me),t=h.toLowerCase().trim(),n=t.length===2&&/^[0-9a-f]{2}$/i.test(t);return s.sort(([r,i],[l,I])=>{if(n){const M=oe(r).toLowerCase(),F=oe(l).toLowerCase(),ae=M===t,me=F===t;if(ae&&!me)return-1;if(me&&!ae)return 1}let N=0;switch(E){case"lastHeard":N=(i.last_seen||0)-(I.last_seen||0);break;case"distance":{const M=le.get(r)??null,F=le.get(l)??null;M===null&&F===null?N=0:M===null?N=1:F===null?N=-1:N=M-F;break}case"centrality":{const M=g.get(r)||0,F=g.get(l)||0;N=M-F;break}}return V==="desc"?-N:N})},[Me,E,V,le,g,h]),m=a.useMemo(()=>{let s=0,t=0,n=0,r=0,i=0;for(const[,l]of u){const I=Ce(l),N=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0;switch(I.type){case"room_server":n++;break;case"repeater":t++;break;case"companion":s++;break;case"unknown":i++;break}N&&r++}return{companions:s,repeaters:t,roomServers:n,total:u.length,withLocation:r,unknown:i}},[u]),Ue=a.useMemo(()=>new Set(x),[x]),Se=a.useMemo(()=>C===0?u:u.slice(0,Q),[u,Q,C]);a.useEffect(()=>{ce(C||u.length)},[E,V,h,z,b,C,u.length]),a.useEffect(()=>{const s=t=>{t.target.closest("[data-dropdown]")||ee(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),a.useEffect(()=>{if(C===0)return;const s=new IntersectionObserver(t=>{t[0].isIntersecting&&QMath.min(n+C,u.length))},{threshold:.1,rootMargin:"100px"});return ye.current&&s.observe(ye.current),()=>s.disconnect()},[C,Q,u.length]);const We=a.useCallback(s=>{Be(s),ce(s||u.length)},[u.length]),Ge=a.useCallback(s=>{E===s?X(t=>t==="desc"?"asc":"desc"):(fe(s),X("desc"))},[E]),Qe=a.useCallback(s=>{const t=A[s];t!=null&&t.latitude&&(t!=null&&t.longitude)&&t.latitude!==0&&t.longitude!==0&&G(s)},[A]),Ke=a.useCallback(()=>{G(null)},[]),Ye=a.useCallback((s,t)=>{j({hash:s,name:t})},[]),Ze=a.useCallback(async(s,t)=>{if(t.stopPropagation(),!y){D(s),se(n=>{const r=new Map(n);return r.delete(s),r}),te(n=>{const r=new Map(n);return r.delete(s),r});try{const n=s.startsWith("0x")?s.slice(0,4):`0x${s.slice(0,2)}`,r=await Ns(n,30);r.success&&r.data?(se(i=>new Map(i).set(s,r.data)),setTimeout(()=>{se(i=>{const l=new Map(i);return l.delete(s),l})},1e4)):(te(i=>new Map(i).set(s,r.error||"Ping failed")),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3))}catch(n){const r=n instanceof Error?n.message:"Ping failed";te(i=>new Map(i).set(s,r)),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3)}finally{D(null)}}},[y]);return e.jsxs(vs,{children:[e.jsx(ws,{title:"Contacts",icon:e.jsx(re,{}),subtitle:e.jsx(Ms,{}),controls:e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${m.total} discovered node${m.total!==1?"s":""} on the mesh network`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:m.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),m.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Repeaters",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Companions",children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Room Servers",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),m.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"With GPS location",children:[e.jsx(Us,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:m.withLocation})]}),m.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Unknown type",children:[e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:m.unknown})]})]})]}),e.jsxs("div",{className:"flex sm:hidden items-center gap-1.5",children:[e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3 text-fg-secondary"}),e.jsx("span",{children:m.total})]}),m.repeaters>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S})})]})}),e.jsxs(ks,{children:[e.jsx(pt,{neighbors:A,localNode:R??void 0,localHash:K,onRemoveNode:f,selectedNodeHash:ge,onNodeSelected:Ke}),e.jsxs(gs,{noPadding:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-2.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title flex-shrink-0",children:e.jsx(re,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(js,{type:"search",size:"sm",value:h,onChange:s=>q(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ws,{className:"w-3.5 h-3.5"}),trailingIcon:h?e.jsx("button",{onClick:()=>{q(""),(h.toLowerCase().trim()==="neighbor"||h.toLowerCase().trim()==="neighbors")&&U(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(ys,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32 xl:w-44","aria-label":"Search contacts"}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>ee(!J),className:ve(b.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Filter"}),b.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:b.size})]}),J&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:t})=>e.jsxs("button",{onClick:()=>{W(n=>{const r=new Set(n);return r.has(s)?r.delete(s):r.add(s),r})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:we("w-4 h-4 flex items-center justify-center radius-badge border",b.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:b.has(s)&&e.jsx(ke,{className:"w-3 h-3"})}),e.jsx("span",{className:b.has(s)?"text-fg-primary":"text-fg-secondary",children:t})]},s)),b.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>W(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),de.size>0&&e.jsxs("button",{onClick:()=>U(!z),className:ve(z,{color:"success",border:!0}),title:z?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Neighbors"})]})]}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[vt.map(({field:s,icon:t,label:n})=>e.jsxs("button",{onClick:()=>Ge(s),className:ve(E===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(t,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:n}),E===s&&e.jsx(Ys,{className:we("w-3 h-3",V==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Cs,{value:C,onChange:We,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(ue,{value:25,children:"25"}),e.jsx(ue,{value:50,children:"50"}),e.jsx(ue,{value:100,children:"100"}),e.jsx(ue,{value:0,children:"All"})]})]})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:Se.map(([s,t])=>{const n=oe(s),r=Ue.has(s),i=de.has(s),l=le.get(s)??null,I=g.get(s)||0,N=i?qe.get(s):void 0,M=n?H.get(n)??null:null,F=B.get(s)??Nt;let ae=null;if(!i&&K&&p.size>0){const Je=`${s}→${K}`,xe=p.get(Je);if(xe&&xe.hops.length>0){const _e=xe.hops[0],Re=Object.keys(ie).find(es=>es.toUpperCase().startsWith(_e.toUpperCase())),Y=Re?ie[Re]:null;ae={prefix:_e,name:(Y==null?void 0:Y.node_name)??(Y==null?void 0:Y.name)??null,hopCount:xe.hopCount}}}const me=d.has(s),Xe=Ve.get(s)??null;return e.jsx(yt,{hash:s,contact:t,isHub:r,isNeighbor:i,distance:l,centrality:I,sparklineData:F,neighborSignal:N,collisionInfo:M,isViterbiResolved:w,isPinging:y!==null,isPingingThis:y===s,pingResult:je.get(s),pingError:Ie.get(s),gatewayInfo:ae,lastForwarderPrefix:Xe,isMobile:me,onRowClick:Qe,onPing:Ze,onRemove:Ye},s)})}),C>0&&Q0&&Qce(s=>Math.min(s+C,u.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]})]}),e.jsx(qs,{isOpen:!!_,title:"Remove Contact",message:`Are you sure you would like to remove ${(_==null?void 0:_.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{_&&f(_.hash),j(null)},onCancel:()=>j(null)})]})}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Mt},Symbol.toStringTag,{value:"Module"}));export{Kt as C,ft as P,He as R,mt as T}; + */const dt=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],mt=P("trending-down",dt);class xt extends a.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(c){return{hasError:!0,error:c}}render(){var c;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:((c=this.state.error)==null?void 0:c.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const ut=a.lazy(()=>ts(()=>import("./ContactsMapMapLibre-BLoRVnyK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),$e=()=>e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})});function pt({neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d}){return ss()===!1?e.jsx($e,{}):e.jsx(xt,{children:e.jsx(a.Suspense,{fallback:e.jsx($e,{}),children:e.jsx(ut,{neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d})})})}function ht({hash:o,className:c="",size:f="sm",collisionInfo:x,isViterbiResolved:g}){const v=Ee(),p=Fe(),[d,T]=a.useState(!1),S=a.useMemo(()=>oe(o),[o]),L=a.useMemo(()=>x!==void 0?x:S?v.find(j=>j.prefix===S)??null:null,[S,v,x]),$=g??(p.totalPaths>0&&p.avgPathConfidence>=.7),O=a.useCallback(j=>{j.preventDefault(),j.stopPropagation(),T(!0)},[]),B=a.useCallback(()=>{T(!1)},[]);if(!L)return null;const w=f==="sm"?"w-3.5 h-3.5":"w-4 h-4",H=$?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",_=$?`Prefix conflict resolved by Viterbi HMM (${(p.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${L.candidateCount} nodes share prefix "${S}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:O,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${H} ${c}`,title:_,"aria-label":`View prefix conflict for ${S}${$?" (Viterbi resolved)":""}`,children:$?e.jsxs("span",{className:"relative",children:[e.jsx(Ds,{className:w}),e.jsx(ke,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(et,{className:w})}),e.jsx(Os,{isOpen:d,prefix:L.prefix,candidateHashes:L.candidateHashes,onClose:B})]})}const ft=a.memo(ht),Ae=[{target:"Contacts",fn:"name",minStage:1,when:_s},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Rs}];Ps(Ae);function gt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function jt({hash:o,contact:c,isHub:f,isNeighbor:x,distance:g,centrality:v,sparklineData:p,neighborSignal:d,collisionInfo:T,isViterbiResolved:S,isPinging:L,isPingingThis:$,pingResult:O,pingError:B,gatewayInfo:w,lastForwarderPrefix:H,isMobile:_,pathStability:j,onRowClick:E,onPing:fe,onRemove:V}){Ss(Ae);const X=c.latitude&&c.longitude&&c.latitude!==0&&c.longitude!==0,h=c.node_name||c.name||"Unknown",q=x&&d,z=Ce(c),{isRepeater:U,isCompanion:b,isRoomServer:W,isClient:J,label:ee}=z,ge=x?`${ee} — Direct RF contact (zero-hop neighbor)`:`${ee} — Flood routing (multi-hop via mesh)`,G=c.first_seen?Pe(c.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${f?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${X?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>E(o),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[q&&(d==null?void 0:d.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ns(d.avgSnr)}`}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:ge,children:(()=>{if(W&&U)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(he,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(zs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(W)return e.jsx(he,{className:"w-5 h-5 text-sys-pink"});if(U)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"})});if((b||J)&&h!=="Unknown"){const{emoji:y,cleanName:D}=Ts(h);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:Ls(D)},children:y?e.jsx("span",{className:"text-sm leading-none",children:y}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:$s(h)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:h,children:h}),x&&e.jsx(k,{color:Z.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),f&&e.jsxs(k,{color:Z.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Bs,{className:"w-3 h-3"}),"HUB"]}),U&&e.jsx(k,{color:Z.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),W&&e.jsx(k,{color:Z.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),b&&e.jsx(k,{color:Z.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),J&&e.jsx(k,{color:Z.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),_&&e.jsxs(k,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ot,{className:"w-2.5 h-2.5"}),"MOBILE"]}),!X&&e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0 text-fg-muted/50",title:"No GPS location provided",children:e.jsx(at,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(As,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(ft,{hash:o,collisionInfo:T,isViterbiResolved:S}),!x&&w&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${w.name||w.prefix} (${w.hopCount} hop${w.hopCount!==1?"s":""})`,children:[e.jsx(Es,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:w.prefix}),w.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",w.hopCount-1]})]}),H&&!x&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${H}`,children:[e.jsx(Qs,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:H})]}),j!=null&&j!==0&&e.jsx(k,{color:j>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:j>0?"Path stability improving":"Path stability declining",children:j>0?e.jsx(as,{className:"w-2.5 h-2.5"}):e.jsx(mt,{className:"w-2.5 h-2.5"})}),p.length>0&&(()=>{const y=p.reduce((je,se)=>je+se.count,0);if(y===0)return null;const D=y/24;return e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${y} packets in last 24h (~${D.toFixed(1)}/hr)`,children:[e.jsx(it,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[D<1?"<1":D.toFixed(0),"/hr"]})]})})(),G&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${G}`,children:[e.jsx(Xs,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:G})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[q&&(d==null?void 0:d.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fs,{rssi:d.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(d.avgRssi)})]}),q&&(d==null?void 0:d.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[d.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:g!=null&&e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:gt(g)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:v>0&&e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(v*100).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:c.last_seen?Pe(c.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[x&&e.jsx(e.Fragment,{children:O?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${O.rtt_ms.toFixed(0)}ms`,children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[O.snr_db.toFixed(1),"dB"]})]}):B?e.jsx("span",{className:"text-sys-red text-xs",title:B,children:"✗"}):e.jsx("button",{onClick:y=>fe(o,y),disabled:L,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:$?e.jsx(Oe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Hs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:y=>{y.stopPropagation(),V(o,h)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const yt=a.memo(jt),bt=6371e3,Nt=[],vt=[{field:"lastHeard",icon:Is,label:"Recent"},{field:"distance",icon:He,label:"Distance"},{field:"centrality",icon:De,label:"Centrality"}];function wt(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function kt(o){const c=Ce(o);return wt(c.type)}function ve(o,c){const{color:f="primary",border:x=!1}=c??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?f==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",x&&(o?f==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function Ct(o,c,f,x){const g=(f-o)*Math.PI/180,v=(x-c)*Math.PI/180,p=Math.sin(g/2)*Math.sin(g/2)+Math.cos(o*Math.PI/180)*Math.cos(f*Math.PI/180)*Math.sin(v/2)*Math.sin(v/2),d=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return bt*d}function Mt(){const{stats:o}=rs(),c=os(),f=cs(),x=is(),g=ls(),v=ds(),p=ms(),d=xs(),T=us(),S=ps(),L=Ne[T],$=Ee(),O=Fe(),B=hs(),w=O.totalPaths>0&&O.avgPathConfidence>=.7,H=a.useMemo(()=>{const s=new Map;for(const t of $)s.set(t.prefix,t);return s},[$]),[_,j]=a.useState(null),[E,fe]=a.useState("lastHeard"),[V,X]=a.useState("desc"),[h,q]=a.useState(""),[z,U]=a.useState(!1),[b,W]=a.useState(new Set),[J,ee]=a.useState(!1),[ge,G]=a.useState(null),[y,D]=a.useState(null),[je,se]=a.useState(new Map),[Ie,te]=a.useState(new Map),[C,Be]=a.useState(25),[Q,ce]=a.useState(25),ye=a.useRef(null),ne=a.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),be=bs(),ie=a.useMemo(()=>{if(be.size===0)return ne;const s=new Set;for(const n of Object.keys(ne))s.add((n.startsWith("0x")?n.slice(2):n).toLowerCase());let t=null;for(const[n,r]of be){const i=(n.startsWith("0x")?n.slice(2):n).toLowerCase();s.has(i)||(t||(t={...ne}),t[n]={last_seen:r.lastSeen,name:r.name??void 0,node_name:r.name??void 0,latitude:r.latitude,longitude:r.longitude,is_repeater:r.nodeType==="repeater",contact_type:r.nodeType==="repeater"?"Repeater":r.nodeType==="companion"?"Companion":r.nodeType==="room_server"?"Room Server":void 0})}return t??ne},[ne,be]),A=a.useMemo(()=>{const t=Date.now()/1e3-L.minutes*60;return Object.fromEntries(Object.entries(ie).filter(([n,r])=>c.has(n)?!1:(r.last_seen??0)>=t))},[ie,c,L.minutes]),R=fs(),K=o==null?void 0:o.local_hash,Ve=a.useMemo(()=>{const s=new Map;if(!K||p.size===0)return s;for(const[t,n]of p)if(t.endsWith(`→${K}`)&&n.hops.length>1){const r=t.split("→")[0],i=n.hops[n.hops.length-1];s.set(r,i)}return s},[p,K]),le=a.useMemo(()=>{const s=new Map;if(!(R!=null&&R.latitude)||!(R!=null&&R.longitude))return s;for(const[t,n]of Object.entries(A))n.latitude&&n.longitude&&n.latitude!==0&&n.longitude!==0?s.set(t,Ct(R.latitude,R.longitude,n.latitude,n.longitude)):s.set(t,null);return s},[A,R]),{neighborHashSet:de,neighborSignalMap:qe}=a.useMemo(()=>{const s=new Set,t=new Map;for(const n of v)s.add(n.hash),t.set(n.hash,{avgRssi:n.avgRssi,avgSnr:n.avgSnr});return{neighborHashSet:s,neighborSignalMap:t}},[v]),Me=a.useMemo(()=>{const s=h.toLowerCase().trim(),t=s==="neighbor"||s==="neighbors",n=z||t,r=b.size>0;return Object.fromEntries(Object.entries(A).filter(([i,l])=>{if(r){const M=kt(l);if(!b.has(M))return!1}if(n&&!de.has(i))return!1;if(t||!s)return!0;const I=(l.node_name||l.name||"").toLowerCase(),N=oe(i).toLowerCase();return I.includes(s)||N.includes(s)||i.toLowerCase().includes(s)}))},[A,h,z,de,b]),u=a.useMemo(()=>{const s=Object.entries(Me),t=h.toLowerCase().trim(),n=t.length===2&&/^[0-9a-f]{2}$/i.test(t);return s.sort(([r,i],[l,I])=>{if(n){const M=oe(r).toLowerCase(),F=oe(l).toLowerCase(),ae=M===t,me=F===t;if(ae&&!me)return-1;if(me&&!ae)return 1}let N=0;switch(E){case"lastHeard":N=(i.last_seen||0)-(I.last_seen||0);break;case"distance":{const M=le.get(r)??null,F=le.get(l)??null;M===null&&F===null?N=0:M===null?N=1:F===null?N=-1:N=M-F;break}case"centrality":{const M=g.get(r)||0,F=g.get(l)||0;N=M-F;break}}return V==="desc"?-N:N})},[Me,E,V,le,g,h]),m=a.useMemo(()=>{let s=0,t=0,n=0,r=0,i=0;for(const[,l]of u){const I=Ce(l),N=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0;switch(I.type){case"room_server":n++;break;case"repeater":t++;break;case"companion":s++;break;case"unknown":i++;break}N&&r++}return{companions:s,repeaters:t,roomServers:n,total:u.length,withLocation:r,unknown:i}},[u]),Ue=a.useMemo(()=>new Set(x),[x]),Se=a.useMemo(()=>C===0?u:u.slice(0,Q),[u,Q,C]);a.useEffect(()=>{ce(C||u.length)},[E,V,h,z,b,C,u.length]),a.useEffect(()=>{const s=t=>{t.target.closest("[data-dropdown]")||ee(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),a.useEffect(()=>{if(C===0)return;const s=new IntersectionObserver(t=>{t[0].isIntersecting&&QMath.min(n+C,u.length))},{threshold:.1,rootMargin:"100px"});return ye.current&&s.observe(ye.current),()=>s.disconnect()},[C,Q,u.length]);const We=a.useCallback(s=>{Be(s),ce(s||u.length)},[u.length]),Ge=a.useCallback(s=>{E===s?X(t=>t==="desc"?"asc":"desc"):(fe(s),X("desc"))},[E]),Qe=a.useCallback(s=>{const t=A[s];t!=null&&t.latitude&&(t!=null&&t.longitude)&&t.latitude!==0&&t.longitude!==0&&G(s)},[A]),Ke=a.useCallback(()=>{G(null)},[]),Ye=a.useCallback((s,t)=>{j({hash:s,name:t})},[]),Ze=a.useCallback(async(s,t)=>{if(t.stopPropagation(),!y){D(s),se(n=>{const r=new Map(n);return r.delete(s),r}),te(n=>{const r=new Map(n);return r.delete(s),r});try{const n=s.startsWith("0x")?s.slice(0,4):`0x${s.slice(0,2)}`,r=await Ns(n,30);r.success&&r.data?(se(i=>new Map(i).set(s,r.data)),setTimeout(()=>{se(i=>{const l=new Map(i);return l.delete(s),l})},1e4)):(te(i=>new Map(i).set(s,r.error||"Ping failed")),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3))}catch(n){const r=n instanceof Error?n.message:"Ping failed";te(i=>new Map(i).set(s,r)),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3)}finally{D(null)}}},[y]);return e.jsxs(vs,{children:[e.jsx(ws,{title:"Contacts",icon:e.jsx(re,{}),subtitle:e.jsx(Ms,{}),controls:e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${m.total} discovered node${m.total!==1?"s":""} on the mesh network`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:m.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),m.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Repeaters",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Companions",children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Room Servers",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),m.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"With GPS location",children:[e.jsx(Us,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:m.withLocation})]}),m.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Unknown type",children:[e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:m.unknown})]})]})]}),e.jsxs("div",{className:"flex sm:hidden items-center gap-1.5",children:[e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3 text-fg-secondary"}),e.jsx("span",{children:m.total})]}),m.repeaters>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S})})]})}),e.jsxs(ks,{children:[e.jsx(pt,{neighbors:A,localNode:R??void 0,localHash:K,onRemoveNode:f,selectedNodeHash:ge,onNodeSelected:Ke}),e.jsxs(gs,{noPadding:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-2.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title flex-shrink-0",children:e.jsx(re,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(js,{type:"search",size:"sm",value:h,onChange:s=>q(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ws,{className:"w-3.5 h-3.5"}),trailingIcon:h?e.jsx("button",{onClick:()=>{q(""),(h.toLowerCase().trim()==="neighbor"||h.toLowerCase().trim()==="neighbors")&&U(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(ys,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32 xl:w-44","aria-label":"Search contacts"}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>ee(!J),className:ve(b.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Filter"}),b.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:b.size})]}),J&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:t})=>e.jsxs("button",{onClick:()=>{W(n=>{const r=new Set(n);return r.has(s)?r.delete(s):r.add(s),r})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:we("w-4 h-4 flex items-center justify-center radius-badge border",b.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:b.has(s)&&e.jsx(ke,{className:"w-3 h-3"})}),e.jsx("span",{className:b.has(s)?"text-fg-primary":"text-fg-secondary",children:t})]},s)),b.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>W(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),de.size>0&&e.jsxs("button",{onClick:()=>U(!z),className:ve(z,{color:"success",border:!0}),title:z?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Neighbors"})]})]}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[vt.map(({field:s,icon:t,label:n})=>e.jsxs("button",{onClick:()=>Ge(s),className:ve(E===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(t,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:n}),E===s&&e.jsx(Ys,{className:we("w-3 h-3",V==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Cs,{value:C,onChange:We,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(ue,{value:25,children:"25"}),e.jsx(ue,{value:50,children:"50"}),e.jsx(ue,{value:100,children:"100"}),e.jsx(ue,{value:0,children:"All"})]})]})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:Se.map(([s,t])=>{const n=oe(s),r=Ue.has(s),i=de.has(s),l=le.get(s)??null,I=g.get(s)||0,N=i?qe.get(s):void 0,M=n?H.get(n)??null:null,F=B.get(s)??Nt;let ae=null;if(!i&&K&&p.size>0){const Je=`${s}→${K}`,xe=p.get(Je);if(xe&&xe.hops.length>0){const _e=xe.hops[0],Re=Object.keys(ie).find(es=>es.toUpperCase().startsWith(_e.toUpperCase())),Y=Re?ie[Re]:null;ae={prefix:_e,name:(Y==null?void 0:Y.node_name)??(Y==null?void 0:Y.name)??null,hopCount:xe.hopCount}}}const me=d.has(s),Xe=Ve.get(s)??null;return e.jsx(yt,{hash:s,contact:t,isHub:r,isNeighbor:i,distance:l,centrality:I,sparklineData:F,neighborSignal:N,collisionInfo:M,isViterbiResolved:w,isPinging:y!==null,isPingingThis:y===s,pingResult:je.get(s),pingError:Ie.get(s),gatewayInfo:ae,lastForwarderPrefix:Xe,isMobile:me,onRowClick:Qe,onPing:Ze,onRemove:Ye},s)})}),C>0&&Q0&&Qce(s=>Math.min(s+C,u.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]})]}),e.jsx(qs,{isOpen:!!_,title:"Remove Contact",message:`Are you sure you would like to remove ${(_==null?void 0:_.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{_&&f(_.hash),j(null)},onCancel:()=>j(null)})]})}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Mt},Symbol.toStringTag,{value:"Module"}));export{Kt as C,ft as P,He as R,mt as T}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-BLoRVnyK.js b/frontend/dist/assets/ContactsMapMapLibre-BLoRVnyK.js new file mode 100644 index 00000000..874edaf4 --- /dev/null +++ b/frontend/dist/assets/ContactsMapMapLibre-BLoRVnyK.js @@ -0,0 +1,125 @@ +import{d as L0,a7 as na,r as j,e$ as sa,c2 as ia,cV as oa,cW as la,j as m,am as fo,cX as aa,an as ho,m as qt,D as Hr,c as zr,L as Gn,d9 as s0,Z as hr,f0 as Un,f1 as mo,f2 as ua,bU as ca,b_ as fa,c0 as ha,a9 as po,ao as go,A as v0,b as gr,B as Lt,da,bW as ls,M as Ls,S as Ns,d0 as yo,e as xo,cx as wo,R as vo,bo as Gr,bj as ai,f3 as bo,G as ma,K as pa,d8 as ga,f4 as ya,aj as ko,bw as ui,by as xa,E as Vn,F as Wn,bY as wa,aO as va,en as Co,f5 as ba,c1 as ka,f6 as Ca,f7 as Ea,ar as Eo,x as mt,f8 as Sa,f9 as So,a8 as pr,cb as Ma,fa as Mo,fb as Bo,bM as Ba,eZ as Da,bP as _a,c_ as Do,d1 as Ta,P as ja,fc as Ra,ez as Ia,fd as as,fe as La}from"./index-BxXoqIwr.js";import{u as q0,S as I0,L as Kt,M as Na,b as Fa,B as Pa}from"./BasemapLayer-BaN23fEz.js";import{u as _o,r as To,e as ci,f as fi,g as Qa}from"./consumer-registry-PC_rDaZ7.js";import{L as Fn,c as Oa}from"./link-scoring-ChgSAej1.js";import{C as za}from"./ConfirmModal-BsKnU4PL.js";import{b as Ha,e as Ga,a as jo,m as hi,s as Ua,G as xs,f as Va,M as Wa,E as Ya,u as Za,c as $a,h as Ka,i as qa,j as Xa}from"./max-DXCf6XMj.js";import{D as Ro}from"./download-4oqud7e0.js";import{D as Ja}from"./database-ClxUxDRV.js";import{H as Au,A as un,D as di,p as eu,c as tu,u as or}from"./useMapViewStore-Dx0tAQ0a.js";import{R as Io}from"./refresh-cw-D1AU1e6s.js";import{E as Lo}from"./target-CkWLrgj4.js";import{F as ru}from"./funnel-3o6m8jr6.js";import{P as nu}from"./plus-CpcpAQLp.js";import{C as su,a as No,b as ws,c as iu}from"./easing-Pi1r2b4f.js";import{Z as ou}from"./zap-I-XGbFMB.js";import{T as lu}from"./trash-2-DXpoExCg.js";import{W as au}from"./wifi-off-Cd0xYy6R.js";import{W as uu}from"./wifi-CIRTj44S.js";import{C as Fo,H as On,a as i0,N as cu,b as fu}from"./badge-colors-YFzbsFdv.js";import{C as hu}from"./chevron-right-2z1sXpRw.js";import{T as du,P as Po,R as mu}from"./Contacts-CzvSrbCz.js";import{L as pu}from"./LightSparkline-BTQUkuf1.js";import{M as gu}from"./map-pin-CfgGK3Nu.js";import{c as mi}from"./node-types-CUctjdbw.js";import"./triangle-alert-s7OFBXSQ.js";import"./index-m2ldcO9a.js";import"./usePipelineStore-CThQspLf.js";import"./ping-Bv_lBCYg.js";import"./PageLayout-9jTb5LQy.js";import"./listbox-DObLFkCK.js";import"./element-movement-DMWTrEpo.js";import"./MqttModeBadge-B2gdgHRr.js";import"./chat-utils-C_Ic_Z3G.js";import"./SignalIndicator-3GFNHm8Y.js";import"./CollisionExplorerModal-CGe2meHQ.js";import"./monitor-smartphone-CGoLFRac.js";import"./DataBox-VKzAgqy6.js";import"./circle-question-mark-DyqPGIeM.js";import"./network-CkO3-tWX.js";import"./activity-CuCWwHCn.js";import"./search-odjRG97X.js";/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yu=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],vs=L0("boxes",yu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xu=[["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"}]],wu=L0("circle-alert",xu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vu=[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]],Qo=L0("ghost",vu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bu=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],ku=L0("map",bu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cu=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],Eu=L0("mountain",Cu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Su=[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]],Oo=L0("nfc",Su);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mu=[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]],Bu=L0("sigma",Mu);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Du=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],_u=L0("swords",Du);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tu=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ju=L0("wrench",Tu);function Ru(u,c){return c.filter(y=>y.nodes.includes(u)).sort((y,x)=>x.avgCertainCount-y.avgCertainCount)}function Iu(u,c,g){const y=Ru(u,c),x=new Set,C=[];for(const T of y)for(const Q of T.edgeKeys)if(!x.has(Q)){x.add(Q);const D=g.get(Q);C.push({key:Q,certainCount:(D==null?void 0:D.certainCount)??0})}return C.sort((T,Q)=>Q.certainCount-T.certainCount),{loops:y,highlightedEdgeKeys:x,sortedEdges:C}}function Lu(u){const c=new Map;for(const g of u)for(const y of g.edgeKeys){const x=c.get(y)??[];x.push(g),c.set(y,x)}return c}const Cn={MAX_THICKNESS_AT:300,MIN_VALIDATIONS:5},Nu=6,pi=1;function bs(u,c){const g=Math.max(Cn.MIN_VALIDATIONS,Math.min(u,Cn.MAX_THICKNESS_AT)),y=Math.log(Cn.MIN_VALIDATIONS),x=Math.log(Cn.MAX_THICKNESS_AT),T=(Math.log(g)-y)/(x-y);return pi+(Nu-pi)*T}const Fu=Pu(Qu);function Pu(u){return function(c,g,y=g){if(!((g=+g)>=0))throw new RangeError("invalid rx");if(!((y=+y)>=0))throw new RangeError("invalid ry");let{data:x,width:C,height:T}=c;if(!((C=Math.floor(C))>=0))throw new RangeError("invalid width");if(!((T=Math.floor(T!==void 0?T:x.length/C))>=0))throw new RangeError("invalid height");if(!C||!T||!g&&!y)return c;const Q=g&&u(g),D=y&&u(y),E=x.slice();return Q&&D?(Rr(Q,E,x,C,T),Rr(Q,x,E,C,T),Rr(Q,E,x,C,T),Ir(D,x,E,C,T),Ir(D,E,x,C,T),Ir(D,x,E,C,T)):Q?(Rr(Q,x,E,C,T),Rr(Q,E,x,C,T),Rr(Q,x,E,C,T)):D&&(Ir(D,x,E,C,T),Ir(D,E,x,C,T),Ir(D,x,E,C,T)),c}}function Rr(u,c,g,y,x){for(let C=0,T=y*x;C{if(!((Q-=D)>=T))return;let E=c*C[T];const L=D*c,O=L+D;for(let z=T,$=T+L;z<$;z+=D)E+=C[Math.min(Q,z)];for(let z=T,$=Q;z<=$;z+=D)E+=C[Math.min(Q,z+L)],x[z]=(E+g*(C[Math.max(T,z-O)]+C[Math.min(Q,z+O)]))/y,E-=C[Math.max(T,z-L)]}}function Ou(u){const c=2*u+1;return(g,y,x,C,T)=>{if(!((C-=T)>=x))return;let Q=u*y[x];const D=T*u;for(let E=x,L=x+D;E=y&&++g;return g}function Hu(u,c,g){let y;for(;;){const x=Ha(u,c,g);if(x===y||x===0||!isFinite(x))return[u,c];x>0?(u=Math.floor(u/x)*x,c=Math.ceil(c/x)*x):x<0&&(u=Math.ceil(u*x)/x,c=Math.floor(c*x)/x),y=x}}function Gu(u){return Math.max(1,Math.ceil(Math.log(zu(u))/Math.LN2)+1)}var Uu=Array.prototype,zo=Uu.slice;function Vu(u,c){return u-c}function Wu(u){for(var c=0,g=u.length,y=u[g-1][1]*u[0][0]-u[g-1][0]*u[0][1];++c()=>u;function Yu(u,c){for(var g=-1,y=c.length,x;++gy!=$>y&&g<(z-E)*(y-L)/($-L)+E&&(x=-x)}return x}function $u(u,c,g){var y;return Ku(u,c,g)&&qu(u[y=+(u[0]===c[0])],g[y],c[y])}function Ku(u,c,g){return(c[0]-u[0])*(g[1]-u[1])===(g[0]-u[0])*(c[1]-u[1])}function qu(u,c,g){return u<=c&&c<=g||g<=c&&c<=u}function Xu(){}var R0=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function gi(){var u=1,c=1,g=Gu,y=D;function x(E){var L=g(E);if(Array.isArray(L))L=L.slice().sort(Vu);else{const O=Ga(E,Ju);for(L=jo(...Hu(O[0],O[1],L),L);L[L.length-1]>=O[1];)L.pop();for(;L[1]C(E,O))}function C(E,L){const O=L==null?NaN:+L;if(isNaN(O))throw new Error(`invalid value: ${L}`);var z=[],$=[];return T(E,O,function(V){y(V,E,O),Wu(V)>0?z.push([V]):$.push(V)}),$.forEach(function(V){for(var AA=0,oA=z.length,eA;AA=L,R0[Y<<2].forEach(lA);++V0&&$0&&V=0&&O>=0))throw new Error("invalid size");return u=L,c=O,x},x.thresholds=function(E){return arguments.length?(g=typeof E=="function"?E:Array.isArray(E)?K0(zo.call(E)):K0(E),x):g},x.smooth=function(E){return arguments.length?(y=E?D:Xu,x):y===D},x}function Ju(u){return isFinite(u)?u:NaN}function lr(u,c){return u==null?!1:+u>=c}function us(u){return u==null||isNaN(u=+u)?-1/0:u}function yi(u,c,g,y){const x=y-c,C=g-c,T=isFinite(x)||isFinite(C)?x/C:Math.sign(x)/Math.sign(C);return isNaN(T)?u:u+T-.5}function Ac(u){return u[0]}function ec(u){return u[1]}function tc(){return 1}function rc(){var u=Ac,c=ec,g=tc,y=960,x=500,C=20,T=2,Q=C*3,D=y+Q*2>>T,E=x+Q*2>>T,L=K0(20);function O(Y){var cA=new Float32Array(D*E),lA=Math.pow(2,-T),bA=-1;for(const NA of Y){var iA=(u(NA,++bA,Y)+Q)*lA,fA=(c(NA,bA,Y)+Q)*lA,DA=+g(NA,bA,Y);if(DA&&iA>=0&&iA=0&&fAiA*bA))(cA).map((iA,fA)=>(iA.value=+lA[fA],$(iA)))}z.contours=function(Y){var cA=O(Y),lA=gi().size([D,E]),bA=Math.pow(2,2*T),iA=fA=>{fA=+fA;var DA=$(lA.contour(cA,fA*bA));return DA.value=fA,DA};return Object.defineProperty(iA,"max",{get:()=>hi(cA)/bA}),iA};function $(Y){return Y.coordinates.forEach(V),Y}function V(Y){Y.forEach(AA)}function AA(Y){Y.forEach(oA)}function oA(Y){Y[0]=Y[0]*Math.pow(2,T)-Q,Y[1]=Y[1]*Math.pow(2,T)-Q}function eA(){return Q=C*3,D=y+Q*2>>T,E=x+Q*2>>T,z}return z.x=function(Y){return arguments.length?(u=typeof Y=="function"?Y:K0(+Y),z):u},z.y=function(Y){return arguments.length?(c=typeof Y=="function"?Y:K0(+Y),z):c},z.weight=function(Y){return arguments.length?(g=typeof Y=="function"?Y:K0(+Y),z):g},z.size=function(Y){if(!arguments.length)return[y,x];var cA=+Y[0],lA=+Y[1];if(!(cA>=0&&lA>=0))throw new Error("invalid size");return y=cA,x=lA,eA()},z.cellSize=function(Y){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return T=Math.floor(Math.log(Y)/Math.LN2),eA()},z.thresholds=function(Y){return arguments.length?(L=typeof Y=="function"?Y:Array.isArray(Y)?K0(zo.call(Y)):K0(Y),z):L},z.bandwidth=function(Y){if(!arguments.length)return Math.sqrt(C*(C+1));if(!((Y=+Y)>=0))throw new Error("invalid bandwidth");return C=(Math.sqrt(4*Y*Y+1)-1)/2,eA()},z}function ks(){const u=na();return j.useMemo(()=>sa.getPackets(),[u])}function En({label:u,icon:c,status:g,detail:y}){return m.jsxs("div",{className:zr("flex items-center gap-3 py-3 px-4 radius-inset transition-base",g==="active"&&"bg-sys-blue/10",g==="complete"&&"bg-sys-blue/10 ring-2 ring-inset ring-sys-blue",g==="pending"&&"opacity-40"),children:[m.jsx("div",{className:zr("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300",g==="active"&&"bg-sys-blue/20",g==="complete"&&"bg-sys-blue/20",g==="pending"&&"bg-subtle-fill"),children:g==="complete"?m.jsx(Hr,{className:"w-4 h-4 text-sys-blue"}):g==="active"?m.jsx(Gn,{className:"w-4 h-4 animate-spin text-sys-blue"}):m.jsx("span",{className:"text-fg-muted",children:c})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:zr("text-sm font-medium transition-colors",g==="active"&&"text-sys-blue",g==="complete"&&"text-sys-blue",g==="pending"&&"text-fg-muted"),children:u}),y&&g!=="pending"&&m.jsx("div",{className:"text-xs text-fg-muted mt-0.5 truncate",children:y})]})]})}function nc({isOpen:u,onClose:c}){const{packetCacheState:g,triggerDeepAnalysis:y}=ia(),x=oa(),C=la(),T=g.packetCount,[Q,D]=j.useState("fetching");j.useEffect(()=>{u&&y()},[u,y]),j.useEffect(()=>{if(u){if(g.isTopologyLoading)D("fetching");else if(x)D("analyzing"),setTimeout(()=>D("building"),500),setTimeout(()=>D("discovering"),1e3);else if(C>0&&!g.isTopologyLoading){D("complete");const V=setTimeout(()=>{c()},1500);return()=>clearTimeout(V)}}},[u,g.isTopologyLoading,x,C,c]);const E=Q==="complete",L=g.loadProgress,O=j.useMemo(()=>{if(L&&L.target>0){const V=(L.loaded/1e3).toFixed(1),AA=(L.target/1e3).toFixed(1);return`Loading... ${V}k / ${AA}k packets (${L.percent}%)`}return T>0?`${T.toLocaleString()} packets loaded`:"Connecting to database..."},[L,T]),z=V=>{const AA=["fetching","analyzing","building","discovering","complete"],oA=AA.indexOf(Q),eA=AA.indexOf(V);return eA{};return m.jsx(fo,{open:u,onClose:$,size:"sm",bottomSheet:!1,children:m.jsx(aa,{isLoading:!E,borderRadius:16,children:m.jsx(ho,{className:"p-6 radius-card overflow-hidden",children:E?m.jsxs("div",{className:"flex flex-col items-center py-6",children:[m.jsx(qt.div,{variants:Ua,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-sys-blue/20",children:m.jsx(Hr,{className:"w-8 h-8 text-sys-blue"})}),m.jsx("h3",{className:"type-micro text-sys-blue",children:"Ready!"}),m.jsx("button",{onClick:c,className:"mt-3 sm:hidden min-h-[44px] min-w-[44px] px-4 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[m.jsx("div",{className:"w-10 h-10 radius-inset flex items-center justify-center bg-sys-blue/15",children:m.jsx(xs,{className:"w-5 h-5 text-sys-blue"})}),m.jsxs("div",{children:[m.jsx("h3",{className:"type-micro",children:"Deep Analysis"}),m.jsx("p",{className:"text-xs text-fg-muted",children:"Building mesh topology"})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(En,{label:"Fetching Packets",icon:m.jsx(Ro,{className:"w-4 h-4"}),status:z("fetching"),detail:O}),m.jsx(En,{label:"Analyzing Database",icon:m.jsx(Ja,{className:"w-4 h-4"}),status:z("analyzing"),detail:"Processing packet paths"}),m.jsx(En,{label:"Building Topology",icon:m.jsx(xs,{className:"w-4 h-4"}),status:z("building"),detail:"Computing mesh edges"}),m.jsx(En,{label:"Discovering Nodes",icon:m.jsx(Qo,{className:"w-4 h-4"}),status:z("discovering"),detail:"Viterbi HMM ghost detection"})]}),m.jsx("p",{className:"text-xs text-fg-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})}const sc=j.memo(nc),Ho=16,Cs=24,ic=Ho,oc=5,dr={nodeFill:s0.blue,nodeStroke:"rgba(255,255,255,0.9)",nodeColor:s0.indigo,localColor:s0.amber,hubColor:s0.purple,gatewayColor:s0.indigo,mobileColor:s0.orange,roomServerColor:s0.pink,neighborColor:s0.amber,edges:{rest:hr[700],restBright:hr[600],restDim:hr[800],hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:hr[400],hoverNeighbor:s0.amber,neighborRest:hr[500],neighborHover:s0.amber,highlight:"#FFD700"},edgeOpacity:.82};function Fs(){if(typeof window>"u")return dr;const u=Un(),c=mo();return{nodeFill:u.nodeFill,nodeStroke:u.nodeStroke,nodeColor:dr.nodeColor,localColor:u.localColor,hubColor:u.hubColor,gatewayColor:u.gatewayColor,mobileColor:u.mobileColor,roomServerColor:u.roomColor,neighborColor:u.neighborColor,edges:{rest:c.rest,restBright:c.restBright,restDim:c.restDim,hoverDirect:c.hoverDirect,hoverLoop:c.hoverLoop,hoverStandard:c.hoverStandard,hoverNeighbor:c.hoverNeighbor,neighborRest:dr.edges.neighborRest,neighborHover:dr.edges.neighborHover,highlight:c.highlight},edgeOpacity:dr.edgeOpacity}}const Sn=2e3,Mn=750,lc="#00FF00",ac=500,xi=500,wi=250,uc=150,Go=200,cc=gr.snappy;function Lr({color:u,ring:c}){const g=ic-2;return m.jsx("span",{className:"shrink-0 rounded-full","aria-hidden":"true",style:{width:g,height:g,backgroundColor:c?"transparent":u,border:c?`${oc-1}px solid ${u}`:void 0,boxSizing:"border-box"}})}function cs({color:u,pattern:c="solid"}){return m.jsx("svg",{className:"shrink-0","aria-hidden":"true",width:18,height:6,viewBox:"0 0 18 6",children:m.jsx("line",{x1:0,y1:3,x2:18,y2:3,stroke:u,strokeWidth:3,strokeLinecap:"round",strokeDasharray:c==="dashed"?"5,3":c==="dotted"?"2,3":void 0})})}function n0({indicator:u,label:c,tooltip:g}){return m.jsxs("div",{className:"flex items-center gap-1.5",children:[u,m.jsx("span",{className:"text-fg-secondary",children:c}),g&&m.jsx(po,{content:g,delay:Go,children:m.jsx("span",{className:"cursor-help text-[11px] text-fg-muted opacity-75 hover:opacity-100 transition-opacity",children:"ⓘ"})})]})}function fc(u){return`legend-section-${u.toLowerCase().replace(/\s+/g,"-")}`}function fs({title:u,tooltip:c,isOpen:g,onToggle:y,showDivider:x,children:C}){const T=fc(u);return m.jsxs("div",{className:x?"mt-2 pt-2 border-t border-edge-subtle":"",children:[m.jsxs("button",{type:"button",onClick:y,"aria-expanded":g,"aria-controls":T,className:"group w-full flex items-center justify-between py-1 min-h-[44px] sm:min-h-0 font-medium text-fg-secondary hover:text-fg-primary transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[u,m.jsx(po,{content:c,delay:Go,children:m.jsx("span",{className:"cursor-help text-[11px] text-fg-muted opacity-75 group-hover:opacity-100 transition-opacity",children:"ⓘ"})})]}),m.jsx(qt.span,{animate:{rotate:g?0:-90},transition:{duration:.15},"aria-hidden":"true",children:m.jsx(go,{className:"w-3 h-3 text-fg-muted"})})]}),m.jsx(v0,{initial:!1,children:g&&m.jsx(qt.div,{id:T,role:"region","aria-label":u,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:cc,className:"overflow-hidden",children:m.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:C})})})]})}function vi({label:u,value:c,color:g}){return m.jsxs("div",{className:"flex justify-between tabular-nums text-fg-muted",children:[m.jsx("span",{children:u}),m.jsx("span",{className:g?"":"text-fg-secondary",style:g?{color:g}:void 0,children:c})]})}function bi({icon:u,color:c,title:g,subtitle:y}){return m.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-edge-subtle",children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"shrink-0",style:{color:c},children:u}),m.jsxs("div",{className:"flex flex-col min-w-0",children:[m.jsx("span",{className:"font-medium truncate",style:{color:c},children:g}),m.jsx("span",{className:"text-[10px] leading-tight text-fg-muted",children:y})]})]})})}function hc(u){return u.some(([,c])=>{var y;const g=(y=c.contact_type)==null?void 0:y.toLowerCase();return g==="room server"||g==="room_server"||g==="room"||g==="server"})}function dc(u){let c=0;for(const g of u.txDelayRecommendations.values())g.networkRole==="backbone"&&c++;return c}function mc({showTopology:u,validatedPolylineCount:c,filteredNeighborCount:g,hasLocalNode:y,meshTopology:x,zeroHopNeighbors:C,neighborsWithLocation:T,basemapMode:Q="dark"}){const D=ua(),E=ca(),L=fa(),O=E.filter(lA=>lA.isLikelyReal).length,z=dc(x),$=C.size>0,[V,AA]=j.useState(!0),[oA,eA]=j.useState(!0),[Y,cA]=j.useState(!0);return m.jsxs("div",{className:"map-control-surface p-2.5 text-xs",children:[m.jsxs(fs,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:V,onToggle:()=>AA(lA=>!lA),children:[m.jsx(n0,{indicator:m.jsx(Lr,{color:D.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),m.jsx(n0,{indicator:m.jsx(Lr,{color:D.hubColor}),label:"Hub",tooltip:"Network hub (≥10% of last-hop traffic)."}),hc(T)&&m.jsx(n0,{indicator:m.jsx(ha,{className:"w-3 h-3 shrink-0",style:{color:D.roomColor},strokeWidth:2.5}),label:"Room",tooltip:"Room Server identity for client sync."}),m.jsx(n0,{indicator:m.jsx(Au,{className:"w-3 h-3 shrink-0",style:{color:D.localColor},strokeWidth:2.5}),label:"Local",tooltip:"Your repeater running pyMC_Repeater."}),$&&m.jsx(n0,{indicator:m.jsx(Lr,{color:D.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),x.gatewayNodes.length>0&&m.jsx(n0,{indicator:m.jsx(Lr,{color:D.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),z>0&&m.jsx(n0,{indicator:m.jsx(Lr,{color:D.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),x.mobileNodes.length>0&&m.jsx(n0,{indicator:m.jsx(Lr,{color:D.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),O>0&&m.jsx(n0,{indicator:m.jsx(Qo,{className:"w-3 h-3 shrink-0",style:{color:D.ghostColor},strokeWidth:2.5}),label:`Ghost (${O})`,tooltip:"Unknown repeater from Viterbi analysis."})]}),$&&m.jsxs(fs,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:oA,onToggle:()=>eA(lA=>!lA),showDivider:!0,children:[m.jsx(n0,{indicator:m.jsx(cs,{color:Fn.YELLOW,pattern:"solid"}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),m.jsx(n0,{indicator:m.jsx(cs,{color:Fn.GREEN,pattern:"dashed"}),label:"Listener",tooltip:">67% listener. They hear us well."}),m.jsx(n0,{indicator:m.jsx(cs,{color:Fn.RED,pattern:"dotted"}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),u&&c>0&&m.jsxs(fs,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:Y,onToggle:()=>cA(lA=>!lA),showDivider:!0,children:[m.jsx(vi,{label:"Nodes",value:g+(y?1:0)}),x.hubNodes.length>0&&m.jsx(vi,{label:"Hubs",value:x.hubNodes.length,color:dr.hubColor}),x.loops.length>0&&m.jsx(bi,{icon:m.jsx(Io,{className:"w-3 h-3"}),color:dr.edges.hoverLoop,title:`${x.loops.length} ${x.loops.length===1?"Loop":"Loops"}`,subtitle:"Redundant paths"}),L.totalPaths>0&&m.jsx(bi,{icon:m.jsx(Lo,{className:"w-3 h-3"}),color:D.ghostColor,title:`${L.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]})}const ki={repeater:"blue",companion:"cyan",room_server:"pink",hubs:"indigo",direct:"green"},Bn={repeater:"Repeaters",companion:"Companions",room_server:"Rooms",hubs:"Hubs",direct:"Direct"},Ci={repeater:"Repeater nodes (mesh relays)",companion:"Companion devices (clients)",room_server:"Room server nodes",hubs:"Hub nodes and their connections",direct:"Zero-hop (direct RF) neighbors"},pc=["repeater","companion","room_server"],Ei=["hubs","direct"],Nr="!p-2.5 sm:!p-1.5 !rounded-md min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 shrink-0 flex items-center justify-center",Dn="!p-2.5 sm:!p-1.5 !rounded-none min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 shrink-0 flex items-center justify-center",gc=()=>typeof window>"u"?!1:window.innerWidth<640;function yc({mapRef:u,showNeighborLines:c,onToggleNeighborLines:g,hasNeighborPolylines:y,nodeFilters:x,onToggleFilter:C,onToggleAll:T,filterCounts:Q,showCoverage:D,onToggleCoverage:E,showMinCut:L=!1,onToggleMinCut:O,hasMinCutData:z=!1,show3DTerrain:$,onToggle3DTerrain:V,basemapMode:AA,onToggleBasemap:oA,isFullscreen:eA,onToggleFullscreen:Y,showLinkQuality:cA=!1,onToggleLinkQuality:lA,hasTraceLinks:bA=!1}){const[iA,fA]=j.useState(()=>!gc()),DA=()=>{var FA,GA;(GA=(FA=u.current)==null?void 0:FA.getMap())==null||GA.zoomIn()},TA=()=>{var FA,GA;(GA=(FA=u.current)==null?void 0:FA.getMap())==null||GA.zoomOut()},CA=()=>{var GA;const FA=(GA=u.current)==null?void 0:GA.getMap();FA&&FA.easeTo({bearing:0,pitch:0,duration:300})},mA="w-4 h-4",IA=AA==="light"?"#525252":"var(--fg-secondary)",NA=x.length>=un.length;return m.jsx(m.Fragment,{children:m.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4 max-w-[calc(100vw-1.5rem)] sm:max-w-none pr-[env(safe-area-inset-right)]",children:[m.jsxs("div",{className:"map-control-surface flex flex-nowrap items-center gap-0.5 sm:gap-1 p-1 overflow-hidden",children:[y&&m.jsx(Lt,{plain:!0,color:c?"warning":"muted",onClick:g,title:c?"Hide edge lines":"Show edge lines","aria-label":c?"Hide edge lines":"Show edge lines","aria-pressed":c,className:Nr,"data-tint":c?"warning":void 0,children:m.jsx(da,{className:mA})}),m.jsx(Lt,{plain:!0,color:"muted",onClick:()=>fA(FA=>!FA),title:iA?"Hide node filters":"Show node filters","aria-label":iA?"Collapse node filters":"Expand node filters","aria-expanded":iA,className:Nr,children:m.jsx(ru,{className:mA})}),m.jsx(v0,{initial:!1,children:iA&&m.jsxs(qt.div,{className:"flex items-center gap-0.5 flex-nowrap overflow-x-auto scrollbar-none max-w-[50vw] sm:max-w-none sm:overflow-visible",role:"group","aria-label":"Node type filters",initial:{width:0,opacity:0},animate:{width:"auto",opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:[.4,0,.2,1]},children:[m.jsx(ls,{color:NA?"green":"zinc",customColor:NA?void 0:IA,onClick:T,title:"Show all nodes","aria-pressed":NA,"aria-label":"Show all node types",className:"shrink-0",children:"All"}),pc.map(FA=>{const GA=Q[FA];if(GA===0)return null;const vA=!NA&&x.includes(FA);return m.jsx(ls,{color:vA?ki[FA]:"zinc",customColor:vA?void 0:IA,onClick:()=>C(FA),title:Ci[FA],"aria-pressed":vA,"aria-label":`${Bn[FA]} (${GA})`,className:"shrink-0",children:Bn[FA]},FA)}),Ei.some(FA=>Q[FA]>0)&&m.jsx("span",{className:"mx-0.5 h-3 w-px bg-[var(--map-ui-border,var(--edge-subtle))] hidden sm:block shrink-0","aria-hidden":"true"}),Ei.map(FA=>{const GA=Q[FA];if(GA===0)return null;const vA=!NA&&x.includes(FA);return m.jsx(ls,{color:vA?ki[FA]:"zinc",customColor:vA?void 0:IA,onClick:()=>C(FA),title:Ci[FA],"aria-pressed":vA,"aria-label":`${Bn[FA]} (${GA})`,className:"shrink-0",children:Bn[FA]},FA)})]})}),z&&O&&m.jsx(Lt,{plain:!0,color:L?"primary":"muted",onClick:O,title:L?"Hide community partition":"Show community partition","aria-label":L?"Hide community partition":"Show community partition","aria-pressed":L,className:Nr,"data-tint":L?"primary":void 0,children:m.jsx(vs,{className:mA})}),m.jsx(Lt,{plain:!0,color:AA==="light"?"primary":"muted",onClick:oA,title:AA==="light"?"Switch to dark map":"Switch to light map","aria-label":AA==="light"?"Switch to dark map":"Switch to light map","aria-pressed":AA==="light",className:Nr,"data-tint":AA==="light"?"primary":void 0,children:AA==="light"?m.jsx(Ls,{className:mA}):m.jsx(Ns,{className:mA})}),m.jsx(Lt,{plain:!0,color:$?"success":"muted",onClick:V,title:$?"Disable 3D terrain":"Enable 3D terrain","aria-label":$?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":$,className:Nr,"data-tint":$?"success":void 0,children:m.jsx(Eu,{className:mA})}),m.jsx(Lt,{plain:!0,color:"muted",onClick:Y,title:eA?"Exit fullscreen":"Fullscreen","aria-label":eA?"Exit fullscreen":"Enter fullscreen","aria-pressed":eA,className:Nr,children:eA?m.jsx(Va,{className:mA}):m.jsx(Wa,{className:mA})})]}),m.jsxs("div",{className:"map-control-surface flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[m.jsx(Lt,{plain:!0,color:"muted",onClick:DA,title:"Zoom in","aria-label":"Zoom in",className:Dn,children:m.jsx(nu,{className:mA})}),m.jsx("div",{className:"h-px bg-border-subtle","aria-hidden":"true"}),m.jsx(Lt,{plain:!0,color:"muted",onClick:TA,title:"Zoom out","aria-label":"Zoom out",className:Dn,children:m.jsx(yo,{className:mA})}),m.jsx("div",{className:"h-px bg-border-subtle","aria-hidden":"true"}),m.jsx(Lt,{plain:!0,color:"muted",onClick:CA,title:"Reset bearing to north","aria-label":"Reset bearing to north",className:Dn,children:m.jsx(su,{className:mA})})]}),bA&&lA&&m.jsx("div",{className:"map-control-surface flex flex-col items-stretch !overflow-hidden self-end !p-0",children:m.jsx(Lt,{plain:!0,color:cA?"success":"muted",onClick:lA,title:cA?"Hide link quality overlay":"Show link quality overlay","aria-label":cA?"Hide link quality overlay":"Show link quality overlay","aria-pressed":cA,className:Dn,"data-tint":cA?"success":void 0,children:m.jsx(Oo,{className:mA})})})]})})}const xc="#4ADE80",wc="#16A34A",vc="rgba(10, 26, 10, 1)",bc="rgba(220, 252, 231, 1)",ar="DeepAnalysis",kc=700,Si="abcdefghijklmnopqrstuvwxyz0123456789";function Cc(){return Si[Math.floor(Math.random()*Si.length)]}function Ec({isActive:u,hasAnalyzed:c,isLoading:g,onClick:y,basemapMode:x="dark"}){const C=x==="light",T=C?wc:xc,[Q,D]=j.useState(!1),[E,L]=j.useState(ar),O=j.useRef(!1),z=j.useRef(null),[$]=j.useState(()=>{var eA;return typeof window<"u"&&(((eA=window.matchMedia)==null?void 0:eA.call(window,"(hover: hover)").matches)??!1)}),V=Q&&!u&&!g&&$;j.useEffect(()=>{if(Q&&!u&&!g&&!O.current){O.current=!0;const eA=performance.now(),Y=cA=>{const lA=cA-eA,bA=Math.min(lA/kc,1),iA=Math.floor(bA*ar.length);let fA="";for(let DA=0;DA{z.current&&cancelAnimationFrame(z.current)}},[Q,u,g]);const AA=g?"Analyzing...":E,oA=g?"Analyzing packet history":c?u?"Hide topology edges":"Show topology edges":"Load full packet history and build topology";return m.jsxs("button",{onClick:y,onMouseEnter:()=>$&&D(!0),onMouseLeave:()=>$&&D(!1),onPointerEnter:()=>$&&D(!0),onPointerLeave:()=>$&&D(!1),disabled:g,className:`map-tool-btn flex items-center gap-2 w-full text-left radius-inner transition-base ${g?"cursor-wait":""}`,style:{padding:"0.5rem 0.625rem",...u&&{backgroundColor:C?bc:vc}},title:oA,"aria-label":oA,"aria-pressed":u,children:[g?m.jsx(Gn,{className:"w-3.5 h-3.5 shrink-0 animate-spin",style:{color:T}}):m.jsx(xs,{className:`w-3.5 h-3.5 shrink-0 transition-colors ${u?"":"text-fg-secondary"}`,style:{...u&&{color:T},...V&&{color:T}}}),m.jsx("span",{className:`${u?"":"text-fg-secondary"}`,"aria-hidden":"true",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:u||V?700:500,letterSpacing:"-0.01em",lineHeight:1,...u&&{color:T},...V&&{color:T}},children:AA})]})}const Sc=s0.teal,Mc="#0D7377",Bc="rgba(10, 36, 32, 1)",Dc="rgba(204, 251, 241, 1)",Mi="LiveTrace",_c=400,Bi=100;function Tc({isActive:u,onClick:c,basemapMode:g="dark"}){const y=g==="light",x=y?Mc:Sc,[C,T]=j.useState(!1),[Q,D]=j.useState(0),E=j.useRef(!1),L=j.useRef(null),[O,z]=j.useState(0),$=j.useRef(!1),[V]=j.useState(()=>{var Y;return typeof window<"u"&&(((Y=window.matchMedia)==null?void 0:Y.call(window,"(hover: hover)").matches)??!1)}),AA=C&&!u&&V;j.useEffect(()=>{AA&&!$.current&&($.current=!0,z(1),setTimeout(()=>z(2),Bi),setTimeout(()=>z(3),Bi*2)),C||($.current=!1,z(0))},[AA,C]),j.useEffect(()=>{if(C&&!u&&!E.current){E.current=!0;const Y=performance.now(),cA=lA=>{const bA=lA-Y,iA=Math.min(bA/_c,1);D(iA),iA<1&&(L.current=requestAnimationFrame(cA))};L.current=requestAnimationFrame(cA)}return C||(L.current&&(cancelAnimationFrame(L.current),L.current=null),E.current=!1,D(0)),()=>{L.current&&cancelAnimationFrame(L.current)}},[C,u]);const oA=Y=>{if(u)return x;if(!AA)return;const cA=Mi.length,lA=Q*(cA+2);return Y>=lA-2&&YV&&T(!0),onMouseLeave:()=>V&&T(!1),onPointerEnter:()=>V&&T(!0),onPointerLeave:()=>V&&T(!1),className:"map-tool-btn flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",...u&&{backgroundColor:y?Dc:Bc}},title:u?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing","aria-label":eA,"aria-pressed":u,children:[m.jsx(ou,{className:`w-3.5 h-3.5 shrink-0 ${u?"":"text-fg-secondary"}`,fill:O===1?"#FFFFFF":O===3?x:"none",stroke:O===1||O===2?"#FFFFFF":u||AA?x:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),m.jsx("span",{className:`${u?"":"text-fg-secondary"}`,"aria-hidden":"true",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:u||AA?700:500,letterSpacing:"-0.01em",lineHeight:1},children:Mi.split("").map((Y,cA)=>m.jsx("span",{style:{color:oA(cA)||void 0},children:Y},cA))})]})}const Di=.2,jc="rgba(26, 20, 8, 1)",Rc="rgba(254, 243, 199, 1)",hs=.01,ds=1,_i="#fe8019",Ic="'Wardrive', serif",Es=1.45,Lc=Es*1.1,Nc=80;function Fc({isActive:u,onClick:c,brightness:g=.7,onBrightnessChange:y,basemapMode:x="dark"}){const C=x==="light",[T,Q]=j.useState(!1),[D,E]=j.useState(!1),[L]=j.useState(()=>{var Y;return typeof window<"u"&&(((Y=window.matchMedia)==null?void 0:Y.call(window,"(hover: hover)").matches)??!1)});j.useEffect(()=>{if(!T||u)return;const Y=requestAnimationFrame(()=>E(!0)),cA=setTimeout(()=>E(!1),Nc);return()=>{cancelAnimationFrame(Y),clearTimeout(cA)}},[T,u]);const O=Math.max(hs,Math.min(ds,g)),z=Y=>{Y.stopPropagation();const cA=Math.min(ds,O+Di);y==null||y(cA)},$=Y=>{Y.stopPropagation();const cA=Math.max(hs,O-Di);y==null||y(cA)},V=Ohs+.001,oA=T&&!u&&L,eA=u?"Configure wardriving coverage":"Show wardriving coverage";return m.jsxs("button",{onClick:c,onMouseEnter:()=>L&&Q(!0),onMouseLeave:()=>L&&Q(!1),onPointerEnter:()=>L&&Q(!0),onPointerLeave:()=>L&&Q(!1),className:"map-tool-btn flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",...u&&{backgroundColor:C?Rc:jc}},title:eA,"aria-label":eA,"aria-pressed":u,children:[m.jsx(_u,{className:`w-3.5 h-3.5 shrink-0 transition-colors ${u?"text-sys-amber":"text-fg-secondary"}`,style:oA?{color:_i}:void 0}),m.jsx("span",{className:`${u?"text-sys-amber":"text-fg-secondary"}`,"aria-hidden":"true",style:{fontFamily:u||oA?Ic:"ui-monospace, SFMono-Regular, monospace",fontSize:u||oA?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:u?`scale(${Es})`:oA?`scale(${D?Lc:Es})`:void 0,transformOrigin:"left center",...oA?{color:_i}:{}},children:"Wardrive"}),u&&y&&m.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[m.jsx("button",{onClick:$,disabled:!AA,className:`p-1 sm:p-0.5 min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center rounded transition-colors ${AA?"text-sys-amber hover:bg-[var(--map-ui-hover,var(--elevated))] active:bg-[var(--map-ui-active,var(--subtle))]":"cursor-not-allowed"}`,style:AA?void 0:{color:C?"rgba(0, 0, 0, 0.25)":"rgba(251, 191, 36, 0.3)"},title:`Decrease opacity (${Math.round(O*100)}%)`,"aria-label":`Decrease opacity, currently ${Math.round(O*100)}%`,children:m.jsx(Ls,{className:"w-3.5 h-3.5"})}),m.jsx("button",{onClick:z,disabled:!V,className:`p-1 sm:p-0.5 min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center rounded transition-colors ${V?"text-sys-amber hover:bg-[var(--map-ui-hover,var(--elevated))] active:bg-[var(--map-ui-active,var(--subtle))]":"cursor-not-allowed"}`,style:V?void 0:{color:C?"rgba(0, 0, 0, 0.25)":"rgba(251, 191, 36, 0.3)"},title:`Increase opacity (${Math.round(O*100)}%)`,"aria-label":`Increase opacity, currently ${Math.round(O*100)}%`,children:m.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]})}const Pc="0123456789bcdefghjkmnpqrstuvwxyz";function Qc(u){let c=!0,g=-90,y=90,x=-180,C=180;for(const T of u.toLowerCase()){const Q=Pc.indexOf(T);if(Q!==-1)for(let D=4;D>=0;D--){const E=Q>>D&1;if(c){const L=(x+C)/2;E?x=L:C=L}else{const L=(g+y)/2;E?g=L:y=L}c=!c}}return{lat:(g+y)/2,lon:(x+C)/2}}function Oc(u){return Math.exp(-u*Math.LN2/7)}const Ss="pymc-wardriving-url",Uo="pymc-wardriving-enabled",Vo="pymc-wardriving-brightness",Ti=.7;function zc(){return typeof localStorage>"u"?"":localStorage.getItem(Ss)||""}function ji(u){typeof localStorage>"u"||(u?localStorage.setItem(Ss,u):localStorage.removeItem(Ss))}function Hc(){return typeof localStorage>"u"?!1:localStorage.getItem(Uo)==="true"}function _n(u){typeof localStorage>"u"||localStorage.setItem(Uo,String(u))}function Gc(){if(typeof localStorage>"u")return Ti;const u=localStorage.getItem(Vo);if(u){const c=parseFloat(u);if(!isNaN(c)&&c>=.01&&c<=1)return c}return Ti}function Uc(u){if(typeof localStorage>"u")return;const c=Math.max(.01,Math.min(1,u));localStorage.setItem(Vo,String(c))}const Vc=8e3;async function Wc(u,c={},g=Vc){const y=new AbortController,x=setTimeout(()=>y.abort(),g);try{return await fetch(u,{...c,signal:y.signal})}catch(C){throw C instanceof Error&&C.name==="AbortError"?new Error(`Connection timed out after ${g/1e3}s`):C}finally{clearTimeout(x)}}async function Yc(u){const g=`${u.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,y=await Wc(g,{headers:{Accept:"application/json"}});if(!y.ok)throw new Error(`Failed to fetch precise samples: ${y.status}`);return y.json()}function Zc(u,c=null){if(u!==null){const y=(Math.max(-12,Math.min(12,u))+12)/24;if(c!==null){const C=(Math.max(-120,Math.min(-50,c))+120)/70;return y*.8+C*.2}return y}return c!==null?(Math.max(-120,Math.min(-50,c))+120)/70:.5}function $c(u){var g;const c=[];for(const y of u.keys){if(!y.observed)continue;const{lat:x,lon:C}=Qc(y.hash),T=parseInt(y.time,10),Q=isNaN(T)?30:(Date.now()-T)/(1e3*60*60*24),D=Oc(Q),L=Zc(y.snr,y.rssi)*(.3+D*.7);c.push({lat:x,lon:C,successRate:y.observed?1:0,weight:L,totalSamples:1,ageDays:Q,geohash:y.hash,repeaters:((g=y.path)==null?void 0:g.map(O=>O.toLowerCase()))||[]})}return c}const cn=xo((u,c)=>({status:"idle",isVisible:Hc(),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:zc(),brightness:Gc(),isModalOpen:!1,openModal:()=>u({isModalOpen:!0}),closeModal:()=>u({isModalOpen:!1}),setUrl:g=>u({url:g}),setBrightness:g=>{const y=Math.max(.01,Math.min(1,g));Uc(y),u({brightness:y})},toggleVisibility:()=>{const g=!c().isVisible;_n(g),u({isVisible:g})},setVisible:g=>{_n(g),u({isVisible:g})},loadCoverage:async g=>{if(!g.trim())return u({error:"Please enter a URL",status:"error"}),!1;try{new URL(g.trim())}catch{return u({error:"Invalid URL format",status:"error"}),!1}u({error:null,status:"connecting"});try{u({status:"loading"});const y=await Yc(g.trim());if(!y||typeof y!="object")throw new Error("Invalid response from server");if(!Array.isArray(y.keys))throw new Error("No sample data found in response");u({status:"processing"});const x=$c(y);if(x.length===0)throw new Error("No valid coverage points found");return u({coveragePoints:x,repeaters:[],stats:{coverageCount:x.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:g.trim()}),ji(g.trim()),_n(!0),!0}catch(y){const x=y instanceof Error?y.message:"Failed to load coverage data";let C=x;return x.includes("timed out")?C="Connection timed out. Server may be unreachable or slow.":x.includes("Failed to fetch")||x.includes("NetworkError")?C="Could not connect to server. Check the URL and try again.":x.includes("CORS")?C="Server does not allow cross-origin requests.":x.includes("404")?C="Coverage endpoint not found. Check the URL.":(x.includes("ERR_NAME_NOT_RESOLVED")||x.includes("DNS"))&&(C="Server not found. Check the URL for typos."),u({error:C,status:"error"}),!1}},clearCoverage:()=>{u({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),ji(""),_n(!1)}})),Kc={bg:"#F8F8F8",bgSubtle:"#F0F0F0",bgElevated:"#FFFFFF",bgInput:"#FFFFFF",border:"rgba(0, 0, 0, 0.12)",borderStrong:"rgba(0, 0, 0, 0.20)",borderFocus:"#3B82F6",text:"#1A1A1A",textSecondary:"#4A4A4A",textMuted:"#737373",success:"#059669",successBg:"#ECFDF5",successBorder:"#A7F3D0",error:"#DC2626",errorBg:"#FEF2F2",errorBorder:"#FECACA",info:"#2563EB",infoBg:"#EFF6FF",infoBorder:"#BFDBFE",warning:"#D97706",warningBg:"#FFFBEB",warningBorder:"#FDE68A",primary:"#F59E0B",hoverBg:"rgba(0, 0, 0, 0.04)",sliderTrack:"#E5E7EB",sliderThumb:"#F59E0B"},Wo={bg:"var(--surface)",bgSubtle:"var(--subtle)",bgElevated:"var(--elevated)",bgInput:"var(--subtle)",border:"var(--edge-subtle)",borderStrong:"var(--edge-strong)",borderFocus:"var(--sys-blue)",text:"var(--fg-primary)",textSecondary:"var(--fg-secondary)",textMuted:"var(--fg-muted)",success:"var(--sys-green)",successBg:"rgba(74, 222, 128, 0.1)",successBorder:"rgba(74, 222, 128, 0.3)",error:"var(--sys-red)",errorBg:"rgba(239, 68, 68, 0.1)",errorBorder:"rgba(239, 68, 68, 0.3)",info:"var(--sys-indigo)",infoBg:"rgba(249, 210, 111, 0.1)",infoBorder:"rgba(249, 210, 111, 0.3)",warning:"var(--sys-indigo)",warningBg:"rgba(249, 210, 111, 0.1)",warningBorder:"rgba(249, 210, 111, 0.3)",primary:"var(--sys-indigo)",hoverBg:"var(--hover-tint)",sliderTrack:"var(--elevated)",sliderThumb:"var(--sys-indigo)"},Yo=j.createContext({theme:Wo,isLight:!1});function yr(){return j.useContext(Yo)}function qc({status:u,hasData:c}){const{theme:g,isLight:y}=yr(),x=j.useMemo(()=>u==="connecting"||u==="loading"||u==="processing"?{icon:m.jsx(Gn,{className:"w-3.5 h-3.5 animate-spin"}),label:u==="connecting"?"Connecting...":u==="loading"?"Loading...":"Processing...",color:g.warning,bg:g.warningBg}:u==="error"?{icon:m.jsx(au,{className:"w-3.5 h-3.5"}),label:"Disconnected",color:g.error,bg:g.errorBg}:c?{icon:m.jsx(uu,{className:"w-3.5 h-3.5"}),label:"Connected",color:g.success,bg:g.successBg}:{icon:m.jsx(vo,{className:"w-3.5 h-3.5"}),label:"Ready",color:g.textMuted,bg:y?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)"},[u,c,g,y]);return m.jsxs(qt.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:x.bg,color:x.color},children:[x.icon,m.jsx("span",{children:x.label})]},x.label)}function Xc({status:u}){const{theme:c}=yr(),g=j.useMemo(()=>{switch(u){case"connecting":return 25;case"loading":return 60;case"processing":return 90;default:return 0}},[u]);return g===0?null:m.jsx(qt.div,{initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:0},className:"h-1 rounded-full overflow-hidden origin-top",style:{backgroundColor:c.sliderTrack},children:m.jsx(qt.div,{className:"h-full rounded-full",style:{backgroundColor:c.primary},initial:{width:0},animate:{width:`${g}%`},transition:{duration:.4,ease:"easeOut"}})})}function Ri({variant:u,title:c,description:g,onDismiss:y}){const{theme:x}=yr(),C=j.useMemo(()=>{switch(u){case"success":return{icon:m.jsx(Hr,{className:"w-4 h-4"}),color:x.success,bg:x.successBg,border:x.successBorder};case"error":return{icon:m.jsx(wu,{className:"w-4 h-4"}),color:x.error,bg:x.errorBg,border:x.errorBorder};case"info":return{icon:m.jsx(ku,{className:"w-4 h-4"}),color:x.info,bg:x.infoBg,border:x.infoBorder}}},[u,x]);return m.jsxs(qt.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:gr.snappy,className:"flex items-start gap-3 p-3 rounded-lg border",style:{backgroundColor:C.bg,borderColor:C.border,color:C.color},children:[m.jsx("div",{className:"shrink-0 mt-0.5",children:C.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"text-sm font-medium",children:c}),g&&m.jsx("p",{className:"text-xs mt-0.5 opacity-80",children:g})]}),y&&m.jsx("button",{onClick:y,className:"shrink-0 p-1 rounded hover:bg-black/10 transition-colors","aria-label":"Dismiss",children:m.jsx(Gr,{className:"w-3.5 h-3.5"})})]})}function Jc({value:u,onChange:c,onSubmit:g,disabled:y}){const{theme:x,isLight:C}=yr(),[T,Q]=j.useState(!1),D=E=>{E.key==="Enter"&&!E.shiftKey&&!y&&(E.preventDefault(),g())};return m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("label",{className:"block text-sm font-medium",style:{color:x.textSecondary},children:"Coverage Server URL"}),m.jsxs("div",{className:"relative",children:[m.jsx("input",{type:"url",value:u,onChange:E=>c(E.target.value),onKeyDown:D,onFocus:()=>Q(!0),onBlur:()=>Q(!1),placeholder:"https://coverage.wcmesh.com",disabled:y,className:zr("w-full pl-3 pr-10 py-2.5 rounded-lg border text-sm transition-all duration-150","focus:outline-none",y&&"opacity-50 cursor-not-allowed"),style:{backgroundColor:x.bgInput,borderColor:T?x.borderFocus:x.border,color:x.text,boxShadow:T?`0 0 0 3px ${C?"rgba(59, 130, 246, 0.15)":"rgba(139, 92, 246, 0.15)"}`:"none"}}),u&&!y&&m.jsx("button",{onClick:()=>c(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 rounded transition-colors",style:{color:x.textMuted},onMouseEnter:E=>E.currentTarget.style.color=x.text,onMouseLeave:E=>E.currentTarget.style.color=x.textMuted,"aria-label":"Clear URL",children:m.jsx(Gr,{className:"w-4 h-4"})})]}),m.jsx("p",{className:"text-xs",style:{color:x.textMuted},children:"Press Enter to connect, or use the Connect button below"})]})}function Af({value:u,onChange:c}){const{theme:g,isLight:y}=yr(),x=Math.round(u*100);return m.jsx(qt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:gr.gentle,className:"overflow-hidden",children:m.jsx("div",{className:"p-3 rounded-lg border",style:{backgroundColor:g.bgSubtle,borderColor:g.border},children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsxs("div",{className:"relative w-4 h-4",children:[m.jsx(Ls,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:g.textMuted,opacity:u<.5?1:0}}),m.jsx(Ns,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:g.primary,opacity:u>=.5?1:0}})]}),m.jsxs("div",{className:"flex-1",children:[m.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[m.jsx("span",{className:"text-xs font-medium",style:{color:g.textSecondary},children:"Layer Opacity"}),m.jsxs("span",{className:"text-xs font-mono tabular-nums px-1.5 py-0.5 rounded",style:{color:g.text,backgroundColor:y?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.06)"},children:[x,"%"]})]}),m.jsx("input",{type:"range",min:5,max:100,value:x,onChange:C=>c(Number(C.target.value)/100),className:zr("w-full h-2 rounded-full appearance-none cursor-pointer","[&::-webkit-slider-thumb]:appearance-none","[&::-webkit-slider-thumb]:w-4","[&::-webkit-slider-thumb]:h-4","[&::-webkit-slider-thumb]:rounded-full","[&::-webkit-slider-thumb]:cursor-pointer","[&::-webkit-slider-thumb]:transition-transform","[&::-webkit-slider-thumb]:hover:scale-110","[&::-webkit-slider-thumb]:shadow-lg","[&::-moz-range-thumb]:appearance-none","[&::-moz-range-thumb]:w-4","[&::-moz-range-thumb]:h-4","[&::-moz-range-thumb]:rounded-full","[&::-moz-range-thumb]:border-0","[&::-moz-range-thumb]:cursor-pointer"),style:{background:`linear-gradient(to right, ${g.primary} ${x}%, ${g.sliderTrack} ${x}%)`,"--thumb-color":g.sliderThumb}}),m.jsx("style",{children:` + input[type="range"]::-webkit-slider-thumb { + background-color: ${g.sliderThumb}; + } + input[type="range"]::-moz-range-thumb { + background-color: ${g.sliderThumb}; + } + `})]})]})})})}function ef({coverageCount:u,repeaterCount:c,lastUpdated:g}){const{theme:y}=yr();return m.jsxs("div",{className:"grid grid-cols-3 gap-2 p-3 rounded-lg border",style:{backgroundColor:y.bgSubtle,borderColor:y.border},children:[m.jsxs("div",{className:"text-center",children:[m.jsx(di,{value:u,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:y.text}}),m.jsx("div",{className:"text-xs mt-0.5",style:{color:y.textMuted},children:"Points"})]}),m.jsxs("div",{className:"text-center border-x",style:{borderColor:y.border},children:[m.jsx(di,{value:c,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:y.text}}),m.jsx("div",{className:"text-xs mt-0.5",style:{color:y.textMuted},children:"Repeaters"})]}),m.jsxs("div",{className:"text-center",children:[m.jsxs("div",{className:"flex items-center justify-center gap-1",children:[m.jsx(Fo,{className:"w-3.5 h-3.5",style:{color:y.textMuted}}),m.jsx("span",{className:"text-lg font-semibold tabular-nums",style:{color:y.text},children:g?g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"})]}),m.jsx("div",{className:"text-xs mt-0.5",style:{color:y.textMuted},children:"Updated"})]})]})}function Ii({icon:u,label:c,onClick:g,disabled:y,variant:x="default",active:C}){const{theme:T,isLight:Q}=yr(),D=j.useMemo(()=>x==="danger"?{text:T.error,hoverBg:Q?"rgba(220, 38, 38, 0.08)":"rgba(239, 68, 68, 0.15)"}:{text:C?T.primary:T.textSecondary,hoverBg:T.hoverBg},[x,C,T,Q]);return m.jsxs("button",{onClick:g,disabled:y,className:zr("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium transition-colors",y&&"opacity-50 cursor-not-allowed"),style:{color:D.text},onMouseEnter:E=>!y&&(E.currentTarget.style.backgroundColor=D.hoverBg),onMouseLeave:E=>E.currentTarget.style.backgroundColor="transparent",children:[u,m.jsx("span",{children:c})]})}function tf(){const u=wo(),c=u==="light",g=c?Kc:Wo,{isModalOpen:y,closeModal:x,status:C,isVisible:T,stats:Q,error:D,url:E,brightness:L,loadCoverage:O,clearCoverage:z,toggleVisibility:$,setUrl:V,setBrightness:AA}=cn(),oA=C==="connecting"||C==="loading"||C==="processing",eA=Q.coverageCount>0,[Y,cA]=j.useState(!0),[lA,bA]=j.useState(E);j.useEffect(()=>{bA(E)},[E]),j.useEffect(()=>{C==="error"&&cA(!0)},[C]);const iA=j.useCallback(async()=>{await O(lA)},[lA,O]),fA=j.useCallback(()=>{bA(""),z()},[z]),DA=j.useCallback(mA=>{bA(mA),V(mA)},[V]),TA=j.useCallback(()=>{oA||x()},[oA,x]),CA=lA.trim().length>0&&!oA;return m.jsx(Yo.Provider,{value:{theme:g,isLight:c},children:m.jsxs(fo,{open:y,onClose:TA,size:"md",bottomSheet:!0,basemapMode:u,children:[m.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:g.border},children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:g.bgSubtle,color:g.primary},children:m.jsx(vo,{className:"w-5 h-5"})}),m.jsxs("div",{children:[m.jsx("h2",{className:"type-micro",style:{color:g.text},children:"Wardriving Coverage"}),m.jsx("p",{className:"text-xs",style:{color:g.textMuted},children:"RF coverage heatmap overlay"})]})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(qc,{status:C,hasData:eA}),!oA&&m.jsxs(m.Fragment,{children:[m.jsx("button",{onClick:TA,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium transition-base radius-inner active:bg-subtle-fill",style:{color:g.primary},children:"Done"}),m.jsx("button",{onClick:TA,className:"hidden sm:flex items-center justify-center p-2 rounded-lg transition-colors",style:{color:g.textMuted},onMouseEnter:mA=>{mA.currentTarget.style.color=g.text,mA.currentTarget.style.backgroundColor=g.hoverBg},onMouseLeave:mA=>{mA.currentTarget.style.color=g.textMuted,mA.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close",children:m.jsx(Gr,{className:"w-5 h-5"})})]})]})]}),m.jsx(v0,{children:oA&&m.jsx(Xc,{status:C})}),m.jsxs(ho,{className:"space-y-4",children:[m.jsx(Jc,{value:lA,onChange:DA,onSubmit:iA,disabled:oA}),m.jsx(v0,{children:C==="error"&&D&&Y&&m.jsx(Ri,{variant:"error",title:"Connection Failed",description:D,onDismiss:()=>cA(!1)})}),m.jsx(v0,{children:C==="success"&&eA&&m.jsx(Ri,{variant:"success",title:"Coverage Data Loaded",description:"Adjust opacity below, then close to view on map"})}),m.jsx(v0,{children:eA&&!oA&&m.jsx(qt.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:gr.snappy,children:m.jsx(ef,{coverageCount:Q.coverageCount,repeaterCount:Q.repeaterCount,lastUpdated:Q.lastUpdated})})}),m.jsx(v0,{children:eA&&!oA&&m.jsx(Af,{value:L,onChange:AA})})]}),m.jsxs("div",{className:"flex items-center justify-between p-4 border-t",style:{borderColor:g.border},children:[m.jsx("div",{className:"flex items-center gap-1",children:m.jsx(v0,{children:eA&&m.jsxs(qt.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:gr.snappy,className:"flex items-center gap-1",children:[m.jsx(Ii,{icon:T?m.jsx(Ya,{className:"w-4 h-4"}):m.jsx(Lo,{className:"w-4 h-4"}),label:T?"Hide":"Show",onClick:$,disabled:oA,active:T}),m.jsx(Ii,{icon:m.jsx(lu,{className:"w-4 h-4"}),label:"Clear",onClick:fA,disabled:oA,variant:"danger"})]})})}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Lt,{plain:!0,color:"muted",onClick:TA,disabled:oA,children:eA?"Done":"Cancel"}),m.jsx(Lt,{color:"warning",onClick:iA,disabled:!CA,children:oA?m.jsxs(m.Fragment,{children:[m.jsx(Gn,{"data-slot":"icon",className:"animate-spin"}),C==="connecting"?"Connecting...":C==="loading"?"Loading...":"Processing..."]}):eA?m.jsxs(m.Fragment,{children:[m.jsx(Io,{"data-slot":"icon"}),"Refresh"]}):m.jsxs(m.Fragment,{children:[m.jsx(Ro,{"data-slot":"icon"}),"Connect"]})})]})]})]})})}const rf={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5};function Tn({label:u,value:c,min:g,max:y,step:x,unit:C,formatValue:T,onChange:Q}){const D=T?T(c):c.toFixed(2);return m.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[m.jsx("span",{className:"text-xs font-medium w-14 sm:w-16 shrink-0 text-fg-secondary",children:u}),m.jsx("input",{type:"range",min:g,max:y,step:x,value:c,onChange:E=>Q(parseFloat(E.target.value)),className:`flex-1 h-1.5 rounded-full appearance-none cursor-pointer bg-elevated + [&::-webkit-slider-thumb]:appearance-none + [&::-webkit-slider-thumb]:w-3.5 + [&::-webkit-slider-thumb]:h-3.5 + [&::-webkit-slider-thumb]:rounded-full + [&::-webkit-slider-thumb]:bg-sys-indigo + [&::-webkit-slider-thumb]:cursor-pointer + [&::-webkit-slider-thumb]:transition-transform + [&::-webkit-slider-thumb]:hover:scale-110 + [&::-webkit-slider-thumb]:shadow-md`}),m.jsxs("span",{className:"text-xs font-mono tabular-nums w-12 sm:w-14 text-right shrink-0 text-fg-muted",children:[D,C&&m.jsx("span",{className:"ml-0.5 opacity-70",children:C})]})]})}function jn({icon:u,label:c,value:g,subtext:y}){return m.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[m.jsx("div",{className:"text-fg-muted",children:u}),m.jsx("div",{className:"flex-1 min-w-0",children:m.jsx("div",{className:"text-[10px] sm:text-xs truncate text-fg-secondary",children:c})}),m.jsxs("div",{className:"text-right",children:[m.jsx("div",{className:"text-xs font-mono tabular-nums text-fg-primary",children:g}),y&&m.jsx("div",{className:"text-[9px] leading-tight opacity-70 text-fg-muted",children:y})]})]})}function nf({visible:u,onClose:c,settings:g,onSettingsChange:y,partition:x,totalNodes:C,basemapMode:T="dark"}){const Q=Za(),D=j.useRef(null),E=j.useMemo(()=>{if(!x)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const z=Array.from(x.communities.values()).map(V=>V.length),$=z.reduce((V,AA)=>V+AA,0);return{numCommunities:x.numCommunities,avgCommunitySize:z.length>0?Math.round($/z.length):0,minCommunitySize:z.length>0?Math.min(...z):0,maxCommunitySize:z.length>0?Math.max(...z):0,fiedlerValue:x.fiedlerValue,modularity:0,coveragePercent:C>0?Math.round($/C*100):0}},[x,C]),L=(z,$)=>{y({...g,[z]:$})},O=(g.bandwidth*111).toFixed(1);return m.jsx("div",{ref:D,className:"absolute inset-0 z-[600] pointer-events-none",children:m.jsx(v0,{children:u&&m.jsx(qt.div,{drag:!0,dragControls:Q,dragConstraints:D,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:gr.smooth,className:` + absolute pointer-events-auto + /* Mobile: bottom sheet style, full width with margins */ + bottom-2 left-2 right-2 + /* sm+: floating panel in bottom-right */ + sm:bottom-16 sm:left-auto sm:right-3 sm:w-64 + /* md+: slightly wider */ + md:w-72 + `,style:{touchAction:"none"},children:m.jsxs("div",{className:` + map-control-surface rounded-lg overflow-hidden shadow-lg + /* Mobile: limit height, allow scroll */ + max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto + /* iOS momentum scrolling */ + overscroll-contain + `,children:[m.jsxs("div",{className:` + flex items-center justify-between + px-3 py-2 sm:px-2.5 sm:py-1.5 + border-b border-edge-subtle + cursor-grab active:cursor-grabbing + min-h-[44px] sm:min-h-0 + `,onPointerDown:z=>Q.start(z),children:[m.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[m.jsx($a,{className:"w-4 h-4 sm:w-3 sm:h-3 text-fg-muted"}),m.jsx(vs,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-sys-blue"}),m.jsx("span",{className:"text-sm sm:text-xs font-medium text-fg-primary",children:"Partition"})]}),m.jsx(Lt,{plain:!0,color:"muted",onClick:c,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:m.jsx(Gr,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),m.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b border-edge-subtle",children:m.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[m.jsx(jn,{icon:m.jsx(vs,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:E.numCommunities}),m.jsx(jn,{icon:m.jsx(ai,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:E.avgCommunitySize,subtext:`${E.minCommunitySize}–${E.maxCommunitySize}`}),m.jsx(jn,{icon:m.jsx(Bu,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:E.fiedlerValue.toFixed(3)}),m.jsx(jn,{icon:m.jsx(ai,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${E.coveragePercent}%`,subtext:`of ${C}`})]})}),m.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:m.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[m.jsx(Tn,{label:"Bandwidth",value:g.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>O,unit:"km",onChange:z=>L("bandwidth",z)}),m.jsx(Tn,{label:"Threshold",value:g.threshold,min:.05,max:.5,step:.01,formatValue:z=>`${Math.round((1-z)*100)}%`,unit:"cov",onChange:z=>L("threshold",z)}),m.jsx(Tn,{label:"Opacity",value:g.opacity,min:.1,max:1,step:.05,formatValue:z=>`${Math.round(z*100)}%`,onChange:z=>L("opacity",z)}),m.jsx(Tn,{label:"Stroke",value:g.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:z=>z.toFixed(1),onChange:z=>L("strokeWidth",z)})]})})]})})})})}const sf={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-signal-poor",critical:"text-signal-critical"};function fn(u,c){return sf[Co(u,c)]}const of={backgroundColor:"var(--map-ui-hover, var(--elevated))",color:"var(--map-ui-text, var(--fg-primary))",boxShadow:"inset 0 0 0 1px var(--map-ui-border-strong, var(--edge-strong))"},lf={backgroundColor:"var(--map-ui-bg, var(--body))",color:"var(--map-ui-text, var(--fg-primary))",boxShadow:"0 1px 4px rgba(0,0,0,0.15), inset 0 0 0 1px var(--map-ui-border, var(--edge-subtle))"};function Fr({prefix:u,name:c}){const g=j.useRef(null),[y,x]=j.useState(!1),[C,T]=j.useState({top:0,left:0}),Q=()=>{if(!c||!g.current)return;const D=g.current.getBoundingClientRect();T({top:D.top-4,left:D.left+D.width/2}),x(!0)};return m.jsxs(m.Fragment,{children:[m.jsx("span",{ref:g,className:"inline-flex items-center px-1.5 py-0.5 rounded font-mono text-[10px] font-semibold transition-opacity hover:opacity-80 cursor-default",style:of,onMouseEnter:Q,onMouseLeave:()=>x(!1),children:u}),c&&y&&va.createPortal(m.jsx("span",{className:"fixed z-[9999] pointer-events-none -translate-x-1/2 -translate-y-full whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-medium",style:{...lf,top:C.top,left:C.left},children:c}),document.body)]})}function Zo(u){if(u._tracePathHashes)return u._tracePathHashes;if(u.payload&&u.payload.length>=20){const c=u.payload.slice(18),g=[];for(let y=0;y0?g:null}return null}function $o(u,c){return u.src_hash?[u.src_hash.replace(/^0x/i,"").slice(0,2).toUpperCase(),...c.map(y=>y.toUpperCase())]:c.map(g=>g.toUpperCase())}function af(u,c,g,y=15){const x=[],C=c.toUpperCase(),T=g.toUpperCase();for(const Q of u){if((Q.type??Q.payload_type)!==wa.TRACE)continue;const E=Zo(Q);if(!E||E.length<1)continue;const L=$o(Q,E);if(!(L.length<2)){for(let O=0;O=y)break}}return x}function uf(u){switch(u){case"improving":return m.jsx(ka,{className:"w-3 h-3 text-sys-green"});case"degrading":return m.jsx(du,{className:"w-3 h-3 text-sys-red"});case"stable":return m.jsx(yo,{className:"w-3 h-3 text-fg-muted"});default:return null}}const cf={backgroundColor:"var(--map-ui-stripe)"};function Pn({label:u,value:c,unit:g,color:y,tooltip:x}){return m.jsxs("div",{className:`flex items-center justify-between gap-2 py-[3px] ${x?"cursor-help":""}`,title:x,children:[m.jsx("span",{className:"type-data-xs text-fg-muted",children:u}),m.jsxs("span",{className:`data-box data-box-compact ${y||""}`,children:[c,g&&m.jsx("span",{className:"text-fg-muted ml-0.5",children:g})]})]})}function Li({stats:u,direction:c,sf:g,noiseFloor:y}){if(!u)return m.jsxs("div",{className:"min-w-0",children:[m.jsx("div",{className:"flex items-center justify-between mb-1.5",children:m.jsx("p",{className:"type-data-xs text-fg-secondary font-medium",children:c})}),m.jsx("p",{className:"type-data-xs text-fg-muted italic px-1.5",children:"No data"})]});const x=u.max-u.min,C=u.median-u.mean,T=ba(g),Q=u.mean-T,D=Co(u.mean,g),E=[`Mean SNR: ${u.mean.toFixed(1)} dB (${D}) from ${u.count} measurement${u.count!==1?"s":""}`,`Variability: ±${u.stdDev.toFixed(1)} dB`,"",`Link budget (SF${g}, 3.5 dBi omni):`,` Demod threshold: ${T.toFixed(1)} dB`,` SNR margin: ${Q>=0?"+":""}${Q.toFixed(1)} dB`];return y!=null&&E.push(` Noise floor: ${y} dBm`),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[m.jsx("p",{className:"type-data-xs text-fg-secondary font-medium",children:c}),m.jsxs("span",{className:"type-data-xs text-fg-muted tabular-nums",title:`${u.count} measurement${u.count!==1?"s":""}`,children:["n=",u.count]})]}),m.jsx(Pn,{label:"Mean",value:u.mean.toFixed(1),unit:"dB",color:fn(u.mean,g),tooltip:E.join(` +`)}),m.jsx(Pn,{label:"Median",value:u.median.toFixed(1),unit:"dB",tooltip:`Middle value — less affected by unusual readings than the average.${Math.abs(C)>=.15?` +Differs from mean by ${C>0?"+":""}${C.toFixed(1)} dB`:""}`}),m.jsx(Pn,{label:"Range",value:`${u.min.toFixed(1)}–${u.max.toFixed(1)}`,unit:"dB",tooltip:`Best to worst signal observed. Total spread: ${x.toFixed(1)} dB.`})]})}function ff({pair:u,onClose:c,prefixToName:g}){var bA,iA,fA,DA,TA,CA,mA,IA,NA,FA,GA,vA;const y=bo(),x=ma(),C=pa(),T=ga(),[Q,D]=j.useState(null),E=((iA=(bA=C==null?void 0:C.config)==null?void 0:bA.radio)==null?void 0:iA.spreading_factor)??ya,L=j.useMemo(()=>{const uA=`${u.nodeA.hash}>${u.nodeB.hash}`,hA=`${u.nodeB.hash}>${u.nodeA.hash}`;return{forward:y.get(uA)??null,reverse:y.get(hA)??null}},[y,u.nodeA.hash,u.nodeB.hash]),O=j.useMemo(()=>!x||x.length===0?[]:af(x,u.nodeA.prefix,u.nodeB.prefix),[x,u.nodeA.prefix,u.nodeB.prefix]),z=u.nodeA.name||(g==null?void 0:g.get(u.nodeA.prefix.toUpperCase()))||null,$=u.nodeB.name||(g==null?void 0:g.get(u.nodeB.prefix.toUpperCase()))||null,V=((fA=L.forward)==null?void 0:fA.trend)??((DA=L.reverse)==null?void 0:DA.trend)??"insufficient",AA=Math.max(((TA=L.forward)==null?void 0:TA.lastSeen)??0,((CA=L.reverse)==null?void 0:CA.lastSeen)??0),oA=(((mA=L.forward)==null?void 0:mA.uniqueTraceCount)??0)+(((IA=L.reverse)==null?void 0:IA.uniqueTraceCount)??0),eA=V==="insufficient"?"Not enough data to determine trend (need at least 4 measurements).":`Whether signal quality is getting better or worse over time. +Compares older measurements to newer ones.`,Y=((NA=L.forward)==null?void 0:NA.uniqueTraceCount)??0,cA=((FA=L.reverse)==null?void 0:FA.uniqueTraceCount)??0,lA=["Number of trace packets that traveled through this link.",`${u.nodeA.prefix}→${u.nodeB.prefix}: ${Y}`,`${u.nodeB.prefix}→${u.nodeA.prefix}: ${cA}`].join(` +`);return m.jsx("div",{className:` + absolute z-[700] overflow-hidden + /* Mobile: full-width bottom sheet with breathing room */ + bottom-2 left-2 right-2 + /* sm+: right-aligned floating panel */ + sm:bottom-16 sm:left-auto sm:right-4 sm:w-[280px] + `,children:m.jsxs("div",{className:` + map-control-surface flex flex-col + /* Mobile: cap at 45vh so map stays visible */ + max-h-[45vh] + /* sm+: taller allowance */ + sm:max-h-[420px] + `,children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 sm:py-2 min-h-[44px] sm:min-h-0 border-b border-edge-subtle",children:[m.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[m.jsx(Oo,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-sys-green shrink-0"}),m.jsx(Fr,{prefix:u.nodeA.prefix,name:z}),m.jsx("span",{className:"type-data-xs text-fg-muted",children:"↔"}),m.jsx(Fr,{prefix:u.nodeB.prefix,name:$})]}),m.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[AA>0&&m.jsx("span",{className:"type-data-xs text-fg-muted",title:ui(AA),children:ko(AA)}),m.jsx(Lt,{plain:!0,color:"muted",onClick:c,className:"!p-1.5 sm:!p-0.5 !rounded-md min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center",children:m.jsx(Gr,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5"})})]})]}),m.jsxs("div",{className:"px-3 py-2.5 border-b border-edge-subtle",children:[m.jsxs("div",{className:"space-y-1.5 mb-2",children:[m.jsxs("div",{className:"flex items-center justify-between cursor-help",title:`${u.nodeA.prefix}→${u.nodeB.prefix}: mean of ${((GA=u.aToB)==null?void 0:GA.count)??0} measurements`,children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(Fr,{prefix:u.nodeA.prefix,name:z}),m.jsx("span",{className:"type-data-xs text-fg-muted",children:"→"}),m.jsx(Fr,{prefix:u.nodeB.prefix,name:$})]}),u.aToB?m.jsxs("span",{className:`type-data-sm tabular-nums font-semibold ${fn(u.aToB.mean,E)}`,children:[u.aToB.mean.toFixed(1),m.jsx("span",{className:"text-fg-muted font-normal ml-0.5",children:"dB"})]}):m.jsx("span",{className:"type-data-sm text-fg-muted",children:"—"})]}),m.jsxs("div",{className:"flex items-center justify-between cursor-help",title:`${u.nodeB.prefix}→${u.nodeA.prefix}: mean of ${((vA=u.bToA)==null?void 0:vA.count)??0} measurements`,children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(Fr,{prefix:u.nodeB.prefix,name:$}),m.jsx("span",{className:"type-data-xs text-fg-muted",children:"→"}),m.jsx(Fr,{prefix:u.nodeA.prefix,name:z})]}),u.bToA?m.jsxs("span",{className:`type-data-sm tabular-nums font-semibold ${fn(u.bToA.mean,E)}`,children:[u.bToA.mean.toFixed(1),m.jsx("span",{className:"text-fg-muted font-normal ml-0.5",children:"dB"})]}):m.jsx("span",{className:"type-data-sm text-fg-muted",children:"—"})]})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-0 -mx-3 border-t border-edge-subtle",children:[m.jsx("div",{className:"px-3 pt-2 pb-1 border-r border-edge-subtle",children:m.jsx(Li,{stats:u.aToB,direction:`${u.nodeA.prefix}→${u.nodeB.prefix}`,sf:E,noiseFloor:T})}),m.jsx("div",{className:"px-3 pt-2 pb-1",children:m.jsx(Li,{stats:u.bToA,direction:`${u.nodeB.prefix}→${u.nodeA.prefix}`,sf:E,noiseFloor:T})})]})]}),m.jsxs("div",{className:"px-3 py-1.5 border-b border-edge-subtle",children:[V!=="insufficient"&&m.jsxs("div",{className:"flex items-center justify-between gap-2 py-[3px] cursor-help",title:eA,children:[m.jsx("span",{className:"type-data-xs text-fg-muted",children:"Trend"}),m.jsx("span",{className:"data-box data-box-compact",children:m.jsxs("span",{className:"flex items-center gap-1",children:[uf(V),m.jsx("span",{className:"text-fg-secondary capitalize",children:V})]})})]}),oA>0&&m.jsx(Pn,{label:"Unique traces",value:oA.toString(),tooltip:lA})]}),O.length>0&&m.jsxs("div",{className:"px-3 py-2 flex-1 min-h-0 flex flex-col",children:[m.jsxs("p",{className:"type-micro text-fg-secondary mb-1 shrink-0",children:["Source packets (",O.length,")"]}),m.jsx("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",style:{scrollbarGutter:"stable"},children:O.map((uA,hA)=>{const jA=Zo(uA),MA=jA?$o(uA,jA):null,VA=MA?Math.max(0,MA.length-1):0,ue=MA?MA.map(UA=>(g==null?void 0:g.get(UA))??UA).join(" → "):null,XA=Q===hA,ZA=uA.id??`${uA.packet_hash}-${uA.timestamp}`;return m.jsxs("div",{className:"rounded-sm",style:hA%2===1?cf:void 0,children:[m.jsxs("button",{onClick:()=>D(XA?null:hA),className:"flex items-center gap-1.5 py-[3px] px-1 w-full text-left text-[10px] font-mono text-fg-secondary hover:text-fg-primary transition-colors group",children:[XA?m.jsx(go,{className:"w-2.5 h-2.5 text-fg-muted shrink-0"}):m.jsx(hu,{className:"w-2.5 h-2.5 text-fg-muted shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"}),m.jsx("span",{className:"text-fg-muted w-[52px] shrink-0",children:ui(uA.timestamp)}),ue?m.jsx("span",{className:"text-fg-secondary truncate min-w-0",title:MA.join(" → "),children:ue}):m.jsx("span",{className:"text-fg-muted truncate min-w-0 italic",children:"path n/a"}),m.jsxs("span",{className:"text-fg-muted shrink-0",children:[VA,"h"]}),uA.snr!=null&&m.jsx("span",{className:`shrink-0 tabular-nums ${fn(uA.snr,E)}`,children:uA.snr.toFixed(1)})]}),XA&&m.jsxs("div",{className:"mb-1 mt-0.5 mx-1 pl-2 border-l border-edge-subtle space-y-0.5 text-[10px]",children:[uA.rssi!=null&&m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"RSSI"}),m.jsxs("span",{className:"font-mono tabular-nums text-fg-secondary",children:[uA.rssi," dBm"]})]}),uA.snr!=null&&m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"SNR"}),m.jsxs("span",{className:`font-mono tabular-nums ${fn(uA.snr,E)}`,children:[uA.snr.toFixed(1)," dB"]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"Route"}),m.jsx("span",{className:"font-mono text-fg-secondary",children:xa(uA.route??uA.route_type)})]}),uA.packet_hash&&m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"Hash"}),m.jsxs("button",{onClick:UA=>{UA.stopPropagation(),Wn(uA.packet_hash)},className:"flex items-center gap-1 font-mono text-fg-secondary hover:text-fg-primary transition-colors",title:"Copy packet hash",children:[m.jsx("span",{className:"truncate max-w-[120px]",children:uA.packet_hash}),m.jsx(Vn,{className:"w-2.5 h-2.5 text-fg-muted shrink-0"})]})]}),uA.src_hash&&m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"Source"}),m.jsx("span",{className:"font-mono text-fg-secondary truncate max-w-[140px]",title:uA.src_hash,children:uA.src_hash})]}),MA&&MA.length>0&&m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"text-fg-muted",children:"Path"}),m.jsx("span",{className:"font-mono text-fg-secondary truncate max-w-[140px]",title:MA.join(" → "),children:MA.join(" → ")})]})]})]},ZA)})})]})]})})}const Ko=[{target:"Sparklines",fn:"sparklines",minStage:2}];To(Ko);const qo=j.memo(function({nodeHash:c,width:g=60,height:y=20,color:x,showArea:C=!0,showTooltip:T=!1,className:Q=""}){_o(Ko);const D=Ca(c),E=Ea(),O=!Eo().backgroundLoadComplete||E,z=typeof g=="number"?g:60;return m.jsx(pu,{data:D,width:z,height:y,color:x,isLoading:O,className:Q})});function hf(u){return u===null?"—":u<1e3?`${Math.round(u)}m`:`${(u/1e3).toFixed(1)}km`}function df(u){const c=new Date(u*1e3);return`${(c.getMonth()+1).toString().padStart(2,"0")}/${c.getDate().toString().padStart(2,"0")}`}function mf({txDelayRec:u,networkRole:c,roleTitles:g,dataConfidence:y,dataQualityTitles:x}){const[C,T]=j.useState(!1),Q=u.floodFactor??u.txDelayFactor,D=u.directFactor??u.directTxDelayFactor,E=async()=>{const L=`set txdelay ${Q.toFixed(1)} +set direct.txdelay ${D.toFixed(1)}`;await Wn(L),T(!0),setTimeout(()=>T(!1),1500)};return m.jsxs("div",{className:"flex flex-col gap-1.5 text-sm",children:[(c||y)&&m.jsxs("div",{className:"flex items-center gap-2",children:[c&&m.jsx(mt,{color:cu[c],compact:!0,title:g[c],children:c}),y&&m.jsxs(mt,{color:fu[y],compact:!0,title:x[y],children:[y," data"]})]}),m.jsxs("button",{onClick:E,className:"flex items-center gap-2 py-1.5 px-2 bg-subtle-fill hover:bg-subtle-fill-hover rounded transition-colors group",title:"Click to copy CLI commands",children:[m.jsx(ju,{className:"w-3.5 h-3.5 text-sys-amber shrink-0"}),m.jsx("span",{className:"text-fg-muted",children:"TxDelay"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"text-fg-muted",children:"F"}),m.jsxs("span",{className:"data-box text-sys-amber",children:["×",Q.toFixed(1)]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"text-fg-muted",children:"D"}),m.jsxs("span",{className:"data-box text-sys-amber",children:["×",D.toFixed(1)]})]})]}),C?m.jsx(Hr,{className:"w-3.5 h-3.5 text-sys-green ml-auto"}):m.jsx(Vn,{className:"w-3.5 h-3.5 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]})]})}function pf({hash:u,hashPrefix:c,name:g,isHub:y,isGateway:x,isBackbone:C,isZeroHop:T,isMobile:Q,isRoomServer:D,isStale:E,lastSeenTimestamp:L,centrality:O,affinity:z,meanSnr:$,meanRssi:V,neighbor:AA,onRemove:oA,txDelayRec:eA,hideHeader:Y=!1}){const[cA,lA]=j.useState(!1),bA=async()=>{await Wn(u),lA(!0),setTimeout(()=>lA(!1),1500)},iA=T?"Direct":z!=null&&z.typicalHopPosition?`${z.typicalHopPosition}-hop`:null,fA=eA&&!eA.insufficientData,DA={hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"},TA={high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"};return m.jsxs("div",{children:[!Y&&m.jsx("div",{className:"text-[14px] font-semibold text-fg-primary leading-tight truncate mb-1",children:g}),!Y&&m.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[m.jsx("code",{className:"type-data-xs text-fg-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:c}),m.jsx("button",{onClick:bA,className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:cA?m.jsx(Hr,{className:"w-3 h-3 text-sys-green"}):m.jsx(Vn,{className:"w-3 h-3 text-fg-secondary"})}),m.jsx(Po,{hash:u,size:"sm"}),iA&&m.jsx(mt,{color:T?On.direct:On.multihop,compact:!0,children:iA}),AA.is_repeater&&m.jsx(mt,{color:i0.repeater,compact:!0,children:"Rptr"}),y&&m.jsx(mt,{color:i0.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),x&&!y&&m.jsx(mt,{color:i0.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),C&&m.jsx(mt,{color:i0.backbone,compact:!0,title:"Backbone",children:"Bone"}),Q&&m.jsx(mt,{color:i0.mobile,compact:!0,children:"Mobile"}),D&&m.jsx(mt,{color:i0.room,compact:!0,children:"Room"}),E&&L&&m.jsxs(mt,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",df(L)]})]}),m.jsx("div",{title:"7-day activity trend (6-hour buckets)",children:m.jsx(qo,{nodeHash:u,width:224,height:28,showArea:!0,showTooltip:!0,className:"w-full"})}),m.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-sm text-fg-secondary mt-2",children:[m.jsxs("span",{className:"flex items-center gap-0.5",title:AA.last_seen?`Last heard: ${new Date(AA.last_seen*1e3).toLocaleString()}`:"Last heard time",children:[m.jsx(Fo,{className:"w-3 h-3 text-fg-muted shrink-0"}),m.jsx("span",{className:"font-mono",children:ko(AA.last_seen)})]}),(z==null?void 0:z.distanceMeters)&&m.jsxs("span",{className:"flex items-center gap-0.5",title:"Line-of-sight distance from local node",children:[m.jsx(mu,{className:"w-3 h-3 text-fg-muted shrink-0"}),m.jsx("span",{className:"font-mono font-semibold text-fg-primary",children:hf(z.distanceMeters)})]}),AA.latitude&&AA.longitude&&AA.latitude!==0&&AA.longitude!==0&&m.jsxs("span",{className:"flex items-center gap-0.5",title:"GPS coordinates (lat, lon)",children:[m.jsx(gu,{className:"w-3 h-3 text-fg-muted shrink-0"}),m.jsxs("span",{className:"font-mono text-fg-muted",children:[AA.latitude.toFixed(2),", ",AA.longitude.toFixed(2)]})]})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 text-sm mt-2",children:[m.jsxs("div",{className:"flex justify-between items-center gap-2",title:"Total packets seen from this node",children:[m.jsx("span",{className:"text-fg-muted",children:"Packets"}),m.jsx("span",{className:"data-box",children:(z==null?void 0:z.frequency)||0})]}),m.jsxs("div",{className:"flex justify-between items-center gap-2",title:"ADVERT beacon packets received",children:[m.jsx("span",{className:"text-fg-muted",children:"Adverts"}),m.jsx("span",{className:"data-box",children:AA.advert_count||0})]}),T&&$!==void 0&&m.jsxs("div",{className:"flex justify-between items-center gap-2",title:"Average Signal-to-Noise Ratio (direct zero-hop)",children:[m.jsx("span",{className:"text-fg-muted",children:"SNR"}),m.jsxs("span",{className:"data-box",children:[$.toFixed(1)," dB"]})]}),T&&V!==void 0&&m.jsxs("div",{className:"flex justify-between items-center gap-2",title:"Average Received Signal Strength (direct zero-hop)",children:[m.jsx("span",{className:"text-fg-muted",children:"RSSI"}),m.jsxs("span",{className:"data-box",children:[Math.round(V)," dBm"]})]})]}),fA&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"border-t border-edge-subtle mt-2.5 mb-2"}),m.jsx(mf,{txDelayRec:eA,networkRole:eA.networkRole,roleTitles:DA,dataConfidence:eA.dataConfidence,dataQualityTitles:TA})]}),oA&&m.jsx("button",{onClick:oA,className:"w-full text-center text-sm mt-2 py-3 sm:py-1.5 rounded text-fg-muted hover:text-sys-red hover:bg-sys-red/10 transition-colors",children:"Remove from Contacts"})]})}function gf(u){const c=new Date(u*1e3);return`${(c.getMonth()+1).toString().padStart(2,"0")}/${c.getDate().toString().padStart(2,"0")}`}function yf({data:u,localNode:c,localColor:g,onClose:y,onRemove:x}){var E,L,O,z;const[C,T]=j.useState(!1);j.useEffect(()=>{if(!u)return;const $=V=>{V.key==="Escape"&&y()};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[u,y]);const Q=async()=>{u!=null&&u.hash&&(await Wn(u.hash),T(!0),setTimeout(()=>T(!1),1500))},D=u!=null&&u.isZeroHop?"Direct":(E=u==null?void 0:u.affinity)!=null&&E.typicalHopPosition?`${u.affinity.typicalHopPosition}-hop`:null;return m.jsx(v0,{children:u&&m.jsx(qt.div,{className:"map-node-panel",initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:16},transition:gr.smooth,children:m.jsxs("div",{className:"map-control-surface flex flex-col max-h-[38dvh] sm:max-h-[50vh]",children:[m.jsx("div",{className:"map-node-panel-drag-handle sm:hidden"}),m.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2.5 shrink-0",children:[m.jsxs("div",{className:"flex items-start justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[m.jsx("span",{className:"text-sm font-semibold truncate text-fg-primary",children:u.name||"Unknown"}),u.hash&&m.jsxs(m.Fragment,{children:[m.jsx("code",{className:"type-data-xs text-fg-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded ml-1",children:u.hashPrefix||u.hash.substring(0,2)}),m.jsx("button",{onClick:Q,className:"p-2 -m-1.5 sm:p-0.5 sm:m-0 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:C?m.jsx(Hr,{className:"w-3 h-3 text-sys-green"}):m.jsx(Vn,{className:"w-3 h-3 text-fg-secondary"})}),m.jsx(Po,{hash:u.hash,size:"sm"})]})]}),m.jsx(Lt,{plain:!0,color:"muted",onClick:y,className:"!p-1 !rounded-md -mr-1 -mt-1 hover:bg-subtle-fill-hover min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close node detail",children:m.jsx(Gr,{className:"w-4 h-4"})})]}),(D||((L=u.neighbor)==null?void 0:L.is_repeater)||u.isHub||u.isGateway&&!u.isHub||u.isBackbone||u.isMobile||u.isRoomServer||u.isStale&&u.lastSeenTimestamp)&&m.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[D&&m.jsx(mt,{color:u.isZeroHop?On.direct:On.multihop,compact:!0,title:u.isZeroHop?"Direct RF contact (zero-hop)":`${((O=u.affinity)==null?void 0:O.typicalHopPosition)??"?"} hops from local node`,children:D}),((z=u.neighbor)==null?void 0:z.is_repeater)&&m.jsx(mt,{color:i0.repeater,compact:!0,title:"Repeater node (forwards packets)",children:"Rptr"}),u.isHub&&m.jsx(mt,{color:i0.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),u.isGateway&&!u.isHub&&m.jsx(mt,{color:i0.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),u.isBackbone&&m.jsx(mt,{color:i0.backbone,compact:!0,title:"Backbone: critical relay with high traffic",children:"Bone"}),u.isMobile&&m.jsx(mt,{color:i0.mobile,compact:!0,title:"Mobile repeater (path volatility detected)",children:"Mobile"}),u.isRoomServer&&m.jsx(mt,{color:i0.room,compact:!0,title:"Room server node",children:"Room"}),u.isStale&&u.lastSeenTimestamp&&m.jsxs(mt,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",gf(u.lastSeenTimestamp)]})]})]}),m.jsx("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-3 pt-2 pb-3",children:u.isLocal?m.jsxs("div",{className:"text-sm",children:[m.jsx("div",{className:"mb-2",children:m.jsx("span",{style:{color:g},className:"font-medium",children:"This Node (Local)"})}),u.hash&&m.jsx("div",{className:"mb-2",children:m.jsx(qo,{nodeHash:u.hash,width:224,height:28,showArea:!0,showTooltip:!0,className:"w-full"})}),c&&m.jsxs("div",{className:"text-xs text-fg-muted font-mono border-t border-edge-subtle pt-2",children:[c.latitude.toFixed(5),", ",c.longitude.toFixed(5)]})]}):u.neighbor&&u.hash?m.jsx(pf,{hash:u.hash,hashPrefix:u.hashPrefix,name:u.name,isHub:u.isHub,isGateway:u.isGateway,isBackbone:u.isBackbone,isZeroHop:u.isZeroHop,isMobile:u.isMobile,isRoomServer:u.isRoomServer,isStale:u.isStale,lastSeenTimestamp:u.lastSeenTimestamp,centrality:u.centrality,affinity:u.affinity,meanSnr:u.meanSnr,meanRssi:u.meanRssi,neighbor:u.neighbor,txDelayRec:u.txDelayRec,onRemove:x?()=>x(u.hash,u.name):void 0,hideHeader:!0}):null})]})})})}const xf={getItem:u=>{try{return localStorage.getItem(u)}catch{return null}},setItem:(u,c)=>{try{localStorage.setItem(u,c)}catch{}},removeItem:u=>{try{localStorage.removeItem(u)}catch{}}},Xo=xo()(eu(u=>({isEnabled:!1,toggle:()=>u(c=>({isEnabled:!c.isEnabled})),setEnabled:c=>u({isEnabled:c})}),{name:"pymc-live-trace",storage:tu(()=>xf)})),wf=()=>Xo(u=>u.isEnabled),vf=()=>Xo(u=>u.toggle);var Nt=(function(u){u=u||{};var c=typeof u<"u"?u:{},g={},y;for(y in c)c.hasOwnProperty(y)&&(g[y]=c[y]);var x="";function C(rA){return c.locateFile?c.locateFile(rA,x):x+rA}var T;typeof document<"u"&&document.currentScript&&(x=document.currentScript.src),x.indexOf("blob:")!==0?x=x.substr(0,x.lastIndexOf("/")+1):x="",T=function(gA,RA,xA){var t=new XMLHttpRequest;t.open("GET",gA,!0),t.responseType="arraybuffer",t.onload=function(){if(t.status==200||t.status==0&&t.response){RA(t.response);return}var ge=c0(gA);if(ge){RA(ge.buffer);return}xA()},t.onerror=xA,t.send(null)};var Q=c.print||console.log.bind(console),D=c.printErr||console.warn.bind(console);for(y in g)g.hasOwnProperty(y)&&(c[y]=g[y]);g=null,c.arguments&&c.arguments;var E=0,L=function(rA){E=rA},O=function(){return E},z=8;function $(rA,gA,RA,xA){switch(RA=RA||"i8",RA.charAt(RA.length-1)==="*"&&(RA="i32"),RA){case"i1":IA[rA>>0]=gA;break;case"i8":IA[rA>>0]=gA;break;case"i16":FA[rA>>1]=gA;break;case"i32":GA[rA>>2]=gA;break;case"i64":ot=[gA>>>0,(Ge=gA,+Ee(Ge)>=1?Ge>0?(Ke(+ye(Ge/4294967296),4294967295)|0)>>>0:~~+Me((Ge-+(~~Ge>>>0))/4294967296)>>>0:0)],GA[rA>>2]=ot[0],GA[rA+4>>2]=ot[1];break;case"float":vA[rA>>2]=gA;break;case"double":uA[rA>>3]=gA;break;default:pt("invalid type for setValue: "+RA)}}function V(rA,gA,RA){switch(gA=gA||"i8",gA.charAt(gA.length-1)==="*"&&(gA="i32"),gA){case"i1":return IA[rA>>0];case"i8":return IA[rA>>0];case"i16":return FA[rA>>1];case"i32":return GA[rA>>2];case"i64":return GA[rA>>2];case"float":return vA[rA>>2];case"double":return uA[rA>>3];default:pt("invalid type for getValue: "+gA)}return null}var AA=!1;function oA(rA,gA){rA||pt("Assertion failed: "+gA)}function eA(rA){var gA=c["_"+rA];return oA(gA,"Cannot call unknown function "+rA+", make sure it is exported"),gA}function Y(rA,gA,RA,xA,t){var b={string:function(ie){var rt=0;if(ie!=null&&ie!==0){var Qt=(ie.length<<2)+1;rt=ut(Qt),DA(ie,rt,Qt)}return rt},array:function(ie){var rt=ut(ie.length);return TA(ie,rt),rt}};function ge(ie){return gA==="string"?iA(ie):gA==="boolean"?!!ie:ie}var De=eA(rA),Ve=[],$A=0;if(xA)for(var xe=0;xe=xA);)++t;if(t-gA>16&&rA.subarray&&lA)return lA.decode(rA.subarray(gA,t));for(var b="";gA>10,56320|$A&1023)}}return b}function iA(rA,gA){return rA?bA(NA,rA,gA):""}function fA(rA,gA,RA,xA){if(!(xA>0))return 0;for(var t=RA,b=RA+xA-1,ge=0;ge=55296&&De<=57343){var Ve=rA.charCodeAt(++ge);De=65536+((De&1023)<<10)|Ve&1023}if(De<=127){if(RA>=b)break;gA[RA++]=De}else if(De<=2047){if(RA+1>=b)break;gA[RA++]=192|De>>6,gA[RA++]=128|De&63}else if(De<=65535){if(RA+2>=b)break;gA[RA++]=224|De>>12,gA[RA++]=128|De>>6&63,gA[RA++]=128|De&63}else{if(RA+3>=b)break;gA[RA++]=240|De>>18,gA[RA++]=128|De>>12&63,gA[RA++]=128|De>>6&63,gA[RA++]=128|De&63}}return gA[RA]=0,RA-t}function DA(rA,gA,RA){return fA(rA,NA,gA,RA)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function TA(rA,gA){IA.set(rA,gA)}function CA(rA,gA){return rA%gA>0&&(rA+=gA-rA%gA),rA}var mA,IA,NA,FA,GA,vA,uA;function hA(rA){mA=rA,c.HEAP8=IA=new Int8Array(rA),c.HEAP16=FA=new Int16Array(rA),c.HEAP32=GA=new Int32Array(rA),c.HEAPU8=NA=new Uint8Array(rA),c.HEAPU16=new Uint16Array(rA),c.HEAPU32=new Uint32Array(rA),c.HEAPF32=vA=new Float32Array(rA),c.HEAPF64=uA=new Float64Array(rA)}var jA=5271536,MA=28624,VA=c.TOTAL_MEMORY||33554432;c.buffer?mA=c.buffer:mA=new ArrayBuffer(VA),VA=mA.byteLength,hA(mA),GA[MA>>2]=jA;function ue(rA){for(;rA.length>0;){var gA=rA.shift();if(typeof gA=="function"){gA();continue}var RA=gA.func;typeof RA=="number"?gA.arg===void 0?c.dynCall_v(RA):c.dynCall_vi(RA,gA.arg):RA(gA.arg===void 0?null:gA.arg)}}var XA=[],ZA=[],UA=[],Ie=[];function Le(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)$e(c.preRun.shift());ue(XA)}function se(){ue(ZA)}function pe(){ue(UA)}function be(){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Ce(c.postRun.shift());ue(Ie)}function $e(rA){XA.unshift(rA)}function Ce(rA){Ie.unshift(rA)}var Ee=Math.abs,Me=Math.ceil,ye=Math.floor,Ke=Math.min,Xe=0,At=null;function nt(rA){Xe++,c.monitorRunDependencies&&c.monitorRunDependencies(Xe)}function kt(rA){if(Xe--,c.monitorRunDependencies&&c.monitorRunDependencies(Xe),Xe==0&&At){var gA=At;At=null,gA()}}c.preloadedImages={},c.preloadedAudios={};var Qe=null,Je="data:application/octet-stream;base64,";function Be(rA){return String.prototype.startsWith?rA.startsWith(Je):rA.indexOf(Je)===0}var Ge,ot;Qe="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAU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wmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAA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AAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAA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a9cr8+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/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBB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lQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var Ft=28640;function k0(rA,gA,RA,xA){pt("Assertion failed: "+iA(rA)+", at: "+[gA?iA(gA):"unknown filename",RA,xA?iA(xA):"unknown function"])}function Xt(){return IA.length}function Jt(rA,gA,RA){NA.set(NA.subarray(gA,gA+RA),rA)}function N0(rA){return c.___errno_location&&(GA[c.___errno_location()>>2]=rA),rA}function X0(rA){pt("OOM")}function C0(rA){try{var gA=new ArrayBuffer(rA);return gA.byteLength!=rA?void 0:(new Int8Array(gA).set(IA),f0(gA),hA(gA),1)}catch{}}function Ut(rA){var gA=Xt(),RA=16777216,xA=2147483648-RA;if(rA>xA)return!1;for(var t=16777216,b=Math.max(gA,t);b>4,t=(De&15)<<4|Ve>>2,b=(Ve&3)<<6|$A,RA=RA+String.fromCharCode(xA),Ve!==64&&(RA=RA+String.fromCharCode(t)),$A!==64&&(RA=RA+String.fromCharCode(b));while(xe13780509?(A=xn(15,A)|0,A|0):(r=((e|0)<0)<<31>>31,s=ht(e|0,r|0,3,0)|0,n=S()|0,r=YA(e|0,r|0,1,0)|0,r=ht(s|0,n|0,r|0,S()|0)|0,r=YA(r|0,S()|0,1,0)|0,e=S()|0,t[A>>2]=r,t[A+4>>2]=e,A=0,A|0)}function v(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,_(e,A,r,n,0)|0}function _(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0;if(a=k,k=k+16|0,o=a,!(P(e,A,r,n,s)|0))return n=0,k=a,n|0;do if((r|0)>=0){if((r|0)>13780509){if(i=xn(15,o)|0,i|0)break;l=o,o=t[l>>2]|0,l=t[l+4>>2]|0}else i=((r|0)<0)<<31>>31,f=ht(r|0,i|0,3,0)|0,l=S()|0,i=YA(r|0,i|0,1,0)|0,i=ht(f|0,l|0,i|0,S()|0)|0,i=YA(i|0,S()|0,1,0)|0,l=S()|0,t[o>>2]=i,t[o+4>>2]=l,o=i;if(V0(n|0,0,o<<3|0)|0,s|0){V0(s|0,0,o<<2|0)|0,i=X(e,A,r,n,s,o,l,0)|0;break}i=Gt(o,4)|0,i?(f=X(e,A,r,n,i,o,l,0)|0,qA(i),i=f):i=13}else i=2;while(!1);return f=i,k=a,f|0}function P(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0;if(G=k,k=k+16|0,I=G,N=G+8|0,R=I,t[R>>2]=e,t[R+4>>2]=A,(r|0)<0)return N=2,k=G,N|0;if(i=n,t[i>>2]=e,t[i+4>>2]=A,i=(s|0)!=0,i&&(t[s>>2]=0),He(e,A)|0)return N=9,k=G,N|0;t[N>>2]=0;A:do if((r|0)>=1)if(i)for(p=1,f=0,M=0,R=1,i=e;;){if(!(f|M)){if(i=Z(i,A,4,N,I)|0,i|0)break A;if(A=I,i=t[A>>2]|0,A=t[A+4>>2]|0,He(i,A)|0){i=9;break A}}if(i=Z(i,A,t[26800+(M<<2)>>2]|0,N,I)|0,i|0)break A;if(A=I,i=t[A>>2]|0,A=t[A+4>>2]|0,e=n+(p<<3)|0,t[e>>2]=i,t[e+4>>2]=A,t[s+(p<<2)>>2]=R,e=f+1|0,o=(e|0)==(R|0),l=M+1|0,a=(l|0)==6,He(i,A)|0){i=9;break A}if(R=R+(a&o&1)|0,(R|0)>(r|0)){i=0;break}else p=p+1|0,f=o?0:e,M=o?a?0:l:M}else for(p=1,f=0,M=0,R=1,i=e;;){if(!(f|M)){if(i=Z(i,A,4,N,I)|0,i|0)break A;if(A=I,i=t[A>>2]|0,A=t[A+4>>2]|0,He(i,A)|0){i=9;break A}}if(i=Z(i,A,t[26800+(M<<2)>>2]|0,N,I)|0,i|0)break A;if(A=I,i=t[A>>2]|0,A=t[A+4>>2]|0,e=n+(p<<3)|0,t[e>>2]=i,t[e+4>>2]=A,e=f+1|0,o=(e|0)==(R|0),l=M+1|0,a=(l|0)==6,He(i,A)|0){i=9;break A}if(R=R+(a&o&1)|0,(R|0)>(r|0)){i=0;break}else p=p+1|0,f=o?0:e,M=o?a?0:l:M}else i=0;while(!1);return N=i,k=G,N|0}function X(e,A,r,n,s,i,o,l){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,i=i|0,o=o|0,l=l|0;var a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0;if(G=k,k=k+16|0,I=G+8|0,N=G,a=Tr(e|0,A|0,i|0,o|0)|0,p=S()|0,M=n+(a<<3)|0,W=M,nA=t[W>>2]|0,W=t[W+4>>2]|0,f=(nA|0)==(e|0)&(W|0)==(A|0),!((nA|0)==0&(W|0)==0|f))do a=YA(a|0,p|0,1,0)|0,a=_r(a|0,S()|0,i|0,o|0)|0,p=S()|0,M=n+(a<<3)|0,nA=M,W=t[nA>>2]|0,nA=t[nA+4>>2]|0,f=(W|0)==(e|0)&(nA|0)==(A|0);while(!((W|0)==0&(nA|0)==0|f));if(a=s+(a<<2)|0,f&&(t[a>>2]|0)<=(l|0)||(nA=M,t[nA>>2]=e,t[nA+4>>2]=A,t[a>>2]=l,(l|0)>=(r|0)))return nA=0,k=G,nA|0;switch(f=l+1|0,t[I>>2]=0,a=Z(e,A,2,I,N)|0,a|0){case 9:{R=9;break}case 0:{a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a||(R=9);break}}A:do if((R|0)==9){switch(t[I>>2]=0,a=Z(e,A,3,I,N)|0,a|0){case 9:break;case 0:{if(a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a|0)break A;break}default:break A}switch(t[I>>2]=0,a=Z(e,A,1,I,N)|0,a|0){case 9:break;case 0:{if(a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a|0)break A;break}default:break A}switch(t[I>>2]=0,a=Z(e,A,5,I,N)|0,a|0){case 9:break;case 0:{if(a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a|0)break A;break}default:break A}switch(t[I>>2]=0,a=Z(e,A,4,I,N)|0,a|0){case 9:break;case 0:{if(a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a|0)break A;break}default:break A}switch(t[I>>2]=0,a=Z(e,A,6,I,N)|0,a|0){case 9:break;case 0:{if(a=N,a=X(t[a>>2]|0,t[a+4>>2]|0,r,n,s,i,o,f)|0,a|0)break A;break}default:break A}return nA=0,k=G,nA|0}while(!1);return nA=a,k=G,nA|0}function Z(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0;if(r>>>0>6)return s=1,s|0;if(M=(t[n>>2]|0)%6|0,t[n>>2]=M,(M|0)>0){i=0;do r=Wt(r)|0,i=i+1|0;while((i|0)<(t[n>>2]|0))}if(M=wA(e|0,A|0,45)|0,S()|0,p=M&127,p>>>0>121)return s=5,s|0;a=Ht(e,A)|0,i=wA(e|0,A|0,52)|0,S()|0,i=i&15;A:do if(!i)f=8;else{for(;;){if(o=(15-i|0)*3|0,l=wA(e|0,A|0,o|0)|0,S()|0,l=l&7,(l|0)==7){A=5;break}if(N=(t0(i)|0)==0,i=i+-1|0,R=kA(7,0,o|0)|0,A=A&~(S()|0),I=kA(t[(N?432:16)+(l*28|0)+(r<<2)>>2]|0,0,o|0)|0,o=S()|0,r=t[(N?640:224)+(l*28|0)+(r<<2)>>2]|0,e=I|e&~R,A=o|A,!r){r=0;break A}if(!i){f=8;break A}}return A|0}while(!1);(f|0)==8&&(N=t[848+(p*28|0)+(r<<2)>>2]|0,I=kA(N|0,0,45)|0,e=I|e,A=S()|0|A&-1040385,r=t[4272+(p*28|0)+(r<<2)>>2]|0,(N&127|0)==127&&(N=kA(t[848+(p*28|0)+20>>2]|0,0,45)|0,A=S()|0|A&-1040385,r=t[4272+(p*28|0)+20>>2]|0,e=sr(N|e,A)|0,A=S()|0,t[n>>2]=(t[n>>2]|0)+1)),l=wA(e|0,A|0,45)|0,S()|0,l=l&127;A:do if(je(l)|0){e:do if((Ht(e,A)|0)==1){if((p|0)!=(l|0))if(D0(l,t[7696+(p*28|0)>>2]|0)|0){e=Kn(e,A)|0,o=1,A=S()|0;break}else OA(27795,26864,533,26872);switch(a|0){case 3:{e=sr(e,A)|0,A=S()|0,t[n>>2]=(t[n>>2]|0)+1,o=0;break e}case 5:{e=Kn(e,A)|0,A=S()|0,t[n>>2]=(t[n>>2]|0)+5,o=0;break e}case 0:return N=9,N|0;default:return N=1,N|0}}else o=0;while(!1);if((r|0)>0){i=0;do e=$n(e,A)|0,A=S()|0,i=i+1|0;while((i|0)!=(r|0))}if((p|0)!=(l|0)){if(!(Bt(l)|0)){if((o|0)!=0|(Ht(e,A)|0)!=5)break;t[n>>2]=(t[n>>2]|0)+1;break}switch(M&127){case 8:case 118:break A}(Ht(e,A)|0)!=3&&(t[n>>2]=(t[n>>2]|0)+1)}}else if((r|0)>0){i=0;do e=sr(e,A)|0,A=S()|0,i=i+1|0;while((i|0)!=(r|0))}while(!1);return t[n>>2]=((t[n>>2]|0)+r|0)%6|0,N=s,t[N>>2]=e,t[N+4>>2]=A,N=0,N|0}function aA(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,_A(e,A,r,n)|0?(V0(n|0,0,r*48|0)|0,n=JA(e,A,r,n)|0,n|0):(n=0,n|0)}function _A(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0;if(N=k,k=k+16|0,R=N,I=N+8|0,M=R,t[M>>2]=e,t[M+4>>2]=A,(r|0)<0)return I=2,k=N,I|0;if(!r)return I=n,t[I>>2]=e,t[I+4>>2]=A,I=0,k=N,I|0;t[I>>2]=0;A:do if(He(e,A)|0)e=9;else{s=0,M=e;do{if(e=Z(M,A,4,I,R)|0,e|0)break A;if(A=R,M=t[A>>2]|0,A=t[A+4>>2]|0,s=s+1|0,He(M,A)|0){e=9;break A}}while((s|0)<(r|0));p=n,t[p>>2]=M,t[p+4>>2]=A,p=r+-1|0,f=0,e=1;do{if(s=26800+(f<<2)|0,(f|0)==5)for(o=t[s>>2]|0,i=0,s=e;;){if(e=R,e=Z(t[e>>2]|0,t[e+4>>2]|0,o,I,R)|0,e|0)break A;if((i|0)!=(p|0))if(a=R,l=t[a>>2]|0,a=t[a+4>>2]|0,e=n+(s<<3)|0,t[e>>2]=l,t[e+4>>2]=a,!(He(l,a)|0))e=s+1|0;else{e=9;break A}else e=s;if(i=i+1|0,(i|0)>=(r|0))break;s=e}else for(o=R,a=t[s>>2]|0,l=0,s=e,i=t[o>>2]|0,o=t[o+4>>2]|0;;){if(e=Z(i,o,a,I,R)|0,e|0)break A;if(o=R,i=t[o>>2]|0,o=t[o+4>>2]|0,e=n+(s<<3)|0,t[e>>2]=i,t[e+4>>2]=o,e=s+1|0,He(i,o)|0){e=9;break A}if(l=l+1|0,(l|0)>=(r|0))break;s=e}f=f+1|0}while(f>>>0<6);e=R,e=(M|0)==(t[e>>2]|0)&&(A|0)==(t[e+4>>2]|0)?0:9}while(!1);return I=e,k=N,I|0}function JA(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;if(M=k,k=k+16|0,o=M,!r)return t[n>>2]=e,t[n+4>>2]=A,n=0,k=M,n|0;do if((r|0)>=0){if((r|0)>13780509){if(s=xn(15,o)|0,s|0)break;i=o,s=t[i>>2]|0,i=t[i+4>>2]|0}else s=((r|0)<0)<<31>>31,p=ht(r|0,s|0,3,0)|0,i=S()|0,s=YA(r|0,s|0,1,0)|0,s=ht(p|0,i|0,s|0,S()|0)|0,s=YA(s|0,S()|0,1,0)|0,i=S()|0,p=o,t[p>>2]=s,t[p+4>>2]=i;if(f=Gt(s,8)|0,!f)s=13;else{if(p=Gt(s,4)|0,!p){qA(f),s=13;break}if(s=X(e,A,r,f,p,s,i,0)|0,s|0){qA(f),qA(p);break}if(A=t[o>>2]|0,o=t[o+4>>2]|0,(o|0)>0|(o|0)==0&A>>>0>0){s=0,l=0,a=0;do e=f+(l<<3)|0,i=t[e>>2]|0,e=t[e+4>>2]|0,!((i|0)==0&(e|0)==0)&&(t[p+(l<<2)>>2]|0)==(r|0)&&(R=n+(s<<3)|0,t[R>>2]=i,t[R+4>>2]=e,s=s+1|0),l=YA(l|0,a|0,1,0)|0,a=S()|0;while((a|0)<(o|0)|(a|0)==(o|0)&l>>>0>>0)}qA(f),qA(p),s=0}}else s=2;while(!1);return R=s,k=M,R|0}function Ae(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0;for(l=k,k=k+16|0,i=l,o=l+8|0,s=(He(e,A)|0)==0,s=s?1:2;;){if(t[o>>2]=0,f=(Z(e,A,s,o,i)|0)==0,a=i,f&((t[a>>2]|0)==(r|0)?(t[a+4>>2]|0)==(n|0):0)){e=4;break}if(s=s+1|0,s>>>0>=7){s=7,e=4;break}}return(e|0)==4?(k=l,s|0):0}function fe(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0;if(l=k,k=k+48|0,s=l+16|0,i=l+8|0,o=l,r=nn(r)|0,r|0)return o=r,k=l,o|0;if(f=e,a=t[f+4>>2]|0,r=i,t[r>>2]=t[f>>2],t[r+4>>2]=a,Zs(i,s),r=sA(s,A,o)|0,!r){if(A=t[i>>2]|0,i=t[e+8>>2]|0,(i|0)>0){s=t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(+(f>>>0)+4294967296*+(a|0)),li=+b[ne>>3],a=ft(f|0,a|0,nA|0,q|0)|0,It=+(a>>>0)+4294967296*+(S()|0),me=+(nA>>>0)+4294967296*+(q|0),b[SA>>3]=Ze*(li*It)+Ze*(+b[HA>>3]*me),b[Se>>3]=Ze*(+b[ce>>3]*It)+Ze*(+b[de>>3]*me),a=qn(SA,n,zA)|0,a|0){l=a;break}W=zA,G=t[W>>2]|0,W=t[W+4>>2]|0,R=Tr(G|0,W|0,A|0,r|0)|0,p=S()|0,a=o+(R<<3)|0,M=a,f=t[M>>2]|0,M=t[M+4>>2]|0;t:do if((f|0)==0&(M|0)==0)U=a,ve=16;else for(I=0,N=0;;){if((I|0)>(r|0)|(I|0)==(r|0)&N>>>0>A>>>0){l=1;break e}if((f|0)==(G|0)&(M|0)==(W|0))break t;if(a=YA(R|0,p|0,1,0)|0,R=_r(a|0,S()|0,A|0,r|0)|0,p=S()|0,N=YA(N|0,I|0,1,0)|0,I=S()|0,a=o+(R<<3)|0,M=a,f=t[M>>2]|0,M=t[M+4>>2]|0,(f|0)==0&(M|0)==0){U=a,ve=16;break}}while(!1);if((ve|0)==16&&(ve=0,!((G|0)==0&(W|0)==0))&&(N=U,t[N>>2]=G,t[N+4>>2]=W,N=i+(t[s>>2]<<3)|0,t[N>>2]=G,t[N+4>>2]=W,N=s,N=YA(t[N>>2]|0,t[N+4>>2]|0,1,0)|0,G=S()|0,W=s,t[W>>2]=N,t[W+4>>2]=G),nA=YA(nA|0,q|0,1,0)|0,q=S()|0,a=EA,f=t[a>>2]|0,a=t[a+4>>2]|0,!((a|0)>(q|0)|(a|0)==(q|0)&f>>>0>nA>>>0)){f=1;break A}}f=0}else f=1;while(!1);if(K=K+1|0,!f){ve=21;break}if(a=t[e>>2]|0,(K|0)>=(a|0)){l=0,ve=21;break}}return(ve|0)==21?(k=Ye,l|0):0}function St(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p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!1);(EA|0)>0|(EA|0)==0&HA>>>0>0&&V0(l|0,0,HA<<3|0)|0,ne=ve,Se=t[ne+4>>2]|0;e:do if((Se|0)>0|(Se|0)==0&(t[ne>>2]|0)>>>0>0){QA=r,ce=l,de=r,Se=l,ne=r,s=r,U=r,SA=l,zA=l,r=l;t:for(;;){for(W=0,nA=0,q=0,K=0,i=0,o=0;;){l=Ye,a=l+56|0;do t[l>>2]=0,l=l+4|0;while((l|0)<(a|0));if(A=QA+(W<<3)|0,f=t[A>>2]|0,A=t[A+4>>2]|0,P(f,A,1,Ye,0)|0){l=Ye,a=l+56|0;do t[l>>2]=0,l=l+4|0;while((l|0)<(a|0));l=Gt(7,4)|0,l|0&&(X(f,A,1,Ye,l,7,0,0)|0,qA(l))}for(G=0;;){N=Ye+(G<<3)|0,I=t[N>>2]|0,N=t[N+4>>2]|0;r:do if((I|0)==0&(N|0)==0)l=i,a=o;else{if(p=Tr(I|0,N|0,HA|0,EA|0)|0,f=S()|0,l=n+(p<<3)|0,A=l,a=t[A>>2]|0,A=t[A+4>>2]|0,!((a|0)==0&(A|0)==0)){M=0,R=0;do{if((M|0)>(EA|0)|(M|0)==(EA|0)&R>>>0>HA>>>0)break t;if((a|0)==(I|0)&(A|0)==(N|0)){l=i,a=o;break r}l=YA(p|0,f|0,1,0)|0,p=_r(l|0,S()|0,HA|0,EA|0)|0,f=S()|0,R=YA(R|0,M|0,1,0)|0,M=S()|0,l=n+(p<<3)|0,A=l,a=t[A>>2]|0,A=t[A+4>>2]|0}while(!((a|0)==0&(A|0)==0))}if((I|0)==0&(N|0)==0){l=i,a=o;break}ir(I,N,me)|0,ss(e,Ze,me)|0&&(R=YA(i|0,o|0,1,0)|0,o=S()|0,M=l,t[M>>2]=I,t[M+4>>2]=N,i=ce+(i<<3)|0,t[i>>2]=I,t[i+4>>2]=N,i=R),l=i,a=o}while(!1);if(G=G+1|0,G>>>0>=7)break;i=l,o=a}if(W=YA(W|0,nA|0,1,0)|0,nA=S()|0,q=YA(q|0,K|0,1,0)|0,K=S()|0,o=ve,i=t[o>>2]|0,o=t[o+4>>2]|0,(K|0)<(o|0)|(K|0)==(o|0)&q>>>0>>0)i=l,o=a;else break}if((o|0)>0|(o|0)==0&i>>>0>0){i=0,o=0;do K=QA+(i<<3)|0,t[K>>2]=0,t[K+4>>2]=0,i=YA(i|0,o|0,1,0)|0,o=S()|0,K=ve,q=t[K+4>>2]|0;while((o|0)<(q|0)|((o|0)==(q|0)?i>>>0<(t[K>>2]|0)>>>0:0))}if(K=ve,t[K>>2]=l,t[K+4>>2]=a,(a|0)>0|(a|0)==0&l>>>0>0)G=r,W=zA,nA=ne,q=SA,K=ce,r=U,zA=s,SA=de,U=G,s=W,ne=Se,Se=nA,de=q,ce=QA,QA=K;else break e}qA(de),qA(Se),qA(Ze),s=1;break A}else s=l;while(!1);qA(Ze),qA(r),qA(s),s=0}while(!1);return Ze=s,k=It,Ze|0}}return qA(Ze),Ze=s,k=It,Ze|0}function Mt(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(p=k,k=k+176|0,a=p,(A|0)<1)return Ai(r,0,0),f=0,k=p,f|0;for(l=e,l=wA(t[l>>2]|0,t[l+4>>2]|0,52)|0,S()|0,Ai(r,(A|0)>6?A:6,l&15),l=0;n=e+(l<<3)|0,n=Br(t[n>>2]|0,t[n+4>>2]|0,a)|0,!(n|0);){if(n=t[a>>2]|0,(n|0)>0){o=0;do i=a+8+(o<<4)|0,o=o+1|0,n=a+8+(((o|0)%(n|0)|0)<<4)|0,s=Aa(r,n,i)|0,s?ri(r,s)|0:Jl(r,i,n)|0,n=t[a>>2]|0;while((o|0)<(n|0))}if(l=l+1|0,(l|0)>=(A|0)){n=0,f=13;break}}return(f|0)==13?(k=p,n|0):(ei(r),f=n,k=p,f|0)}function xt(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;if(i=k,k=k+32|0,n=i,s=i+16|0,e=Mt(e,A,s)|0,e|0)return r=e,k=i,r|0;if(t[r>>2]=0,t[r+4>>2]=0,t[r+8>>2]=0,e=ti(s)|0,e|0)do{A=Dl(r)|0;do _l(A,e)|0,o=e+16|0,t[n>>2]=t[o>>2],t[n+4>>2]=t[o+4>>2],t[n+8>>2]=t[o+8>>2],t[n+12>>2]=t[o+12>>2],ri(s,e)|0,e=ea(s,n)|0;while((e|0)!=0);e=ti(s)|0}while((e|0)!=0);return ei(s),e=Tl(r)|0,e?(Us(r),o=e,k=i,o|0):(o=0,k=i,o|0)}function je(e){return e=e|0,e>>>0>121?(e=0,e|0):(e=t[7696+(e*28|0)+16>>2]|0,e|0)}function Bt(e){return e=e|0,(e|0)==4|(e|0)==117|0}function p0(e){return e=e|0,t[11120+((t[e>>2]|0)*216|0)+((t[e+4>>2]|0)*72|0)+((t[e+8>>2]|0)*24|0)+(t[e+12>>2]<<3)>>2]|0}function u0(e){return e=e|0,t[11120+((t[e>>2]|0)*216|0)+((t[e+4>>2]|0)*72|0)+((t[e+8>>2]|0)*24|0)+(t[e+12>>2]<<3)+4>>2]|0}function O0(e,A){e=e|0,A=A|0,e=7696+(e*28|0)|0,t[A>>2]=t[e>>2],t[A+4>>2]=t[e+4>>2],t[A+8>>2]=t[e+8>>2],t[A+12>>2]=t[e+12>>2]}function e0(e,A){e=e|0,A=A|0;var r=0,n=0;if(A>>>0>20)return A=-1,A|0;do if((t[11120+(A*216|0)>>2]|0)!=(e|0))if((t[11120+(A*216|0)+8>>2]|0)!=(e|0))if((t[11120+(A*216|0)+16>>2]|0)!=(e|0))if((t[11120+(A*216|0)+24>>2]|0)!=(e|0))if((t[11120+(A*216|0)+32>>2]|0)!=(e|0))if((t[11120+(A*216|0)+40>>2]|0)!=(e|0))if((t[11120+(A*216|0)+48>>2]|0)!=(e|0))if((t[11120+(A*216|0)+56>>2]|0)!=(e|0))if((t[11120+(A*216|0)+64>>2]|0)!=(e|0))if((t[11120+(A*216|0)+72>>2]|0)!=(e|0))if((t[11120+(A*216|0)+80>>2]|0)!=(e|0))if((t[11120+(A*216|0)+88>>2]|0)!=(e|0))if((t[11120+(A*216|0)+96>>2]|0)!=(e|0))if((t[11120+(A*216|0)+104>>2]|0)!=(e|0))if((t[11120+(A*216|0)+112>>2]|0)!=(e|0))if((t[11120+(A*216|0)+120>>2]|0)!=(e|0))if((t[11120+(A*216|0)+128>>2]|0)!=(e|0))if((t[11120+(A*216|0)+136>>2]|0)==(e|0))e=2,r=1,n=2;else{if((t[11120+(A*216|0)+144>>2]|0)==(e|0)){e=0,r=2,n=0;break}if((t[11120+(A*216|0)+152>>2]|0)==(e|0)){e=0,r=2,n=1;break}if((t[11120+(A*216|0)+160>>2]|0)==(e|0)){e=0,r=2,n=2;break}if((t[11120+(A*216|0)+168>>2]|0)==(e|0)){e=1,r=2,n=0;break}if((t[11120+(A*216|0)+176>>2]|0)==(e|0)){e=1,r=2,n=1;break}if((t[11120+(A*216|0)+184>>2]|0)==(e|0)){e=1,r=2,n=2;break}if((t[11120+(A*216|0)+192>>2]|0)==(e|0)){e=2,r=2,n=0;break}if((t[11120+(A*216|0)+200>>2]|0)==(e|0)){e=2,r=2,n=1;break}if((t[11120+(A*216|0)+208>>2]|0)==(e|0)){e=2,r=2,n=2;break}else e=-1;return e|0}else e=2,r=1,n=1;else e=2,r=1,n=0;else e=1,r=1,n=2;else e=1,r=1,n=1;else e=1,r=1,n=0;else e=0,r=1,n=2;else e=0,r=1,n=1;else e=0,r=1,n=0;else e=2,r=0,n=2;else e=2,r=0,n=1;else e=2,r=0,n=0;else e=1,r=0,n=2;else e=1,r=0,n=1;else e=1,r=0,n=0;else e=0,r=0,n=2;else e=0,r=0,n=1;else e=0,r=0,n=0;while(!1);return A=t[11120+(A*216|0)+(r*72|0)+(e*24|0)+(n<<3)+4>>2]|0,A|0}function D0(e,A){return e=e|0,A=A|0,(t[7696+(e*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(t[7696+(e*28|0)+24>>2]|0)==(A|0),A|0)}function er(e,A){return e=e|0,A=A|0,t[848+(e*28|0)+(A<<2)>>2]|0}function tr(e,A){return e=e|0,A=A|0,(t[848+(e*28|0)>>2]|0)==(A|0)?(A=0,A|0):(t[848+(e*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(t[848+(e*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(t[848+(e*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(t[848+(e*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(t[848+(e*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((t[848+(e*28|0)+24>>2]|0)==(A|0)?6:7)|0}function Ur(){return 122}function Vr(e){e=e|0;var A=0,r=0,n=0;A=0;do kA(A|0,0,45)|0,n=S()|0|134225919,r=e+(A<<3)|0,t[r>>2]=-1,t[r+4>>2]=n,A=A+1|0;while((A|0)!=122);return 0}function Wr(e){e=e|0;var A=0,r=0,n=0;return n=+b[e+16>>3],r=+b[e+24>>3],A=n-r,+(n>3]<+b[e+24>>3]|0}function rr(e){return e=e|0,+(+b[e>>3]-+b[e+8>>3])}function g0(e,A){e=e|0,A=A|0;var r=0,n=0,s=0;return r=+b[A>>3],!(r>=+b[e+8>>3])||!(r<=+b[e>>3])?(A=0,A|0):(n=+b[e+16>>3],r=+b[e+24>>3],s=+b[A+8>>3],A=s>=r,e=s<=n&1,n>3]<+b[A+8>>3]||+b[e+8>>3]>+b[A>>3]?(n=0,n|0):(i=+b[e+16>>3],r=e+24|0,p=+b[r>>3],o=i>3],s=A+24|0,a=+b[s>>3],l=f>3],A)||(p=+Zt(+b[r>>3],e),p>+Zt(+b[n>>3],A))?(l=0,l|0):(l=1,l|0))}function y0(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0;i=+b[e+16>>3],a=+b[e+24>>3],e=i>3],o=+b[A+24>>3],s=l>2]=e?s|A?1:2:0,t[n>>2]=s?e?1:A?2:1:0}function _0(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;return+b[e>>3]<+b[A>>3]||+b[e+8>>3]>+b[A+8>>3]?(n=0,n|0):(n=e+16|0,a=+b[n>>3],i=+b[e+24>>3],o=a>3],s=A+24|0,f=+b[s>>3],l=p>3],A)?(p=+Zt(+b[n>>3],e),l=p>=+Zt(+b[r>>3],A),l|0):(l=0,l|0))}function H(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0;s=k,k=k+176|0,n=s,t[n>>2]=4,l=+b[A>>3],b[n+8>>3]=l,i=+b[A+16>>3],b[n+16>>3]=i,b[n+24>>3]=l,l=+b[A+24>>3],b[n+32>>3]=l,o=+b[A+8>>3],b[n+40>>3]=o,b[n+48>>3]=l,b[n+56>>3]=o,b[n+64>>3]=i,A=n+72|0,r=A+96|0;do t[A>>2]=0,A=A+4|0;while((A|0)<(r|0));jr(e|0,n|0,168)|0,k=s}function sA(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0;N=k,k=k+288|0,p=N+264|0,M=N+96|0,f=N,l=f,a=l+96|0;do t[l>>2]=0,l=l+4|0;while((l|0)<(a|0));return A=Jn(A,f)|0,A|0?(I=A,k=N,I|0):(a=f,f=t[a>>2]|0,a=t[a+4>>2]|0,ir(f,a,p)|0,Br(f,a,M)|0,o=+tn(p,M+8|0),b[p>>3]=+b[e>>3],a=p+8|0,b[a>>3]=+b[e+16>>3],b[M>>3]=+b[e+8>>3],f=M+8|0,b[f>>3]=+b[e+24>>3],s=+tn(p,M),W=+b[a>>3]-+b[f>>3],i=+$A(+W),G=+b[p>>3]-+b[M>>3],n=+$A(+G),!(W==0|G==0)&&(W=+ii(+i,+n),W=+at(+(s*s/+bn(+(W/+bn(+i,+n)),3)/(o*(o*2.59807621135)*.8))),b[ge>>3]=W,R=~~W>>>0,I=+$A(W)>=1?W>0?~~+et(+Ve(W/4294967296),4294967295)>>>0:~~+at((W-+(~~W>>>0))/4294967296)>>>0:0,(t[ge+4>>2]&2146435072|0)!=2146435072)?(M=(R|0)==0&(I|0)==0,A=r,t[A>>2]=M?1:R,t[A+4>>2]=M?0:I,A=0):A=1,I=A,k=N,I|0)}function yA(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0;f=k,k=k+288|0,o=f+264|0,l=f+96|0,a=f,s=a,i=s+96|0;do t[s>>2]=0,s=s+4|0;while((s|0)<(i|0));return r=Jn(r,a)|0,r|0?(n=r,k=f,n|0):(r=a,s=t[r>>2]|0,r=t[r+4>>2]|0,ir(s,r,o)|0,Br(s,r,l)|0,p=+tn(o,l+8|0),p=+at(+(+tn(e,A)/(p*2))),b[ge>>3]=p,r=~~p>>>0,s=+$A(p)>=1?p>0?~~+et(+Ve(p/4294967296),4294967295)>>>0:~~+at((p-+(~~p>>>0))/4294967296)>>>0:0,(t[ge+4>>2]&2146435072|0)==2146435072?(n=1,k=f,n|0):(a=(r|0)==0&(s|0)==0,t[n>>2]=a?1:r,t[n+4>>2]=a?0:s,n=0,k=f,n|0))}function LA(e,A){e=e|0,A=+A;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;i=e+16|0,o=+b[i>>3],r=e+24|0,s=+b[r>>3],n=o-s,n=o>3],l=e+8|0,a=+b[l>>3],p=f-a,n=(n*A-n)*.5,A=(p*A-p)*.5,f=f+A,b[e>>3]=f>1.5707963267948966?1.5707963267948966:f,A=a-A,b[l>>3]=A<-1.5707963267948966?-1.5707963267948966:A,A=o+n,A=A>3.141592653589793?A+-6.283185307179586:A,b[i>>3]=A<-3.141592653589793?A+6.283185307179586:A,A=s-n,A=A>3.141592653589793?A+-6.283185307179586:A,b[r>>3]=A<-3.141592653589793?A+6.283185307179586:A}function WA(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0,t[e>>2]=A,t[e+4>>2]=r,t[e+8>>2]=n}function he(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;M=A+8|0,t[M>>2]=0,a=+b[e>>3],o=+$A(+a),f=+b[e+8>>3],l=+$A(+f)*1.1547005383792515,o=o+l*.5,r=~~o,e=~~l,o=o-+(r|0),l=l-+(e|0);do if(o<.5)if(o<.3333333333333333)if(t[A>>2]=r,l<(o+1)*.5){t[A+4>>2]=e;break}else{e=e+1|0,t[A+4>>2]=e;break}else if(R=1-o,e=(!(l>2]=e,R<=l&l>2]=r;break}else{t[A>>2]=r;break}else{if(!(o<.6666666666666666))if(r=r+1|0,t[A>>2]=r,l>2]=e;break}else{e=e+1|0,t[A+4>>2]=e;break}if(l<1-o){if(t[A+4>>2]=e,o*2+-1>2]=r;break}}else e=e+1|0,t[A+4>>2]=e;r=r+1|0,t[A>>2]=r}while(!1);do if(a<0)if(e&1){p=(e+1|0)/2|0,p=ft(r|0,((r|0)<0)<<31>>31|0,p|0,((p|0)<0)<<31>>31|0)|0,r=~~(+(r|0)-((+(p>>>0)+4294967296*+(S()|0))*2+1)),t[A>>2]=r;break}else{p=(e|0)/2|0,p=ft(r|0,((r|0)<0)<<31>>31|0,p|0,((p|0)<0)<<31>>31|0)|0,r=~~(+(r|0)-(+(p>>>0)+4294967296*+(S()|0))*2),t[A>>2]=r;break}while(!1);p=A+4|0,f<0&&(r=r-((e<<1|1|0)/2|0)|0,t[A>>2]=r,e=0-e|0,t[p>>2]=e),n=e-r|0,(r|0)<0?(s=0-r|0,t[p>>2]=n,t[M>>2]=s,t[A>>2]=0,e=n,r=0):s=0,(e|0)<0&&(r=r-e|0,t[A>>2]=r,s=s-e|0,t[M>>2]=s,t[p>>2]=0,e=0),i=r-s|0,n=e-s|0,(s|0)<0&&(t[A>>2]=i,t[p>>2]=n,t[M>>2]=0,e=n,r=i,s=0),n=(e|0)<(r|0)?e:r,n=(s|0)<(n|0)?s:n,!((n|0)<=0)&&(t[A>>2]=r-n,t[p>>2]=e-n,t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(i?0-n|0:0)+((t[e+8>>2]|0)-(l?o:0))|0,r=(s|0)<0,e=r?0:s,A=(i?0:n)-(r?s:0)|0,s=(l?0:o)-(i?n:0)-(r?s:0)|0,r=(A|0)<(s|0)?A:s,r=(e|0)<(r|0)?e:r,n=(r|0)>0,e=e-(n?r:0)|0,A=A-(n?r:0)|0;A:do switch(s-(n?r:0)|0){case 0:switch(A|0){case 0:return l=(e|0)==0?0:(e|0)==1?1:7,l|0;case 1:return l=(e|0)==0?2:(e|0)==1?3:7,l|0;default:break A}case 1:switch(A|0){case 0:return l=(e|0)==0?4:(e|0)==1?5:7,l|0;case 1:{if(!e)e=6;else break A;return e|0}default:break A}}while(!1);return l=7,l|0}function Dt(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0;if(a=e+8|0,o=t[a>>2]|0,l=(t[e>>2]|0)-o|0,f=e+4|0,o=(t[f>>2]|0)-o|0,l>>>0>715827881|o>>>0>715827881){if(n=(l|0)>0,s=2147483647-l|0,i=-2147483648-l|0,(n?(s|0)<(l|0):(i|0)>(l|0))||(r=l<<1,n?(2147483647-r|0)<(l|0):(-2147483648-r|0)>(l|0))||((o|0)>0?(2147483647-o|0)<(o|0):(-2147483648-o|0)>(o|0))||(A=l*3|0,r=o<<1,(n?(s|0)<(r|0):(i|0)>(r|0))||((l|0)>-1?(A|-2147483648|0)>=(o|0):(A^-2147483648|0)<(o|0))))return f=1,f|0}else r=o<<1,A=l*3|0;return n=G0(+(A-o|0)*.14285714285714285)|0,t[e>>2]=n,s=G0(+(r+l|0)*.14285714285714285)|0,t[f>>2]=s,t[a>>2]=0,r=(s|0)<(n|0),A=r?n:s,r=r?s:n,(r|0)<0&&(((r|0)==-2147483648||((A|0)>0?(2147483647-A|0)<(r|0):(-2147483648-A|0)>(r|0)))&&OA(27795,26892,354,26903),((A|0)>-1?(A|-2147483648|0)>=(r|0):(A^-2147483648|0)<(r|0))&&OA(27795,26892,354,26903)),A=s-n|0,(n|0)<0?(r=0-n|0,t[f>>2]=A,t[a>>2]=r,t[e>>2]=0,n=0):(A=s,r=0),(A|0)<0&&(n=n-A|0,t[e>>2]=n,r=r-A|0,t[a>>2]=r,t[f>>2]=0,A=0),i=n-r|0,s=A-r|0,(r|0)<0?(t[e>>2]=i,t[f>>2]=s,t[a>>2]=0,A=s,s=i,r=0):s=n,n=(A|0)<(s|0)?A:s,n=(r|0)<(n|0)?r:n,(n|0)<=0?(f=0,f|0):(t[e>>2]=s-n,t[f>>2]=A-n,t[a>>2]=r-n,f=0,f|0)}function hn(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0;if(o=e+8|0,s=t[o>>2]|0,i=(t[e>>2]|0)-s|0,l=e+4|0,s=(t[l>>2]|0)-s|0,i>>>0>715827881|s>>>0>715827881){if(r=(i|0)>0,(r?(2147483647-i|0)<(i|0):(-2147483648-i|0)>(i|0))||(A=i<<1,n=(s|0)>0,n?(2147483647-s|0)<(s|0):(-2147483648-s|0)>(s|0)))return l=1,l|0;if(a=s<<1,(n?(2147483647-a|0)<(s|0):(-2147483648-a|0)>(s|0))||(r?(2147483647-A|0)<(s|0):(-2147483648-A|0)>(s|0))||(r=s*3|0,(s|0)>-1?(r|-2147483648|0)>=(i|0):(r^-2147483648|0)<(i|0)))return a=1,a|0}else r=s*3|0,A=i<<1;return n=G0(+(A+s|0)*.14285714285714285)|0,t[e>>2]=n,s=G0(+(r-i|0)*.14285714285714285)|0,t[l>>2]=s,t[o>>2]=0,r=(s|0)<(n|0),A=r?n:s,r=r?s:n,(r|0)<0&&(((r|0)==-2147483648||((A|0)>0?(2147483647-A|0)<(r|0):(-2147483648-A|0)>(r|0)))&&OA(27795,26892,402,26917),((A|0)>-1?(A|-2147483648|0)>=(r|0):(A^-2147483648|0)<(r|0))&&OA(27795,26892,402,26917)),A=s-n|0,(n|0)<0?(r=0-n|0,t[l>>2]=A,t[o>>2]=r,t[e>>2]=0,n=0):(A=s,r=0),(A|0)<0&&(n=n-A|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e+8|0,r=t[l>>2]|0,s=n+A|0,t[e>>2]=s,n=r+n|0,t[o>>2]=n,A=r+A|0,t[l>>2]=A,r=n-s|0,(s|0)<0?(A=A-s|0,t[o>>2]=r,t[l>>2]=A,t[e>>2]=0,n=0):(r=n,n=s),(r|0)<0&&(n=n-r|0,t[e>>2]=n,A=A-r|0,t[l>>2]=A,t[o>>2]=0,r=0),i=n-A|0,s=r-A|0,(A|0)<0?(t[e>>2]=i,t[o>>2]=s,t[l>>2]=0,n=i,A=0):s=r,r=(s|0)<(n|0)?s:n,r=(A|0)<(r|0)?A:r,!((r|0)<=0)&&(t[e>>2]=n-r,t[o>>2]=s-r,t[l>>2]=A-r)}function Wt(e){switch(e=e|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;break}}return e|0}function Yt(e){switch(e=e|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;break}}return e|0}function Yr(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0;A=t[e>>2]|0,o=e+4|0,r=t[o>>2]|0,l=e+8|0,n=t[l>>2]|0,s=r+(A<<1)|0,t[e>>2]=s,r=n+(r<<1)|0,t[o>>2]=r,A=(n<<1)+A|0,t[l>>2]=A,n=r-s|0,(s|0)<0?(A=A-s|0,t[o>>2]=n,t[l>>2]=A,t[e>>2]=0,r=n,n=0):n=s,(r|0)<0&&(n=n-r|0,t[e>>2]=n,A=A-r|0,t[l>>2]=A,t[o>>2]=0,r=0),i=n-A|0,s=r-A|0,(A|0)<0?(t[e>>2]=i,t[o>>2]=s,t[l>>2]=0,n=i,A=0):s=r,r=(s|0)<(n|0)?s:n,r=(A|0)<(r|0)?A:r,!((r|0)<=0)&&(t[e>>2]=n-r,t[o>>2]=s-r,t[l>>2]=A-r)}function Zr(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0;s=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=0,o=0,l=0,a=0,f=0,p=0,M=0;if(M=k,k=k+64|0,p=M,l=M+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(n&2013265920|0)==134217728)))return s=5,k=M,s|0;if((e|0)==(r|0)&(A|0)==(n|0))return t[s>>2]=0,s=0,k=M,s|0;if(o=wA(e|0,A|0,52)|0,S()|0,o=o&15,f=wA(r|0,n|0,52)|0,S()|0,(o|0)!=(f&15|0))return s=12,k=M,s|0;if(i=o+-1|0,o>>>0>1){Rt(e,A,i,p)|0,Rt(r,n,i,l)|0,f=p,a=t[f>>2]|0,f=t[f+4>>2]|0;A:do if((a|0)==(t[l>>2]|0)&&(f|0)==(t[l+4>>2]|0)){o=(o^15)*3|0,i=wA(e|0,A|0,o|0)|0,S()|0,i=i&7,o=wA(r|0,n|0,o|0)|0,S()|0,o=o&7;do if((i|0)==0|(o|0)==0)t[s>>2]=1,i=0;else if((i|0)==7)i=5;else{if((i|0)==1|(o|0)==1&&He(a,f)|0){i=5;break}if((t[15536+(i<<2)>>2]|0)!=(o|0)&&(t[15568+(i<<2)>>2]|0)!=(o|0))break A;t[s>>2]=1,i=0}while(!1);return s=i,k=M,s|0}while(!1)}i=p,o=i+56|0;do t[i>>2]=0,i=i+4|0;while((i|0)<(o|0));return v(e,A,1,p)|0,A=p,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0))&&(A=p+8|0,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0)))&&(A=p+16|0,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0)))&&(A=p+24|0,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0)))&&(A=p+32|0,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0)))&&(A=p+40|0,!((t[A>>2]|0)==(r|0)&&(t[A+4>>2]|0)==(n|0)))?(i=p+48|0,i=((t[i>>2]|0)==(r|0)?(t[i+4>>2]|0)==(n|0):0)&1):i=1,t[s>>2]=i,s=0,k=M,s|0}function mn(e,A,r,n,s){return e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,r=Ae(e,A,r,n)|0,(r|0)==7?(s=11,s|0):(n=kA(r|0,0,56)|0,A=A&-2130706433|(S()|0)|268435456,t[s>>2]=e|n,t[s+4>>2]=A,s=0,s|0)}function Cr(e,A,r){return e=e|0,A=A|0,r=r|0,!0&(A&2013265920|0)==268435456?(t[r>>2]=e,t[r+4>>2]=A&-2130706433|134217728,r=0,r|0):(r=6,r|0)}function pn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;return s=k,k=k+16|0,n=s,t[n>>2]=0,!0&(A&2013265920|0)==268435456?(i=wA(e|0,A|0,56)|0,S()|0,n=Z(e,A&-2130706433|134217728,i&7,n,r)|0,k=s,n|0):(n=6,k=s,n|0)}function Xr(e,A){e=e|0,A=A|0;var r=0;switch(r=wA(e|0,A|0,56)|0,S()|0,r&7){case 0:case 7:return r=0,r|0}return r=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(He(e,r)|0)!=0?(r=0,r|0):(r=We(e,r)|0,r|0)}function Er(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;return s=k,k=k+16|0,n=s,!0&(A&2013265920|0)==268435456?(i=A&-2130706433|134217728,o=r,t[o>>2]=e,t[o+4>>2]=i,t[n>>2]=0,A=wA(e|0,A|0,56)|0,S()|0,n=Z(e,i,A&7,n,r+8|0)|0,k=s,n|0):(n=6,k=s,n|0)}function Sr(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0;return s=(He(e,A)|0)==0,A=A&-2130706433,n=r,t[n>>2]=s?e:0,t[n+4>>2]=s?A|285212672:0,n=r+8|0,t[n>>2]=e,t[n+4>>2]=A|301989888,n=r+16|0,t[n>>2]=e,t[n+4>>2]=A|318767104,n=r+24|0,t[n>>2]=e,t[n+4>>2]=A|335544320,n=r+32|0,t[n>>2]=e,t[n+4>>2]=A|352321536,r=r+40|0,t[r>>2]=e,t[r+4>>2]=A|369098752,0}function nr(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;return o=k,k=k+16|0,s=o,i=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(n=wA(e|0,A|0,56)|0,S()|0,n=Kl(e,i,n&7)|0,(n|0)==-1?(t[r>>2]=0,i=6,k=o,i|0):(Mr(e,i,s)|0&&OA(27795,26932,282,26947),A=wA(e|0,A|0,52)|0,S()|0,A=A&15,He(e,i)|0?w(s,A,n,2,r):J(s,A,n,2,r),i=0,k=o,i|0)):(i=6,k=o,i|0)}function gn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0;n=k,k=k+16|0,s=n,yn(e,A,r,s),he(s,r+4|0),k=n}function yn(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0;if(l=k,k=k+16|0,a=l,Jr(e,r,a),i=+Qt(+(1-+b[a>>3]*.5)),i<1e-16){t[n>>2]=0,t[n+4>>2]=0,t[n+8>>2]=0,t[n+12>>2]=0,k=l;return}if(a=t[r>>2]|0,s=+b[15920+(a*24|0)>>3],s=+en(s-+en(+xl(15600+(a<<4)|0,e))),t0(A)|0?o=+en(s+-.3334731722518321):o=s,s=+rt(+i)*2.618033988749896,(A|0)>0){e=0;do s=s*2.6457513110645907,e=e+1|0;while((e|0)!=(A|0))}i=+_e(+o)*s,b[n>>3]=i,o=+ie(+o)*s,b[n+8>>3]=o,k=l}function Jr(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;if(i=k,k=k+32|0,s=i,$l(e,s),t[A>>2]=0,b[r>>3]=5,n=+it(16400,s),n<+b[r>>3]&&(t[A>>2]=0,b[r>>3]=n),n=+it(16424,s),n<+b[r>>3]&&(t[A>>2]=1,b[r>>3]=n),n=+it(16448,s),n<+b[r>>3]&&(t[A>>2]=2,b[r>>3]=n),n=+it(16472,s),n<+b[r>>3]&&(t[A>>2]=3,b[r>>3]=n),n=+it(16496,s),n<+b[r>>3]&&(t[A>>2]=4,b[r>>3]=n),n=+it(16520,s),n<+b[r>>3]&&(t[A>>2]=5,b[r>>3]=n),n=+it(16544,s),n<+b[r>>3]&&(t[A>>2]=6,b[r>>3]=n),n=+it(16568,s),n<+b[r>>3]&&(t[A>>2]=7,b[r>>3]=n),n=+it(16592,s),n<+b[r>>3]&&(t[A>>2]=8,b[r>>3]=n),n=+it(16616,s),n<+b[r>>3]&&(t[A>>2]=9,b[r>>3]=n),n=+it(16640,s),n<+b[r>>3]&&(t[A>>2]=10,b[r>>3]=n),n=+it(16664,s),n<+b[r>>3]&&(t[A>>2]=11,b[r>>3]=n),n=+it(16688,s),n<+b[r>>3]&&(t[A>>2]=12,b[r>>3]=n),n=+it(16712,s),n<+b[r>>3]&&(t[A>>2]=13,b[r>>3]=n),n=+it(16736,s),n<+b[r>>3]&&(t[A>>2]=14,b[r>>3]=n),n=+it(16760,s),n<+b[r>>3]&&(t[A>>2]=15,b[r>>3]=n),n=+it(16784,s),n<+b[r>>3]&&(t[A>>2]=16,b[r>>3]=n),n=+it(16808,s),n<+b[r>>3]&&(t[A>>2]=17,b[r>>3]=n),n=+it(16832,s),n<+b[r>>3]&&(t[A>>2]=18,b[r>>3]=n),n=+it(16856,s),!(n<+b[r>>3])){k=i;return}t[A>>2]=19,b[r>>3]=n,k=i}function z0(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0;if(i=+Zl(e),i<1e-16){A=15600+(A<<4)|0,t[s>>2]=t[A>>2],t[s+4>>2]=t[A+4>>2],t[s+8>>2]=t[A+8>>2],t[s+12>>2]=t[A+12>>2];return}if(o=+Te(+ +b[e+8>>3],+ +b[e>>3]),(r|0)>0){e=0;do i=i*.37796447300922725,e=e+1|0;while((e|0)!=(r|0))}l=i*.3333333333333333,n?(r=(t0(r)|0)==0,i=+gt(+((r?l:l*.37796447300922725)*.381966011250105))):(i=+gt(+(i*.381966011250105)),t0(r)|0&&(o=+en(o+.3334731722518321))),wl(15600+(A<<4)|0,+en(+b[15920+(A*24|0)>>3]-o),i,s)}function d(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0;n=k,k=k+16|0,s=n,Oe(e+4|0,s),z0(s,t[e>>2]|0,A,0,r),k=n}function w(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0,de=0,Se=0,ne=0,HA=0,EA=0,ve=0,Ye=0,me=0;if(ve=k,k=k+272|0,i=ve+256|0,q=ve+240|0,ne=ve,HA=ve+224|0,EA=ve+208|0,K=ve+176|0,U=ve+160|0,SA=ve+192|0,zA=ve+144|0,QA=ve+128|0,ce=ve+112|0,de=ve+96|0,Se=ve+80|0,t[i>>2]=A,t[q>>2]=t[e>>2],t[q+4>>2]=t[e+4>>2],t[q+8>>2]=t[e+8>>2],t[q+12>>2]=t[e+12>>2],B(q,i,ne),t[s>>2]=0,q=n+r+((n|0)==5&1)|0,(q|0)<=(r|0)){k=ve;return}a=t[i>>2]|0,f=HA+4|0,p=K+4|0,M=r+5|0,R=16880+(a<<2)|0,I=16960+(a<<2)|0,N=QA+8|0,G=ce+8|0,W=de+8|0,nA=EA+4|0,l=r;A:for(;;){o=ne+(((l|0)%5|0)<<4)|0,t[EA>>2]=t[o>>2],t[EA+4>>2]=t[o+4>>2],t[EA+8>>2]=t[o+8>>2],t[EA+12>>2]=t[o+12>>2];do;while((F(EA,a,0,1)|0)==2);if((l|0)>(r|0)&(t0(A)|0)!=0){if(t[K>>2]=t[EA>>2],t[K+4>>2]=t[EA+4>>2],t[K+8>>2]=t[EA+8>>2],t[K+12>>2]=t[EA+12>>2],Oe(f,U),n=t[K>>2]|0,i=t[17040+(n*80|0)+(t[HA>>2]<<2)>>2]|0,t[K>>2]=t[18640+(n*80|0)+(i*20|0)>>2],o=t[18640+(n*80|0)+(i*20|0)+16>>2]|0,(o|0)>0){e=0;do br(p),e=e+1|0;while((e|0)<(o|0))}switch(o=18640+(n*80|0)+(i*20|0)+4|0,t[SA>>2]=t[o>>2],t[SA+4>>2]=t[o+4>>2],t[SA+8>>2]=t[o+8>>2],ct(SA,(t[R>>2]|0)*3|0),ze(p,SA,p),oe(p),Oe(p,zA),Ye=+(t[I>>2]|0),b[QA>>3]=Ye*3,b[N>>3]=0,me=Ye*-1.5,b[ce>>3]=me,b[G>>3]=Ye*2.598076211353316,b[de>>3]=me,b[W>>3]=Ye*-2.598076211353316,t[17040+((t[K>>2]|0)*80|0)+(t[EA>>2]<<2)>>2]|0){case 1:{e=ce,n=QA;break}case 3:{e=de,n=ce;break}case 2:{e=QA,n=de;break}default:{e=12;break A}}qs(U,zA,n,e,Se),z0(Se,t[K>>2]|0,a,1,s+8+(t[s>>2]<<4)|0),t[s>>2]=(t[s>>2]|0)+1}if((l|0)<(M|0)&&(Oe(nA,K),z0(K,t[EA>>2]|0,a,1,s+8+(t[s>>2]<<4)|0),t[s>>2]=(t[s>>2]|0)+1),t[HA>>2]=t[EA>>2],t[HA+4>>2]=t[EA+4>>2],t[HA+8>>2]=t[EA+8>>2],t[HA+12>>2]=t[EA+12>>2],l=l+1|0,(l|0)>=(q|0)){e=3;break}}if((e|0)==3){k=ve;return}else(e|0)==12&&OA(26970,27017,572,27027)}function B(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0;a=k,k=k+128|0,n=a+64|0,s=a,i=n,o=20240,l=i+60|0;do t[i>>2]=t[o>>2],i=i+4|0,o=o+4|0;while((i|0)<(l|0));i=s,o=20304,l=i+60|0;do t[i>>2]=t[o>>2],i=i+4|0,o=o+4|0;while((i|0)<(l|0));l=(t0(t[A>>2]|0)|0)==0,n=l?n:s,s=e+4|0,Yr(s),Zr(s),t0(t[A>>2]|0)|0&&(Vt(s),t[A>>2]=(t[A>>2]|0)+1),t[r>>2]=t[e>>2],A=r+4|0,ze(s,n,A),oe(A),t[r+16>>2]=t[e>>2],A=r+20|0,ze(s,n+12|0,A),oe(A),t[r+32>>2]=t[e>>2],A=r+36|0,ze(s,n+24|0,A),oe(A),t[r+48>>2]=t[e>>2],A=r+52|0,ze(s,n+36|0,A),oe(A),t[r+64>>2]=t[e>>2],r=r+68|0,ze(s,n+48|0,r),oe(r),k=a}function F(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0;if(N=k,k=k+32|0,R=N+12|0,l=N,I=e+4|0,M=t[16960+(A<<2)>>2]|0,p=(n|0)!=0,M=p?M*3|0:M,s=t[I>>2]|0,f=e+8|0,o=t[f>>2]|0,p){if(i=e+12|0,n=t[i>>2]|0,s=o+s+n|0,(s|0)==(M|0))return I=1,k=N,I|0;a=i}else a=e+12|0,n=t[a>>2]|0,s=o+s+n|0;if((s|0)<=(M|0))return I=0,k=N,I|0;do if((n|0)>0){if(n=t[e>>2]|0,(o|0)>0){i=18640+(n*80|0)+60|0,n=e;break}n=18640+(n*80|0)+40|0,r?(WA(R,M,0,0),wt(I,R,l),T0(l),ze(l,R,I),i=n,n=e):(i=n,n=e)}else i=18640+((t[e>>2]|0)*80|0)+20|0,n=e;while(!1);if(t[n>>2]=t[i>>2],s=i+16|0,(t[s>>2]|0)>0){n=0;do br(I),n=n+1|0;while((n|0)<(t[s>>2]|0))}return e=i+4|0,t[R>>2]=t[e>>2],t[R+4>>2]=t[e+4>>2],t[R+8>>2]=t[e+8>>2],A=t[16880+(A<<2)>>2]|0,ct(R,p?A*3|0:A),ze(I,R,I),oe(I),p?n=((t[f>>2]|0)+(t[I>>2]|0)+(t[a>>2]|0)|0)==(M|0)?1:2:n=2,I=n,k=N,I|0}function tA(e,A){e=e|0,A=A|0;var r=0;do r=F(e,A,0,1)|0;while((r|0)==2);return r|0}function J(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0,de=0,Se=0,ne=0;if(de=k,k=k+240|0,i=de+224|0,SA=de+208|0,zA=de,QA=de+192|0,ce=de+176|0,W=de+160|0,nA=de+144|0,q=de+128|0,K=de+112|0,U=de+96|0,t[i>>2]=A,t[SA>>2]=t[e>>2],t[SA+4>>2]=t[e+4>>2],t[SA+8>>2]=t[e+8>>2],t[SA+12>>2]=t[e+12>>2],dA(SA,i,zA),t[s>>2]=0,G=n+r+((n|0)==6&1)|0,(G|0)<=(r|0)){k=de;return}a=t[i>>2]|0,f=r+6|0,p=16960+(a<<2)|0,M=nA+8|0,R=q+8|0,I=K+8|0,N=QA+4|0,o=0,l=r,n=-1;A:for(;;){if(i=(l|0)%6|0,e=zA+(i<<4)|0,t[QA>>2]=t[e>>2],t[QA+4>>2]=t[e+4>>2],t[QA+8>>2]=t[e+8>>2],t[QA+12>>2]=t[e+12>>2],e=o,o=F(QA,a,0,1)|0,(l|0)>(r|0)&(t0(A)|0)!=0&&(e|0)!=1&&(t[QA>>2]|0)!=(n|0)){switch(Oe(zA+(((i+5|0)%6|0)<<4)+4|0,ce),Oe(zA+(i<<4)+4|0,W),Se=+(t[p>>2]|0),b[nA>>3]=Se*3,b[M>>3]=0,ne=Se*-1.5,b[q>>3]=ne,b[R>>3]=Se*2.598076211353316,b[K>>3]=ne,b[I>>3]=Se*-2.598076211353316,i=t[SA>>2]|0,t[17040+(i*80|0)+(((n|0)==(i|0)?t[QA>>2]|0:n)<<2)>>2]|0){case 1:{e=q,n=nA;break}case 3:{e=K,n=q;break}case 2:{e=nA,n=K;break}default:{e=8;break A}}qs(ce,W,n,e,U),!(Xs(ce,U)|0)&&!(Xs(W,U)|0)&&(z0(U,t[SA>>2]|0,a,1,s+8+(t[s>>2]<<4)|0),t[s>>2]=(t[s>>2]|0)+1)}if((l|0)<(f|0)&&(Oe(N,ce),z0(ce,t[QA>>2]|0,a,1,s+8+(t[s>>2]<<4)|0),t[s>>2]=(t[s>>2]|0)+1),l=l+1|0,(l|0)>=(G|0)){e=3;break}else n=t[QA>>2]|0}if((e|0)==3){k=de;return}else(e|0)==8&&OA(27054,27017,737,27099)}function dA(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0;a=k,k=k+160|0,n=a+80|0,s=a,i=n,o=20368,l=i+72|0;do t[i>>2]=t[o>>2],i=i+4|0,o=o+4|0;while((i|0)<(l|0));i=s,o=20448,l=i+72|0;do t[i>>2]=t[o>>2],i=i+4|0,o=o+4|0;while((i|0)<(l|0));l=(t0(t[A>>2]|0)|0)==0,n=l?n:s,s=e+4|0,Yr(s),Zr(s),t0(t[A>>2]|0)|0&&(Vt(s),t[A>>2]=(t[A>>2]|0)+1),t[r>>2]=t[e>>2],A=r+4|0,ze(s,n,A),oe(A),t[r+16>>2]=t[e>>2],A=r+20|0,ze(s,n+12|0,A),oe(A),t[r+32>>2]=t[e>>2],A=r+36|0,ze(s,n+24|0,A),oe(A),t[r+48>>2]=t[e>>2],A=r+52|0,ze(s,n+36|0,A),oe(A),t[r+64>>2]=t[e>>2],A=r+68|0,ze(s,n+48|0,A),oe(A),t[r+80>>2]=t[e>>2],r=r+84|0,ze(s,n+60|0,r),oe(r),k=a}function BA(e,A){return e=e|0,A=A|0,A=wA(e|0,A|0,52)|0,S()|0,A&15|0}function te(e,A){return e=e|0,A=A|0,A=wA(e|0,A|0,45)|0,S()|0,A&127|0}function ke(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,(r+-1|0)>>>0>14?(n=4,n|0):(r=wA(e|0,A|0,(15-r|0)*3|0)|0,S()|0,t[n>>2]=r&7,n=0,n|0)}function we(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0;if(e>>>0>15)return n=4,n|0;if(A>>>0>121)return n=17,n|0;o=kA(e|0,0,52)|0,s=S()|0,l=kA(A|0,0,45)|0,s=s|(S()|0)|134225919;A:do if((e|0)>=1){for(l=1,o=(xA[20528+A>>0]|0)!=0,i=-1;;){if(A=t[r+(l+-1<<2)>>2]|0,A>>>0>6){s=18,A=10;break}if(!((A|0)==0|o^1))if((A|0)==1){s=19,A=10;break}else o=0;if(f=(15-l|0)*3|0,a=kA(7,0,f|0)|0,s=s&~(S()|0),A=kA(A|0,((A|0)<0)<<31>>31|0,f|0)|0,i=A|i&~a,s=S()|0|s,(l|0)<(e|0))l=l+1|0;else break A}if((A|0)==10)return s|0}else i=-1;while(!1);return f=n,t[f>>2]=i,t[f+4>>2]=s,f=0,f|0}function We(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0;return!(!0&(A&-16777216|0)==134217728)||(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,r=wA(e|0,A|0,45)|0,S()|0,r=r&127,r>>>0>121)?(e=0,e|0):(o=(n^15)*3|0,s=wA(e|0,A|0,o|0)|0,o=kA(s|0,S()|0,o|0)|0,s=S()|0,i=ft(-1227133514,-1171,o|0,s|0)|0,!((o&613566756&i|0)==0&(s&4681&(S()|0)|0)==0)||(o=(n*3|0)+19|0,i=kA(~e|0,~A|0,o|0)|0,o=wA(i|0,S()|0,o|0)|0,!((n|0)==15|(o|0)==0&(S()|0)==0))?(o=0,o|0):!(xA[20528+r>>0]|0)||(A=A&8191,(e|0)==0&(A|0)==0)?(o=1,o|0):(o=os(e|0,A|0)|0,S()|0,((63-o|0)%3|0|0)!=0|0))}function Tt(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0;return!0&(A&-16777216|0)==134217728&&(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,r=wA(e|0,A|0,45)|0,S()|0,r=r&127,r>>>0<=121)&&(o=(n^15)*3|0,s=wA(e|0,A|0,o|0)|0,o=kA(s|0,S()|0,o|0)|0,s=S()|0,i=ft(-1227133514,-1171,o|0,s|0)|0,(o&613566756&i|0)==0&(s&4681&(S()|0)|0)==0)&&(o=(n*3|0)+19|0,i=kA(~e|0,~A|0,o|0)|0,o=wA(i|0,S()|0,o|0)|0,(n|0)==15|(o|0)==0&(S()|0)==0)&&(!(xA[20528+r>>0]|0)||(r=A&8191,(e|0)==0&(r|0)==0)||(o=os(e|0,r|0)|0,S()|0,(63-o|0)%3|0|0))||Xr(e,A)|0?(o=1,o|0):(o=(Js(e,A)|0)!=0&1,o|0)}function jt(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0;if(s=kA(A|0,0,52)|0,i=S()|0,r=kA(r|0,0,45)|0,r=i|(S()|0)|134225919,(A|0)<1){i=-1,n=r,A=e,t[A>>2]=i,e=e+4|0,t[e>>2]=n;return}for(i=1,s=-1;o=(15-i|0)*3|0,l=kA(7,0,o|0)|0,r=r&~(S()|0),o=kA(n|0,0,o|0)|0,s=s&~l|o,r=r|(S()|0),(i|0)!=(A|0);)i=i+1|0;l=e,o=l,t[o>>2]=s,l=l+4|0,t[l>>2]=r}function Rt(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0;if(i=wA(e|0,A|0,52)|0,S()|0,i=i&15,r>>>0>15)return n=4,n|0;if((i|0)<(r|0))return n=12,n|0;if((i|0)==(r|0))return t[n>>2]=e,t[n+4>>2]=A,n=0,n|0;if(s=kA(r|0,0,52)|0,s=s|e,e=S()|0|A&-15728641,(i|0)>(r|0))do A=kA(7,0,(14-r|0)*3|0)|0,r=r+1|0,s=A|s,e=S()|0|e;while((r|0)<(i|0));return t[n>>2]=s,t[n+4>>2]=e,n=0,n|0}function x0(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0;if(i=wA(e|0,A|0,52)|0,S()|0,i=i&15,!((r|0)<16&(i|0)<=(r|0)))return n=4,n|0;s=r-i|0,r=wA(e|0,A|0,45)|0,S()|0;A:do if(!(je(r&127)|0))r=H0(7,0,s,((s|0)<0)<<31>>31)|0,s=S()|0;else{e:do if(i|0){for(r=1;o=kA(7,0,(15-r|0)*3|0)|0,!!((o&e|0)==0&((S()|0)&A|0)==0);)if(r>>>0>>0)r=r+1|0;else break e;r=H0(7,0,s,((s|0)<0)<<31>>31)|0,s=S()|0;break A}while(!1);r=H0(7,0,s,((s|0)<0)<<31>>31)|0,r=ht(r|0,S()|0,5,0)|0,r=YA(r|0,S()|0,-5,-1)|0,r=U0(r|0,S()|0,6,0)|0,r=YA(r|0,S()|0,1,0)|0,s=S()|0}while(!1);return o=n,t[o>>2]=r,t[o+4>>2]=s,o=0,o|0}function He(e,A){e=e|0,A=A|0;var r=0,n=0,s=0;if(s=wA(e|0,A|0,45)|0,S()|0,!(je(s&127)|0))return s=0,s|0;s=wA(e|0,A|0,52)|0,S()|0,s=s&15;A:do if(!s)r=0;else for(n=1;;){if(r=wA(e|0,A|0,(15-n|0)*3|0)|0,S()|0,r=r&7,r|0)break A;if(n>>>0>>0)n=n+1|0;else{r=0;break}}while(!1);return s=(r|0)==0&1,s|0}function An(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0;if(o=k,k=k+16|0,i=o,As(i,e,A,r),A=i,e=t[A>>2]|0,A=t[A+4>>2]|0,(e|0)==0&(A|0)==0)return k=o,0;s=0,r=0;do l=n+(s<<3)|0,t[l>>2]=e,t[l+4>>2]=A,s=YA(s|0,r|0,1,0)|0,r=S()|0,es(i),l=i,e=t[l>>2]|0,A=t[l+4>>2]|0;while(!((e|0)==0&(A|0)==0));return k=o,0}function Ps(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,(n|0)<(r|0)?(r=A,n=e,KA(r|0),n|0):(r=kA(-1,-1,((n-r|0)*3|0)+3|0)|0,n=kA(~r|0,~(S()|0)|0,(15-n|0)*3|0)|0,r=~(S()|0)&A,n=~n&e,KA(r|0),n|0)}function Qs(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0;return s=wA(e|0,A|0,52)|0,S()|0,s=s&15,(r|0)<16&(s|0)<=(r|0)?((s|0)<(r|0)&&(s=kA(-1,-1,((r+-1-s|0)*3|0)+3|0)|0,s=kA(~s|0,~(S()|0)|0,(15-r|0)*3|0)|0,A=~(S()|0)&A,e=~s&e),s=kA(r|0,0,52)|0,r=A&-15728641|(S()|0),t[n>>2]=e|s,t[n+4>>2]=r,n=0,n|0):(n=4,n|0)}function ol(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0,de=0,Se=0,ne=0,HA=0,EA=0;if((r|0)==0&(n|0)==0)return EA=0,EA|0;if(s=e,i=t[s>>2]|0,s=t[s+4>>2]|0,!0&(s&15728640|0)==0){if(!((n|0)>0|(n|0)==0&r>>>0>0)||(EA=A,t[EA>>2]=i,t[EA+4>>2]=s,(r|0)==1&(n|0)==0))return EA=0,EA|0;s=1,i=0;do ne=e+(s<<3)|0,HA=t[ne+4>>2]|0,EA=A+(s<<3)|0,t[EA>>2]=t[ne>>2],t[EA+4>>2]=HA,s=YA(s|0,i|0,1,0)|0,i=S()|0;while((i|0)<(n|0)|(i|0)==(n|0)&s>>>0>>0);return s=0,s|0}if(Se=r<<3,HA=w0(Se)|0,!HA)return EA=13,EA|0;if(jr(HA|0,e|0,Se|0)|0,ne=Gt(r,8)|0,!ne)return qA(HA),EA=13,EA|0;A:for(;;){s=HA,f=t[s>>2]|0,s=t[s+4>>2]|0,ce=wA(f|0,s|0,52)|0,S()|0,ce=ce&15,de=ce+-1|0,QA=(ce|0)!=0,zA=(n|0)>0|(n|0)==0&r>>>0>0;e:do if(QA&zA){if(q=kA(de|0,0,52)|0,K=S()|0,de>>>0>15){if(!((f|0)==0&(s|0)==0)){EA=16;break A}for(i=0,e=0;;){if(i=YA(i|0,e|0,1,0)|0,e=S()|0,!((e|0)<(n|0)|(e|0)==(n|0)&i>>>0>>0))break e;if(o=HA+(i<<3)|0,SA=t[o>>2]|0,o=t[o+4>>2]|0,!((SA|0)==0&(o|0)==0)){s=o,EA=16;break A}}}for(l=f,e=s,i=0,o=0;;){if(!((l|0)==0&(e|0)==0)){if(!(!0&(e&117440512|0)==0)){EA=21;break A}if(p=wA(l|0,e|0,52)|0,S()|0,p=p&15,(p|0)<(de|0)){s=12,EA=27;break A}if((p|0)!=(de|0)&&(l=l|q,e=e&-15728641|K,p>>>0>=ce>>>0)){a=de;do SA=kA(7,0,(14-a|0)*3|0)|0,a=a+1|0,l=SA|l,e=S()|0|e;while(a>>>0

>>0)}if(R=Tr(l|0,e|0,r|0,n|0)|0,I=S()|0,a=ne+(R<<3)|0,p=a,M=t[p>>2]|0,p=t[p+4>>2]|0,!((M|0)==0&(p|0)==0)){W=0,nA=0;do{if((W|0)>(n|0)|(W|0)==(n|0)&nA>>>0>r>>>0){EA=31;break A}if((M|0)==(l|0)&(p&-117440513|0)==(e|0)){N=wA(M|0,p|0,56)|0,S()|0,N=N&7,G=N+1|0,SA=wA(M|0,p|0,45)|0,S()|0;t:do if(!(je(SA&127)|0))p=7;else{if(M=wA(M|0,p|0,52)|0,S()|0,M=M&15,!M){p=6;break}for(p=1;;){if(SA=kA(7,0,(15-p|0)*3|0)|0,!((SA&l|0)==0&((S()|0)&e|0)==0)){p=7;break t}if(p>>>0>>0)p=p+1|0;else{p=6;break}}}while(!1);if((N+2|0)>>>0>p>>>0){EA=41;break A}SA=kA(G|0,0,56)|0,e=S()|0|e&-117440513,U=a,t[U>>2]=0,t[U+4>>2]=0,l=SA|l}else R=YA(R|0,I|0,1,0)|0,R=_r(R|0,S()|0,r|0,n|0)|0,I=S()|0;nA=YA(nA|0,W|0,1,0)|0,W=S()|0,a=ne+(R<<3)|0,p=a,M=t[p>>2]|0,p=t[p+4>>2]|0}while(!((M|0)==0&(p|0)==0))}SA=a,t[SA>>2]=l,t[SA+4>>2]=e}if(i=YA(i|0,o|0,1,0)|0,o=S()|0,!((o|0)<(n|0)|(o|0)==(n|0)&i>>>0>>0))break e;e=HA+(i<<3)|0,l=t[e>>2]|0,e=t[e+4>>2]|0}}while(!1);if(SA=YA(r|0,n|0,5,0)|0,U=S()|0,U>>>0<0|(U|0)==0&SA>>>0<11){EA=85;break}if(SA=U0(r|0,n|0,6,0)|0,S()|0,SA=Gt(SA,8)|0,!SA){EA=48;break}do if(zA){for(G=0,e=0,N=0,W=0;;){if(p=ne+(G<<3)|0,o=p,i=t[o>>2]|0,o=t[o+4>>2]|0,(i|0)==0&(o|0)==0)U=N;else{M=wA(i|0,o|0,56)|0,S()|0,M=M&7,l=M+1|0,R=o&-117440513,U=wA(i|0,o|0,45)|0,S()|0;e:do if(je(U&127)|0){if(I=wA(i|0,o|0,52)|0,S()|0,I=I&15,I|0)for(a=1;;){if(U=kA(7,0,(15-a|0)*3|0)|0,!((i&U|0)==0&(R&(S()|0)|0)==0))break e;if(a>>>0>>0)a=a+1|0;else break}o=kA(l|0,0,56)|0,i=o|i,o=S()|0|R,l=p,t[l>>2]=i,t[l+4>>2]=o,l=M+2|0}while(!1);(l|0)==7?(U=SA+(e<<3)|0,t[U>>2]=i,t[U+4>>2]=o&-117440513,e=YA(e|0,N|0,1,0)|0,U=S()|0):U=N}if(G=YA(G|0,W|0,1,0)|0,W=S()|0,(W|0)<(n|0)|(W|0)==(n|0)&G>>>0>>0)N=U;else break}if(zA){if(nA=de>>>0>15,q=kA(de|0,0,52)|0,K=S()|0,!QA){for(i=0,a=0,l=0,o=0;(f|0)==0&(s|0)==0||(de=A+(i<<3)|0,t[de>>2]=f,t[de+4>>2]=s,i=YA(i|0,a|0,1,0)|0,a=S()|0),l=YA(l|0,o|0,1,0)|0,o=S()|0,!!((o|0)<(n|0)|(o|0)==(n|0)&l>>>0>>0);)s=HA+(l<<3)|0,f=t[s>>2]|0,s=t[s+4>>2]|0;s=U;break}for(i=0,a=0,o=0,l=0;;){do if(!((f|0)==0&(s|0)==0)){if(I=wA(f|0,s|0,52)|0,S()|0,I=I&15,nA|(I|0)<(de|0)){EA=80;break A}if((I|0)!=(de|0)){if(p=f|q,M=s&-15728641|K,I>>>0>=ce>>>0){R=de;do QA=kA(7,0,(14-R|0)*3|0)|0,R=R+1|0,p=QA|p,M=S()|0|M;while(R>>>0>>0)}}else p=f,M=s;N=Tr(p|0,M|0,r|0,n|0)|0,R=0,I=0,W=S()|0;do{if((R|0)>(n|0)|(R|0)==(n|0)&I>>>0>r>>>0){EA=81;break A}if(QA=ne+(N<<3)|0,G=t[QA+4>>2]|0,(G&-117440513|0)==(M|0)&&(t[QA>>2]|0)==(p|0)){EA=65;break}QA=YA(N|0,W|0,1,0)|0,N=_r(QA|0,S()|0,r|0,n|0)|0,W=S()|0,I=YA(I|0,R|0,1,0)|0,R=S()|0,QA=ne+(N<<3)|0}while(!((t[QA>>2]|0)==(p|0)&&(t[QA+4>>2]|0)==(M|0)));if((EA|0)==65&&(EA=0,!0&(G&117440512|0)==100663296))break;QA=A+(i<<3)|0,t[QA>>2]=f,t[QA+4>>2]=s,i=YA(i|0,a|0,1,0)|0,a=S()|0}while(!1);if(o=YA(o|0,l|0,1,0)|0,l=S()|0,!((l|0)<(n|0)|(l|0)==(n|0)&o>>>0>>0))break;s=HA+(o<<3)|0,f=t[s>>2]|0,s=t[s+4>>2]|0}s=U}else i=0,s=U}else i=0,e=0,s=0;while(!1);if(V0(ne|0,0,Se|0)|0,jr(HA|0,SA|0,e<<3|0)|0,qA(SA),(e|0)==0&(s|0)==0){EA=89;break}else A=A+(i<<3)|0,n=s,r=e}if((EA|0)==16)!0&(s&117440512|0)==0?(s=4,EA=27):EA=21;else if((EA|0)==31)OA(27795,27122,620,27132);else{if((EA|0)==41)return qA(HA),qA(ne),EA=10,EA|0;if((EA|0)==48)return qA(HA),qA(ne),EA=13,EA|0;(EA|0)==80?OA(27795,27122,711,27132):(EA|0)==81?OA(27795,27122,723,27132):(EA|0)==85&&(jr(A|0,HA|0,r<<3|0)|0,EA=89)}return(EA|0)==21?(qA(HA),qA(ne),EA=5,EA|0):(EA|0)==27?(qA(HA),qA(ne),EA=s,EA|0):(EA|0)==89?(qA(HA),qA(ne),EA=0,EA|0):0}function ll(e,A,r,n,s,i,o){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,i=i|0,o=o|0;var l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0;if(G=k,k=k+16|0,N=G,!((r|0)>0|(r|0)==0&A>>>0>0))return N=0,k=G,N|0;if((o|0)>=16)return N=12,k=G,N|0;R=0,I=0,M=0,l=0;A:for(;;){if(f=e+(R<<3)|0,a=t[f>>2]|0,f=t[f+4>>2]|0,p=wA(a|0,f|0,52)|0,S()|0,(p&15|0)>(o|0)){l=12,a=11;break}if(As(N,a,f,o),p=N,f=t[p>>2]|0,p=t[p+4>>2]|0,(f|0)==0&(p|0)==0)a=M;else{a=M;do{if(!((l|0)<(i|0)|(l|0)==(i|0)&a>>>0>>0)){a=10;break A}M=n+(a<<3)|0,t[M>>2]=f,t[M+4>>2]=p,a=YA(a|0,l|0,1,0)|0,l=S()|0,es(N),M=N,f=t[M>>2]|0,p=t[M+4>>2]|0}while(!((f|0)==0&(p|0)==0))}if(R=YA(R|0,I|0,1,0)|0,I=S()|0,(I|0)<(r|0)|(I|0)==(r|0)&R>>>0>>0)M=a;else{l=0,a=11;break}}return(a|0)==10?(N=14,k=G,N|0):(a|0)==11?(k=G,l|0):0}function al(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;R=k,k=k+16|0,M=R;A:do if((r|0)>0|(r|0)==0&A>>>0>0){for(f=0,o=0,i=0,p=0;;){if(a=e+(f<<3)|0,l=t[a>>2]|0,a=t[a+4>>2]|0,!((l|0)==0&(a|0)==0)&&(a=(x0(l,a,n,M)|0)==0,l=M,o=YA(t[l>>2]|0,t[l+4>>2]|0,o|0,i|0)|0,i=S()|0,!a)){i=12;break}if(f=YA(f|0,p|0,1,0)|0,p=S()|0,!((p|0)<(r|0)|(p|0)==(r|0)&f>>>0>>0))break A}return k=R,i|0}else o=0,i=0;while(!1);return t[s>>2]=o,t[s+4>>2]=i,s=0,k=R,s|0}function ul(e,A){return e=e|0,A=A|0,A=wA(e|0,A|0,52)|0,S()|0,A&1|0}function Ht(e,A){e=e|0,A=A|0;var r=0,n=0,s=0;if(s=wA(e|0,A|0,52)|0,S()|0,s=s&15,!s)return s=0,s|0;for(n=1;;){if(r=wA(e|0,A|0,(15-n|0)*3|0)|0,S()|0,r=r&7,r|0){n=5;break}if(n>>>0>>0)n=n+1|0;else{r=0,n=5;break}}return(n|0)==5?r|0:0}function $n(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0;if(a=wA(e|0,A|0,52)|0,S()|0,a=a&15,!a)return l=A,a=e,KA(l|0),a|0;for(l=1,r=0;;){i=(15-l|0)*3|0,n=kA(7,0,i|0)|0,s=S()|0,o=wA(e|0,A|0,i|0)|0,S()|0,i=kA(Wt(o&7)|0,0,i|0)|0,o=S()|0,e=i|e&~n,A=o|A&~s;A:do if(!r)if((i&n|0)==0&(o&s|0)==0)r=0;else if(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,!n)r=1;else{r=1;e:for(;;){switch(o=wA(e|0,A|0,(15-r|0)*3|0)|0,S()|0,o&7){case 1:break e;case 0:break;default:{r=1;break A}}if(r>>>0>>0)r=r+1|0;else{r=1;break A}}for(r=1;;)if(o=(15-r|0)*3|0,s=wA(e|0,A|0,o|0)|0,S()|0,i=kA(7,0,o|0)|0,A=A&~(S()|0),o=kA(Wt(s&7)|0,0,o|0)|0,e=e&~i|o,A=A|(S()|0),r>>>0>>0)r=r+1|0;else{r=1;break}}while(!1);if(l>>>0>>0)l=l+1|0;else break}return KA(A|0),e|0}function sr(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0;if(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,!n)return r=A,n=e,KA(r|0),n|0;for(r=1;i=(15-r|0)*3|0,o=wA(e|0,A|0,i|0)|0,S()|0,s=kA(7,0,i|0)|0,A=A&~(S()|0),i=kA(Wt(o&7)|0,0,i|0)|0,e=i|e&~s,A=S()|0|A,r>>>0>>0;)r=r+1|0;return KA(A|0),e|0}function cl(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0;if(a=wA(e|0,A|0,52)|0,S()|0,a=a&15,!a)return l=A,a=e,KA(l|0),a|0;for(l=1,r=0;;){i=(15-l|0)*3|0,n=kA(7,0,i|0)|0,s=S()|0,o=wA(e|0,A|0,i|0)|0,S()|0,i=kA(Yt(o&7)|0,0,i|0)|0,o=S()|0,e=i|e&~n,A=o|A&~s;A:do if(!r)if((i&n|0)==0&(o&s|0)==0)r=0;else if(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,!n)r=1;else{r=1;e:for(;;){switch(o=wA(e|0,A|0,(15-r|0)*3|0)|0,S()|0,o&7){case 1:break e;case 0:break;default:{r=1;break A}}if(r>>>0>>0)r=r+1|0;else{r=1;break A}}for(r=1;;)if(s=(15-r|0)*3|0,i=kA(7,0,s|0)|0,o=A&~(S()|0),A=wA(e|0,A|0,s|0)|0,S()|0,A=kA(Yt(A&7)|0,0,s|0)|0,e=e&~i|A,A=o|(S()|0),r>>>0>>0)r=r+1|0;else{r=1;break}}while(!1);if(l>>>0>>0)l=l+1|0;else break}return KA(A|0),e|0}function Kn(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0;if(n=wA(e|0,A|0,52)|0,S()|0,n=n&15,!n)return r=A,n=e,KA(r|0),n|0;for(r=1;o=(15-r|0)*3|0,i=kA(7,0,o|0)|0,s=A&~(S()|0),A=wA(e|0,A|0,o|0)|0,S()|0,A=kA(Yt(A&7)|0,0,o|0)|0,e=A|e&~i,A=S()|0|s,r>>>0>>0;)r=r+1|0;return KA(A|0),e|0}function fl(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(a=k,k=k+64|0,l=a+40|0,n=a+24|0,s=a+12|0,i=a,kA(A|0,0,52)|0,r=S()|0|134225919,!A)return(t[e+4>>2]|0)>2||(t[e+8>>2]|0)>2||(t[e+12>>2]|0)>2?(o=0,l=0,KA(o|0),k=a,l|0):(kA(p0(e)|0,0,45)|0,o=S()|0|r,l=-1,KA(o|0),k=a,l|0);if(t[l>>2]=t[e>>2],t[l+4>>2]=t[e+4>>2],t[l+8>>2]=t[e+8>>2],t[l+12>>2]=t[e+12>>2],o=l+4|0,(A|0)>0)for(e=-1;t[n>>2]=t[o>>2],t[n+4>>2]=t[o+4>>2],t[n+8>>2]=t[o+8>>2],A&1?(xr(o),t[s>>2]=t[o>>2],t[s+4>>2]=t[o+4>>2],t[s+8>>2]=t[o+8>>2],vr(s)):(wr(o),t[s>>2]=t[o>>2],t[s+4>>2]=t[o+4>>2],t[s+8>>2]=t[o+8>>2],Vt(s)),wt(n,s,i),oe(i),p=(15-A|0)*3|0,f=kA(7,0,p|0)|0,r=r&~(S()|0),p=kA(tt(i)|0,0,p|0)|0,e=p|e&~f,r=S()|0|r,(A|0)>1;)A=A+-1|0;else e=-1;A:do if((t[o>>2]|0)<=2&&(t[l+8>>2]|0)<=2&&(t[l+12>>2]|0)<=2){if(n=p0(l)|0,A=kA(n|0,0,45)|0,A=A|e,e=S()|0|r&-1040385,i=u0(l)|0,!(je(n)|0)){if((i|0)<=0)break;for(s=0;;){if(n=wA(A|0,e|0,52)|0,S()|0,n=n&15,n)for(r=1;p=(15-r|0)*3|0,l=wA(A|0,e|0,p|0)|0,S()|0,f=kA(7,0,p|0)|0,e=e&~(S()|0),p=kA(Wt(l&7)|0,0,p|0)|0,A=A&~f|p,e=e|(S()|0),r>>>0>>0;)r=r+1|0;if(s=s+1|0,(s|0)==(i|0))break A}}s=wA(A|0,e|0,52)|0,S()|0,s=s&15;e:do if(s){r=1;t:for(;;){switch(p=wA(A|0,e|0,(15-r|0)*3|0)|0,S()|0,p&7){case 1:break t;case 0:break;default:break e}if(r>>>0>>0)r=r+1|0;else break e}if(D0(n,t[l>>2]|0)|0)for(r=1;l=(15-r|0)*3|0,f=kA(7,0,l|0)|0,p=e&~(S()|0),e=wA(A|0,e|0,l|0)|0,S()|0,e=kA(Yt(e&7)|0,0,l|0)|0,A=A&~f|e,e=p|(S()|0),r>>>0>>0;)r=r+1|0;else for(r=1;p=(15-r|0)*3|0,l=wA(A|0,e|0,p|0)|0,S()|0,f=kA(7,0,p|0)|0,e=e&~(S()|0),p=kA(Wt(l&7)|0,0,p|0)|0,A=A&~f|p,e=e|(S()|0),r>>>0>>0;)r=r+1|0}while(!1);if((i|0)>0){r=0;do A=$n(A,e)|0,e=S()|0,r=r+1|0;while((r|0)!=(i|0))}}else A=0,e=0;while(!1);return f=e,p=A,KA(f|0),k=a,p|0}function t0(e){return e=e|0,(e|0)%2|0|0}function qn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0;return s=k,k=k+16|0,n=s,A>>>0>15?(n=4,k=s,n|0):(t[e+4>>2]&2146435072|0)==2146435072||(t[e+8+4>>2]&2146435072|0)==2146435072?(n=3,k=s,n|0):(gn(e,A,n),A=fl(n,A)|0,n=S()|0,t[r>>2]=A,t[r+4>>2]=n,(A|0)==0&(n|0)==0&&OA(27795,27122,1050,27145),n=0,k=s,n|0)}function Xn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;if(s=r+4|0,i=wA(e|0,A|0,52)|0,S()|0,i=i&15,o=wA(e|0,A|0,45)|0,S()|0,n=(i|0)==0,je(o&127)|0){if(n)return o=1,o|0;n=1}else{if(n)return o=0,o|0;(t[s>>2]|0)==0&&(t[r+8>>2]|0)==0?n=(t[r+12>>2]|0)!=0&1:n=1}for(r=1;r&1?vr(s):Vt(s),o=wA(e|0,A|0,(15-r|0)*3|0)|0,S()|0,dn(s,o&7),r>>>0>>0;)r=r+1|0;return n|0}function Mr(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(p=k,k=k+16|0,a=p,f=wA(e|0,A|0,45)|0,S()|0,f=f&127,f>>>0>121)return t[r>>2]=0,t[r+4>>2]=0,t[r+8>>2]=0,t[r+12>>2]=0,f=5,k=p,f|0;A:do if((je(f)|0)!=0&&(i=wA(e|0,A|0,52)|0,S()|0,i=i&15,(i|0)!=0)){n=1;e:for(;;){switch(l=wA(e|0,A|0,(15-n|0)*3|0)|0,S()|0,l&7){case 5:break e;case 0:break;default:{n=A;break A}}if(n>>>0>>0)n=n+1|0;else{n=A;break A}}for(s=1,n=A;A=(15-s|0)*3|0,o=kA(7,0,A|0)|0,l=n&~(S()|0),n=wA(e|0,n|0,A|0)|0,S()|0,n=kA(Yt(n&7)|0,0,A|0)|0,e=e&~o|n,n=l|(S()|0),s>>>0>>0;)s=s+1|0}else n=A;while(!1);if(l=7696+(f*28|0)|0,t[r>>2]=t[l>>2],t[r+4>>2]=t[l+4>>2],t[r+8>>2]=t[l+8>>2],t[r+12>>2]=t[l+12>>2],!(Xn(e,n,r)|0))return f=0,k=p,f|0;if(o=r+4|0,t[a>>2]=t[o>>2],t[a+4>>2]=t[o+4>>2],t[a+8>>2]=t[o+8>>2],i=wA(e|0,n|0,52)|0,S()|0,l=i&15,i&1?(Vt(o),i=l+1|0):i=l,!(je(f)|0))n=0;else{A:do if(!l)n=0;else for(A=1;;){if(s=wA(e|0,n|0,(15-A|0)*3|0)|0,S()|0,s=s&7,s|0){n=s;break A}if(A>>>0>>0)A=A+1|0;else{n=0;break}}while(!1);n=(n|0)==4&1}if(!(F(r,i,n,0)|0))(i|0)!=(l|0)&&(t[o>>2]=t[a>>2],t[o+4>>2]=t[a+4>>2],t[o+8>>2]=t[a+8>>2]);else{if(je(f)|0)do;while((F(r,i,0,0)|0)!=0);(i|0)!=(l|0)&&wr(o)}return f=0,k=p,f|0}function ir(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;return i=k,k=k+16|0,n=i,s=Mr(e,A,n)|0,s|0?(k=i,s|0):(s=wA(e|0,A|0,52)|0,S()|0,d(n,s&15,r),s=0,k=i,s|0)}function Br(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0;if(o=k,k=k+16|0,i=o,n=Mr(e,A,i)|0,n|0)return i=n,k=o,i|0;n=wA(e|0,A|0,45)|0,S()|0,n=(je(n&127)|0)==0,s=wA(e|0,A|0,52)|0,S()|0,s=s&15;A:do if(!n){if(s|0)for(n=1;;){if(l=kA(7,0,(15-n|0)*3|0)|0,!((l&e|0)==0&((S()|0)&A|0)==0))break A;if(n>>>0>>0)n=n+1|0;else break}return w(i,s,0,5,r),l=0,k=o,l|0}while(!1);return J(i,s,0,6,r),l=0,k=o,l|0}function hl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;if(s=wA(e|0,A|0,45)|0,S()|0,!(je(s&127)|0))return s=2,t[r>>2]=s,0;if(s=wA(e|0,A|0,52)|0,S()|0,s=s&15,!s)return s=5,t[r>>2]=s,0;for(n=1;;){if(i=kA(7,0,(15-n|0)*3|0)|0,!((i&e|0)==0&((S()|0)&A|0)==0)){n=2,e=6;break}if(n>>>0>>0)n=n+1|0;else{n=5,e=6;break}}return(e|0)==6&&(t[r>>2]=n),0}function Os(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0;M=k,k=k+128|0,f=M+112|0,i=M+96|0,p=M,s=wA(e|0,A|0,52)|0,S()|0,l=s&15,t[f>>2]=l,o=wA(e|0,A|0,45)|0,S()|0,o=o&127;A:do if(je(o)|0){if(l|0)for(n=1;;){if(a=kA(7,0,(15-n|0)*3|0)|0,!((a&e|0)==0&((S()|0)&A|0)==0)){s=0;break A}if(n>>>0>>0)n=n+1|0;else break}if(s&1)s=1;else return a=kA(l+1|0,0,52)|0,p=S()|0|A&-15728641,f=kA(7,0,(14-l|0)*3|0)|0,p=Os((a|e)&~f,p&~(S()|0),r)|0,k=M,p|0}else s=0;while(!1);if(n=Mr(e,A,i)|0,!n){s?(B(i,f,p),a=5):(dA(i,f,p),a=6);A:do if(je(o)|0)if(!l)e=5;else for(n=1;;){if(o=kA(7,0,(15-n|0)*3|0)|0,!((o&e|0)==0&((S()|0)&A|0)==0)){e=2;break A}if(n>>>0>>0)n=n+1|0;else{e=5;break}}else e=2;while(!1);V0(r|0,-1,e<<2|0)|0;A:do if(s)for(i=0;;){if(o=p+(i<<4)|0,tA(o,t[f>>2]|0)|0,o=t[o>>2]|0,l=t[r>>2]|0,(l|0)==-1|(l|0)==(o|0))n=r;else{s=0;do{if(s=s+1|0,s>>>0>=e>>>0){n=1;break A}n=r+(s<<2)|0,l=t[n>>2]|0}while(!((l|0)==-1|(l|0)==(o|0)))}if(t[n>>2]=o,i=i+1|0,i>>>0>=a>>>0){n=0;break}}else for(i=0;;){if(o=p+(i<<4)|0,F(o,t[f>>2]|0,0,1)|0,o=t[o>>2]|0,l=t[r>>2]|0,(l|0)==-1|(l|0)==(o|0))n=r;else{s=0;do{if(s=s+1|0,s>>>0>=e>>>0){n=1;break A}n=r+(s<<2)|0,l=t[n>>2]|0}while(!((l|0)==-1|(l|0)==(o|0)))}if(t[n>>2]=o,i=i+1|0,i>>>0>=a>>>0){n=0;break}}while(!1)}return p=n,k=M,p|0}function dl(){return 12}function Jn(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0;if(e>>>0>15)return l=4,l|0;if(kA(e|0,0,52)|0,l=S()|0|134225919,!e){r=0,n=0;do je(n)|0&&(kA(n|0,0,45)|0,o=l|(S()|0),e=A+(r<<3)|0,t[e>>2]=-1,t[e+4>>2]=o,r=r+1|0),n=n+1|0;while((n|0)!=122);return r=0,r|0}r=0,o=0;do{if(je(o)|0){for(kA(o|0,0,45)|0,n=1,s=-1,i=l|(S()|0);a=kA(7,0,(15-n|0)*3|0)|0,s=s&~a,i=i&~(S()|0),(n|0)!=(e|0);)n=n+1|0;a=A+(r<<3)|0,t[a>>2]=s,t[a+4>>2]=i,r=r+1|0}o=o+1|0}while((o|0)!=122);return r=0,r|0}function ml(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0;if(q=k,k=k+16|0,W=q,nA=wA(e|0,A|0,52)|0,S()|0,nA=nA&15,r>>>0>15)return nA=4,k=q,nA|0;if((nA|0)<(r|0))return nA=12,k=q,nA|0;if((nA|0)!=(r|0))if(i=kA(r|0,0,52)|0,i=i|e,l=S()|0|A&-15728641,(nA|0)>(r|0)){a=r;do G=kA(7,0,(14-a|0)*3|0)|0,a=a+1|0,i=G|i,l=S()|0|l;while((a|0)<(nA|0));G=i}else G=i;else G=e,l=A;N=wA(G|0,l|0,45)|0,S()|0;A:do if(je(N&127)|0){if(a=wA(G|0,l|0,52)|0,S()|0,a=a&15,a|0)for(i=1;;){if(N=kA(7,0,(15-i|0)*3|0)|0,!((N&G|0)==0&((S()|0)&l|0)==0)){f=33;break A}if(i>>>0>>0)i=i+1|0;else break}if(N=n,t[N>>2]=0,t[N+4>>2]=0,(nA|0)>(r|0)){for(N=A&-15728641,I=nA;;){if(R=I,I=I+-1|0,I>>>0>15|(nA|0)<(I|0)){f=19;break}if((nA|0)!=(I|0))if(i=kA(I|0,0,52)|0,i=i|e,a=S()|0|N,(nA|0)<(R|0))M=i;else{f=I;do M=kA(7,0,(14-f|0)*3|0)|0,f=f+1|0,i=M|i,a=S()|0|a;while((f|0)<(nA|0));M=i}else M=e,a=A;if(p=wA(M|0,a|0,45)|0,S()|0,!(je(p&127)|0))i=0;else{p=wA(M|0,a|0,52)|0,S()|0,p=p&15;e:do if(!p)i=0;else for(f=1;;){if(i=wA(M|0,a|0,(15-f|0)*3|0)|0,S()|0,i=i&7,i|0)break e;if(f>>>0

>>0)f=f+1|0;else{i=0;break}}while(!1);i=(i|0)==0&1}if(a=wA(e|0,A|0,(15-R|0)*3|0)|0,S()|0,a=a&7,(a|0)==7){s=5,f=42;break}if(i=(i|0)!=0,(a|0)==1&i){s=5,f=42;break}if(M=a+(((a|0)!=0&i)<<31>>31)|0,M|0&&(f=nA-R|0,f=H0(7,0,f,((f|0)<0)<<31>>31)|0,p=S()|0,i?(i=ht(f|0,p|0,5,0)|0,i=YA(i|0,S()|0,-5,-1)|0,i=U0(i|0,S()|0,6,0)|0,i=YA(i|0,S()|0,1,0)|0,a=S()|0):(i=f,a=p),R=M+-1|0,R=ht(f|0,p|0,R|0,((R|0)<0)<<31>>31|0)|0,R=YA(i|0,a|0,R|0,S()|0)|0,M=S()|0,p=n,p=YA(R|0,M|0,t[p>>2]|0,t[p+4>>2]|0)|0,M=S()|0,R=n,t[R>>2]=p,t[R+4>>2]=M),(I|0)<=(r|0)){f=37;break}}if((f|0)==19)OA(27795,27122,1367,27158);else if((f|0)==37){o=n,s=t[o+4>>2]|0,o=t[o>>2]|0;break}else if((f|0)==42)return k=q,s|0}else s=0,o=0}else f=33;while(!1);A:do if((f|0)==33)if(N=n,t[N>>2]=0,t[N+4>>2]=0,(nA|0)>(r|0)){for(i=nA;;){if(s=wA(e|0,A|0,(15-i|0)*3|0)|0,S()|0,s=s&7,(s|0)==7){s=5;break}if(o=nA-i|0,o=H0(7,0,o,((o|0)<0)<<31>>31)|0,s=ht(o|0,S()|0,s|0,0)|0,o=S()|0,N=n,o=YA(t[N>>2]|0,t[N+4>>2]|0,s|0,o|0)|0,s=S()|0,N=n,t[N>>2]=o,t[N+4>>2]=s,i=i+-1|0,(i|0)<=(r|0))break A}return k=q,s|0}else s=0,o=0;while(!1);return x0(G,l,nA,W)|0&&OA(27795,27122,1327,27173),nA=W,W=t[nA+4>>2]|0,((s|0)>-1|(s|0)==-1&o>>>0>4294967295)&((W|0)>(s|0)|((W|0)==(s|0)?(t[nA>>2]|0)>>>0>o>>>0:0))?(nA=0,k=q,nA|0):(OA(27795,27122,1407,27158),0)}function pl(e,A,r,n,s,i){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,i=i|0;var o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0;if(M=k,k=k+16|0,o=M,s>>>0>15)return i=4,k=M,i|0;if(l=wA(r|0,n|0,52)|0,S()|0,l=l&15,(l|0)>(s|0))return i=12,k=M,i|0;if(x0(r,n,s,o)|0&&OA(27795,27122,1327,27173),p=o,f=t[p+4>>2]|0,!(((A|0)>-1|(A|0)==-1&e>>>0>4294967295)&((f|0)>(A|0)|((f|0)==(A|0)?(t[p>>2]|0)>>>0>e>>>0:0))))return i=2,k=M,i|0;p=s-l|0,s=kA(s|0,0,52)|0,a=S()|0|n&-15728641,f=i,t[f>>2]=s|r,t[f+4>>2]=a,f=wA(r|0,n|0,45)|0,S()|0;A:do if(je(f&127)|0){if(l|0)for(o=1;;){if(f=kA(7,0,(15-o|0)*3|0)|0,!((f&r|0)==0&((S()|0)&n|0)==0))break A;if(o>>>0>>0)o=o+1|0;else break}if((p|0)<1)return i=0,k=M,i|0;for(f=l^15,n=-1,a=1,o=1;;){l=p-a|0,l=H0(7,0,l,((l|0)<0)<<31>>31)|0,r=S()|0;do if(o)if(o=ht(l|0,r|0,5,0)|0,o=YA(o|0,S()|0,-5,-1)|0,o=U0(o|0,S()|0,6,0)|0,s=S()|0,(A|0)>(s|0)|(A|0)==(s|0)&e>>>0>o>>>0){A=YA(e|0,A|0,-1,-1)|0,A=ft(A|0,S()|0,o|0,s|0)|0,o=S()|0,R=i,N=t[R>>2]|0,R=t[R+4>>2]|0,G=(f+n|0)*3|0,I=kA(7,0,G|0)|0,R=R&~(S()|0),n=U0(A|0,o|0,l|0,r|0)|0,e=S()|0,s=YA(n|0,e|0,2,0)|0,G=kA(s|0,S()|0,G|0)|0,R=S()|0|R,s=i,t[s>>2]=G|N&~I,t[s+4>>2]=R,e=ht(n|0,e|0,l|0,r|0)|0,e=ft(A|0,o|0,e|0,S()|0)|0,o=0,A=S()|0;break}else{G=i,I=t[G>>2]|0,G=t[G+4>>2]|0,N=kA(7,0,(f+n|0)*3|0)|0,G=G&~(S()|0),o=i,t[o>>2]=I&~N,t[o+4>>2]=G,o=1;break}else I=i,s=t[I>>2]|0,I=t[I+4>>2]|0,n=(f+n|0)*3|0,R=kA(7,0,n|0)|0,I=I&~(S()|0),G=U0(e|0,A|0,l|0,r|0)|0,o=S()|0,n=kA(G|0,o|0,n|0)|0,I=S()|0|I,N=i,t[N>>2]=n|s&~R,t[N+4>>2]=I,o=ht(G|0,o|0,l|0,r|0)|0,e=ft(e|0,A|0,o|0,S()|0)|0,o=0,A=S()|0;while(!1);if((p|0)>(a|0))n=~a,a=a+1|0;else{A=0;break}}return k=M,A|0}while(!1);if((p|0)<1)return G=0,k=M,G|0;for(s=l^15,o=1;;)if(N=p-o|0,N=H0(7,0,N,((N|0)<0)<<31>>31)|0,G=S()|0,a=i,r=t[a>>2]|0,a=t[a+4>>2]|0,l=(s-o|0)*3|0,n=kA(7,0,l|0)|0,a=a&~(S()|0),R=U0(e|0,A|0,N|0,G|0)|0,I=S()|0,l=kA(R|0,I|0,l|0)|0,a=S()|0|a,f=i,t[f>>2]=l|r&~n,t[f+4>>2]=a,G=ht(R|0,I|0,N|0,G|0)|0,e=ft(e|0,A|0,G|0,S()|0)|0,A=S()|0,(p|0)<=(o|0)){A=0;break}else o=o+1|0;return k=M,A|0}function As(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0;s=wA(A|0,r|0,52)|0,S()|0,s=s&15,(A|0)==0&(r|0)==0|((n|0)>15|(s|0)>(n|0))?(i=-1,A=-1,r=0,s=0):(A=Ps(A,r,s+1|0,n)|0,o=(S()|0)&-15728641,r=kA(n|0,0,52)|0,r=A|r,o=o|(S()|0),A=(He(r,o)|0)==0,i=s,A=A?-1:n,s=o),o=e,t[o>>2]=r,t[o+4>>2]=s,t[e+8>>2]=i,t[e+12>>2]=A}function zs(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0;if(s=wA(e|0,A|0,52)|0,S()|0,s=s&15,i=n+8|0,t[i>>2]=s,(e|0)==0&(A|0)==0|((r|0)>15|(s|0)>(r|0))){r=n,t[r>>2]=0,t[r+4>>2]=0,t[i>>2]=-1,t[n+12>>2]=-1;return}if(e=Ps(e,A,s+1|0,r)|0,i=(S()|0)&-15728641,s=kA(r|0,0,52)|0,s=e|s,i=i|(S()|0),e=n,t[e>>2]=s,t[e+4>>2]=i,e=n+12|0,He(s,i)|0){t[e>>2]=r;return}else{t[e>>2]=-1;return}}function es(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0;if(r=e,A=t[r>>2]|0,r=t[r+4>>2]|0,!((A|0)==0&(r|0)==0)&&(n=wA(A|0,r|0,52)|0,S()|0,n=n&15,l=kA(1,0,(n^15)*3|0)|0,A=YA(l|0,S()|0,A|0,r|0)|0,r=S()|0,l=e,t[l>>2]=A,t[l+4>>2]=r,l=e+8|0,o=t[l>>2]|0,!((n|0)<(o|0)))){for(a=e+12|0,i=n;;){if((i|0)==(o|0)){n=5;break}if(f=(i|0)==(t[a>>2]|0),s=(15-i|0)*3|0,n=wA(A|0,r|0,s|0)|0,S()|0,n=n&7,f&((n|0)==1&!0)){n=7;break}if(!((n|0)==7&!0)){n=10;break}if(f=kA(1,0,s|0)|0,A=YA(A|0,r|0,f|0,S()|0)|0,r=S()|0,f=e,t[f>>2]=A,t[f+4>>2]=r,(i|0)>(o|0))i=i+-1|0;else{n=10;break}}if((n|0)==5){f=e,t[f>>2]=0,t[f+4>>2]=0,t[l>>2]=-1,t[a>>2]=-1;return}else if((n|0)==7){o=kA(1,0,s|0)|0,o=YA(A|0,r|0,o|0,S()|0)|0,l=S()|0,f=e,t[f>>2]=o,t[f+4>>2]=l,t[a>>2]=i+-1;return}else if((n|0)==10)return}}function en(e){e=+e;var A=0;return A=e<0?e+6.283185307179586:e,+(e>=6.283185307179586?A+-6.283185307179586:A)}function Dr(e,A){return e=e|0,A=A|0,+$A(+(+b[e>>3]-+b[A>>3]))<17453292519943298e-27?(A=+$A(+(+b[e+8>>3]-+b[A+8>>3]))<17453292519943298e-27,A|0):(A=0,A|0)}function Zt(e,A){switch(e=+e,A=A|0,A|0){case 1:{e=e<0?e+6.283185307179586:e;break}case 2:{e=e>0?e+-6.283185307179586:e;break}}return+e}function gl(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;return s=+b[A>>3],n=+b[e>>3],i=+ie(+((s-n)*.5)),r=+ie(+((+b[A+8>>3]-+b[e+8>>3])*.5)),r=i*i+r*(+_e(+s)*+_e(+n)*r),+(+Te(+ +xe(+r),+ +xe(+(1-r)))*2)}function tn(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;return s=+b[A>>3],n=+b[e>>3],i=+ie(+((s-n)*.5)),r=+ie(+((+b[A+8>>3]-+b[e+8>>3])*.5)),r=i*i+r*(+_e(+s)*+_e(+n)*r),+(+Te(+ +xe(+r),+ +xe(+(1-r)))*2*6371.007180918475)}function yl(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;return s=+b[A>>3],n=+b[e>>3],i=+ie(+((s-n)*.5)),r=+ie(+((+b[A+8>>3]-+b[e+8>>3])*.5)),r=i*i+r*(+_e(+s)*+_e(+n)*r),+(+Te(+ +xe(+r),+ +xe(+(1-r)))*2*6371.007180918475*1e3)}function xl(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0;return i=+b[A>>3],n=+_e(+i),s=+b[A+8>>3]-+b[e+8>>3],o=n*+ie(+s),r=+b[e>>3],+ +Te(+o,+(+ie(+i)*+_e(+r)-+_e(+s)*(n*+ie(+r))))}function wl(e,A,r,n){e=e|0,A=+A,r=+r,n=n|0;var s=0,i=0,o=0,l=0;if(r<1e-16){t[n>>2]=t[e>>2],t[n+4>>2]=t[e+4>>2],t[n+8>>2]=t[e+8>>2],t[n+12>>2]=t[e+12>>2];return}i=A<0?A+6.283185307179586:A,i=A>=6.283185307179586?i+-6.283185307179586:i;do if(i<1e-16)A=+b[e>>3]+r,b[n>>3]=A,s=n;else{if(s=+$A(+(i+-3.141592653589793))<1e-16,A=+b[e>>3],s){A=A-r,b[n>>3]=A,s=n;break}if(o=+_e(+r),r=+ie(+r),A=o*+ie(+A)+ +_e(+i)*(r*+_e(+A)),A=A>1?1:A,A=+h0(+(A<-1?-1:A)),b[n>>3]=A,+$A(+(A+-1.5707963267948966))<1e-16){b[n>>3]=1.5707963267948966,b[n+8>>3]=0;return}if(+$A(+(A+1.5707963267948966))<1e-16){b[n>>3]=-1.5707963267948966,b[n+8>>3]=0;return}if(l=1/+_e(+A),i=r*+ie(+i)*l,r=+b[e>>3],A=l*((o-+ie(+A)*+ie(+r))/+_e(+r)),o=i>1?1:i,A=A>1?1:A,A=+b[e+8>>3]+ +Te(+(o<-1?-1:o),+(A<-1?-1:A)),A>3.141592653589793)do A=A+-6.283185307179586;while(A>3.141592653589793);if(A<-3.141592653589793)do A=A+6.283185307179586;while(A<-3.141592653589793);b[n+8>>3]=A;return}while(!1);if(+$A(+(A+-1.5707963267948966))<1e-16){b[s>>3]=1.5707963267948966,b[n+8>>3]=0;return}if(+$A(+(A+1.5707963267948966))<1e-16){b[s>>3]=-1.5707963267948966,b[n+8>>3]=0;return}if(A=+b[e+8>>3],A>3.141592653589793)do A=A+-6.283185307179586;while(A>3.141592653589793);if(A<-3.141592653589793)do A=A+6.283185307179586;while(A<-3.141592653589793);b[n+8>>3]=A}function Hs(e,A){return e=e|0,A=A|0,e>>>0>15?(A=4,A|0):(b[A>>3]=+b[20656+(e<<3)>>3],A=0,A|0)}function vl(e,A){return e=e|0,A=A|0,e>>>0>15?(A=4,A|0):(b[A>>3]=+b[20784+(e<<3)>>3],A=0,A|0)}function bl(e,A){return e=e|0,A=A|0,e>>>0>15?(A=4,A|0):(b[A>>3]=+b[20912+(e<<3)>>3],A=0,A|0)}function kl(e,A){return e=e|0,A=A|0,e>>>0>15?(A=4,A|0):(b[A>>3]=+b[21040+(e<<3)>>3],A=0,A|0)}function xn(e,A){e=e|0,A=A|0;var r=0;return e>>>0>15?(A=4,A|0):(r=H0(7,0,e,((e|0)<0)<<31>>31)|0,r=ht(r|0,S()|0,120,0)|0,e=S()|0,t[A>>2]=r|2,t[A+4>>2]=e,A=0,A|0)}function Gs(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;return R=+b[A>>3],p=+b[e>>3],a=+ie(+((R-p)*.5)),i=+b[A+8>>3],f=+b[e+8>>3],o=+ie(+((i-f)*.5)),l=+_e(+p),M=+_e(+R),o=a*a+o*(M*l*o),o=+Te(+ +xe(+o),+ +xe(+(1-o)))*2,a=+b[r>>3],R=+ie(+((a-R)*.5)),n=+b[r+8>>3],i=+ie(+((n-i)*.5)),s=+_e(+a),i=R*R+i*(M*s*i),i=+Te(+ +xe(+i),+ +xe(+(1-i)))*2,a=+ie(+((p-a)*.5)),n=+ie(+((f-n)*.5)),n=a*a+n*(l*s*n),n=+Te(+ +xe(+n),+ +xe(+(1-n)))*2,s=(o+i+n)*.5,+(+gt(+ +xe(+(+rt(+(s*.5))*+rt(+((s-o)*.5))*+rt(+((s-i)*.5))*+rt(+((s-n)*.5)))))*4)}function ts(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0;if(l=k,k=k+192|0,i=l+168|0,o=l,s=ir(e,A,i)|0,s|0)return r=s,k=l,r|0;if(Br(e,A,o)|0&&OA(27795,27190,415,27199),A=t[o>>2]|0,(A|0)>0){if(n=+Gs(o+8|0,o+8+(((A|0)!=1&1)<<4)|0,i)+0,(A|0)!=1){e=1;do s=e,e=e+1|0,n=n+ +Gs(o+8+(s<<4)|0,o+8+(((e|0)%(A|0)|0)<<4)|0,i);while((e|0)<(A|0))}}else n=0;return b[r>>3]=n,r=0,k=l,r|0}function Cl(e,A,r){return e=e|0,A=A|0,r=r|0,e=ts(e,A,r)|0,e|0||(b[r>>3]=+b[r>>3]*6371.007180918475*6371.007180918475),e|0}function El(e,A,r){return e=e|0,A=A|0,r=r|0,e=ts(e,A,r)|0,e|0||(b[r>>3]=+b[r>>3]*6371.007180918475*6371.007180918475*1e3*1e3),e|0}function Sl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(l=k,k=k+176|0,o=l,e=nr(e,A,o)|0,e|0)return o=e,k=l,o|0;if(b[r>>3]=0,e=t[o>>2]|0,(e|0)<=1)return o=0,k=l,o|0;A=e+-1|0,e=0,n=+b[o+8>>3],s=+b[o+16>>3],i=0;do e=e+1|0,f=n,n=+b[o+8+(e<<4)>>3],p=+ie(+((n-f)*.5)),a=s,s=+b[o+8+(e<<4)+8>>3],a=+ie(+((s-a)*.5)),a=p*p+a*(+_e(+n)*+_e(+f)*a),i=i+ +Te(+ +xe(+a),+ +xe(+(1-a)))*2;while((e|0)<(A|0));return b[r>>3]=i,o=0,k=l,o|0}function Ml(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(l=k,k=k+176|0,o=l,e=nr(e,A,o)|0,e|0)return o=e,i=+b[r>>3],i=i*6371.007180918475,b[r>>3]=i,k=l,o|0;if(b[r>>3]=0,e=t[o>>2]|0,(e|0)<=1)return o=0,i=0,i=i*6371.007180918475,b[r>>3]=i,k=l,o|0;A=e+-1|0,e=0,n=+b[o+8>>3],s=+b[o+16>>3],i=0;do e=e+1|0,f=n,n=+b[o+8+(e<<4)>>3],p=+ie(+((n-f)*.5)),a=s,s=+b[o+8+(e<<4)+8>>3],a=+ie(+((s-a)*.5)),a=p*p+a*(+_e(+f)*+_e(+n)*a),i=i+ +Te(+ +xe(+a),+ +xe(+(1-a)))*2;while((e|0)!=(A|0));return b[r>>3]=i,o=0,p=i,p=p*6371.007180918475,b[r>>3]=p,k=l,o|0}function Bl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(l=k,k=k+176|0,o=l,e=nr(e,A,o)|0,e|0)return o=e,i=+b[r>>3],i=i*6371.007180918475,i=i*1e3,b[r>>3]=i,k=l,o|0;if(b[r>>3]=0,e=t[o>>2]|0,(e|0)<=1)return o=0,i=0,i=i*6371.007180918475,i=i*1e3,b[r>>3]=i,k=l,o|0;A=e+-1|0,e=0,n=+b[o+8>>3],s=+b[o+16>>3],i=0;do e=e+1|0,f=n,n=+b[o+8+(e<<4)>>3],p=+ie(+((n-f)*.5)),a=s,s=+b[o+8+(e<<4)+8>>3],a=+ie(+((s-a)*.5)),a=p*p+a*(+_e(+f)*+_e(+n)*a),i=i+ +Te(+ +xe(+a),+ +xe(+(1-a)))*2;while((e|0)!=(A|0));return b[r>>3]=i,o=0,p=i,p=p*6371.007180918475,p=p*1e3,b[r>>3]=p,k=l,o|0}function Dl(e){e=e|0;var A=0,r=0,n=0;return A=Gt(1,12)|0,A||OA(27280,27235,49,27293),r=e+4|0,n=t[r>>2]|0,n|0?(n=n+8|0,t[n>>2]=A,t[r>>2]=A,A|0):(t[e>>2]|0&&OA(27310,27235,61,27333),n=e,t[n>>2]=A,t[r>>2]=A,A|0)}function _l(e,A){e=e|0,A=A|0;var r=0,n=0;return n=w0(24)|0,n||OA(27347,27235,78,27361),t[n>>2]=t[A>>2],t[n+4>>2]=t[A+4>>2],t[n+8>>2]=t[A+8>>2],t[n+12>>2]=t[A+12>>2],t[n+16>>2]=0,A=e+4|0,r=t[A>>2]|0,r|0?(t[r+16>>2]=n,t[A>>2]=n,n|0):(t[e>>2]|0&&OA(27376,27235,82,27361),t[e>>2]=n,t[A>>2]=n,n|0)}function Us(e){e=e|0;var A=0,r=0,n=0,s=0;if(e)for(n=1;;){if(A=t[e>>2]|0,A|0)do{if(r=t[A>>2]|0,r|0)do s=r,r=t[r+16>>2]|0,qA(s);while((r|0)!=0);s=A,A=t[A+8>>2]|0,qA(s)}while((A|0)!=0);if(A=e,e=t[e+8>>2]|0,n||qA(A),e)n=0;else break}}function Tl(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0,de=0,Se=0,ne=0,HA=0,EA=0,ve=0,Ye=0,me=0;if(s=e+8|0,t[s>>2]|0)return me=1,me|0;if(n=t[e>>2]|0,!n)return me=0,me|0;A=n,r=0;do r=r+1|0,A=t[A+8>>2]|0;while((A|0)!=0);if(r>>>0<2)return me=0,me|0;ve=w0(r<<2)|0,ve||OA(27396,27235,317,27415),EA=w0(r<<5)|0,EA||OA(27437,27235,321,27415),t[e>>2]=0,zA=e+4|0,t[zA>>2]=0,t[s>>2]=0,r=0,HA=0,SA=0,M=0;A:for(;;){if(p=t[n>>2]|0,p){i=0,o=p;do{if(a=+b[o+8>>3],A=o,o=t[o+16>>2]|0,f=(o|0)==0,s=f?p:o,l=+b[s+8>>3],+$A(+(a-l))>3.141592653589793){me=14;break}i=i+(l-a)*(+b[A>>3]+ +b[s>>3])}while(!f);if((me|0)==14){me=0,i=0,A=p;do U=+b[A+8>>3],ne=A+16|0,Se=t[ne>>2]|0,Se=(Se|0)==0?p:Se,K=+b[Se+8>>3],i=i+(+b[A>>3]+ +b[Se>>3])*((K<0?K+6.283185307179586:K)-(U<0?U+6.283185307179586:U)),A=t[((A|0)==0?n:ne)>>2]|0;while((A|0)!=0)}i>0?(t[ve+(HA<<2)>>2]=n,HA=HA+1|0,s=SA,A=M):me=19}else me=19;if((me|0)==19){me=0;do if(r){if(A=r+8|0,t[A>>2]|0){me=21;break A}if(r=Gt(1,12)|0,!r){me=23;break A}t[A>>2]=r,s=r+4|0,o=r,A=M}else if(M){s=zA,o=M+8|0,A=n,r=e;break}else if(t[e>>2]|0){me=27;break A}else{s=zA,o=e,A=n,r=e;break}while(!1);if(t[o>>2]=n,t[s>>2]=n,o=EA+(SA<<5)|0,f=t[n>>2]|0,f){for(p=EA+(SA<<5)+8|0,b[p>>3]=17976931348623157e292,M=EA+(SA<<5)+24|0,b[M>>3]=17976931348623157e292,b[o>>3]=-17976931348623157e292,R=EA+(SA<<5)+16|0,b[R>>3]=-17976931348623157e292,nA=17976931348623157e292,q=-17976931348623157e292,s=0,I=f,a=17976931348623157e292,G=17976931348623157e292,W=-17976931348623157e292,l=-17976931348623157e292;i=+b[I>>3],U=+b[I+8>>3],I=t[I+16>>2]|0,N=(I|0)==0,K=+b[(N?f:I)+8>>3],i>3]=i,a=i),U>3]=U,G=U),i>W?b[o>>3]=i:i=W,U>l&&(b[R>>3]=U,l=U),nA=U>0&Uq?U:q,s=s|+$A(+(U-K))>3.141592653589793,!N;)W=i;s&&(b[R>>3]=q,b[M>>3]=nA)}else t[o>>2]=0,t[o+4>>2]=0,t[o+8>>2]=0,t[o+12>>2]=0,t[o+16>>2]=0,t[o+20>>2]=0,t[o+24>>2]=0,t[o+28>>2]=0;s=SA+1|0}if(ne=n+8|0,n=t[ne>>2]|0,t[ne>>2]=0,n)SA=s,M=A;else{me=45;break}}if((me|0)==21)OA(27213,27235,35,27247);else if((me|0)==23)OA(27267,27235,37,27247);else if((me|0)==27)OA(27310,27235,61,27333);else if((me|0)==45){A:do if((HA|0)>0){for(ne=(s|0)==0,de=s<<2,Se=(e|0)==0,ce=0,A=0;;){if(QA=t[ve+(ce<<2)>>2]|0,ne)me=73;else{if(SA=w0(de)|0,!SA){me=50;break}if(zA=w0(de)|0,!zA){me=52;break}e:do if(Se)r=0;else{for(s=0,r=0,o=e;n=EA+(s<<5)|0,Vs(t[o>>2]|0,n,t[QA>>2]|0)|0?(t[SA+(r<<2)>>2]=o,t[zA+(r<<2)>>2]=n,N=r+1|0):N=r,o=t[o+8>>2]|0,o;)s=s+1|0,r=N;if((N|0)>0)if(n=t[SA>>2]|0,(N|0)==1)r=n;else for(R=0,I=-1,r=n,M=n;;){for(f=t[M>>2]|0,n=0,o=0;s=t[t[SA+(o<<2)>>2]>>2]|0,(s|0)==(f|0)?p=n:p=n+((Vs(s,t[zA+(o<<2)>>2]|0,t[f>>2]|0)|0)&1)|0,o=o+1|0,(o|0)!=(N|0);)n=p;if(s=(p|0)>(I|0),r=s?M:r,n=R+1|0,(n|0)==(N|0))break e;R=n,I=s?p:I,M=t[SA+(n<<2)>>2]|0}else r=0}while(!1);if(qA(SA),qA(zA),r){if(s=r+4|0,n=t[s>>2]|0,n)r=n+8|0;else if(t[r>>2]|0){me=70;break}t[r>>2]=QA,t[s>>2]=QA}else me=73}if((me|0)==73){if(me=0,A=t[QA>>2]|0,A|0)do zA=A,A=t[A+16>>2]|0,qA(zA);while((A|0)!=0);qA(QA),A=1}if(ce=ce+1|0,(ce|0)>=(HA|0)){Ye=A;break A}}(me|0)==50?OA(27452,27235,249,27471):(me|0)==52?OA(27490,27235,252,27471):(me|0)==70&&OA(27310,27235,61,27333)}else Ye=0;while(!1);return qA(ve),qA(EA),me=Ye,me|0}return 0}function Vs(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(!(g0(A,r)|0)||(A=zt(A)|0,n=+b[r>>3],s=+b[r+8>>3],s=A&s<0?s+6.283185307179586:s,e=t[e>>2]|0,!e))return e=0,e|0;if(A){A=0,f=s,r=e;A:for(;;){for(;o=+b[r>>3],s=+b[r+8>>3],r=r+16|0,p=t[r>>2]|0,p=(p|0)==0?e:p,i=+b[p>>3],l=+b[p+8>>3],o>i?(a=o,o=l):(a=i,i=o,o=s,s=l),n=n==i|n==a?n+2220446049250313e-31:n,!!(na);)if(r=t[r>>2]|0,!r){r=22;break A}if(l=o<0?o+6.283185307179586:o,o=s<0?s+6.283185307179586:s,f=l==f|o==f?f+-2220446049250313e-31:f,a=l+(o-l)*((n-i)/(a-i)),(a<0?a+6.283185307179586:a)>f&&(A=A^1),r=t[r>>2]|0,!r){r=22;break}}if((r|0)==22)return A|0}else{A=0,f=s,r=e;A:for(;;){for(;o=+b[r>>3],s=+b[r+8>>3],r=r+16|0,p=t[r>>2]|0,p=(p|0)==0?e:p,i=+b[p>>3],l=+b[p+8>>3],o>i?(a=o,o=l):(a=i,i=o,o=s,s=l),n=n==i|n==a?n+2220446049250313e-31:n,!!(na);)if(r=t[r>>2]|0,!r){r=22;break A}if(f=o==f|s==f?f+-2220446049250313e-31:f,o+(s-o)*((n-i)/(a-i))>f&&(A=A^1),r=t[r>>2]|0,!r){r=22;break}}if((r|0)==22)return A|0}return 0}function j0(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0;if(q=k,k=k+32|0,nA=q+16|0,W=q,i=wA(e|0,A|0,52)|0,S()|0,i=i&15,I=wA(r|0,n|0,52)|0,S()|0,(i|0)!=(I&15|0))return nA=12,k=q,nA|0;if(f=wA(e|0,A|0,45)|0,S()|0,f=f&127,p=wA(r|0,n|0,45)|0,S()|0,p=p&127,f>>>0>121|p>>>0>121)return nA=5,k=q,nA|0;if(I=(f|0)!=(p|0),I){if(l=tr(f,p)|0,(l|0)==7)return nA=1,k=q,nA|0;a=tr(p,f)|0,(a|0)==7?OA(27514,27538,161,27548):(N=l,o=a)}else N=0,o=0;M=je(f)|0,R=je(p)|0,t[nA>>2]=0,t[nA+4>>2]=0,t[nA+8>>2]=0,t[nA+12>>2]=0;do if(N){if(p=t[4272+(f*28|0)+(N<<2)>>2]|0,l=(p|0)>0,R)if(l){f=0,a=r,l=n;do a=cl(a,l)|0,l=S()|0,o=Yt(o)|0,(o|0)==1&&(o=Yt(1)|0),f=f+1|0;while((f|0)!=(p|0));p=o,f=a,a=l}else p=o,f=r,a=n;else if(l){f=0,a=r,l=n;do a=Kn(a,l)|0,l=S()|0,o=Yt(o)|0,f=f+1|0;while((f|0)!=(p|0));p=o,f=a,a=l}else p=o,f=r,a=n;if(Xn(f,a,nA)|0,I||OA(27563,27538,191,27548),l=(M|0)!=0,o=(R|0)!=0,l&o&&OA(27590,27538,192,27548),l){if(o=Ht(e,A)|0,(o|0)==7){i=5;break}if(xA[22e3+(o*7|0)+N>>0]|0){i=1;break}a=t[21168+(o*28|0)+(N<<2)>>2]|0,f=a}else if(o){if(o=Ht(f,a)|0,(o|0)==7){i=5;break}if(xA[22e3+(o*7|0)+p>>0]|0){i=1;break}f=0,a=t[21168+(p*28|0)+(o<<2)>>2]|0}else f=0,a=0;if((f|a|0)<0)i=5;else{if((a|0)>0){l=nA+4|0,o=0;do T0(l),o=o+1|0;while((o|0)!=(a|0))}if(t[W>>2]=0,t[W+4>>2]=0,t[W+8>>2]=0,dn(W,N),i|0)for(;t0(i)|0?vr(W):Vt(W),(i|0)>1;)i=i+-1|0;if((f|0)>0){i=0;do T0(W),i=i+1|0;while((i|0)!=(f|0))}G=nA+4|0,ze(G,W,G),oe(G),G=51}}else if(Xn(r,n,nA)|0,(M|0)!=0&(R|0)!=0)if((p|0)!=(f|0)&&OA(27621,27538,261,27548),o=Ht(e,A)|0,i=Ht(r,n)|0,(o|0)==7|(i|0)==7)i=5;else if(xA[22e3+(o*7|0)+i>>0]|0)i=1;else if(o=t[21168+(o*28|0)+(i<<2)>>2]|0,(o|0)>0){l=nA+4|0,i=0;do T0(l),i=i+1|0;while((i|0)!=(o|0));G=51}else G=51;else G=51;while(!1);return(G|0)==51&&(i=nA+4|0,t[s>>2]=t[i>>2],t[s+4>>2]=t[i+4>>2],t[s+8>>2]=t[i+8>>2],i=0),nA=i,k=q,nA|0}function Ws(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0;if(G=k,k=k+48|0,f=G+36|0,o=G+24|0,l=G+12|0,a=G,s=wA(e|0,A|0,52)|0,S()|0,s=s&15,R=wA(e|0,A|0,45)|0,S()|0,R=R&127,R>>>0>121)return n=5,k=G,n|0;if(p=je(R)|0,kA(s|0,0,52)|0,W=S()|0|134225919,i=n,t[i>>2]=-1,t[i+4>>2]=W,!s)return s=tt(r)|0,(s|0)==7||(s=er(R,s)|0,(s|0)==127)?(W=1,k=G,W|0):(I=kA(s|0,0,45)|0,N=S()|0,R=n,N=t[R+4>>2]&-1040385|N,W=n,t[W>>2]=t[R>>2]|I,t[W+4>>2]=N,W=0,k=G,W|0);for(t[f>>2]=t[r>>2],t[f+4>>2]=t[r+4>>2],t[f+8>>2]=t[r+8>>2],r=s;;){if(i=r,r=r+-1|0,t[o>>2]=t[f>>2],t[o+4>>2]=t[f+4>>2],t[o+8>>2]=t[f+8>>2],t0(i)|0){if(s=Dt(f)|0,s|0){r=13;break}t[l>>2]=t[f>>2],t[l+4>>2]=t[f+4>>2],t[l+8>>2]=t[f+8>>2],vr(l)}else{if(s=hn(f)|0,s|0){r=13;break}t[l>>2]=t[f>>2],t[l+4>>2]=t[f+4>>2],t[l+8>>2]=t[f+8>>2],Vt(l)}if(wt(o,l,a),oe(a),s=n,q=t[s>>2]|0,s=t[s+4>>2]|0,K=(15-i|0)*3|0,nA=kA(7,0,K|0)|0,s=s&~(S()|0),K=kA(tt(a)|0,0,K|0)|0,s=S()|0|s,W=n,t[W>>2]=K|q&~nA,t[W+4>>2]=s,(i|0)<=1){r=14;break}}A:do if((r|0)!=13&&(r|0)==14)if((t[f>>2]|0)<=1&&(t[f+4>>2]|0)<=1&&(t[f+8>>2]|0)<=1){r=tt(f)|0,s=er(R,r)|0,(s|0)==127?a=0:a=je(s)|0;e:do if(r){if(p){if(s=Ht(e,A)|0,(s|0)==7){s=5;break A}if(i=t[21376+(s*28|0)+(r<<2)>>2]|0,(i|0)>0){s=r,r=0;do s=Wt(s)|0,r=r+1|0;while((r|0)!=(i|0))}else s=r;if((s|0)==1){s=9;break A}r=er(R,s)|0,(r|0)==127&&OA(27648,27538,411,27678),je(r)|0?OA(27693,27538,412,27678):(N=r,I=i,M=s)}else N=s,I=0,M=r;if(l=t[4272+(R*28|0)+(M<<2)>>2]|0,(l|0)<=-1&&OA(27724,27538,419,27678),!a){if((I|0)<0){s=5;break A}if(I|0){i=n,s=0,r=t[i>>2]|0,i=t[i+4>>2]|0;do r=sr(r,i)|0,i=S()|0,K=n,t[K>>2]=r,t[K+4>>2]=i,s=s+1|0;while((s|0)<(I|0))}if((l|0)<=0){s=N,r=58;break}for(i=n,s=0,r=t[i>>2]|0,i=t[i+4>>2]|0;;)if(r=sr(r,i)|0,i=S()|0,K=n,t[K>>2]=r,t[K+4>>2]=i,s=s+1|0,(s|0)==(l|0)){s=N,r=58;break e}}if(o=tr(N,R)|0,(o|0)==7&&OA(27514,27538,428,27678),s=n,r=t[s>>2]|0,s=t[s+4>>2]|0,(l|0)>0){i=0;do r=sr(r,s)|0,s=S()|0,K=n,t[K>>2]=r,t[K+4>>2]=s,i=i+1|0;while((i|0)!=(l|0))}if(s=Ht(r,s)|0,(s|0)==7&&OA(27795,27538,440,27678),r=Bt(N)|0,r=t[(r?21792:21584)+(o*28|0)+(s<<2)>>2]|0,(r|0)<0&&OA(27795,27538,454,27678),!r)s=N,r=58;else{o=n,s=0,i=t[o>>2]|0,o=t[o+4>>2]|0;do i=$n(i,o)|0,o=S()|0,K=n,t[K>>2]=i,t[K+4>>2]=o,s=s+1|0;while((s|0)<(r|0));s=N,r=58}}else if((p|0)!=0&(a|0)!=0){if(r=Ht(e,A)|0,i=n,i=Ht(t[i>>2]|0,t[i+4>>2]|0)|0,(r|0)==7|(i|0)==7){s=5;break A}if(i=t[21376+(r*28|0)+(i<<2)>>2]|0,(i|0)<0){s=5;break A}if(!i)r=59;else{l=n,r=0,o=t[l>>2]|0,l=t[l+4>>2]|0;do o=sr(o,l)|0,l=S()|0,K=n,t[K>>2]=o,t[K+4>>2]=l,r=r+1|0;while((r|0)<(i|0));r=58}}else r=58;while(!1);if((r|0)==58&&a&&(r=59),(r|0)==59&&(K=n,(Ht(t[K>>2]|0,t[K+4>>2]|0)|0)==1)){s=9;break}K=n,nA=t[K>>2]|0,K=t[K+4>>2]&-1040385,q=kA(s|0,0,45)|0,K=K|(S()|0),s=n,t[s>>2]=nA|q,t[s+4>>2]=K,s=0}else s=1;while(!1);return K=s,k=G,K|0}function jl(e,A,r,n,s,i){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,i=i|0;var o=0,l=0;return l=k,k=k+16|0,o=l,s?e=15:(e=j0(e,A,r,n,o)|0,e||($r(o,i),e=0)),k=l,e|0}function Rl(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0;return o=k,k=k+16|0,i=o,n?r=15:(r=_t(r,i)|0,r||(r=Ws(e,A,i,s)|0)),k=o,r|0}function Il(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0;return a=k,k=k+32|0,o=a+12|0,l=a,i=j0(e,A,e,A,o)|0,i|0?(l=i,k=a,l|0):(e=j0(e,A,r,n,l)|0,e|0?(l=e,k=a,l|0):(o=kr(o,l)|0,l=s,t[l>>2]=o,t[l+4>>2]=((o|0)<0)<<31>>31,l=0,k=a,l|0))}function Ll(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0;return a=k,k=k+32|0,o=a+12|0,l=a,i=j0(e,A,e,A,o)|0,!i&&(i=j0(e,A,r,n,l)|0,!i)?(n=kr(o,l)|0,n=YA(n|0,((n|0)<0)<<31>>31|0,1,0)|0,o=S()|0,l=s,t[l>>2]=n,t[l+4>>2]=o,l=0,k=a,l|0):(l=i,k=a,l|0)}function Nl(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0;if(QA=k,k=k+48|0,SA=QA+24|0,o=QA+12|0,zA=QA,i=j0(e,A,e,A,SA)|0,!i&&(i=j0(e,A,r,n,o)|0,!i)){K=kr(SA,o)|0,U=((K|0)<0)<<31>>31,t[SA>>2]=0,t[SA+4>>2]=0,t[SA+8>>2]=0,t[o>>2]=0,t[o+4>>2]=0,t[o+8>>2]=0,j0(e,A,e,A,SA)|0&&OA(27795,27538,692,27747),j0(e,A,r,n,o)|0&&OA(27795,27538,697,27747),Kr(SA),Kr(o),p=(K|0)==0?0:1/+(K|0),r=t[SA>>2]|0,G=p*+((t[o>>2]|0)-r|0),W=SA+4|0,n=t[W>>2]|0,nA=p*+((t[o+4>>2]|0)-n|0),q=SA+8|0,i=t[q>>2]|0,p=p*+((t[o+8>>2]|0)-i|0),t[zA>>2]=r,M=zA+4|0,t[M>>2]=n,R=zA+8|0,t[R>>2]=i;A:do if((K|0)<0)i=0;else for(I=0,N=0;;){a=+(N>>>0)+4294967296*+(I|0),ce=G*a+ +(r|0),l=nA*a+ +(n|0),a=p*a+ +(i|0),r=~~+kn(+ce),o=~~+kn(+l),i=~~+kn(+a),ce=+$A(+(+(r|0)-ce)),l=+$A(+(+(o|0)-l)),a=+$A(+(+(i|0)-a));do if(ce>l&ce>a)r=0-(o+i)|0,n=o;else if(f=0-r|0,l>a){n=f-i|0;break}else{n=o,i=f-o|0;break}while(!1);if(t[zA>>2]=r,t[M>>2]=n,t[R>>2]=i,qr(zA),i=Ws(e,A,zA,s+(N<<3)|0)|0,i|0)break A;if(!((I|0)<(U|0)|(I|0)==(U|0)&N>>>0>>0)){i=0;break A}r=YA(N|0,I|0,1,0)|0,n=S()|0,I=n,N=r,r=t[SA>>2]|0,n=t[W>>2]|0,i=t[q>>2]|0}while(!1);return zA=i,k=QA,zA|0}return zA=i,k=QA,zA|0}function H0(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0;if((r|0)==0&(n|0)==0)return s=0,i=1,KA(s|0),i|0;i=e,s=A,e=1,A=0;do o=(r&1|0)==0&!0,e=ht((o?1:i)|0,(o?0:s)|0,e|0,A|0)|0,A=S()|0,r=si(r|0,n|0,1)|0,n=S()|0,i=ht(i|0,s|0,i|0,s|0)|0,s=S()|0;while(!((r|0)==0&(n|0)==0));return KA(A|0),e|0}function rs(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0;l=k,k=k+16|0,i=l,o=wA(e|0,A|0,52)|0,S()|0,o=o&15;do if(o){if(s=ir(e,A,i)|0,!s){f=+b[i>>3],a=1/+_e(+f),p=+b[25968+(o<<3)>>3],b[r>>3]=f+p,b[r+8>>3]=f-p,f=+b[i+8>>3],a=p*a,b[r+16>>3]=a+f,b[r+24>>3]=f-a;break}return o=s,k=l,o|0}else{if(s=wA(e|0,A|0,45)|0,S()|0,s=s&127,s>>>0>121)return o=5,k=l,o|0;i=22064+(s<<5)|0,t[r>>2]=t[i>>2],t[r+4>>2]=t[i+4>>2],t[r+8>>2]=t[i+8>>2],t[r+12>>2]=t[i+12>>2],t[r+16>>2]=t[i+16>>2],t[r+20>>2]=t[i+20>>2],t[r+24>>2]=t[i+24>>2],t[r+28>>2]=t[i+28>>2];break}while(!1);return LA(r,n?1.4:1.1),n=26096+(o<<3)|0,(t[n>>2]|0)==(e|0)&&(t[n+4>>2]|0)==(A|0)&&(b[r>>3]=1.5707963267948966),o=26224+(o<<3)|0,(t[o>>2]|0)==(e|0)&&(t[o+4>>2]|0)==(A|0)&&(b[r+8>>3]=-1.5707963267948966),+b[r>>3]!=1.5707963267948966&&+b[r+8>>3]!=-1.5707963267948966?(o=0,k=l,o|0):(b[r+16>>3]=3.141592653589793,b[r+24>>3]=-3.141592653589793,o=0,k=l,o|0)}function Fl(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0;f=k,k=k+48|0,o=f+32|0,i=f+40|0,l=f,jt(o,0,0,0),a=t[o>>2]|0,o=t[o+4>>2]|0;do if(r>>>0<=15){if(s=nn(n)|0,s|0){n=l,t[n>>2]=0,t[n+4>>2]=0,t[l+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e,r=t[n>>2]|0,n=t[n+4>>2]|0,(r|0)==0&(n|0)==0){k=U;return}if(A=e+28|0,xA[A>>0]|0?(r=Ys(r,n)|0,n=S()|0):xA[A>>0]=1,K=e+20|0,!(t[t[K>>2]>>2]|0)){A=e+24|0,r=t[A>>2]|0,r|0&&qA(r),q=e,t[q>>2]=0,t[q+4>>2]=0,t[e+8>>2]=0,t[K>>2]=0,t[e+12>>2]=-1,t[e+16>>2]=0,t[A>>2]=0,k=U;return}q=e+16|0,A=t[q>>2]|0,s=A&15;A:do if((r|0)==0&(n|0)==0)nA=e+24|0;else{G=e+12|0,M=(s|0)==3,p=A&255,a=(s|1|0)==3,R=e+24|0,f=(s+-1|0)>>>0<3,o=(s|2|0)==3,l=N+8|0;e:for(;;){if(i=wA(r|0,n|0,52)|0,S()|0,i=i&15,(i|0)==(t[G>>2]|0)){switch(p&15){case 0:case 2:case 3:{if(s=ir(r,n,I)|0,s|0){W=15;break e}if(ss(t[K>>2]|0,t[R>>2]|0,I)|0){W=19;break e}break}}if(a&&(s=t[(t[K>>2]|0)+4>>2]|0,t[I>>2]=t[s>>2],t[I+4>>2]=t[s+4>>2],t[I+8>>2]=t[s+8>>2],t[I+12>>2]=t[s+12>>2],g0(26832,I)|0)){if(qn(t[(t[K>>2]|0)+4>>2]|0,i,N)|0){W=25;break}if(s=N,(t[s>>2]|0)==(r|0)&&(t[s+4>>2]|0)==(n|0)){W=29;break}}if(f){if(s=Br(r,n,I)|0,s|0){W=32;break}if(rs(r,n,N,0)|0){W=36;break}if(o&&$s(t[K>>2]|0,t[R>>2]|0,I,N)|0){W=42;break}if(a&&Ks(t[K>>2]|0,t[R>>2]|0,I,N)|0){W=42;break}}if(M){if(A=rs(r,n,I,1)|0,s=t[R>>2]|0,A|0){W=45;break}if(Fe(s,I)|0){if(H(N,I),_0(I,t[R>>2]|0)|0){W=53;break}if(ss(t[K>>2]|0,t[R>>2]|0,l)|0){W=53;break}if(Ks(t[K>>2]|0,t[R>>2]|0,N,I)|0){W=53;break}}}}do if((i|0)<(t[G>>2]|0)){if(A=rs(r,n,I,1)|0,s=t[R>>2]|0,A|0){W=58;break e}if(!(Fe(s,I)|0)){W=73;break}if(_0(t[R>>2]|0,I)|0&&(H(N,I),$s(t[K>>2]|0,t[R>>2]|0,N,I)|0)){W=65;break e}if(r=Qs(r,n,i+1|0,N)|0,r|0){W=67;break e}n=N,r=t[n>>2]|0,n=t[n+4>>2]|0}else W=73;while(!1);if((W|0)==73&&(W=0,r=Ys(r,n)|0,n=S()|0),(r|0)==0&(n|0)==0){nA=R;break A}}switch(W|0){case 15:{A=t[R>>2]|0,A|0&&qA(A),W=e,t[W>>2]=0,t[W+4>>2]=0,t[K>>2]=0,t[G>>2]=-1,t[q>>2]=0,t[R>>2]=0,t[e+8>>2]=s,W=20;break}case 19:{t[e>>2]=r,t[e+4>>2]=n,W=20;break}case 25:{OA(27795,27761,470,27772);break}case 29:{t[e>>2]=r,t[e+4>>2]=n,k=U;return}case 32:{A=t[R>>2]|0,A|0&&qA(A),nA=e,t[nA>>2]=0,t[nA+4>>2]=0,t[K>>2]=0,t[G>>2]=-1,t[q>>2]=0,t[R>>2]=0,t[e+8>>2]=s,k=U;return}case 36:{OA(27795,27761,493,27772);break}case 42:{t[e>>2]=r,t[e+4>>2]=n,k=U;return}case 45:{s|0&&qA(s),W=e,t[W>>2]=0,t[W+4>>2]=0,t[K>>2]=0,t[G>>2]=-1,t[q>>2]=0,t[R>>2]=0,t[e+8>>2]=A,W=55;break}case 53:{t[e>>2]=r,t[e+4>>2]=n,W=55;break}case 58:{s|0&&qA(s),W=e,t[W>>2]=0,t[W+4>>2]=0,t[K>>2]=0,t[G>>2]=-1,t[q>>2]=0,t[R>>2]=0,t[e+8>>2]=A,W=71;break}case 65:{t[e>>2]=r,t[e+4>>2]=n,W=71;break}case 67:{A=t[R>>2]|0,A|0&&qA(A),nA=e,t[nA>>2]=0,t[nA+4>>2]=0,t[K>>2]=0,t[G>>2]=-1,t[q>>2]=0,t[R>>2]=0,t[e+8>>2]=r,k=U;return}}if((W|0)==20){k=U;return}else if((W|0)==55){k=U;return}else if((W|0)==71){k=U;return}}while(!1);A=t[nA>>2]|0,A|0&&qA(A),W=e,t[W>>2]=0,t[W+4>>2]=0,t[e+8>>2]=0,t[K>>2]=0,t[e+12>>2]=-1,t[q>>2]=0,t[nA>>2]=0,k=U}function Ys(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0;M=k,k=k+16|0,p=M,n=wA(e|0,A|0,52)|0,S()|0,n=n&15,r=wA(e|0,A|0,45)|0,S()|0;do if(n){for(;r=kA(n+4095|0,0,52)|0,s=S()|0|A&-15728641,i=(15-n|0)*3|0,o=kA(7,0,i|0)|0,l=S()|0,r=r|e|o,s=s|l,a=wA(e|0,A|0,i|0)|0,S()|0,a=a&7,n=n+-1|0,!(a>>>0<6);)if(n)A=s,e=r;else{f=4;break}if((f|0)==4){r=wA(r|0,s|0,45)|0,S()|0;break}return p=(a|0)==0&(He(r,s)|0)!=0,p=kA((p?2:1)+a|0,0,i|0)|0,f=S()|0|A&~l,p=p|e&~o,KA(f|0),k=M,p|0}while(!1);return r=r&127,r>>>0>120?(f=0,p=0,KA(f|0),k=M,p|0):(jt(p,0,r+1|0,0),f=t[p+4>>2]|0,p=t[p>>2]|0,KA(f|0),k=M,p|0)}function Pl(e,A,r,n,s,i){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0,i=i|0;var o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0;W=k,k=k+160|0,M=W+80|0,l=W+64|0,R=W+112|0,G=W,Fl(M,e,A,r),f=M,As(l,t[f>>2]|0,t[f+4>>2]|0,A),f=l,a=t[f>>2]|0,f=t[f+4>>2]|0,o=t[M+8>>2]|0,I=R+4|0,t[I>>2]=t[M>>2],t[I+4>>2]=t[M+4>>2],t[I+8>>2]=t[M+8>>2],t[I+12>>2]=t[M+12>>2],t[I+16>>2]=t[M+16>>2],t[I+20>>2]=t[M+20>>2],t[I+24>>2]=t[M+24>>2],t[I+28>>2]=t[M+28>>2],I=G,t[I>>2]=a,t[I+4>>2]=f,I=G+8|0,t[I>>2]=o,e=G+12|0,A=R,r=e+36|0;do t[e>>2]=t[A>>2],e=e+4|0,A=A+4|0;while((e|0)<(r|0));if(R=G+48|0,t[R>>2]=t[l>>2],t[R+4>>2]=t[l+4>>2],t[R+8>>2]=t[l+8>>2],t[R+12>>2]=t[l+12>>2],(a|0)==0&(f|0)==0)return G=o,k=W,G|0;r=G+16|0,p=G+24|0,M=G+28|0,o=0,l=0,A=a,e=f;do{if(!((o|0)<(s|0)|(o|0)==(s|0)&l>>>0>>0)){N=4;break}if(f=l,l=YA(l|0,o|0,1,0)|0,o=S()|0,f=i+(f<<3)|0,t[f>>2]=A,t[f+4>>2]=e,es(R),e=R,A=t[e>>2]|0,e=t[e+4>>2]|0,(A|0)==0&(e|0)==0){if(wn(r),A=r,e=t[A>>2]|0,A=t[A+4>>2]|0,(e|0)==0&(A|0)==0){N=10;break}zs(e,A,t[M>>2]|0,R),e=R,A=t[e>>2]|0,e=t[e+4>>2]|0}f=G,t[f>>2]=A,t[f+4>>2]=e}while(!((A|0)==0&(e|0)==0));return(N|0)==4?(e=G+40|0,A=t[e>>2]|0,A|0&&qA(A),N=G+16|0,t[N>>2]=0,t[N+4>>2]=0,t[p>>2]=0,t[G+36>>2]=0,t[M>>2]=-1,t[G+32>>2]=0,t[e>>2]=0,zs(0,0,0,R),t[G>>2]=0,t[G+4>>2]=0,t[I>>2]=0,G=14,k=W,G|0):((N|0)==10&&(t[G>>2]=0,t[G+4>>2]=0,t[I>>2]=t[p>>2]),G=t[I>>2]|0,k=W,G|0)}function Ql(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0;if(M=k,k=k+48|0,a=M+32|0,l=M+40|0,f=M,!(t[e>>2]|0))return p=n,t[p>>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0,a)|0,!(i/+b[a>>3]>10))break A;I=t[s>>2]|0,r=I+-1|0,t[s>>2]=r}while((I|0)>1);while(!1);if(wn(f),s=n,t[s>>2]=0,t[s+4>>2]=0,s=f,r=t[s>>2]|0,s=t[s+4>>2]|0,!((r|0)==0&(s|0)==0))do x0(r,s,A,a)|0,l=a,e=n,l=YA(t[e>>2]|0,t[e+4>>2]|0,t[l>>2]|0,t[l+4>>2]|0)|0,e=S()|0,I=n,t[I>>2]=l,t[I+4>>2]=e,wn(f),I=f,r=t[I>>2]|0,s=t[I+4>>2]|0;while(!((r|0)==0&(s|0)==0));r=t[o>>2]|0}while(!1);return I=r,k=M,I|0}function rn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;if(!(g0(A,r)|0)||(A=zt(A)|0,n=+b[r>>3],s=+b[r+8>>3],s=A&s<0?s+6.283185307179586:s,R=t[e>>2]|0,(R|0)<=0))return R=0,R|0;if(M=t[e+4>>2]|0,A){A=0,p=s,r=-1,e=0;A:for(;;){for(f=e;o=+b[M+(f<<4)>>3],s=+b[M+(f<<4)+8>>3],e=(r+2|0)%(R|0)|0,i=+b[M+(e<<4)>>3],l=+b[M+(e<<4)+8>>3],o>i?(a=o,o=l):(a=i,i=o,o=s,s=l),n=n==i|n==a?n+2220446049250313e-31:n,!!(na);)if(r=f+1|0,(r|0)>=(R|0)){r=22;break A}else e=f,f=r,r=e;if(l=o<0?o+6.283185307179586:o,o=s<0?s+6.283185307179586:s,p=l==p|o==p?p+-2220446049250313e-31:p,a=l+(o-l)*((n-i)/(a-i)),(a<0?a+6.283185307179586:a)>p&&(A=A^1),e=f+1|0,(e|0)>=(R|0)){r=22;break}else r=f}if((r|0)==22)return A|0}else{A=0,p=s,r=-1,e=0;A:for(;;){for(f=e;o=+b[M+(f<<4)>>3],s=+b[M+(f<<4)+8>>3],e=(r+2|0)%(R|0)|0,i=+b[M+(e<<4)>>3],l=+b[M+(e<<4)+8>>3],o>i?(a=o,o=l):(a=i,i=o,o=s,s=l),n=n==i|n==a?n+2220446049250313e-31:n,!!(na);)if(r=f+1|0,(r|0)>=(R|0)){r=22;break A}else e=f,f=r,r=e;if(p=o==p|s==p?p+-2220446049250313e-31:p,o+(s-o)*((n-i)/(a-i))>p&&(A=A^1),e=f+1|0,(e|0)>=(R|0)){r=22;break}else r=f}if((r|0)==22)return A|0}return 0}function Zs(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0;if(N=t[e>>2]|0,!N){t[A>>2]=0,t[A+4>>2]=0,t[A+8>>2]=0,t[A+12>>2]=0,t[A+16>>2]=0,t[A+20>>2]=0,t[A+24>>2]=0,t[A+28>>2]=0;return}if(G=A+8|0,b[G>>3]=17976931348623157e292,W=A+24|0,b[W>>3]=17976931348623157e292,b[A>>3]=-17976931348623157e292,nA=A+16|0,b[nA>>3]=-17976931348623157e292,!((N|0)<=0)){for(R=t[e+4>>2]|0,f=17976931348623157e292,p=-17976931348623157e292,M=0,e=-1,i=17976931348623157e292,o=17976931348623157e292,a=-17976931348623157e292,n=-17976931348623157e292,I=0;r=+b[R+(I<<4)>>3],l=+b[R+(I<<4)+8>>3],e=e+2|0,s=+b[R+(((e|0)==(N|0)?0:e)<<4)+8>>3],r>3]=r,i=r),l>3]=l,o=l),r>a?b[A>>3]=r:r=a,l>n&&(b[nA>>3]=l,n=l),f=l>0&lp?l:p,M=M|+$A(+(l-s))>3.141592653589793,e=I+1|0,(e|0)!=(N|0);)q=I,a=r,I=e,e=q;M&&(b[nA>>3]=p,b[W>>3]=f)}}function nn(e){return e=e|0,(e>>>0<4?0:15)|0}function ns(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0;if(N=t[e>>2]|0,N){if(G=A+8|0,b[G>>3]=17976931348623157e292,W=A+24|0,b[W>>3]=17976931348623157e292,b[A>>3]=-17976931348623157e292,nA=A+16|0,b[nA>>3]=-17976931348623157e292,(N|0)>0){for(s=t[e+4>>2]|0,R=17976931348623157e292,I=-17976931348623157e292,n=0,r=-1,a=17976931348623157e292,f=17976931348623157e292,M=-17976931348623157e292,o=-17976931348623157e292,q=0;i=+b[s+(q<<4)>>3],p=+b[s+(q<<4)+8>>3],zA=r+2|0,l=+b[s+(((zA|0)==(N|0)?0:zA)<<4)+8>>3],i>3]=i,a=i),p>3]=p,f=p),i>M?b[A>>3]=i:i=M,p>o&&(b[nA>>3]=p,o=p),R=p>0&pI?p:I,n=n|+$A(+(p-l))>3.141592653589793,r=q+1|0,(r|0)!=(N|0);)zA=q,M=i,q=r,r=zA;n&&(b[nA>>3]=I,b[W>>3]=R)}}else t[A>>2]=0,t[A+4>>2]=0,t[A+8>>2]=0,t[A+12>>2]=0,t[A+16>>2]=0,t[A+20>>2]=0,t[A+24>>2]=0,t[A+28>>2]=0;if(zA=e+8|0,r=t[zA>>2]|0,!((r|0)<=0)){SA=e+12|0,U=0;do if(s=t[SA>>2]|0,n=U,U=U+1|0,W=A+(U<<5)|0,nA=t[s+(n<<3)>>2]|0,nA){if(q=A+(U<<5)+8|0,b[q>>3]=17976931348623157e292,e=A+(U<<5)+24|0,b[e>>3]=17976931348623157e292,b[W>>3]=-17976931348623157e292,K=A+(U<<5)+16|0,b[K>>3]=-17976931348623157e292,(nA|0)>0){for(N=t[s+(n<<3)+4>>2]|0,R=17976931348623157e292,I=-17976931348623157e292,s=0,n=-1,G=0,a=17976931348623157e292,f=17976931348623157e292,p=-17976931348623157e292,o=-17976931348623157e292;i=+b[N+(G<<4)>>3],M=+b[N+(G<<4)+8>>3],n=n+2|0,l=+b[N+(((n|0)==(nA|0)?0:n)<<4)+8>>3],i>3]=i,a=i),M>3]=M,f=M),i>p?b[W>>3]=i:i=p,M>o&&(b[K>>3]=M,o=M),R=M>0&MI?M:I,s=s|+$A(+(M-l))>3.141592653589793,n=G+1|0,(n|0)!=(nA|0);)QA=G,G=n,p=i,n=QA;s&&(b[K>>3]=I,b[e>>3]=R)}}else t[W>>2]=0,t[W+4>>2]=0,t[W+8>>2]=0,t[W+12>>2]=0,t[W+16>>2]=0,t[W+20>>2]=0,t[W+24>>2]=0,t[W+28>>2]=0,r=t[zA>>2]|0;while((U|0)<(r|0))}}function ss(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;if(!(rn(e,A,r)|0))return s=0,s|0;if(s=e+8|0,(t[s>>2]|0)<=0)return s=1,s|0;for(n=e+12|0,e=0;;){if(i=e,e=e+1|0,rn((t[n>>2]|0)+(i<<3)|0,A+(e<<5)|0,r)|0){e=0,n=6;break}if((e|0)>=(t[s>>2]|0)){e=1,n=6;break}}return(n|0)==6?e|0:0}function $s(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(f=k,k=k+16|0,l=f,o=r+8|0,!(rn(e,A,o)|0))return a=0,k=f,a|0;a=e+8|0;A:do if((t[a>>2]|0)>0){for(i=e+12|0,s=0;;){if(p=s,s=s+1|0,rn((t[i>>2]|0)+(p<<3)|0,A+(s<<5)|0,o)|0){s=0;break}if((s|0)>=(t[a>>2]|0))break A}return k=f,s|0}while(!1);if(vn(e,A,r,n)|0)return p=0,k=f,p|0;t[l>>2]=t[r>>2],t[l+4>>2]=o,s=t[a>>2]|0;A:do if((s|0)>0)for(e=e+12|0,o=0,i=s;;){if(s=t[e>>2]|0,(t[s+(o<<3)>>2]|0)>0){if(rn(l,n,t[s+(o<<3)+4>>2]|0)|0){s=0;break A}if(s=o+1|0,vn((t[e>>2]|0)+(o<<3)|0,A+(s<<5)|0,r,n)|0){s=0;break A}i=t[a>>2]|0}else s=o+1|0;if((s|0)<(i|0))o=s;else{s=1;break}}else s=1;while(!1);return p=s,k=f,p|0}function vn(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0,zA=0,QA=0,ce=0;if(zA=k,k=k+176|0,q=zA+172|0,s=zA+168|0,K=zA,!(Fe(A,n)|0))return e=0,k=zA,e|0;if(y0(A,n,q,s),jr(K|0,r|0,168)|0,(t[r>>2]|0)>0){A=0;do QA=K+8+(A<<4)+8|0,nA=+Zt(+b[QA>>3],t[s>>2]|0),b[QA>>3]=nA,A=A+1|0;while((A|0)<(t[r>>2]|0))}G=+b[n>>3],W=+b[n+8>>3],nA=+Zt(+b[n+16>>3],t[s>>2]|0),I=+Zt(+b[n+24>>3],t[s>>2]|0);A:do if((t[e>>2]|0)>0){if(n=e+4|0,s=t[K>>2]|0,(s|0)<=0){for(A=0;;)if(A=A+1|0,(A|0)>=(t[e>>2]|0)){A=0;break A}}for(r=0;;){if(A=t[n>>2]|0,R=+b[A+(r<<4)>>3],N=+Zt(+b[A+(r<<4)+8>>3],t[q>>2]|0),A=t[n>>2]|0,r=r+1|0,QA=(r|0)%(t[e>>2]|0)|0,i=+b[A+(QA<<4)>>3],o=+Zt(+b[A+(QA<<4)+8>>3],t[q>>2]|0),!(R>=G)|!(i>=G)&&!(R<=W)|!(i<=W)&&!(N<=I)|!(o<=I)&&!(N>=nA)|!(o>=nA)){M=i-R,f=o-N,A=0;do if(ce=A,A=A+1|0,QA=(A|0)==(s|0)?0:A,i=+b[K+8+(ce<<4)+8>>3],o=+b[K+8+(QA<<4)+8>>3]-i,l=+b[K+8+(ce<<4)>>3],a=+b[K+8+(QA<<4)>>3]-l,p=M*o-f*a,p!=0&&(U=N-i,SA=R-l,a=(U*a-o*SA)/p,!(a<0|a>1))&&(p=(M*U-f*SA)/p,p>=0&p<=1)){A=1;break A}while((A|0)<(s|0))}if((r|0)>=(t[e>>2]|0)){A=0;break}}}else A=0;while(!1);return ce=A,k=zA,ce|0}function Ks(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0;if(vn(e,A,r,n)|0)return i=1,i|0;if(i=e+8|0,(t[i>>2]|0)<=0)return i=0,i|0;for(s=e+12|0,e=0;;){if(o=e,e=e+1|0,vn((t[s>>2]|0)+(o<<3)|0,A+(e<<5)|0,r,n)|0){e=1,s=6;break}if((e|0)>=(t[i>>2]|0)){e=0,s=6;break}}return(s|0)==6?e|0:0}function Ol(){return 8}function zl(){return 16}function Hl(){return 168}function Gl(){return 8}function Ul(){return 16}function Vl(){return 12}function Wl(){return 8}function Yl(e){return e=e|0,+(+((t[e>>2]|0)>>>0)+4294967296*+(t[e+4>>2]|0))}function Zl(e){e=e|0;var A=0,r=0;return r=+b[e>>3],A=+b[e+8>>3],+ +xe(+(r*r+A*A))}function qs(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0;f=+b[e>>3],a=+b[A>>3]-f,l=+b[e+8>>3],o=+b[A+8>>3]-l,M=+b[r>>3],i=+b[n>>3]-M,R=+b[r+8>>3],p=+b[n+8>>3]-R,i=(i*(l-R)-(f-M)*p)/(a*p-o*i),b[s>>3]=f+a*i,b[s+8>>3]=l+o*i}function Xs(e,A){return e=e|0,A=A|0,+$A(+(+b[e>>3]-+b[A>>3]))<11920928955078125e-23?(A=+$A(+(+b[e+8>>3]-+b[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function it(e,A){e=e|0,A=A|0;var r=0,n=0,s=0;return s=+b[e>>3]-+b[A>>3],n=+b[e+8>>3]-+b[A+8>>3],r=+b[e+16>>3]-+b[A+16>>3],+(s*s+n*n+r*r)}function $l(e,A){e=e|0,A=A|0;var r=0,n=0,s=0;r=+b[e>>3],n=+_e(+r),r=+ie(+r),b[A+16>>3]=r,r=+b[e+8>>3],s=n*+_e(+r),b[A>>3]=s,r=n*+ie(+r),b[A+8>>3]=r}function Kl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;if(i=k,k=k+16|0,s=i,n=He(e,A)|0,(r+-1|0)>>>0>5||(n=(n|0)!=0,(r|0)==1&n))return s=-1,k=i,s|0;do if(sn(e,A,s)|0)n=-1;else if(n){n=((t[26352+(r<<2)>>2]|0)+5-(t[s>>2]|0)|0)%5|0;break}else{n=((t[26384+(r<<2)>>2]|0)+6-(t[s>>2]|0)|0)%6|0;break}while(!1);return s=n,k=i,s|0}function sn(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0;if(p=k,k=k+32|0,l=p+16|0,a=p,n=Mr(e,A,l)|0,n|0)return r=n,k=p,r|0;i=te(e,A)|0,f=Ht(e,A)|0,O0(i,a),n=e0(i,t[l>>2]|0)|0;do if(je(i)|0){do switch(i|0){case 4:{s=0;break}case 14:{s=1;break}case 24:{s=2;break}case 38:{s=3;break}case 49:{s=4;break}case 58:{s=5;break}case 63:{s=6;break}case 72:{s=7;break}case 83:{s=8;break}case 97:{s=9;break}case 107:{s=10;break}case 117:{s=11;break}default:OA(27795,27797,75,27806)}while(!1);if(o=t[26416+(s*24|0)+8>>2]|0,A=t[26416+(s*24|0)+16>>2]|0,e=t[l>>2]|0,(e|0)!=(t[a>>2]|0)&&(a=Bt(i)|0,e=t[l>>2]|0,a|(e|0)==(A|0)&&(n=(n+1|0)%6|0)),(f|0)==3&(e|0)==(A|0)){n=(n+5|0)%6|0;break}(f|0)==5&(e|0)==(o|0)&&(n=(n+1|0)%6|0)}while(!1);return t[r>>2]=n,r=0,k=p,r|0}function r0(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0;if(K=k,k=k+32|0,q=K+24|0,W=K+20|0,N=K+8|0,I=K+16|0,R=K,a=(He(e,A)|0)==0,a=a?6:5,p=wA(e|0,A|0,52)|0,S()|0,p=p&15,a>>>0<=r>>>0)return n=2,k=K,n|0;M=(p|0)==0,!M&&(G=kA(7,0,(p^15)*3|0)|0,(G&e|0)==0&((S()|0)&A|0)==0)?s=r:i=4;A:do if((i|0)==4){if(s=(He(e,A)|0)!=0,((s?4:5)|0)<(r|0)||sn(e,A,q)|0||(i=(t[q>>2]|0)+r|0,s?s=26704+(((i|0)%5|0)<<2)|0:s=26736+(((i|0)%6|0)<<2)|0,G=t[s>>2]|0,(G|0)==7))return n=1,k=K,n|0;t[W>>2]=0,s=Z(e,A,G,W,N)|0;do if(!s){if(l=N,f=t[l>>2]|0,l=t[l+4>>2]|0,o=l>>>0>>0|(l|0)==(A|0)&f>>>0>>0,i=o?f:e,o=o?l:A,!M&&(M=kA(7,0,(p^15)*3|0)|0,(f&M|0)==0&(l&(S()|0)|0)==0))s=r;else{if(l=(r+-1+a|0)%(a|0)|0,s=He(e,A)|0,(l|0)<0&&OA(27795,27797,248,27822),a=(s|0)!=0,((a?4:5)|0)<(l|0)&&OA(27795,27797,248,27822),sn(e,A,q)|0&&OA(27795,27797,248,27822),s=(t[q>>2]|0)+l|0,a?s=26704+(((s|0)%5|0)<<2)|0:s=26736+(((s|0)%6|0)<<2)|0,l=t[s>>2]|0,(l|0)==7&&OA(27795,27797,248,27822),t[I>>2]=0,s=Z(e,A,l,I,R)|0,s|0)break;f=R,a=t[f>>2]|0,f=t[f+4>>2]|0;do if(f>>>0>>0|(f|0)==(o|0)&a>>>0>>0){if(He(a,f)|0?i=Ae(a,f,e,A)|0:i=t[26800+((((t[I>>2]|0)+(t[26768+(l<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,s=He(a,f)|0,(i+-1|0)>>>0>5){s=-1,i=a,o=f;break}if(s=(s|0)!=0,(i|0)==1&s){s=-1,i=a,o=f;break}do if(sn(a,f,q)|0)s=-1;else if(s){s=((t[26352+(i<<2)>>2]|0)+5-(t[q>>2]|0)|0)%5|0;break}else{s=((t[26384+(i<<2)>>2]|0)+6-(t[q>>2]|0)|0)%6|0;break}while(!1);i=a,o=f}else s=r;while(!1);l=N,f=t[l>>2]|0,l=t[l+4>>2]|0}if((i|0)==(f|0)&(o|0)==(l|0)){if(a=(He(f,l)|0)!=0,a?e=Ae(f,l,e,A)|0:e=t[26800+((((t[W>>2]|0)+(t[26768+(G<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,s=He(f,l)|0,(e+-1|0)>>>0<=5&&(nA=(s|0)!=0,!((e|0)==1&nA)))do if(sn(f,l,q)|0)s=-1;else if(nA){s=((t[26352+(e<<2)>>2]|0)+5-(t[q>>2]|0)|0)%5|0;break}else{s=((t[26384+(e<<2)>>2]|0)+6-(t[q>>2]|0)|0)%6|0;break}while(!1);else s=-1;s=s+1|0,s=(s|0)==6|a&(s|0)==5?0:s}A=o,e=i;break A}while(!1);return n=s,k=K,n|0}while(!1);return nA=kA(s|0,0,56)|0,q=S()|0|A&-2130706433|536870912,t[n>>2]=nA|e,t[n+4>>2]=q,n=0,k=K,n|0}function ql(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;return i=(He(e,A)|0)==0,n=r0(e,A,0,r)|0,s=(n|0)==0,i?!s||(n=r0(e,A,1,r+8|0)|0,n|0)||(n=r0(e,A,2,r+16|0)|0,n|0)||(n=r0(e,A,3,r+24|0)|0,n|0)||(n=r0(e,A,4,r+32|0)|0,n)?(i=n,i|0):r0(e,A,5,r+40|0)|0:!s||(n=r0(e,A,1,r+8|0)|0,n|0)||(n=r0(e,A,2,r+16|0)|0,n|0)||(n=r0(e,A,3,r+24|0)|0,n|0)||(n=r0(e,A,4,r+32|0)|0,n|0)?(i=n,i|0):(i=r+40|0,t[i>>2]=0,t[i+4>>2]=0,i=0,i|0)}function Xl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0,l=0,a=0;return a=k,k=k+192|0,s=a,i=a+168|0,o=wA(e|0,A|0,56)|0,S()|0,o=o&7,l=A&-2130706433|134217728,n=Mr(e,l,i)|0,n|0?(l=n,k=a,l|0):(A=wA(e|0,A|0,52)|0,S()|0,A=A&15,He(e,l)|0?w(i,A,o,1,s):J(i,A,o,1,s),l=s+8|0,t[r>>2]=t[l>>2],t[r+4>>2]=t[l+4>>2],t[r+8>>2]=t[l+8>>2],t[r+12>>2]=t[l+12>>2],l=0,k=a,l|0)}function Js(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;return s=k,k=k+16|0,r=s,!(!0&(A&2013265920|0)==536870912)||(n=A&-2130706433|134217728,!(We(e,n)|0))?(n=0,k=s,n|0):(i=wA(e|0,A|0,56)|0,S()|0,i=(r0(e,n,i&7,r)|0)==0,n=r,n=i&((t[n>>2]|0)==(e|0)?(t[n+4>>2]|0)==(A|0):0)&1,k=s,n|0)}function Ai(e,A,r){e=e|0,A=A|0,r=r|0;var n=0;(A|0)>0?(n=Gt(A,4)|0,t[e>>2]=n,n||OA(27835,27858,40,27872)):t[e>>2]=0,t[e+4>>2]=A,t[e+8>>2]=0,t[e+12>>2]=r}function ei(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0;s=e+4|0,i=e+12|0,o=e+8|0;A:for(;;){for(r=t[s>>2]|0,A=0;;){if((A|0)>=(r|0))break A;if(n=t[e>>2]|0,l=t[n+(A<<2)>>2]|0,!l)A=A+1|0;else break}A=n+(~~(+$A(+(+lt(10,+ +(15-(t[i>>2]|0)|0))*(+b[l>>3]+ +b[l+8>>3])))%+(r|0))>>>0<<2)|0,r=t[A>>2]|0;e:do if(r|0){if(n=l+32|0,(r|0)==(l|0))t[A>>2]=t[n>>2];else{if(r=r+32|0,A=t[r>>2]|0,!A)break;for(;(A|0)!=(l|0);)if(r=A+32|0,A=t[r>>2]|0,!A)break e;t[r>>2]=t[n>>2]}qA(l),t[o>>2]=(t[o>>2]|0)+-1}while(!1)}qA(t[e>>2]|0)}function ti(e){e=e|0;var A=0,r=0,n=0;for(n=t[e+4>>2]|0,r=0;;){if((r|0)>=(n|0)){A=0,r=4;break}if(A=t[(t[e>>2]|0)+(r<<2)>>2]|0,!A)r=r+1|0;else{r=4;break}}return(r|0)==4?A|0:0}function ri(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;if(r=~~(+$A(+(+lt(10,+ +(15-(t[e+12>>2]|0)|0))*(+b[A>>3]+ +b[A+8>>3])))%+(t[e+4>>2]|0))>>>0,r=(t[e>>2]|0)+(r<<2)|0,n=t[r>>2]|0,!n)return i=1,i|0;i=A+32|0;do if((n|0)!=(A|0)){if(r=t[n+32>>2]|0,!r)return i=1,i|0;for(s=r;;){if((s|0)==(A|0)){s=8;break}if(r=t[s+32>>2]|0,r)n=s,s=r;else{r=1,s=10;break}}if((s|0)==8){t[n+32>>2]=t[i>>2];break}else if((s|0)==10)return r|0}else t[r>>2]=t[i>>2];while(!1);return qA(A),i=e+8|0,t[i>>2]=(t[i>>2]|0)+-1,i=0,i|0}function Jl(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;i=w0(40)|0,i||OA(27888,27858,98,27901),t[i>>2]=t[A>>2],t[i+4>>2]=t[A+4>>2],t[i+8>>2]=t[A+8>>2],t[i+12>>2]=t[A+12>>2],s=i+16|0,t[s>>2]=t[r>>2],t[s+4>>2]=t[r+4>>2],t[s+8>>2]=t[r+8>>2],t[s+12>>2]=t[r+12>>2],t[i+32>>2]=0,s=~~(+$A(+(+lt(10,+ +(15-(t[e+12>>2]|0)|0))*(+b[A>>3]+ +b[A+8>>3])))%+(t[e+4>>2]|0))>>>0,s=(t[e>>2]|0)+(s<<2)|0,n=t[s>>2]|0;do if(!n)t[s>>2]=i;else{for(;!(Dr(n,A)|0&&Dr(n+16|0,r)|0);)if(s=t[n+32>>2]|0,n=(s|0)==0?n:s,!(t[n+32>>2]|0)){o=10;break}if((o|0)==10){t[n+32>>2]=i;break}return qA(i),o=n,o|0}while(!1);return o=e+8|0,t[o>>2]=(t[o>>2]|0)+1,o=i,o|0}function Aa(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0;if(s=~~(+$A(+(+lt(10,+ +(15-(t[e+12>>2]|0)|0))*(+b[A>>3]+ +b[A+8>>3])))%+(t[e+4>>2]|0))>>>0,s=t[(t[e>>2]|0)+(s<<2)>>2]|0,!s)return r=0,r|0;if(!r){for(e=s;;){if(Dr(e,A)|0){n=10;break}if(e=t[e+32>>2]|0,!e){e=0,n=10;break}}if((n|0)==10)return e|0}for(e=s;;){if(Dr(e,A)|0&&Dr(e+16|0,r)|0){n=10;break}if(e=t[e+32>>2]|0,!e){e=0,n=10;break}}return(n|0)==10?e|0:0}function ea(e,A){e=e|0,A=A|0;var r=0;if(r=~~(+$A(+(+lt(10,+ +(15-(t[e+12>>2]|0)|0))*(+b[A>>3]+ +b[A+8>>3])))%+(t[e+4>>2]|0))>>>0,e=t[(t[e>>2]|0)+(r<<2)>>2]|0,!e)return r=0,r|0;for(;;){if(Dr(e,A)|0){A=5;break}if(e=t[e+32>>2]|0,!e){e=0,A=5;break}}return(A|0)==5?e|0:0}function ta(){return 27920}function G0(e){return e=+e,~~+oi(+e)|0}function w0(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0,G=0,W=0,nA=0,q=0,K=0,U=0,SA=0;SA=k,k=k+16|0,R=SA;do if(e>>>0<245){if(f=e>>>0<11?16:e+11&-8,e=f>>>3,M=t[6981]|0,r=M>>>e,r&3|0)return A=(r&1^1)+e|0,e=27964+(A<<1<<2)|0,r=e+8|0,n=t[r>>2]|0,s=n+8|0,i=t[s>>2]|0,(i|0)==(e|0)?t[6981]=M&~(1<>2]=e,t[r>>2]=i),U=A<<3,t[n+4>>2]=U|3,U=n+U+4|0,t[U>>2]=t[U>>2]|1,U=s,k=SA,U|0;if(p=t[6983]|0,f>>>0>p>>>0){if(r|0)return A=2<>>12&16,A=A>>>l,r=A>>>5&8,A=A>>>r,i=A>>>2&4,A=A>>>i,e=A>>>1&2,A=A>>>e,n=A>>>1&1,n=(r|l|i|e|n)+(A>>>n)|0,A=27964+(n<<1<<2)|0,e=A+8|0,i=t[e>>2]|0,l=i+8|0,r=t[l>>2]|0,(r|0)==(A|0)?(e=M&~(1<>2]=A,t[e>>2]=r,e=M),U=n<<3,o=U-f|0,t[i+4>>2]=f|3,s=i+f|0,t[s+4>>2]=o|1,t[i+U>>2]=o,p|0&&(n=t[6986]|0,A=p>>>3,r=27964+(A<<1<<2)|0,A=1<>2]|0):(t[6981]=e|A,A=r,e=r+8|0),t[e>>2]=n,t[A+12>>2]=n,t[n+8>>2]=A,t[n+12>>2]=r),t[6983]=o,t[6986]=s,U=l,k=SA,U|0;if(i=t[6982]|0,i){for(r=(i&0-i)+-1|0,s=r>>>12&16,r=r>>>s,n=r>>>5&8,r=r>>>n,o=r>>>2&4,r=r>>>o,l=r>>>1&2,r=r>>>l,a=r>>>1&1,a=t[28228+((n|s|o|l|a)+(r>>>a)<<2)>>2]|0,r=a,l=a,a=(t[a+4>>2]&-8)-f|0;e=t[r+16>>2]|0,!(!e&&(e=t[r+20>>2]|0,!e));)o=(t[e+4>>2]&-8)-f|0,s=o>>>0>>0,r=e,l=s?e:l,a=s?o:a;if(o=l+f|0,o>>>0>l>>>0){s=t[l+24>>2]|0,A=t[l+12>>2]|0;do if((A|0)==(l|0)){if(e=l+20|0,A=t[e>>2]|0,!A&&(e=l+16|0,A=t[e>>2]|0,!A)){r=0;break}for(;;)if(n=A+20|0,r=t[n>>2]|0,r)A=r,e=n;else if(n=A+16|0,r=t[n>>2]|0,r)A=r,e=n;else break;t[e>>2]=0,r=A}else r=t[l+8>>2]|0,t[r+12>>2]=A,t[A+8>>2]=r,r=A;while(!1);do if(s|0){if(A=t[l+28>>2]|0,e=28228+(A<<2)|0,(l|0)==(t[e>>2]|0)){if(t[e>>2]=r,!r){t[6982]=i&~(1<>2]|0)==(l|0)?U:s+20|0)>>2]=r,!r)break;t[r+24>>2]=s,A=t[l+16>>2]|0,A|0&&(t[r+16>>2]=A,t[A+24>>2]=r),A=t[l+20>>2]|0,A|0&&(t[r+20>>2]=A,t[A+24>>2]=r)}while(!1);return a>>>0<16?(U=a+f|0,t[l+4>>2]=U|3,U=l+U+4|0,t[U>>2]=t[U>>2]|1):(t[l+4>>2]=f|3,t[o+4>>2]=a|1,t[o+a>>2]=a,p|0&&(n=t[6986]|0,A=p>>>3,r=27964+(A<<1<<2)|0,A=1<>2]|0):(t[6981]=A|M,A=r,e=r+8|0),t[e>>2]=n,t[A+12>>2]=n,t[n+8>>2]=A,t[n+12>>2]=r),t[6983]=a,t[6986]=o),U=l+8|0,k=SA,U|0}else M=f}else M=f}else M=f}else if(e>>>0<=4294967231)if(e=e+11|0,f=e&-8,n=t[6982]|0,n){s=0-f|0,e=e>>>8,e?f>>>0>16777215?a=31:(M=(e+1048320|0)>>>16&8,G=e<>>16&4,G=G<>>16&2,a=14-(l|M|a)+(G<>>15)|0,a=f>>>(a+7|0)&1|a<<1):a=0,r=t[28228+(a<<2)>>2]|0;A:do if(!r)r=0,e=0,G=61;else for(e=0,l=f<<((a|0)==31?0:25-(a>>>1)|0),i=0;;){if(o=(t[r+4>>2]&-8)-f|0,o>>>0>>0)if(o)e=r,s=o;else{e=r,s=0,G=65;break A}if(G=t[r+20>>2]|0,r=t[r+16+(l>>>31<<2)>>2]|0,i=(G|0)==0|(G|0)==(r|0)?i:G,r)l=l<<1;else{r=i,G=61;break}}while(!1);if((G|0)==61){if((r|0)==0&(e|0)==0){if(e=2<>>12&16,M=M>>>o,i=M>>>5&8,M=M>>>i,l=M>>>2&4,M=M>>>l,a=M>>>1&2,M=M>>>a,r=M>>>1&1,e=0,r=t[28228+((i|o|l|a|r)+(M>>>r)<<2)>>2]|0}r?G=65:(l=e,o=s)}if((G|0)==65)for(i=r;;)if(M=(t[i+4>>2]&-8)-f|0,r=M>>>0>>0,s=r?M:s,e=r?i:e,r=t[i+16>>2]|0,r||(r=t[i+20>>2]|0),r)i=r;else{l=e,o=s;break}if((l|0)!=0&&o>>>0<((t[6983]|0)-f|0)>>>0&&(p=l+f|0,p>>>0>l>>>0)){i=t[l+24>>2]|0,A=t[l+12>>2]|0;do if((A|0)==(l|0)){if(e=l+20|0,A=t[e>>2]|0,!A&&(e=l+16|0,A=t[e>>2]|0,!A)){A=0;break}for(;;)if(s=A+20|0,r=t[s>>2]|0,r)A=r,e=s;else if(s=A+16|0,r=t[s>>2]|0,r)A=r,e=s;else break;t[e>>2]=0}else U=t[l+8>>2]|0,t[U+12>>2]=A,t[A+8>>2]=U;while(!1);do if(i){if(e=t[l+28>>2]|0,r=28228+(e<<2)|0,(l|0)==(t[r>>2]|0)){if(t[r>>2]=A,!A){n=n&~(1<>2]|0)==(l|0)?U:i+20|0)>>2]=A,!A)break;t[A+24>>2]=i,e=t[l+16>>2]|0,e|0&&(t[A+16>>2]=e,t[e+24>>2]=A),e=t[l+20>>2]|0,e&&(t[A+20>>2]=e,t[e+24>>2]=A)}while(!1);A:do if(o>>>0<16)U=o+f|0,t[l+4>>2]=U|3,U=l+U+4|0,t[U>>2]=t[U>>2]|1;else{if(t[l+4>>2]=f|3,t[p+4>>2]=o|1,t[p+o>>2]=o,A=o>>>3,o>>>0<256){r=27964+(A<<1<<2)|0,e=t[6981]|0,A=1<>2]|0):(t[6981]=e|A,A=r,e=r+8|0),t[e>>2]=p,t[A+12>>2]=p,t[p+8>>2]=A,t[p+12>>2]=r;break}if(A=o>>>8,A?o>>>0>16777215?r=31:(K=(A+1048320|0)>>>16&8,U=A<>>16&4,U=U<>>16&2,r=14-(q|K|r)+(U<>>15)|0,r=o>>>(r+7|0)&1|r<<1):r=0,A=28228+(r<<2)|0,t[p+28>>2]=r,e=p+16|0,t[e+4>>2]=0,t[e>>2]=0,e=1<>2]=p,t[p+24>>2]=A,t[p+12>>2]=p,t[p+8>>2]=p;break}A=t[A>>2]|0;e:do if((t[A+4>>2]&-8|0)!=(o|0)){for(n=o<<((r|0)==31?0:25-(r>>>1)|0);r=A+16+(n>>>31<<2)|0,e=t[r>>2]|0,!!e;)if((t[e+4>>2]&-8|0)==(o|0)){A=e;break e}else n=n<<1,A=e;t[r>>2]=p,t[p+24>>2]=A,t[p+12>>2]=p,t[p+8>>2]=p;break A}while(!1);K=A+8|0,U=t[K>>2]|0,t[U+12>>2]=p,t[K>>2]=p,t[p+8>>2]=U,t[p+12>>2]=A,t[p+24>>2]=0}while(!1);return U=l+8|0,k=SA,U|0}else M=f}else M=f;else M=-1;while(!1);if(r=t[6983]|0,r>>>0>=M>>>0)return A=r-M|0,e=t[6986]|0,A>>>0>15?(U=e+M|0,t[6986]=U,t[6983]=A,t[U+4>>2]=A|1,t[e+r>>2]=A,t[e+4>>2]=M|3):(t[6983]=0,t[6986]=0,t[e+4>>2]=r|3,U=e+r+4|0,t[U>>2]=t[U>>2]|1),U=e+8|0,k=SA,U|0;if(o=t[6984]|0,o>>>0>M>>>0)return q=o-M|0,t[6984]=q,U=t[6987]|0,K=U+M|0,t[6987]=K,t[K+4>>2]=q|1,t[U+4>>2]=M|3,U=U+8|0,k=SA,U|0;if(t[7099]|0?e=t[7101]|0:(t[7101]=4096,t[7100]=4096,t[7102]=-1,t[7103]=-1,t[7104]=0,t[7092]=0,t[7099]=R&-16^1431655768,e=4096),l=M+48|0,a=M+47|0,i=e+a|0,s=0-e|0,f=i&s,f>>>0<=M>>>0||(e=t[7091]|0,e|0&&(p=t[7089]|0,R=p+f|0,R>>>0<=p>>>0|R>>>0>e>>>0)))return U=0,k=SA,U|0;A:do if(t[7092]&4)A=0,G=143;else{r=t[6987]|0;e:do if(r){for(n=28372;R=t[n>>2]|0,!(R>>>0<=r>>>0&&(R+(t[n+4>>2]|0)|0)>>>0>r>>>0);)if(e=t[n+8>>2]|0,e)n=e;else{G=128;break e}if(A=i-o&s,A>>>0<2147483647)if(e=W0(A|0)|0,(e|0)==((t[n>>2]|0)+(t[n+4>>2]|0)|0)){if((e|0)!=-1){o=A,i=e,G=145;break A}}else n=e,G=136;else A=0}else G=128;while(!1);do if((G|0)==128)if(r=W0(0)|0,(r|0)!=-1&&(A=r,I=t[7100]|0,N=I+-1|0,A=((N&A|0)==0?0:(N+A&0-I)-A|0)+f|0,I=t[7089]|0,N=A+I|0,A>>>0>M>>>0&A>>>0<2147483647)){if(R=t[7091]|0,R|0&&N>>>0<=I>>>0|N>>>0>R>>>0){A=0;break}if(e=W0(A|0)|0,(e|0)==(r|0)){o=A,i=r,G=145;break A}else n=e,G=136}else A=0;while(!1);do if((G|0)==136){if(r=0-A|0,!(l>>>0>A>>>0&(A>>>0<2147483647&(n|0)!=-1)))if((n|0)==-1){A=0;break}else{o=A,i=n,G=145;break A}if(e=t[7101]|0,e=a-A+e&0-e,e>>>0>=2147483647){o=A,i=n,G=145;break A}if((W0(e|0)|0)==-1){W0(r|0)|0,A=0;break}else{o=e+A|0,i=n,G=145;break A}}while(!1);t[7092]=t[7092]|4,G=143}while(!1);if((G|0)==143&&f>>>0<2147483647&&(q=W0(f|0)|0,N=W0(0)|0,W=N-q|0,nA=W>>>0>(M+40|0)>>>0,!((q|0)==-1|nA^1|q>>>0>>0&((q|0)!=-1&(N|0)!=-1)^1))&&(o=nA?W:A,i=q,G=145),(G|0)==145){A=(t[7089]|0)+o|0,t[7089]=A,A>>>0>(t[7090]|0)>>>0&&(t[7090]=A),a=t[6987]|0;A:do if(a){for(A=28372;;){if(e=t[A>>2]|0,r=t[A+4>>2]|0,(i|0)==(e+r|0)){G=154;break}if(n=t[A+8>>2]|0,n)A=n;else break}if((G|0)==154&&(K=A+4|0,(t[A+12>>2]&8|0)==0)&&i>>>0>a>>>0&e>>>0<=a>>>0){t[K>>2]=r+o,U=(t[6984]|0)+o|0,q=a+8|0,q=(q&7|0)==0?0:0-q&7,K=a+q|0,q=U-q|0,t[6987]=K,t[6984]=q,t[K+4>>2]=q|1,t[a+U+4>>2]=40,t[6988]=t[7103];break}for(i>>>0<(t[6985]|0)>>>0&&(t[6985]=i),r=i+o|0,A=28372;;){if((t[A>>2]|0)==(r|0)){G=162;break}if(e=t[A+8>>2]|0,e)A=e;else break}if((G|0)==162&&(t[A+12>>2]&8|0)==0){t[A>>2]=i,p=A+4|0,t[p>>2]=(t[p>>2]|0)+o,p=i+8|0,p=i+((p&7|0)==0?0:0-p&7)|0,A=r+8|0,A=r+((A&7|0)==0?0:0-A&7)|0,f=p+M|0,l=A-p-M|0,t[p+4>>2]=M|3;e:do if((a|0)==(A|0))U=(t[6984]|0)+l|0,t[6984]=U,t[6987]=f,t[f+4>>2]=U|1;else{if((t[6986]|0)==(A|0)){U=(t[6983]|0)+l|0,t[6983]=U,t[6986]=f,t[f+4>>2]=U|1,t[f+U>>2]=U;break}if(e=t[A+4>>2]|0,(e&3|0)==1){o=e&-8,n=e>>>3;t:do if(e>>>0<256)if(e=t[A+8>>2]|0,r=t[A+12>>2]|0,(r|0)==(e|0)){t[6981]=t[6981]&~(1<>2]=r,t[r+8>>2]=e;break}else{i=t[A+24>>2]|0,e=t[A+12>>2]|0;do if((e|0)==(A|0)){if(r=A+16|0,n=r+4|0,e=t[n>>2]|0,e)r=n;else if(e=t[r>>2]|0,!e){e=0;break}for(;;)if(s=e+20|0,n=t[s>>2]|0,n)e=n,r=s;else if(s=e+16|0,n=t[s>>2]|0,n)e=n,r=s;else break;t[r>>2]=0}else U=t[A+8>>2]|0,t[U+12>>2]=e,t[e+8>>2]=U;while(!1);if(!i)break;r=t[A+28>>2]|0,n=28228+(r<<2)|0;do if((t[n>>2]|0)!=(A|0)){if(U=i+16|0,t[((t[U>>2]|0)==(A|0)?U:i+20|0)>>2]=e,!e)break t}else{if(t[n>>2]=e,e|0)break;t[6982]=t[6982]&~(1<>2]=i,r=A+16|0,n=t[r>>2]|0,n|0&&(t[e+16>>2]=n,t[n+24>>2]=e),r=t[r+4>>2]|0,!r)break;t[e+20>>2]=r,t[r+24>>2]=e}while(!1);A=A+o|0,s=o+l|0}else s=l;if(A=A+4|0,t[A>>2]=t[A>>2]&-2,t[f+4>>2]=s|1,t[f+s>>2]=s,A=s>>>3,s>>>0<256){r=27964+(A<<1<<2)|0,e=t[6981]|0,A=1<>2]|0):(t[6981]=e|A,A=r,e=r+8|0),t[e>>2]=f,t[A+12>>2]=f,t[f+8>>2]=A,t[f+12>>2]=r;break}A=s>>>8;do if(!A)n=0;else{if(s>>>0>16777215){n=31;break}K=(A+1048320|0)>>>16&8,U=A<>>16&4,U=U<>>16&2,n=14-(q|K|n)+(U<>>15)|0,n=s>>>(n+7|0)&1|n<<1}while(!1);if(A=28228+(n<<2)|0,t[f+28>>2]=n,e=f+16|0,t[e+4>>2]=0,t[e>>2]=0,e=t[6982]|0,r=1<>2]=f,t[f+24>>2]=A,t[f+12>>2]=f,t[f+8>>2]=f;break}A=t[A>>2]|0;t:do if((t[A+4>>2]&-8|0)!=(s|0)){for(n=s<<((n|0)==31?0:25-(n>>>1)|0);r=A+16+(n>>>31<<2)|0,e=t[r>>2]|0,!!e;)if((t[e+4>>2]&-8|0)==(s|0)){A=e;break t}else n=n<<1,A=e;t[r>>2]=f,t[f+24>>2]=A,t[f+12>>2]=f,t[f+8>>2]=f;break e}while(!1);K=A+8|0,U=t[K>>2]|0,t[U+12>>2]=f,t[K>>2]=f,t[f+8>>2]=U,t[f+12>>2]=A,t[f+24>>2]=0}while(!1);return U=p+8|0,k=SA,U|0}for(A=28372;e=t[A>>2]|0,!(e>>>0<=a>>>0&&(U=e+(t[A+4>>2]|0)|0,U>>>0>a>>>0));)A=t[A+8>>2]|0;s=U+-47|0,e=s+8|0,e=s+((e&7|0)==0?0:0-e&7)|0,s=a+16|0,e=e>>>0>>0?a:e,A=e+8|0,r=o+-40|0,q=i+8|0,q=(q&7|0)==0?0:0-q&7,K=i+q|0,q=r-q|0,t[6987]=K,t[6984]=q,t[K+4>>2]=q|1,t[i+r+4>>2]=40,t[6988]=t[7103],r=e+4|0,t[r>>2]=27,t[A>>2]=t[7093],t[A+4>>2]=t[7094],t[A+8>>2]=t[7095],t[A+12>>2]=t[7096],t[7093]=i,t[7094]=o,t[7096]=0,t[7095]=A,A=e+24|0;do K=A,A=A+4|0,t[A>>2]=7;while((K+8|0)>>>0>>0);if((e|0)!=(a|0)){if(i=e-a|0,t[r>>2]=t[r>>2]&-2,t[a+4>>2]=i|1,t[e>>2]=i,A=i>>>3,i>>>0<256){r=27964+(A<<1<<2)|0,e=t[6981]|0,A=1<>2]|0):(t[6981]=e|A,A=r,e=r+8|0),t[e>>2]=a,t[A+12>>2]=a,t[a+8>>2]=A,t[a+12>>2]=r;break}if(A=i>>>8,A?i>>>0>16777215?n=31:(K=(A+1048320|0)>>>16&8,U=A<>>16&4,U=U<>>16&2,n=14-(q|K|n)+(U<>>15)|0,n=i>>>(n+7|0)&1|n<<1):n=0,r=28228+(n<<2)|0,t[a+28>>2]=n,t[a+20>>2]=0,t[s>>2]=0,A=t[6982]|0,e=1<>2]=a,t[a+24>>2]=r,t[a+12>>2]=a,t[a+8>>2]=a;break}A=t[r>>2]|0;e:do if((t[A+4>>2]&-8|0)!=(i|0)){for(n=i<<((n|0)==31?0:25-(n>>>1)|0);r=A+16+(n>>>31<<2)|0,e=t[r>>2]|0,!!e;)if((t[e+4>>2]&-8|0)==(i|0)){A=e;break e}else n=n<<1,A=e;t[r>>2]=a,t[a+24>>2]=A,t[a+12>>2]=a,t[a+8>>2]=a;break A}while(!1);K=A+8|0,U=t[K>>2]|0,t[U+12>>2]=a,t[K>>2]=a,t[a+8>>2]=U,t[a+12>>2]=A,t[a+24>>2]=0}}else U=t[6985]|0,(U|0)==0|i>>>0>>0&&(t[6985]=i),t[7093]=i,t[7094]=o,t[7096]=0,t[6990]=t[7099],t[6989]=-1,t[6994]=27964,t[6993]=27964,t[6996]=27972,t[6995]=27972,t[6998]=27980,t[6997]=27980,t[7e3]=27988,t[6999]=27988,t[7002]=27996,t[7001]=27996,t[7004]=28004,t[7003]=28004,t[7006]=28012,t[7005]=28012,t[7008]=28020,t[7007]=28020,t[7010]=28028,t[7009]=28028,t[7012]=28036,t[7011]=28036,t[7014]=28044,t[7013]=28044,t[7016]=28052,t[7015]=28052,t[7018]=28060,t[7017]=28060,t[7020]=28068,t[7019]=28068,t[7022]=28076,t[7021]=28076,t[7024]=28084,t[7023]=28084,t[7026]=28092,t[7025]=28092,t[7028]=28100,t[7027]=28100,t[7030]=28108,t[7029]=28108,t[7032]=28116,t[7031]=28116,t[7034]=28124,t[7033]=28124,t[7036]=28132,t[7035]=28132,t[7038]=28140,t[7037]=28140,t[7040]=28148,t[7039]=28148,t[7042]=28156,t[7041]=28156,t[7044]=28164,t[7043]=28164,t[7046]=28172,t[7045]=28172,t[7048]=28180,t[7047]=28180,t[7050]=28188,t[7049]=28188,t[7052]=28196,t[7051]=28196,t[7054]=28204,t[7053]=28204,t[7056]=28212,t[7055]=28212,U=o+-40|0,q=i+8|0,q=(q&7|0)==0?0:0-q&7,K=i+q|0,q=U-q|0,t[6987]=K,t[6984]=q,t[K+4>>2]=q|1,t[i+U+4>>2]=40,t[6988]=t[7103];while(!1);if(A=t[6984]|0,A>>>0>M>>>0)return q=A-M|0,t[6984]=q,U=t[6987]|0,K=U+M|0,t[6987]=K,t[K+4>>2]=q|1,t[U+4>>2]=M|3,U=U+8|0,k=SA,U|0}return U=ta()|0,t[U>>2]=12,U=0,k=SA,U|0}function qA(e){e=e|0;var A=0,r=0,n=0,s=0,i=0,o=0,l=0,a=0;if(e){r=e+-8|0,s=t[6985]|0,e=t[e+-4>>2]|0,A=e&-8,a=r+A|0;do if(e&1)l=r,o=r;else{if(n=t[r>>2]|0,!(e&3)||(o=r+(0-n)|0,i=n+A|0,o>>>0>>0))return;if((t[6986]|0)==(o|0)){if(e=a+4|0,A=t[e>>2]|0,(A&3|0)!=3){l=o,A=i;break}t[6983]=i,t[e>>2]=A&-2,t[o+4>>2]=i|1,t[o+i>>2]=i;return}if(r=n>>>3,n>>>0<256)if(e=t[o+8>>2]|0,A=t[o+12>>2]|0,(A|0)==(e|0)){t[6981]=t[6981]&~(1<>2]=A,t[A+8>>2]=e,l=o,A=i;break}s=t[o+24>>2]|0,e=t[o+12>>2]|0;do if((e|0)==(o|0)){if(A=o+16|0,r=A+4|0,e=t[r>>2]|0,e)A=r;else if(e=t[A>>2]|0,!e){e=0;break}for(;;)if(n=e+20|0,r=t[n>>2]|0,r)e=r,A=n;else if(n=e+16|0,r=t[n>>2]|0,r)e=r,A=n;else break;t[A>>2]=0}else l=t[o+8>>2]|0,t[l+12>>2]=e,t[e+8>>2]=l;while(!1);if(s){if(A=t[o+28>>2]|0,r=28228+(A<<2)|0,(t[r>>2]|0)==(o|0)){if(t[r>>2]=e,!e){t[6982]=t[6982]&~(1<>2]|0)==(o|0)?l:s+20|0)>>2]=e,!e){l=o,A=i;break}t[e+24>>2]=s,A=o+16|0,r=t[A>>2]|0,r|0&&(t[e+16>>2]=r,t[r+24>>2]=e),A=t[A+4>>2]|0,A?(t[e+20>>2]=A,t[A+24>>2]=e,l=o,A=i):(l=o,A=i)}else l=o,A=i}while(!1);if(!(o>>>0>=a>>>0)&&(e=a+4|0,n=t[e>>2]|0,!!(n&1))){if(n&2)t[e>>2]=n&-2,t[l+4>>2]=A|1,t[o+A>>2]=A,s=A;else{if((t[6987]|0)==(a|0)){if(a=(t[6984]|0)+A|0,t[6984]=a,t[6987]=l,t[l+4>>2]=a|1,(l|0)!=(t[6986]|0))return;t[6986]=0,t[6983]=0;return}if((t[6986]|0)==(a|0)){a=(t[6983]|0)+A|0,t[6983]=a,t[6986]=o,t[l+4>>2]=a|1,t[o+a>>2]=a;return}s=(n&-8)+A|0,r=n>>>3;do if(n>>>0<256)if(A=t[a+8>>2]|0,e=t[a+12>>2]|0,(e|0)==(A|0)){t[6981]=t[6981]&~(1<>2]=e,t[e+8>>2]=A;break}else{i=t[a+24>>2]|0,e=t[a+12>>2]|0;do if((e|0)==(a|0)){if(A=a+16|0,r=A+4|0,e=t[r>>2]|0,e)A=r;else if(e=t[A>>2]|0,!e){r=0;break}for(;;)if(n=e+20|0,r=t[n>>2]|0,r)e=r,A=n;else if(n=e+16|0,r=t[n>>2]|0,r)e=r,A=n;else break;t[A>>2]=0,r=e}else r=t[a+8>>2]|0,t[r+12>>2]=e,t[e+8>>2]=r,r=e;while(!1);if(i|0){if(e=t[a+28>>2]|0,A=28228+(e<<2)|0,(t[A>>2]|0)==(a|0)){if(t[A>>2]=r,!r){t[6982]=t[6982]&~(1<>2]|0)==(a|0)?n:i+20|0)>>2]=r,!r)break;t[r+24>>2]=i,e=a+16|0,A=t[e>>2]|0,A|0&&(t[r+16>>2]=A,t[A+24>>2]=r),e=t[e+4>>2]|0,e|0&&(t[r+20>>2]=e,t[e+24>>2]=r)}}while(!1);if(t[l+4>>2]=s|1,t[o+s>>2]=s,(l|0)==(t[6986]|0)){t[6983]=s;return}}if(e=s>>>3,s>>>0<256){r=27964+(e<<1<<2)|0,A=t[6981]|0,e=1<>2]|0):(t[6981]=A|e,e=r,A=r+8|0),t[A>>2]=l,t[e+12>>2]=l,t[l+8>>2]=e,t[l+12>>2]=r;return}e=s>>>8,e?s>>>0>16777215?n=31:(o=(e+1048320|0)>>>16&8,a=e<>>16&4,a=a<>>16&2,n=14-(i|o|n)+(a<>>15)|0,n=s>>>(n+7|0)&1|n<<1):n=0,e=28228+(n<<2)|0,t[l+28>>2]=n,t[l+20>>2]=0,t[l+16>>2]=0,A=t[6982]|0,r=1<>2]=l,t[l+24>>2]=e,t[l+12>>2]=l,t[l+8>>2]=l;else{e=t[e>>2]|0;e:do if((t[e+4>>2]&-8|0)!=(s|0)){for(n=s<<((n|0)==31?0:25-(n>>>1)|0);r=e+16+(n>>>31<<2)|0,A=t[r>>2]|0,!!A;)if((t[A+4>>2]&-8|0)==(s|0)){e=A;break e}else n=n<<1,e=A;t[r>>2]=l,t[l+24>>2]=e,t[l+12>>2]=l,t[l+8>>2]=l;break A}while(!1);o=e+8|0,a=t[o>>2]|0,t[a+12>>2]=l,t[o>>2]=l,t[l+8>>2]=a,t[l+12>>2]=e,t[l+24>>2]=0}while(!1);if(a=(t[6989]|0)+-1|0,t[6989]=a,!(a|0)){for(e=28380;e=t[e>>2]|0,e;)e=e+8|0;t[6989]=-1}}}}function Gt(e,A){e=e|0,A=A|0;var r=0;return e?(r=Ne(A,e)|0,(A|e)>>>0>65535&&(r=((r>>>0)/(e>>>0)|0|0)==(A|0)?r:-1)):r=0,e=w0(r)|0,!e||!(t[e+-4>>2]&3)||V0(e|0,0,r|0)|0,e|0}function YA(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,r=e+r>>>0,KA(A+n+(r>>>0>>0|0)>>>0|0),r|0|0}function ft(e,A,r,n){return e=e|0,A=A|0,r=r|0,n=n|0,n=A-n-(r>>>0>e>>>0|0)>>>0,KA(n|0),e-r>>>0|0|0}function ni(e){return e=e|0,(e?31-(yt(e^e-1)|0)|0:32)|0}function is(e,A,r,n,s){e=e|0,A=A|0,r=r|0,n=n|0,s=s|0;var i=0,o=0,l=0,a=0,f=0,p=0,M=0,R=0,I=0,N=0;if(p=e,a=A,f=a,o=r,R=n,l=R,!f)return i=(s|0)!=0,l?i?(t[s>>2]=e|0,t[s+4>>2]=A&0,R=0,s=0,KA(R|0),s|0):(R=0,s=0,KA(R|0),s|0):(i&&(t[s>>2]=(p>>>0)%(o>>>0),t[s+4>>2]=0),R=0,s=(p>>>0)/(o>>>0)>>>0,KA(R|0),s|0);i=(l|0)==0;do if(o){if(!i){if(i=(yt(l|0)|0)-(yt(f|0)|0)|0,i>>>0<=31){M=i+1|0,l=31-i|0,A=i-31>>31,o=M,e=p>>>(M>>>0)&A|f<>>(M>>>0)&A,i=0,l=p<>2]=e|0,t[s+4>>2]=a|A&0,R=0,s=0,KA(R|0),s|0):(R=0,s=0,KA(R|0),s|0)}if(i=o-1|0,i&o|0){l=(yt(o|0)|0)+33-(yt(f|0)|0)|0,N=64-l|0,M=32-l|0,a=M>>31,I=l-32|0,A=I>>31,o=l,e=M-1>>31&f>>>(I>>>0)|(f<>>(l>>>0))&A,A=A&f>>>(l>>>0),i=p<>>(I>>>0))&a|p<>31;break}return s|0&&(t[s>>2]=i&p,t[s+4>>2]=0),(o|0)==1?(I=a|A&0,N=e|0|0,KA(I|0),N|0):(N=ni(o|0)|0,I=f>>>(N>>>0)|0,N=f<<32-N|p>>>(N>>>0)|0,KA(I|0),N|0)}else{if(i)return s|0&&(t[s>>2]=(f>>>0)%(o>>>0),t[s+4>>2]=0),I=0,N=(f>>>0)/(o>>>0)>>>0,KA(I|0),N|0;if(!p)return s|0&&(t[s>>2]=0,t[s+4>>2]=(f>>>0)%(l>>>0)),I=0,N=(f>>>0)/(l>>>0)>>>0,KA(I|0),N|0;if(i=l-1|0,!(i&l))return s|0&&(t[s>>2]=e|0,t[s+4>>2]=i&f|A&0),I=0,N=f>>>((ni(l|0)|0)>>>0),KA(I|0),N|0;if(i=(yt(l|0)|0)-(yt(f|0)|0)|0,i>>>0<=30){A=i+1|0,l=31-i|0,o=A,e=f<>>(A>>>0),A=f>>>(A>>>0),i=0,l=p<>2]=e|0,t[s+4>>2]=a|A&0,I=0,N=0,KA(I|0),N|0):(I=0,N=0,KA(I|0),N|0)}while(!1);if(!o)f=l,a=0,l=0;else{M=r|0|0,p=R|n&0,f=YA(M|0,p|0,-1,-1)|0,r=S()|0,a=l,l=0;do n=a,a=i>>>31|a<<1,i=l|i<<1,n=e<<1|n>>>31|0,R=e>>>31|A<<1|0,ft(f|0,r|0,n|0,R|0)|0,N=S()|0,I=N>>31|((N|0)<0?-1:0)<<1,l=I&1,e=ft(n|0,R|0,I&M|0,(((N|0)<0?-1:0)>>31|((N|0)<0?-1:0)<<1)&p|0)|0,A=S()|0,o=o-1|0;while((o|0)!=0);f=a,a=0}return o=0,s|0&&(t[s>>2]=e,t[s+4>>2]=A),I=(i|0)>>>31|(f|o)<<1|(o<<1|i>>>31)&0|a,N=(i<<1|0)&-2|l,KA(I|0),N|0}function U0(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0;return f=A>>31|((A|0)<0?-1:0)<<1,a=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,i=n>>31|((n|0)<0?-1:0)<<1,s=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1,l=ft(f^e|0,a^A|0,f|0,a|0)|0,o=S()|0,e=i^f,A=s^a,ft((is(l,o,ft(i^r|0,s^n|0,i|0,s|0)|0,S()|0,0)|0)^e|0,(S()|0)^A|0,e|0,A|0)|0}function ra(e,A){e=e|0,A=A|0;var r=0,n=0,s=0,i=0;return i=e&65535,s=A&65535,r=Ne(s,i)|0,n=e>>>16,e=(r>>>16)+(Ne(s,n)|0)|0,s=A>>>16,A=Ne(s,i)|0,KA((e>>>16)+(Ne(s,n)|0)+(((e&65535)+A|0)>>>16)|0),e+A<<16|r&65535|0|0}function ht(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0;return s=e,i=r,r=ra(s,i)|0,e=S()|0,KA((Ne(A,i)|0)+(Ne(n,s)|0)+e|e&0|0),r|0|0|0}function _r(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0,o=0,l=0,a=0,f=0;return s=k,k=k+16|0,l=s|0,o=A>>31|((A|0)<0?-1:0)<<1,i=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,f=n>>31|((n|0)<0?-1:0)<<1,a=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1,e=ft(o^e|0,i^A|0,o|0,i|0)|0,A=S()|0,is(e,A,ft(f^r|0,a^n|0,f|0,a|0)|0,S()|0,l)|0,n=ft(t[l>>2]^o|0,t[l+4>>2]^i|0,o|0,i|0)|0,r=S()|0,k=s,KA(r|0),n|0}function Tr(e,A,r,n){e=e|0,A=A|0,r=r|0,n=n|0;var s=0,i=0;return i=k,k=k+16|0,s=i|0,is(e,A,r,n,s)|0,k=i,KA(t[s+4>>2]|0),t[s>>2]|0|0}function si(e,A,r){return e=e|0,A=A|0,r=r|0,(r|0)<32?(KA(A>>r|0),e>>>r|(A&(1<>r-32|0)}function wA(e,A,r){return e=e|0,A=A|0,r=r|0,(r|0)<32?(KA(A>>>r|0),e>>>r|(A&(1<>>r-32|0)}function kA(e,A,r){return e=e|0,A=A|0,r=r|0,(r|0)<32?(KA(A<>>32-r|0),e<=0?+Ve(e+.5):+at(e-.5)}function jr(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0;if((r|0)>=8192)return l0(e|0,A|0,r|0)|0,e|0;if(i=e|0,s=e+r|0,(e&3)==(A&3)){for(;e&3;){if(!r)return i|0;xA[e>>0]=xA[A>>0]|0,e=e+1|0,A=A+1|0,r=r-1|0}for(r=s&-4|0,n=r-64|0;(e|0)<=(n|0);)t[e>>2]=t[A>>2],t[e+4>>2]=t[A+4>>2],t[e+8>>2]=t[A+8>>2],t[e+12>>2]=t[A+12>>2],t[e+16>>2]=t[A+16>>2],t[e+20>>2]=t[A+20>>2],t[e+24>>2]=t[A+24>>2],t[e+28>>2]=t[A+28>>2],t[e+32>>2]=t[A+32>>2],t[e+36>>2]=t[A+36>>2],t[e+40>>2]=t[A+40>>2],t[e+44>>2]=t[A+44>>2],t[e+48>>2]=t[A+48>>2],t[e+52>>2]=t[A+52>>2],t[e+56>>2]=t[A+56>>2],t[e+60>>2]=t[A+60>>2],e=e+64|0,A=A+64|0;for(;(e|0)<(r|0);)t[e>>2]=t[A>>2],e=e+4|0,A=A+4|0}else for(r=s-4|0;(e|0)<(r|0);)xA[e>>0]=xA[A>>0]|0,xA[e+1>>0]=xA[A+1>>0]|0,xA[e+2>>0]=xA[A+2>>0]|0,xA[e+3>>0]=xA[A+3>>0]|0,e=e+4|0,A=A+4|0;for(;(e|0)<(s|0);)xA[e>>0]=xA[A>>0]|0,e=e+1|0,A=A+1|0;return i|0}function V0(e,A,r){e=e|0,A=A|0,r=r|0;var n=0,s=0,i=0,o=0;if(i=e+r|0,A=A&255,(r|0)>=67){for(;e&3;)xA[e>>0]=A,e=e+1|0;for(n=i&-4|0,o=A|A<<8|A<<16|A<<24,s=n-64|0;(e|0)<=(s|0);)t[e>>2]=o,t[e+4>>2]=o,t[e+8>>2]=o,t[e+12>>2]=o,t[e+16>>2]=o,t[e+20>>2]=o,t[e+24>>2]=o,t[e+28>>2]=o,t[e+32>>2]=o,t[e+36>>2]=o,t[e+40>>2]=o,t[e+44>>2]=o,t[e+48>>2]=o,t[e+52>>2]=o,t[e+56>>2]=o,t[e+60>>2]=o,e=e+64|0;for(;(e|0)<(n|0);)t[e>>2]=o,e=e+4|0}for(;(e|0)<(i|0);)xA[e>>0]=A,e=e+1|0;return i-r|0}function oi(e){return e=+e,e>=0?+Ve(e+.5):+at(e-.5)}function W0(e){e=e|0;var A=0,r=0,n=0;return n=S0()|0,r=t[De>>2]|0,A=r+e|0,(e|0)>0&(A|0)<(r|0)|(A|0)<0?(M0(A|0)|0,Ot(12),-1):(A|0)>(n|0)&&!(a0(A|0)|0)?(Ot(12),-1):(t[De>>2]=A,r|0)}return{___divdi3:U0,___muldi3:ht,___remdi3:_r,___uremdi3:Tr,_areNeighborCells:Zn,_bitshift64Ashr:si,_bitshift64Lshr:wA,_bitshift64Shl:kA,_calloc:Gt,_cellAreaKm2:Cl,_cellAreaM2:El,_cellAreaRads2:ts,_cellToBoundary:Br,_cellToCenterChild:Qs,_cellToChildPos:ml,_cellToChildren:An,_cellToChildrenSize:x0,_cellToLatLng:ir,_cellToLocalIj:jl,_cellToParent:Rt,_cellToVertex:r0,_cellToVertexes:ql,_cellsToDirectedEdge:mn,_cellsToLinkedMultiPolygon:xt,_childPosToCell:pl,_compactCells:ol,_constructCell:we,_destroyLinkedMultiPolygon:Us,_directedEdgeToBoundary:nr,_directedEdgeToCells:Er,_edgeLengthKm:Ml,_edgeLengthM:Bl,_edgeLengthRads:Sl,_emscripten_replace_memory:Et,_free:qA,_getBaseCellNumber:te,_getDirectedEdgeDestination:pn,_getDirectedEdgeOrigin:Cr,_getHexagonAreaAvgKm2:Hs,_getHexagonAreaAvgM2:vl,_getHexagonEdgeLengthAvgKm:bl,_getHexagonEdgeLengthAvgM:kl,_getIcosahedronFaces:Os,_getIndexDigit:ke,_getNumCells:xn,_getPentagons:Jn,_getRes0Cells:Vr,_getResolution:BA,_greatCircleDistanceKm:tn,_greatCircleDistanceM:yl,_greatCircleDistanceRads:gl,_gridDisk:v,_gridDiskDistances:_,_gridDistance:Il,_gridPathCells:Nl,_gridPathCellsSize:Ll,_gridRing:aA,_gridRingUnsafe:_A,_i64Add:YA,_i64Subtract:ft,_isPentagon:He,_isResClassIII:ul,_isValidCell:We,_isValidDirectedEdge:Xr,_isValidIndex:Tt,_isValidVertex:Js,_latLngToCell:qn,_llvm_ctlz_i64:os,_llvm_maxnum_f64:ii,_llvm_minnum_f64:bn,_llvm_round_f64:kn,_localIjToCell:Rl,_malloc:w0,_maxFaceCount:hl,_maxGridDiskSize:h,_maxPolygonToCellsSize:fe,_maxPolygonToCellsSizeExperimental:Ql,_memcpy:jr,_memset:V0,_originToDirectedEdges:Sr,_pentagonCount:dl,_polygonToCells:St,_polygonToCellsExperimental:Pl,_readInt64AsDoubleFromPointer:Yl,_res0CellCount:Ur,_round:oi,_sbrk:W0,_sizeOfCellBoundary:Hl,_sizeOfCoordIJ:Wl,_sizeOfGeoLoop:Gl,_sizeOfGeoPolygon:Ul,_sizeOfH3Index:Ol,_sizeOfLatLng:zl,_sizeOfLinkedGeoPolygon:Vl,_uncompactCells:ll,_uncompactCellsSize:al,_vertexToLatLng:Xl,establishStackSpace:B0,stackAlloc:d0,stackRestore:Q0,stackSave:m0}})(Ar,F0,mA);c.___divdi3=pA.___divdi3,c.___muldi3=pA.___muldi3,c.___remdi3=pA.___remdi3,c.___uremdi3=pA.___uremdi3,c._areNeighborCells=pA._areNeighborCells,c._bitshift64Ashr=pA._bitshift64Ashr,c._bitshift64Lshr=pA._bitshift64Lshr,c._bitshift64Shl=pA._bitshift64Shl,c._calloc=pA._calloc,c._cellAreaKm2=pA._cellAreaKm2,c._cellAreaM2=pA._cellAreaM2,c._cellAreaRads2=pA._cellAreaRads2,c._cellToBoundary=pA._cellToBoundary,c._cellToCenterChild=pA._cellToCenterChild,c._cellToChildPos=pA._cellToChildPos,c._cellToChildren=pA._cellToChildren,c._cellToChildrenSize=pA._cellToChildrenSize,c._cellToLatLng=pA._cellToLatLng,c._cellToLocalIj=pA._cellToLocalIj,c._cellToParent=pA._cellToParent,c._cellToVertex=pA._cellToVertex,c._cellToVertexes=pA._cellToVertexes,c._cellsToDirectedEdge=pA._cellsToDirectedEdge,c._cellsToLinkedMultiPolygon=pA._cellsToLinkedMultiPolygon,c._childPosToCell=pA._childPosToCell,c._compactCells=pA._compactCells,c._constructCell=pA._constructCell,c._destroyLinkedMultiPolygon=pA._destroyLinkedMultiPolygon,c._directedEdgeToBoundary=pA._directedEdgeToBoundary,c._directedEdgeToCells=pA._directedEdgeToCells,c._edgeLengthKm=pA._edgeLengthKm,c._edgeLengthM=pA._edgeLengthM,c._edgeLengthRads=pA._edgeLengthRads;var f0=c._emscripten_replace_memory=pA._emscripten_replace_memory;c._free=pA._free,c._getBaseCellNumber=pA._getBaseCellNumber,c._getDirectedEdgeDestination=pA._getDirectedEdgeDestination,c._getDirectedEdgeOrigin=pA._getDirectedEdgeOrigin,c._getHexagonAreaAvgKm2=pA._getHexagonAreaAvgKm2,c._getHexagonAreaAvgM2=pA._getHexagonAreaAvgM2,c._getHexagonEdgeLengthAvgKm=pA._getHexagonEdgeLengthAvgKm,c._getHexagonEdgeLengthAvgM=pA._getHexagonEdgeLengthAvgM,c._getIcosahedronFaces=pA._getIcosahedronFaces,c._getIndexDigit=pA._getIndexDigit,c._getNumCells=pA._getNumCells,c._getPentagons=pA._getPentagons,c._getRes0Cells=pA._getRes0Cells,c._getResolution=pA._getResolution,c._greatCircleDistanceKm=pA._greatCircleDistanceKm,c._greatCircleDistanceM=pA._greatCircleDistanceM,c._greatCircleDistanceRads=pA._greatCircleDistanceRads,c._gridDisk=pA._gridDisk,c._gridDiskDistances=pA._gridDiskDistances,c._gridDistance=pA._gridDistance,c._gridPathCells=pA._gridPathCells,c._gridPathCellsSize=pA._gridPathCellsSize,c._gridRing=pA._gridRing,c._gridRingUnsafe=pA._gridRingUnsafe,c._i64Add=pA._i64Add,c._i64Subtract=pA._i64Subtract,c._isPentagon=pA._isPentagon,c._isResClassIII=pA._isResClassIII,c._isValidCell=pA._isValidCell,c._isValidDirectedEdge=pA._isValidDirectedEdge,c._isValidIndex=pA._isValidIndex,c._isValidVertex=pA._isValidVertex,c._latLngToCell=pA._latLngToCell,c._llvm_ctlz_i64=pA._llvm_ctlz_i64,c._llvm_maxnum_f64=pA._llvm_maxnum_f64,c._llvm_minnum_f64=pA._llvm_minnum_f64,c._llvm_round_f64=pA._llvm_round_f64,c._localIjToCell=pA._localIjToCell,c._malloc=pA._malloc,c._maxFaceCount=pA._maxFaceCount,c._maxGridDiskSize=pA._maxGridDiskSize,c._maxPolygonToCellsSize=pA._maxPolygonToCellsSize,c._maxPolygonToCellsSizeExperimental=pA._maxPolygonToCellsSizeExperimental,c._memcpy=pA._memcpy,c._memset=pA._memset,c._originToDirectedEdges=pA._originToDirectedEdges,c._pentagonCount=pA._pentagonCount,c._polygonToCells=pA._polygonToCells,c._polygonToCellsExperimental=pA._polygonToCellsExperimental,c._readInt64AsDoubleFromPointer=pA._readInt64AsDoubleFromPointer,c._res0CellCount=pA._res0CellCount,c._round=pA._round,c._sbrk=pA._sbrk,c._sizeOfCellBoundary=pA._sizeOfCellBoundary,c._sizeOfCoordIJ=pA._sizeOfCoordIJ,c._sizeOfGeoLoop=pA._sizeOfGeoLoop,c._sizeOfGeoPolygon=pA._sizeOfGeoPolygon,c._sizeOfH3Index=pA._sizeOfH3Index,c._sizeOfLatLng=pA._sizeOfLatLng,c._sizeOfLinkedGeoPolygon=pA._sizeOfLinkedGeoPolygon,c._uncompactCells=pA._uncompactCells,c._uncompactCellsSize=pA._uncompactCellsSize,c._vertexToLatLng=pA._vertexToLatLng,c.establishStackSpace=pA.establishStackSpace;var ut=c.stackAlloc=pA.stackAlloc,Pe=c.stackRestore=pA.stackRestore,o0=c.stackSave=pA.stackSave;if(c.asm=pA,c.cwrap=cA,c.setValue=$,c.getValue=V,Qe){Be(Qe)||(Qe=C(Qe));{nt();var qe=function(rA){rA.byteLength&&(rA=new Uint8Array(rA)),NA.set(rA,z),c.memoryInitializerRequest&&delete c.memoryInitializerRequest.response,kt()},vt=function(){T(Qe,qe,function(){throw"could not load memory initializer "+Qe})},Ct=c0(Qe);if(Ct)qe(Ct.buffer);else if(c.memoryInitializerRequest){var A0=function(){var rA=c.memoryInitializerRequest,gA=rA.response;if(rA.status!==200&&rA.status!==0){var RA=c0(c.memoryInitializerRequestURL);if(RA)gA=RA.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+rA.status+", retrying "+Qe),vt();return}}qe(gA)};c.memoryInitializerRequest.response?setTimeout(A0,0):c.memoryInitializerRequest.addEventListener("load",A0)}else vt()}}var bt;At=function rA(){bt||Pt(),bt||(At=rA)};function Pt(rA){if(Xe>0||(Le(),Xe>0))return;function gA(){bt||(bt=!0,!AA&&(se(),pe(),c.onRuntimeInitialized&&c.onRuntimeInitialized(),be()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),gA()},1)):gA()}c.run=Pt;function pt(rA){throw c.onAbort&&c.onAbort(rA),rA+="",Q(rA),D(rA),AA=!0,"abort("+rA+"). Build with -s ASSERTIONS=1 for more info."}if(c.abort=pt,c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return Pt(),u})(typeof Nt=="object"?Nt:{}),re="number",ee=re,Pr=re,le=re,ae=re,dt=re,PA=re,bf=[["sizeOfH3Index",re],["sizeOfLatLng",re],["sizeOfCellBoundary",re],["sizeOfGeoLoop",re],["sizeOfGeoPolygon",re],["sizeOfLinkedGeoPolygon",re],["sizeOfCoordIJ",re],["readInt64AsDoubleFromPointer",re],["isValidCell",Pr,[le,ae]],["isValidIndex",Pr,[le,ae]],["latLngToCell",ee,[re,re,dt,PA]],["cellToLatLng",ee,[le,ae,PA]],["cellToBoundary",ee,[le,ae,PA]],["maxGridDiskSize",ee,[re,PA]],["gridDisk",ee,[le,ae,re,PA]],["gridDiskDistances",ee,[le,ae,re,PA,PA]],["gridRing",ee,[le,ae,re,PA]],["gridRingUnsafe",ee,[le,ae,re,PA]],["maxPolygonToCellsSize",ee,[PA,dt,re,PA]],["polygonToCells",ee,[PA,dt,re,PA]],["maxPolygonToCellsSizeExperimental",ee,[PA,dt,re,PA]],["polygonToCellsExperimental",ee,[PA,dt,re,re,re,PA]],["cellsToLinkedMultiPolygon",ee,[PA,re,PA]],["destroyLinkedMultiPolygon",null,[PA]],["compactCells",ee,[PA,PA,re,re]],["uncompactCells",ee,[PA,re,re,PA,re,dt]],["uncompactCellsSize",ee,[PA,re,re,dt,PA]],["isPentagon",Pr,[le,ae]],["isResClassIII",Pr,[le,ae]],["getBaseCellNumber",re,[le,ae]],["getResolution",re,[le,ae]],["getIndexDigit",re,[le,ae,re]],["constructCell",ee,[re,re,PA,PA]],["maxFaceCount",ee,[le,ae,PA]],["getIcosahedronFaces",ee,[le,ae,PA]],["cellToParent",ee,[le,ae,dt,PA]],["cellToChildren",ee,[le,ae,dt,PA]],["cellToCenterChild",ee,[le,ae,dt,PA]],["cellToChildrenSize",ee,[le,ae,dt,PA]],["cellToChildPos",ee,[le,ae,dt,PA]],["childPosToCell",ee,[re,re,le,ae,dt,PA]],["areNeighborCells",ee,[le,ae,le,ae,PA]],["cellsToDirectedEdge",ee,[le,ae,le,ae,PA]],["getDirectedEdgeOrigin",ee,[le,ae,PA]],["getDirectedEdgeDestination",ee,[le,ae,PA]],["isValidDirectedEdge",Pr,[le,ae]],["directedEdgeToCells",ee,[le,ae,PA]],["originToDirectedEdges",ee,[le,ae,PA]],["directedEdgeToBoundary",ee,[le,ae,PA]],["gridDistance",ee,[le,ae,le,ae,PA]],["gridPathCells",ee,[le,ae,le,ae,PA]],["gridPathCellsSize",ee,[le,ae,le,ae,PA]],["cellToLocalIj",ee,[le,ae,le,ae,re,PA]],["localIjToCell",ee,[le,ae,PA,re,PA]],["getHexagonAreaAvgM2",ee,[dt,PA]],["getHexagonAreaAvgKm2",ee,[dt,PA]],["getHexagonEdgeLengthAvgM",ee,[dt,PA]],["getHexagonEdgeLengthAvgKm",ee,[dt,PA]],["greatCircleDistanceM",re,[PA,PA]],["greatCircleDistanceKm",re,[PA,PA]],["greatCircleDistanceRads",re,[PA,PA]],["cellAreaM2",ee,[le,ae,PA]],["cellAreaKm2",ee,[le,ae,PA]],["cellAreaRads2",ee,[le,ae,PA]],["edgeLengthM",ee,[le,ae,PA]],["edgeLengthKm",ee,[le,ae,PA]],["edgeLengthRads",ee,[le,ae,PA]],["getNumCells",ee,[dt,PA]],["getRes0Cells",ee,[PA]],["res0CellCount",re],["getPentagons",ee,[re,PA]],["pentagonCount",re],["cellToVertex",ee,[le,ae,re,PA]],["cellToVertexes",ee,[le,ae,PA]],["vertexToLatLng",ee,[le,ae,PA]],["isValidVertex",Pr,[le,ae]]],kf=0,Cf=1,Ef=2,Sf=3,Mf=4,Bf=5,Df=6,_f=7,Tf=8,jf=9,Rf=10,If=11,Lf=12,Nf=13,Ff=14,Pf=15,Qf=16,Of=17,zf=18,Hf=19,st={};st[kf]="Success";st[Cf]="The operation failed but a more specific error is not available";st[Ef]="Argument was outside of acceptable range";st[Sf]="Latitude or longitude arguments were outside of acceptable range";st[Mf]="Resolution argument was outside of acceptable range";st[Bf]="Cell argument was not valid";st[Df]="Directed edge argument was not valid";st[_f]="Undirected edge argument was not valid";st[Tf]="Vertex argument was not valid";st[jf]="Pentagon distortion was encountered";st[Rf]="Duplicate input";st[If]="Cell arguments were not neighbors";st[Lf]="Cell arguments had incompatible resolutions";st[Nf]="Memory allocation failed";st[Ff]="Bounds of provided memory were insufficient";st[Pf]="Mode or flags argument was not valid";st[Qf]="Index argument was not valid";st[Of]="Base cell number was outside of acceptable range";st[zf]="Child indexing digits invalid";st[Hf]="Child indexing digits refer to a deleted subsequence";var Gf=1e3,Uf=1001,Jo=1002,Yn={};Yn[Gf]="Unknown unit";Yn[Uf]="Array length out of bounds";Yn[Jo]="Got unexpected null value for H3 index";var Vf="Unknown error";function Al(u,c,g){var y=g&&"value"in g,x=new Error((u[c]||Vf)+" (code: "+c+(y?", value: "+g.value:"")+")");return x.code=c,x}function Wf(u,c){var g=arguments.length===2?{value:c}:{};return Al(st,u,g)}function Yf(u,c){var g=arguments.length===2?{value:c}:{};return Al(Yn,u,g)}function el(u){if(u!==0)throw Wf(u)}var b0={};bf.forEach(function(c){b0[c[0]]=Nt.cwrap.apply(Nt,c)});var Or=16,Zf=4,zn=8,Ms=b0.sizeOfH3Index(),$f=b0.sizeOfLatLng(),Kf=b0.sizeOfCellBoundary();b0.sizeOfGeoPolygon();b0.sizeOfGeoLoop();b0.sizeOfLinkedGeoPolygon();b0.sizeOfCoordIJ();function qf(u){if(!u)throw Yf(Jo);return u}var Xf=/[^0-9a-fA-F]/;function Jf(u){if(Array.isArray(u)&&u.length===2&&Number.isInteger(u[0])&&Number.isInteger(u[1]))return u;if(typeof u!="string"||Xf.test(u))return[0,0];var c=parseInt(u.substring(0,u.length-8),Or),g=parseInt(u.substring(u.length-8),Or);return[g,c]}function Ni(u){if(u>=0)return u.toString(Or);u=u&2147483647;var c=tl(8,u.toString(Or)),g=(parseInt(c[0],Or)+8).toString(Or);return c=g+c.substring(1),c}function A2(u,c){return Ni(c)+tl(8,Ni(u))}function tl(u,c){for(var g=u-c.length,y="",x=0;x.85?.9+(u-.85)/.15*.1:.1+(u-.15)/.7*.8}function sl(u,c,g,y){const x=g-c;if(x<.001)return Pi(y[12]);const C=Math.max(0,Math.min(1,(u-c)/x)),T=h2(C),Q=Math.min(23,Math.floor(T*24));return Pi(y[Q])}function d2(u){const c=new Map;for(const C of u){if(typeof C.lat!="number"||typeof C.lon!="number"||isNaN(C.lat)||isNaN(C.lon))continue;const T=n2(C.lat,C.lon,o2),Q=c.get(T),D=C.weight;Q?(Q.count++,Q.qualitySum+=D):c.set(T,{count:1,qualitySum:D})}const g=[];let y=1/0,x=-1/0;for(const[C,T]of c.entries()){const Q=T.qualitySum/T.count;g.push({hexId:C,count:T.count,avgQuality:Q}),y=Math.min(y,Q),x=Math.max(x,Q)}return{cells:g,minQuality:g.length>0?y:0,maxQuality:g.length>0?x:0}}function m2(u,c,g,y){const x=[];for(const C of u){const Q=rl(C.hexId).map(([E,L])=>[L,E]);Q.push(Q[0]);const D=sl(C.avgQuality,c,g,y);x.push({type:"Feature",properties:{color:D,quality:C.avgQuality,count:C.count},geometry:{type:"Polygon",coordinates:[Q]}})}return{type:"FeatureCollection",features:x}}async function p2(u,c,g,y,x){const C=[];let T=0;for(;T[$,z]);L.push(L[0]);const O=sl(D.avgQuality,c,g,y);C.push({type:"Feature",properties:{color:O,quality:D.avgQuality,count:D.count},geometry:{type:"Polygon",coordinates:[L]}})}TrequestAnimationFrame(D))}return{type:"FeatureCollection",features:C}}function g2(u,c){const[g,y]=j.useState(u);return j.useEffect(()=>{const x=setTimeout(()=>y(u),c);return()=>clearTimeout(x)},[u,c]),g}function y2({coveragePoints:u,visible:c,terrainEnabled:g=!1,brightness:y=l2,basemapMode:x="dark"}){const{current:C}=q0(),[T,Q]=j.useState(null);j.useEffect(()=>{const Y=()=>{var iA;const bA=(iA=C==null?void 0:C.getMap)==null?void 0:iA.call(C);bA&&!T&&Q(bA)};Y();const cA=setInterval(Y,50),lA=setTimeout(()=>clearInterval(cA),5e3);return()=>{clearInterval(cA),clearTimeout(lA)}},[C,T]);const[D,E]=j.useState(null),[L,O]=j.useState(!1),z=j.useRef({aborted:!1}),$=j.useRef(0),V=j.useRef(x),AA=g2(u,a2),oA=j.useMemo(()=>f2(x),[x]);j.useEffect(()=>{if(!AA||!Array.isArray(AA)||AA.length===0){queueMicrotask(()=>{E(null),$.current=0});return}const Y=V.current!==x;if(AA.length===$.current&&D&&!Y)return;$.current=AA.length,V.current=x,z.current.aborted=!0,z.current={aborted:!1};const cA=z.current;O(!0);const{cells:lA,minQuality:bA,maxQuality:iA}=d2(AA);if(lA.length===0){E(null),O(!1);return}if(lA.length{!cA.aborted&&fA&&E(fA)}).finally(()=>{cA.aborted||O(!1)}),()=>{cA.aborted=!0}},[AA,oA]),j.useEffect(()=>{if(!T)return;const Y=()=>{var cA,lA;try{const bA=T.getLayer(cr),iA=T.getSource(ur);if(c&&D&&D.features.length>0){if(iA?T.getSource(ur).setData(D):T.addSource(ur,{type:"geojson",data:D}),!bA){const fA=T.getLayer("topology-weak-edges-native"),DA=(lA=(cA=T.getStyle())==null?void 0:cA.layers)==null?void 0:lA.find(CA=>CA.type==="symbol"),TA=fA?"topology-weak-edges-native":DA==null?void 0:DA.id;T.addLayer({id:cr,type:"fill",source:ur,paint:{"fill-color":["get","color"],"fill-opacity":y}},TA)}}else bA&&T.removeLayer(cr),iA&&T.removeSource(ur)}catch(bA){console.warn("[WardrivingHexLayerMapLibre] Layer update error:",bA)}};T.isStyleLoaded()?Y():T.once("style.load",Y)},[T,c,D,g]),j.useEffect(()=>{if(!(!T||!c))try{T.getLayer(cr)&&T.setPaintProperty(cr,"fill-opacity",y)}catch{}},[T,y,c]),j.useEffect(()=>()=>{if(T)try{T.getLayer(cr)&&T.removeLayer(cr),T.getSource(ur)&&T.removeSource(ur)}catch{}},[T]);const eA=(D==null?void 0:D.features.length)??0;return eA>0&&c?m.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(u==null?void 0:u.length)||0,"data-cell-count":eA,"data-terrain-enabled":g,"data-is-processing":L,style:{display:"none"}}):null}const Qi="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Oi="terrarium",zi=256,Hi=14,on={shadowColor:"rgba(10, 10, 10, 0.6)",highlightColor:"rgba(245, 240, 230, 0.4)",accentColor:"rgba(90, 75, 65, 0.3)",illuminationDirection:315,exaggeration:.35},Y0="terrain-dem",Qr="hillshade-dem",Rn="terrain-hillshade";function x2({enabled:u,exaggeration:c=4}){const{current:g}=q0(),[y,x]=j.useState(null),C=j.useRef(null);return j.useEffect(()=>{const T=()=>{var L;const E=(L=g==null?void 0:g.getMap)==null?void 0:L.call(g);E&&!y&&x(E)};T();const Q=setInterval(T,50),D=setTimeout(()=>clearInterval(Q),5e3);return()=>{clearInterval(Q),clearTimeout(D)}},[g,y]),j.useEffect(()=>{if(!y)return;let T=!0;const Q=()=>{var D,E;if(T)try{if(y.getSource(Qr)||y.addSource(Qr,{type:"raster-dem",tiles:[Qi],encoding:Oi,tileSize:zi,maxzoom:Hi}),!y.getLayer(Rn)){const L=(E=(D=y.getStyle())==null?void 0:D.layers)==null?void 0:E.find(O=>O.type==="symbol");y.addLayer({id:Rn,type:"hillshade",source:Qr,paint:{"hillshade-shadow-color":on.shadowColor,"hillshade-highlight-color":on.highlightColor,"hillshade-accent-color":on.accentColor,"hillshade-illumination-direction":on.illuminationDirection,"hillshade-exaggeration":on.exaggeration}},L==null?void 0:L.id)}y.getSource(Y0)||y.addSource(Y0,{type:"raster-dem",tiles:[Qi],encoding:Oi,tileSize:zi,maxzoom:Hi})}catch(L){console.error("[TerrainLayer] Source/layer setup error:",L)}};return y.isStyleLoaded()?Q():(y.once("style.load",Q),y.once("load",()=>{T&&!y.getSource(Qr)&&Q()})),()=>{T=!1}},[y]),j.useEffect(()=>{if(!y)return;let T=!0,Q=!1;const D=()=>{if(!(!T||!y.getSource(Y0)))try{u?(y.setCenterClampedToGround(!1),y.setTerrain({source:Y0,exaggeration:c}),y.setMaxPitch(70),!Q&&y.getPitch()<30&&!y.isMoving()&&(Q=!0,C.current!==null&&clearTimeout(C.current),C.current=window.setTimeout(()=>{C.current=null,T&&!y.isMoving()&&y.getPitch()<30&&y.easeTo({pitch:45,duration:1e3})},200))):(y.setTerrain(null),y.setCenterClampedToGround(!0),y.getPitch()>0&&!y.isMoving()&&y.easeTo({pitch:0,duration:800}),y.setMaxPitch(60))}catch(E){console.error("[TerrainLayer] Terrain state error:",E)}};if(y.isStyleLoaded()&&y.getSource(Y0))D();else{const E=()=>{y.getSource(Y0)&&D()};y.once("idle",E)}return()=>{T=!1,C.current!==null&&(clearTimeout(C.current),C.current=null)}},[y,u,c]),j.useEffect(()=>()=>{var T;try{(T=y==null?void 0:y.getStyle)!=null&&T.call(y)&&y.isStyleLoaded()&&(y.setTerrain(null),y.getLayer(Rn)&&y.removeLayer(Rn),y.getSource(Qr)&&y.removeSource(Qr),y.getSource(Y0)&&y.removeSource(Y0))}catch{}},[y]),null}const w2=.03,v2=.1,b2=2,k2=3,C2=.02,E2=3;function S2(u,c=E2){if(u.length<3||c<=0)return u;let g=u;for(let y=0;y0&&x.push([x[0][0],x[0][1]]),g=x}return g}function M2(u,c){let g=1/0,y=-1/0,x=1/0,C=-1/0;for(const[T,Q]of u)Ty&&(y=T),QC&&(C=Q);return g-=c,y+=c,x-=c,C+=c,{minX:g,minY:x,maxX:y,maxY:C,width:y-g,height:C-x}}function B2(u,c={}){if(u.length(eA-C.minX)/C.width*L,$=eA=>(eA-C.minY)/C.height*O,V=eA=>eA/L*C.width+C.minX,AA=eA=>eA/O*C.height+C.minY,oA=g/C.width*L;try{const Y=rc().x(TA=>z(TA[0])).y(TA=>$(TA[1])).size([L,O]).bandwidth(Math.max(5,oA)).cellSize(x)(u);if(Y.length===0)return{coordinates:[],valid:!1};const lA=Math.max(...Y.map(TA=>TA.value))*y;let bA=Y[0],iA=1/0;for(const TA of Y){const CA=Math.abs(TA.value-lA);CA0){const NA=IA[0],FA=IA[IA.length-1];(NA[0]!==FA[0]||NA[1]!==FA[1])&&IA.push([NA[0],NA[1]])}if(IA.length>=4){const NA=S2(IA);CA.push(NA)}}CA.length>0&&fA.push(CA)}const DA=[];for(const TA of fA)for(const CA of TA)DA.push(CA);return{coordinates:fA,valid:fA.length>0}}catch(eA){return console.warn("[KDE Contour] Failed to generate contour:",eA),{coordinates:[],valid:!1}}}function D2(u,c={}){const g=B2(u,c);return!g.valid||g.coordinates.length===0?null:g.coordinates.length===1?{type:"Polygon",coordinates:g.coordinates[0]}:{type:"MultiPolygon",coordinates:g.coordinates}}const _2="mincut-partition",T2="mincut-partition-fill",j2="mincut-partition-stroke",R2=3,I2=.05,L2=.15,N2=.008,Gi=12;function Ui(u,c,g){return(c[0]-u[0])*(g[1]-u[1])-(c[1]-u[1])*(g[0]-u[0])}function F2(u){if(u.length<3)return u;const c=[...u].sort((x,C)=>x[0]-C[0]||x[1]-C[1]),g=[];for(const x of c){for(;g.length>=2&&Ui(g[g.length-2],g[g.length-1],x)<=0;)g.pop();g.push(x)}const y=[];for(let x=c.length-1;x>=0;x--){const C=c[x];for(;y.length>=2&&Ui(y[y.length-2],y[y.length-1],C)<=0;)y.pop();y.push(C)}return g.pop(),y.pop(),g.concat(y)}function P2(u,c){if(u.length<3)return u;let g=0,y=0;for(const[x,C]of u)g+=x,y+=C;return g/=u.length,y/=u.length,u.map(([x,C])=>{const T=x-g,Q=C-y,D=Math.sqrt(T*T+Q*Q);if(D<1e-4)return[x,C];const E=(D+c)/D;return[g+T*E,y+Q*E]})}function Q2(u,c,g,y,x){const C=x*x,T=C*x;return[.5*(2*c[0]+(-u[0]+g[0])*x+(2*u[0]-5*c[0]+4*g[0]-y[0])*C+(-u[0]+3*c[0]-3*g[0]+y[0])*T),.5*(2*c[1]+(-u[1]+g[1])*x+(2*u[1]-5*c[1]+4*g[1]-y[1])*C+(-u[1]+3*c[1]-3*g[1]+y[1])*T)]}function O2(u){if(u.length<3)return u;const c=[],g=u.length;for(let y=0;yu?H2(u,c,x,C):{type:"FeatureCollection",features:[]},[u,c,x,C]),D=g?y:0,E={"fill-color":["get","color"],"fill-opacity":D},L={"line-color":["get","borderColor"],"line-width":T,"line-opacity":D};return m.jsxs(I0,{id:_2,type:"geojson",data:Q,children:[m.jsx(Kt,{id:T2,type:"fill",paint:E}),m.jsx(Kt,{id:j2,type:"line",paint:L})]})}function U2(u,c=!1,g=!1,y=!1,x=.7,C){const T=mo(C);return y?x>=.75?T.restBright:T.rest:x>=.85?T.rest:(x>=.7,T.restDim)}function Vi(u){return[u[1],u[0]]}function V2(u,c,g,y=12){const[x,C]=u,[T,Q]=c,D=[];for(let E=0;E<=y;E++){const L=E/y,O=C+(Q-C)*L,z=x+(T-x)*L,$=4*g*L*(1-L);D.push([O,z,$])}return D}function Wi(u,c,g,y,x,C,T,Q,D,E,L,O="dark"){const z=Fs(),$=[];let V=1/0,AA=-1/0;const oA=[];for(const Y of u){const cA=Y.edge.avgConfidence??(c?.7:.5),lA=Y.edge.certainCount/Math.max(T,1),bA=cA*.7+lA*.3+(c?.5:0);oA.push({polyline:Y,brightnessScore:bA}),V=Math.min(V,bA),AA=Math.max(AA,bA)}if(oA.length===0)return{type:"FeatureCollection",features:[]};const eA=AA-V||1;oA.sort((Y,cA)=>Y.brightnessScore-cA.brightnessScore);for(const{polyline:Y,brightnessScore:cA}of oA){const{from:lA,to:bA,edge:iA}=Y,fA=g.get(iA.key)??0;if(fA<=0)continue;const DA=Q.has(iA.key),TA=D.has(iA.key),CA=iA.avgConfidence??(c?.7:.5),mA=E===iA.key,IA=L[iA.fromHash],NA=L[iA.toHash],FA=(IA==null?void 0:IA.node_name)||(IA==null?void 0:IA.name)||iA.fromHash.slice(0,8),GA=(NA==null?void 0:NA.node_name)||(NA==null?void 0:NA.name)||iA.toHash.slice(0,8),vA=[lA[0]+(bA[0]-lA[0])*fA,lA[1]+(bA[1]-lA[1])*fA];let uA;if(!c)uA=1.5;else{const ue=C.get(iA.key)??bs(iA.certainCount),XA=x.get(iA.key)??ue;uA=XA+(ue-XA)*y,mA?uA=Math.max(uA*1.6,4.5):TA&&(uA=uA*1.3)}let hA;mA?hA=z.edges.highlight:hA=U2(!1,iA.isDirectPathEdge??!1,DA,TA,CA,O);let jA;mA?jA=z.edges.highlight:iA.isDirectPathEdge?jA=z.edges.hoverDirect:DA?jA=z.edges.hoverLoop:jA=z.edges.hoverStandard;let MA;if(!c)MA=(.3+CA*.3)*fA;else{const ue=Math.min(fA*1.5,1)*z.edgeOpacity;MA=TA?ue*1.15:ue}mA&&(MA=.95);const VA=(cA-V)/eA;$.push({type:"Feature",properties:{key:iA.key,baseColor:hA,hoverColor:jA,baseWidth:uA,baseOpacity:MA,brightnessScore:VA,isLoopEdge:DA,isBackbone:TA,isDirectPath:iA.isDirectPathEdge??!1,isHubConnection:iA.isHubConnection??!1,isZeroHop:iA.isZeroHop??!1,isValidated:c,certainCount:iA.certainCount,confidence:CA,symmetryRatio:iA.symmetryRatio??1,dominantDirection:iA.dominantDirection??"balanced",fromName:FA,toName:GA,fromHash:iA.fromHash,toHash:iA.toHash},geometry:{type:"LineString",coordinates:[Vi(lA),Vi(vA)]}})}return{type:"FeatureCollection",features:$}}const W2=150,Y2=8;function Yi(u,c){const g=Fs(),y=[];let x=0;for(const C of u){const T=c.get(C.hash);T&&T.blendedScore>x&&(x=T.blendedScore)}for(const C of u){const{from:T,to:Q,hash:D,neighbor:E,lastHopData:L}=C,O=`neighbor-${D}`,z=(L==null?void 0:L.avgRssi)??E.rssi??null,$=(L==null?void 0:L.avgSnr)??E.snr??null,V=(L==null?void 0:L.count)??0,AA=(L==null?void 0:L.confidence)??1,oA=c.get(D),eA=(oA==null?void 0:oA.listenerScore)??0,Y=(oA==null?void 0:oA.loudScore)??0,cA=(oA==null?void 0:oA.blendedScore)??0,lA=x>0?cA/x:0,bA=C.rxAdvertCount??0,iA=C.txProxyCount??0,fA=bA+iA,DA=fA>0?(iA-bA)/fA:0,TA=V2(T,Q,W2,Y2);y.push({type:"Feature",properties:{key:O,hash:D,name:E.node_name||E.name||D.slice(0,8),prefix:D.slice(2,4).toUpperCase(),color:g.neighborColor,width:2.5,opacity:.85,rssi:z,snr:$,packetCount:V,confidence:AA,hasAvgRssi:(L==null?void 0:L.avgRssi)!==void 0,hasAvgSnr:(L==null?void 0:L.avgSnr)!==void 0,isNeighborEdge:!0,listenerScore:eA,loudScore:Y,blendedScore:cA,trafficWeight:lA,linkAsymmetry:DA,rxAdvertCount:bA,txProxyCount:iA},geometry:{type:"LineString",coordinates:TA}})}return{type:"FeatureCollection",features:y}}function Z2({map:u,showTopology:c,validatedPolylines:g,weakPolylines:y,maxCertainCount:x,loopEdgeKeys:C,backboneEdgeKeys:T,highlightedEdgeKey:Q,neighbors:D,validatedSourceId:E,weakSourceId:L,neighborPolylines:O=[],showNeighborLines:z=!0,neighborSourceId:$,neighborLinkScores:V=new Map,basemapMode:AA}){const oA=j.useRef(null);j.useEffect(()=>{const se=u&&"current"in u?u.current:u;oA.current=se});const eA=j.useRef(new Map),Y=j.useRef(1),cA=j.useRef(new Map),lA=j.useRef(new Map),bA=j.useRef(!1),iA=j.useRef(null),fA=j.useRef(c),DA=j.useRef(new Set),TA=j.useRef(""),CA=j.useRef(new Map),mA=j.useRef(""),IA=j.useRef(""),NA=j.useRef(""),FA=j.useRef(g),GA=j.useRef(y),vA=j.useRef(x),uA=j.useRef(C),hA=j.useRef(T),jA=j.useRef(Q),MA=j.useRef(D),VA=j.useRef(O),ue=j.useRef(z),XA=j.useRef(V),ZA=j.useRef(AA);j.useEffect(()=>{FA.current=g,GA.current=y,vA.current=x,uA.current=C,hA.current=T,jA.current=Q,MA.current=D,VA.current=O,ue.current=z,XA.current=V,ZA.current=AA},[g,y,x,C,T,Q,D,O,z,V,AA]);const UA=j.useCallback((se=!1)=>{var Ee,Me,ye,Ke,Xe,At,nt,kt,Qe,Je;const pe=oA.current;if(!pe)return;const be=pe.getSource(E),$e=pe.getSource(L),Ce=pe.getSource($);if(be){const Be=Wi(FA.current,!0,eA.current,Y.current,cA.current,lA.current,vA.current,uA.current,hA.current,jA.current,MA.current,ZA.current),Ge=`${Be.features.length}:${((Me=(Ee=Be.features[0])==null?void 0:Ee.properties)==null?void 0:Me.key)??""}:${((Ke=(ye=Be.features[Be.features.length-1])==null?void 0:ye.properties)==null?void 0:Ke.key)??""}:${Array.from(eA.current.values()).reduce((ot,Ft)=>ot+Ft,0).toFixed(2)}`;(se||Ge!==mA.current)&&(be.setData(Be),mA.current=Ge)}if($e){const Be=Wi(GA.current,!1,eA.current,Y.current,cA.current,lA.current,vA.current,uA.current,hA.current,jA.current,MA.current,ZA.current),Ge=`${Be.features.length}:${((At=(Xe=Be.features[0])==null?void 0:Xe.properties)==null?void 0:At.key)??""}:${((kt=(nt=Be.features[Be.features.length-1])==null?void 0:nt.properties)==null?void 0:kt.key)??""}`;(se||Ge!==IA.current)&&($e.setData(Be),IA.current=Ge)}if(Ce&&VA.current.length>0){const Be=Yi(VA.current,XA.current),Ge=`${Be.features.length}:${((Je=(Qe=Be.features[0])==null?void 0:Qe.properties)==null?void 0:Je.hash)??""}`;(se||Ge!==NA.current)&&(Ce.setData(Be),NA.current=Ge)}},[E,L,$]),Ie=j.useCallback(()=>{iA.current&&(cancelAnimationFrame(iA.current),iA.current=null),eA.current=new Map,Y.current=1,cA.current=new Map,lA.current=new Map,bA.current=!1,DA.current=new Set,TA.current="",CA.current=new Map},[]);j.useEffect(()=>{const se=fA.current,pe=c;if(fA.current=c,!!oA.current){if(iA.current&&(cancelAnimationFrame(iA.current),iA.current=null),se&&!pe&&!bA.current){bA.current=!0;const $e=new Map(eA.current);let Ce=null;const Ee=Me=>{Ce||(Ce=Me);const ye=Me-Ce,Ke=Math.min(ye/ac,1),Xe=No(Ke);for(const[At,nt]of $e)eA.current.set(At,nt*(1-Xe));UA(!0),Ke<1?iA.current=requestAnimationFrame(Ee):(bA.current=!1,eA.current=new Map,DA.current=new Set,TA.current="",cA.current=new Map,lA.current=new Map,iA.current=null,UA(!0))};iA.current=requestAnimationFrame(Ee)}!se&&pe&&(eA.current=new Map,DA.current=new Set,TA.current="")}},[c,UA]),j.useEffect(()=>{const se=oA.current;if(!c||bA.current||!se)return;const pe=[...g,...y],be=pe.map(ye=>`${ye.edge.key}:${ye.edge.certainCount}`).sort().join(","),$e=DA.current.size===0,Ce=TA.current!==""&&TA.current!==be;if(!$e&&!Ce){UA();return}const Ee=[],Me=[];for(const{edge:ye}of pe)DA.current.has(ye.key)?Me.push(ye.key):Ee.push(ye.key);Ce&&Me.length>0&&(cA.current=new Map(CA.current),Y.current=0),lA.current=new Map;for(const{edge:ye}of g){const Ke=bs(ye.certainCount);lA.current.set(ye.key,Ke)}for(const ye of Ee)eA.current.set(ye,0);for(const ye of Me)eA.current.has(ye)||eA.current.set(ye,1);if(Ee.length>0||Ce&&Me.length>0){iA.current&&(cancelAnimationFrame(iA.current),iA.current=null);let ye=null;const Ke=Math.min(100,Sn/Math.max(Ee.length,1)/2),Xe=At=>{ye||(ye=At);const nt=At-ye;for(let Qe=0;Qe0){const Qe=Math.min(nt/Sn,1);Y.current=ws(Qe)}UA(!0);const kt=Sn+(Ee.length-1)*Ke;nt{const se=oA.current;if(!se||!$)return;const pe=()=>{const Ce=se.getSource($);if(!Ce)return!1;if(O.length>0){const Ee=Yi(O,V);Ce.setData(Ee)}else Ce.setData({type:"FeatureCollection",features:[]});return!0};if(pe())return;const be=Ce=>{Ce.sourceId===$&&pe()&&se.off("sourcedata",be)};se.on("sourcedata",be);const $e=()=>{pe()&&(se.off("styledata",$e),se.off("sourcedata",be))};return se.on("styledata",$e),()=>{se.off("sourcedata",be),se.off("styledata",$e)}},[$,O,V]);const Le=j.useRef(AA);return j.useEffect(()=>{AA!==Le.current&&(Le.current=AA,mA.current="",IA.current="",NA.current="",UA(!0))},[AA,UA]),j.useEffect(()=>()=>{iA.current&&(cancelAnimationFrame(iA.current),iA.current=null)},[]),{isExiting:bA.current,isAnimating:iA.current!==null,resetAnimationState:Ie,weightAnimProgress:Y.current,animStartWeights:cA.current,animTargetWeights:lA.current}}function $2({activeFilters:u,neighborHashes:c,hubConnectedNodes:g,directNodeSet:y,localConnectedNodes:x,nodeTypeMap:C,showTopology:T}){const[Q,D]=j.useState(new Map),E=j.useMemo(()=>[...u].sort().join(","),[u]),L=j.useRef(E),O=j.useRef(!1),z=j.useRef(new Map),$=j.useRef(null),V=j.useRef(g),AA=j.useRef(y),oA=j.useRef(x),eA=j.useRef(C),Y=j.useRef(T);return j.useEffect(()=>{V.current=g,AA.current=y,oA.current=x,eA.current=C,Y.current=T},[g,y,x,C,T]),j.useEffect(()=>{const lA=L.current,bA=E;if(L.current=E,lA===bA)return;$.current&&(cancelAnimationFrame($.current),$.current=null);const iA=new Set(lA?lA.split(",").filter(Boolean):[]),fA=u,DA=V.current,TA=AA.current,CA=eA.current;for(const vA of c)z.current.has(vA)||z.current.set(vA,Math.random());const mA=(vA,uA)=>{if(uA.size===0)return!1;const hA=CA.get(vA)??"unknown";return!!(uA.has("repeater")&&hA==="repeater"||uA.has("companion")&&(hA==="companion"||hA==="unknown")||uA.has("room_server")&&hA==="room_server"||uA.has("direct")&&TA.has(vA)||uA.has("hubs")&&DA.has(vA))},IA=[];for(const vA of c){const uA=mA(vA,iA),hA=mA(vA,fA);uA!==hA&&IA.push({hash:vA,startOpacity:uA?1:0,targetOpacity:hA?1:0})}if(IA.length===0)return;O.current=!0,D(vA=>{const uA=new Map(vA);for(const{hash:hA,startOpacity:jA}of IA)uA.set(hA,jA);return uA});const NA=IA;let FA=null;const GA=vA=>{FA||(FA=vA);const uA=vA-FA;let hA=!0;D(()=>{const MA=new Map;for(const{hash:VA,startOpacity:ue,targetOpacity:XA}of NA){const ZA=(z.current.get(VA)??0)*wi,UA=Math.max(0,uA-ZA),Ie=Math.min(UA/xi,1),Le=ws(Ie),se=ue+(XA-ue)*Le;MA.set(VA,se),Ie<1&&(hA=!1)}return MA});const jA=xi+wi;uA{$.current&&(cancelAnimationFrame($.current),$.current=null),O.current=!1}},[E,u,c]),{nodeOpacities:Q,getNodeOpacity:(lA,bA)=>O.current&&Q.has(lA)?Q.get(lA):bA?1:0}}const ms=240,Zi=240;function K2(u,c){if(u{T.current=C},[C]);const Q=j.useRef(0),D=j.useRef(null),E=j.useRef(new Map),L=j.useRef(new Map);j.useEffect(()=>{L.current=q2(u)},[u]);const O=j.useRef(null);return j.useEffect(()=>{const z=()=>{const $=performance.now(),V=E.current;if(V.size===0){D.current=null,x(new Map);return}const AA=new Map,oA=[];for(const[eA,{startTime:Y,staggerDelay:cA}]of V){const lA=$-Y-cA;if(!(lA<0))if(lA>=Mn)oA.push(eA);else{const bA=K2(lA,Mn);bA>0&&AA.set(eA,bA)}}for(const eA of oA)V.delete(eA);x(AA),V.size>0&&O.current?D.current=requestAnimationFrame(O.current):D.current=null};O.current=z},[]),j.useEffect(()=>{if(!g)return;const z=T.current;if(z.length===0)return;const $=Q.current,V=z.filter(Y=>(Y.timestamp??0)>$);if($===0){const Y=z.reduce((cA,lA)=>Math.max(cA,lA.timestamp??0),0);Q.current=Y;return}if(V.length===0)return;const AA=V.reduce((Y,cA)=>Math.max(Y,cA.timestamp??0),0);Q.current=AA;const oA=performance.now();let eA=0;for(const Y of V){const cA=So(Y,c);if(!cA||cA.original.length===0)continue;const lA=X2(cA.original,L.current,c);if(lA.length===0)continue;const bA=Mn*.5;for(let iA=0;iA()=>{D.current!==null&&(cancelAnimationFrame(D.current),D.current=null)},[]),{blinkingNodes:y,blinkColor:lc}}const Z0="edge-blink-source",mr="edge-blink-layer",Bs=1e3,Ds=1e3,ps=150,A1=175,e1=3e4,t1=s0.teal,r1="#8B7BAD",n1=2.5,s1=1.875,i1=.5,Hn="node-markers-layer";function o1(u){if(!u.getLayer(mr))return;const c=u.getLayer(Hn)?Hn:void 0;try{u.moveLayer(mr,c)}catch{}}function l1(u,c){const g=new Map;for(const y of Object.keys(u)){const x=pr(y);g.has(x)||g.set(x,y)}if(c){const y=pr(c);g.set(y,c)}return g}function a1(u){return u<0||u>=Bs?0:1-u/Bs}function u1(u){if(u<0||u>=Ds)return 0;const c=u/Ds;return Math.pow(1-c,3)}function In(u){return[u[1],u[0]]}function c1({map:u,nodeCoordinates:c,packets:g,localHash:y,neighbors:x,meshTopology:C,enabled:T=!0}){const Q=j.useRef(null),D=u&&"current"in u?u.current:u;j.useEffect(()=>{Q.current=D},[D]);const E=j.useRef(!1),L=j.useRef(null),O=j.useRef([]),z=j.useRef(0),$=j.useRef(!1),[V,AA]=j.useState(!1),oA=j.useRef(null),eA=j.useRef([]),Y=j.useRef(new Map),cA=j.useRef(c);j.useEffect(()=>{cA.current=c},[c]),j.useEffect(()=>{Y.current=l1(x,y)},[x,y]),j.useEffect(()=>{if(!T){oA.current&&(clearTimeout(oA.current),oA.current=null),eA.current=[],L.current!==null&&(cancelAnimationFrame(L.current),L.current=null),O.current=[];const fA=Q.current;if(fA&&E.current){const DA=fA.getSource(Z0);DA&&DA.setData({type:"FeatureCollection",features:[]})}$.current=!1,z.current=0}},[T]),j.useEffect(()=>{const fA=D;if(!fA)return;let DA=null,TA=!1;const CA=()=>{if(!TA&&!E.current)try{fA.getLayer(mr)&&fA.removeLayer(mr),fA.getSource(Z0)&&fA.removeSource(Z0),fA.addSource(Z0,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const mA=fA.getLayer(Hn)?Hn:void 0;fA.addLayer({id:mr,type:"line",source:Z0,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],r1,t1],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],s1,n1],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},mA),E.current=!0,AA(!0),DA&&(clearInterval(DA),DA=null)}catch{}};return fA.isStyleLoaded()&&CA(),fA.once("style.load",()=>{CA()}),E.current||(DA=setInterval(()=>{if(E.current){DA&&clearInterval(DA);return}CA()},100),setTimeout(()=>{DA&&(clearInterval(DA),DA=null)},5e3)),()=>{TA=!0,DA&&clearInterval(DA),L.current!==null&&(cancelAnimationFrame(L.current),L.current=null);const mA=Q.current;if(mA&&E.current){try{mA.getLayer(mr)&&mA.removeLayer(mr),mA.getSource(Z0)&&mA.removeSource(Z0)}catch{}E.current=!1,AA(!1)}}},[D]);const lA=j.useRef(()=>{});j.useEffect(()=>{lA.current=()=>{const fA=Q.current;if(!fA)return;const DA=fA.getSource(Z0);if(!DA)return;const TA=performance.now(),CA=O.current,mA=[],IA=[];for(const NA of CA){const FA=TA-NA.startTime-NA.delay,GA=NA.isSpeculative?Ds:Bs;if(FA0&&mA.push({type:"Feature",properties:{intensity:vA,opacityMult:NA.isSpeculative?i1:1,isSpeculative:NA.isSpeculative??!1},geometry:{type:"LineString",coordinates:[NA.fromCoord,NA.toCoord]}})}}DA.setData({type:"FeatureCollection",features:mA}),O.current=IA,IA.length>0?L.current=requestAnimationFrame(()=>lA.current()):L.current=null}},[]);const bA=j.useCallback(()=>{const fA=Q.current;fA&&o1(fA),L.current===null&&(L.current=requestAnimationFrame(()=>lA.current()))},[]),iA=j.useCallback(()=>{if(!Q.current||!E.current)return;const DA=eA.current;if(eA.current=[],oA.current=null,DA.length===0)return;const TA=Y.current,CA=cA.current;if(TA.size===0)return;const mA=performance.now();let IA=0,NA=!1;const FA=new Set;for(const GA of DA){const vA=So(GA,y);if(!vA||vA.original.length<2)continue;const uA=vA.original;let hA=0,jA=null;for(let XA=0;XA0){XA.sort((Le,se)=>se.confidence-Le.confidence);const ZA=Math.max(1,Math.ceil(XA.length*.25)),UA=XA.slice(0,ZA),Ie=IA+hA*ps;for(const{edgeKey:Le,otherHash:se}of UA){const pe=CA.get(jA),be=CA.get(se);O.current.push({edgeKey:Le,fromCoord:In(pe),toCoord:In(be),startTime:mA,delay:Ie,isSpeculative:!0}),FA.add(Le),NA=!0}}}hA>0&&(IA+=hA*ps*.5)}NA&&bA()},[y,C,bA]);j.useEffect(()=>{const fA=Q.current;if(!T||!fA||!V||g.length===0)return;const DA=Date.now(),TA=z.current;if(!$.current){$.current=!0;const IA=(DA-e1)/1e3,NA=g.filter(GA=>(GA.timestamp??0)>=IA);let FA=0;for(const GA of g){const vA=GA.timestamp??0;vA>FA&&(FA=vA)}if(z.current=FA,NA.length>0){NA.sort((vA,uA)=>(vA.timestamp??0)-(uA.timestamp??0));const GA=NA.slice(-20);eA.current.push(...GA),iA()}return}const CA=g.filter(IA=>(IA.timestamp??0)>TA);if(CA.length===0)return;let mA=0;for(const IA of CA){const NA=IA.timestamp??0;NA>mA&&(mA=NA)}z.current=mA,eA.current.push(...CA),oA.current&&clearTimeout(oA.current),oA.current=setTimeout(iA,A1)},[T,g,iA,V]),j.useEffect(()=>()=>{oA.current&&clearTimeout(oA.current)},[])}var $0={},fr={};/** + * @license React + * react-dom-server-legacy.browser.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $i;function f1(){if($i)return fr;$i=1;var u=Mo();function c(h){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+h,_=1;_