From ebbd079b603371f5f10f535cc9ae418550d59595 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Sun, 15 Mar 2026 08:38:34 +0000 Subject: [PATCH] Sync build v0.9.310 Automated sync from private repository. Commit: 17b0ed78b1022c6c68c318817550201f2e23f5fb --- frontend/dist/VERSION | 2 +- ...jKV.js => AnalyzerFilterPanel-BjXbv0-E.js} | 2 +- ...4jL.js => AutoConfigureDialog-LhNiSavq.js} | 2 +- ...r-Bv4kYAcR.js => BasemapLayer-B81nTsqc.js} | 2 +- ...ble-DL8lfbnv.js => ChatBubble-CFCWQdGy.js} | 2 +- ....js => CollisionExplorerModal-CDRCTbR-.js} | 2 +- frontend/dist/assets/Companion-CSLLhavp.js | 72 --------- frontend/dist/assets/Companion-qTbNLFUD.js | 72 +++++++++ ...An2gmm.js => CompanionEchoMap-Cmhesaku.js} | 2 +- ...FruuYA.js => CompanionPathMap-DmNbWPuj.js} | 2 +- ...-C6MYk4Vr.js => Configuration-Dg0qrWk7.js} | 2 +- ...l-CtS0orbM.js => ConfirmModal-CH_Er4VJ.js} | 2 +- ...tacts-CkDqsspC.js => Contacts-BgYz8bSj.js} | 6 +- ...ydk.js => ContactsMapMapLibre-DTQ4poRm.js} | 2 +- ...oard-CDloj9Ii.js => Dashboard-B_DHVbWG.js} | 6 +- ...alue-Cj0a0QCM.js => DataValue-CdynXJno.js} | 2 +- .../{Grid-BhoD4aLU.js => Grid-DeJEUuBo.js} | 2 +- ...n-BjL5Ht30.js => KeycapButton-DFXxSuaV.js} | 2 +- ...DC33xzFq.js => LightSparkline-Bfgi1R3B.js} | 2 +- .../{Login-CzKupPAb.js => Login-3t0ZYqhq.js} | 2 +- .../{Logs-DxRQJIYV.js => Logs-BOXDno8q.js} | 2 +- ...raph-DWjajU3T.js => MeshGraph-P8jwne_q.js} | 6 +- .../{Mqtt-DoM7Zof1.js => Mqtt-DR3VniFT.js} | 2 +- ...-Dhi11STL.js => MqttModeBadge-BFJmiZy5.js} | 2 +- ...ist-CbchJDnI.js => PacketList-Dq4ygXCy.js} | 6 +- ...j8V1_.js => PacketObservatory-BrZhT-1E.js} | 4 +- ...ackets-BMtxtCyl.js => Packets-BJYka-4Q.js} | 2 +- ...out-B4RCJ-XT.js => PageLayout-DJSWC4zL.js} | 2 +- ...sgVWepx.js => PathMapMapLibre-DM7wheVG.js} | 2 +- ...ver-DiCPtnmR.js => RoomServer-CzNntLvv.js} | 2 +- ...sions-CqZugS72.js => Sessions-BgoBMfDO.js} | 2 +- ...8uG_rJC.js => SignalIndicator-BpXSkqBv.js} | 2 +- ...ics-xvNcJQ3I.js => Statistics-CDDutBX6.js} | 2 +- ...{System-Cocq8BLz.js => System-2yGnS_a1.js} | 2 +- ...minal-aB_59Bcc.js => Terminal-CBFaPt_l.js} | 8 +- .../{Test-COE9gN1S.js => Test-O-okW-Fy.js} | 2 +- ...ivity-DQoaymFw.js => activity-ZoAXCcWm.js} | 2 +- ...ntenna-C7FNplvf.js => antenna-CnCmnu-_.js} | 2 +- ...own-SlBTV0Nc.js => arrow-down-BuVueZSW.js} | 2 +- ...ht-BZS-u7CW.js => arrow-right-9ryFJ0vV.js} | 2 +- ...ow-up-D_sZeyuo.js => arrow-up-Cd56Jeq2.js} | 2 +- .../{car-aFMoKQAR.js => car-CMkH36na.js} | 2 +- ...ils-BdAUDg3r.js => chat-utils-BLzyljgm.js} | 2 +- ...ck-AfNqagLY.js => check-check-CL5EVU8z.js} | 2 +- ...-DsOuIRi8.js => chevron-right-BCotFXkU.js} | 2 +- ...-up-BVzq549_.js => chevron-up-Tfuf4unO.js} | 2 +- ...t-PnLnz8pa.js => circle-alert-NywFrEoZ.js} | 2 +- ...b9.js => circle-question-mark-z2YWN8ID.js} | 2 +- ...op--JH-Omkf.js => circle-stop-DyVWFFOh.js} | 2 +- .../{clock-F-4SScS_.js => clock-jH_gnOTU.js} | 2 +- ...ompass-0fhguiKE.js => compass-Ddh177-W.js} | 2 +- ...LywpC.js => consumer-registry-ssgJoJPf.js} | 2 +- .../{cpu-BxgsQ0OY.js => cpu-6yAZtSYM.js} | 2 +- ...abase-gsjgeKE3.js => database-n5nNHRzj.js} | 2 +- ...{easing-BdzuOPcT.js => easing-Cg6LL_7U.js} | 2 +- ...3SL-GU.js => element-movement-22ZdBM88.js} | 2 +- ...ldset-DCj-Bavz.js => fieldset-D4C8gyQW.js} | 2 +- ...{frozen-D4mEoVft.js => frozen-ZI0va0FF.js} | 2 +- ...{funnel-CitfWrkD.js => funnel-Bd2d2Gy-.js} | 2 +- ...nch-DrsZ9sUq.js => git-branch-DpI9mavY.js} | 2 +- .../{hash-CyK-Kad6.js => hash-vaiKl847.js} | 2 +- .../{index-i0xzpXop.js => index-CN4vD05c.js} | 152 +++++++++--------- .../{index-CBEGRHd5.js => index-CnWrze_V.js} | 2 +- .../{index-BCuGA4PV.js => index-G-dTy9iF.js} | 2 +- ...ound-BpDWKeL5.js => key-round-CiTX8EjL.js} | 2 +- ...{layers-LQ5jNXOV.js => layers-DwnLNHzI.js} | 2 +- ...g-BqsMOwtz.js => link-scoring--28z7vGg.js} | 2 +- ...istbox-C1gGOelh.js => listbox-Cfex3RUz.js} | 2 +- ...ap-pin-C051lstq.js => map-pin-W8m2dIyd.js} | 2 +- ...ff-CPSqCYZk.js => map-pin-off-VHAD8rJE.js} | 2 +- ...gl-BcToCqGO.js => maplibre-gl-CO2RVU0i.js} | 2 +- ...gl-B20pCOz8.js => maplibre-gl-CRRd6W2P.js} | 4 +- .../{max-C_kLXH5u.js => max-BbWCrv_A.js} | 2 +- ...BzLgyIjH.js => message-square-EOpOlt3H.js} | 2 +- ...Hv3.js => message-square-text-CjTpe3p8.js} | 2 +- ...etwork-CeKhSsIh.js => network-DgftOg20.js} | 2 +- ...pes-rVJPSDxd.js => node-types-UozthSpR.js} | 2 +- ...Bh2WvEK0.js => payload-detail-DXAypO28.js} | 2 +- ...{pencil-8q_J08l4.js => pencil-BEPIyoAD.js} | 2 +- .../{plus-Bb8eT78f.js => plus-3025QRmd.js} | 2 +- ...ves-QKpQyH4U.js => primitives-DS3PJRi6.js} | 2 +- ...{repeat-BSIxXQ81.js => repeat-CTlAf3ox.js} | 2 +- ...ccw-DqV8JyUZ.js => rotate-ccw-D-KWB9ub.js} | 2 +- .../{route-Df1YhBTq.js => route-4Pe810jq.js} | 2 +- ...{search-DsTk_ZsM.js => search-D1TEdb7u.js} | 2 +- ...s-2-B0xGzDNd.js => settings-2-CUT2ngOp.js} | 2 +- ...hare-2-B5yQaExh.js => share-2-FGmu8UDX.js} | 2 +- ...{shield-CxmFjMfw.js => shield-DH-P-9VP.js} | 2 +- ...k-DlsLo8Eo.js => shield-check-WAIr0NHG.js} | 2 +- ...{system-Xia4FpjC.js => system-Bx1EMTn3.js} | 2 +- ...{target-BAeWmUfa.js => target-CftUJhmo.js} | 2 +- ...er-DhPCT8Cn.js => thermometer-lyVPAuKn.js} | 2 +- ...rash-2-DCqpUdF7.js => trash-2-DqmFYXqQ.js} | 2 +- ...T4f0bwXS.js => use-text-value-DHtdh4JM.js} | 2 +- ...4ov8RnQ.js => use-tree-walker-Dw8GtAHe.js} | 2 +- ...ZlzQmak.js => useMapViewStore-D6ulpFc9.js} | 2 +- ...TRxIqB.js => usePipelineStore-BTv04vLL.js} | 4 +- ...iants-Bbq7uzV_.js => variants-WkuRUM3u.js} | 2 +- ...-DBzA3PXL.js => wand-sparkles-Bg4EWlYl.js} | 2 +- ...P.js => webgl-device-QoBMYpnS-B_qdW-Dv.js} | 2 +- .../{wifi-DYlEDPZY.js => wifi-BF-rEj1F.js} | 2 +- ...i-off-CQ0s_9cO.js => wifi-off-Bfc2_ayY.js} | 2 +- .../{zap-tuTM-Jsw.js => zap-Ba3ctUHg.js} | 2 +- frontend/dist/index.html | 2 +- frontend/package.json | 2 +- 105 files changed, 264 insertions(+), 264 deletions(-) rename frontend/dist/assets/{AnalyzerFilterPanel-DPT1vjKV.js => AnalyzerFilterPanel-BjXbv0-E.js} (98%) rename frontend/dist/assets/{AutoConfigureDialog-C9ytM4jL.js => AutoConfigureDialog-LhNiSavq.js} (98%) rename frontend/dist/assets/{BasemapLayer-Bv4kYAcR.js => BasemapLayer-B81nTsqc.js} (95%) rename frontend/dist/assets/{ChatBubble-DL8lfbnv.js => ChatBubble-CFCWQdGy.js} (96%) rename frontend/dist/assets/{CollisionExplorerModal-DAlBzVhS.js => CollisionExplorerModal-CDRCTbR-.js} (96%) delete mode 100644 frontend/dist/assets/Companion-CSLLhavp.js create mode 100644 frontend/dist/assets/Companion-qTbNLFUD.js rename frontend/dist/assets/{CompanionEchoMap-BcAn2gmm.js => CompanionEchoMap-Cmhesaku.js} (94%) rename frontend/dist/assets/{CompanionPathMap-D5FruuYA.js => CompanionPathMap-DmNbWPuj.js} (95%) rename frontend/dist/assets/{Configuration-C6MYk4Vr.js => Configuration-Dg0qrWk7.js} (98%) rename frontend/dist/assets/{ConfirmModal-CtS0orbM.js => ConfirmModal-CH_Er4VJ.js} (91%) rename frontend/dist/assets/{Contacts-CkDqsspC.js => Contacts-BgYz8bSj.js} (91%) rename frontend/dist/assets/{ContactsMapMapLibre-C3aIIydk.js => ContactsMapMapLibre-DTQ4poRm.js} (99%) rename frontend/dist/assets/{Dashboard-CDloj9Ii.js => Dashboard-B_DHVbWG.js} (97%) rename frontend/dist/assets/{DataValue-Cj0a0QCM.js => DataValue-CdynXJno.js} (87%) rename frontend/dist/assets/{Grid-BhoD4aLU.js => Grid-DeJEUuBo.js} (95%) rename frontend/dist/assets/{KeycapButton-BjL5Ht30.js => KeycapButton-DFXxSuaV.js} (98%) rename frontend/dist/assets/{LightSparkline-DC33xzFq.js => LightSparkline-Bfgi1R3B.js} (96%) rename frontend/dist/assets/{Login-CzKupPAb.js => Login-3t0ZYqhq.js} (99%) rename frontend/dist/assets/{Logs-DxRQJIYV.js => Logs-BOXDno8q.js} (92%) rename frontend/dist/assets/{MeshGraph-DWjajU3T.js => MeshGraph-P8jwne_q.js} (99%) rename frontend/dist/assets/{Mqtt-DoM7Zof1.js => Mqtt-DR3VniFT.js} (98%) rename frontend/dist/assets/{MqttModeBadge-Dhi11STL.js => MqttModeBadge-BFJmiZy5.js} (98%) rename frontend/dist/assets/{PacketList-CbchJDnI.js => PacketList-Dq4ygXCy.js} (98%) rename frontend/dist/assets/{PacketObservatory-CbUj8V1_.js => PacketObservatory-BrZhT-1E.js} (99%) rename frontend/dist/assets/{Packets-BMtxtCyl.js => Packets-BJYka-4Q.js} (96%) rename frontend/dist/assets/{PageLayout-B4RCJ-XT.js => PageLayout-DJSWC4zL.js} (95%) rename frontend/dist/assets/{PathMapMapLibre-BsgVWepx.js => PathMapMapLibre-DM7wheVG.js} (96%) rename frontend/dist/assets/{RoomServer-DiCPtnmR.js => RoomServer-CzNntLvv.js} (97%) rename frontend/dist/assets/{Sessions-CqZugS72.js => Sessions-BgoBMfDO.js} (97%) rename frontend/dist/assets/{SignalIndicator-D8uG_rJC.js => SignalIndicator-BpXSkqBv.js} (99%) rename frontend/dist/assets/{Statistics-xvNcJQ3I.js => Statistics-CDDutBX6.js} (98%) rename frontend/dist/assets/{System-Cocq8BLz.js => System-2yGnS_a1.js} (98%) rename frontend/dist/assets/{Terminal-aB_59Bcc.js => Terminal-CBFaPt_l.js} (99%) rename frontend/dist/assets/{Test-COE9gN1S.js => Test-O-okW-Fy.js} (99%) rename frontend/dist/assets/{activity-DQoaymFw.js => activity-ZoAXCcWm.js} (89%) rename frontend/dist/assets/{antenna-C7FNplvf.js => antenna-CnCmnu-_.js} (91%) rename frontend/dist/assets/{arrow-down-SlBTV0Nc.js => arrow-down-BuVueZSW.js} (86%) rename frontend/dist/assets/{arrow-right-BZS-u7CW.js => arrow-right-9ryFJ0vV.js} (86%) rename frontend/dist/assets/{arrow-up-D_sZeyuo.js => arrow-up-Cd56Jeq2.js} (86%) rename frontend/dist/assets/{car-aFMoKQAR.js => car-CMkH36na.js} (92%) rename frontend/dist/assets/{chat-utils-BdAUDg3r.js => chat-utils-BLzyljgm.js} (97%) rename frontend/dist/assets/{check-check-AfNqagLY.js => check-check-CL5EVU8z.js} (88%) rename frontend/dist/assets/{chevron-right-DsOuIRi8.js => chevron-right-BCotFXkU.js} (85%) rename frontend/dist/assets/{chevron-up-BVzq549_.js => chevron-up-Tfuf4unO.js} (99%) rename frontend/dist/assets/{circle-alert-PnLnz8pa.js => circle-alert-NywFrEoZ.js} (90%) rename frontend/dist/assets/{circle-question-mark-CJCLhkb9.js => circle-question-mark-z2YWN8ID.js} (89%) rename frontend/dist/assets/{circle-stop--JH-Omkf.js => circle-stop-DyVWFFOh.js} (94%) rename frontend/dist/assets/{clock-F-4SScS_.js => clock-jH_gnOTU.js} (87%) rename frontend/dist/assets/{compass-0fhguiKE.js => compass-Ddh177-W.js} (89%) rename frontend/dist/assets/{consumer-registry-5uDLywpC.js => consumer-registry-ssgJoJPf.js} (92%) rename frontend/dist/assets/{cpu-BxgsQ0OY.js => cpu-6yAZtSYM.js} (94%) rename frontend/dist/assets/{database-gsjgeKE3.js => database-n5nNHRzj.js} (90%) rename frontend/dist/assets/{easing-BdzuOPcT.js => easing-Cg6LL_7U.js} (57%) rename frontend/dist/assets/{element-movement-BD3SL-GU.js => element-movement-22ZdBM88.js} (97%) rename frontend/dist/assets/{fieldset-DCj-Bavz.js => fieldset-D4C8gyQW.js} (80%) rename frontend/dist/assets/{frozen-D4mEoVft.js => frozen-ZI0va0FF.js} (78%) rename frontend/dist/assets/{funnel-CitfWrkD.js => funnel-Bd2d2Gy-.js} (90%) rename frontend/dist/assets/{git-branch-DrsZ9sUq.js => git-branch-DpI9mavY.js} (90%) rename frontend/dist/assets/{hash-CyK-Kad6.js => hash-vaiKl847.js} (91%) rename frontend/dist/assets/{index-i0xzpXop.js => index-CN4vD05c.js} (75%) rename frontend/dist/assets/{index-CBEGRHd5.js => index-CnWrze_V.js} (98%) rename frontend/dist/assets/{index-BCuGA4PV.js => index-G-dTy9iF.js} (98%) rename frontend/dist/assets/{key-round-BpDWKeL5.js => key-round-CiTX8EjL.js} (92%) rename frontend/dist/assets/{layers-LQ5jNXOV.js => layers-DwnLNHzI.js} (92%) rename frontend/dist/assets/{link-scoring-BqsMOwtz.js => link-scoring--28z7vGg.js} (94%) rename frontend/dist/assets/{listbox-C1gGOelh.js => listbox-Cfex3RUz.js} (98%) rename frontend/dist/assets/{map-pin-C051lstq.js => map-pin-W8m2dIyd.js} (99%) rename frontend/dist/assets/{map-pin-off-CPSqCYZk.js => map-pin-off-VHAD8rJE.js} (93%) rename frontend/dist/assets/{maplibre-gl-BcToCqGO.js => maplibre-gl-CO2RVU0i.js} (99%) rename frontend/dist/assets/{maplibre-gl-B20pCOz8.js => maplibre-gl-CRRd6W2P.js} (98%) rename frontend/dist/assets/{max-C_kLXH5u.js => max-BbWCrv_A.js} (99%) rename frontend/dist/assets/{message-square-BzLgyIjH.js => message-square-EOpOlt3H.js} (90%) rename frontend/dist/assets/{message-square-text-CIgRIHv3.js => message-square-text-CjTpe3p8.js} (92%) rename frontend/dist/assets/{network-CeKhSsIh.js => network-DgftOg20.js} (92%) rename frontend/dist/assets/{node-types-rVJPSDxd.js => node-types-UozthSpR.js} (95%) rename frontend/dist/assets/{payload-detail-Bh2WvEK0.js => payload-detail-DXAypO28.js} (97%) rename frontend/dist/assets/{pencil-8q_J08l4.js => pencil-BEPIyoAD.js} (95%) rename frontend/dist/assets/{plus-Bb8eT78f.js => plus-3025QRmd.js} (87%) rename frontend/dist/assets/{primitives-QKpQyH4U.js => primitives-DS3PJRi6.js} (99%) rename frontend/dist/assets/{repeat-BSIxXQ81.js => repeat-CTlAf3ox.js} (91%) rename frontend/dist/assets/{rotate-ccw-DqV8JyUZ.js => rotate-ccw-D-KWB9ub.js} (89%) rename frontend/dist/assets/{route-Df1YhBTq.js => route-4Pe810jq.js} (94%) rename frontend/dist/assets/{search-DsTk_ZsM.js => search-D1TEdb7u.js} (87%) rename frontend/dist/assets/{settings-2-B0xGzDNd.js => settings-2-CUT2ngOp.js} (89%) rename frontend/dist/assets/{share-2-B5yQaExh.js => share-2-FGmu8UDX.js} (91%) rename frontend/dist/assets/{shield-CxmFjMfw.js => shield-DH-P-9VP.js} (91%) rename frontend/dist/assets/{shield-check-DlsLo8Eo.js => shield-check-WAIr0NHG.js} (92%) rename frontend/dist/assets/{system-Xia4FpjC.js => system-Bx1EMTn3.js} (91%) rename frontend/dist/assets/{target-BAeWmUfa.js => target-CftUJhmo.js} (94%) rename frontend/dist/assets/{thermometer-DhPCT8Cn.js => thermometer-lyVPAuKn.js} (88%) rename frontend/dist/assets/{trash-2-DCqpUdF7.js => trash-2-DqmFYXqQ.js} (91%) rename frontend/dist/assets/{use-text-value-T4f0bwXS.js => use-text-value-DHtdh4JM.js} (93%) rename frontend/dist/assets/{use-tree-walker-B4ov8RnQ.js => use-tree-walker-Dw8GtAHe.js} (84%) rename frontend/dist/assets/{useMapViewStore-DZlzQmak.js => useMapViewStore-D6ulpFc9.js} (97%) rename frontend/dist/assets/{usePipelineStore-BqTRxIqB.js => usePipelineStore-BTv04vLL.js} (97%) rename frontend/dist/assets/{variants-Bbq7uzV_.js => variants-WkuRUM3u.js} (95%) rename frontend/dist/assets/{wand-sparkles-DBzA3PXL.js => wand-sparkles-Bg4EWlYl.js} (93%) rename frontend/dist/assets/{webgl-device-QoBMYpnS-D6oZ9mRP.js => webgl-device-QoBMYpnS-B_qdW-Dv.js} (99%) rename frontend/dist/assets/{wifi-DYlEDPZY.js => wifi-BF-rEj1F.js} (91%) rename frontend/dist/assets/{wifi-off-CQ0s_9cO.js => wifi-off-Bfc2_ayY.js} (93%) rename frontend/dist/assets/{zap-tuTM-Jsw.js => zap-Ba3ctUHg.js} (89%) diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 6b8d0d2f..b2775a98 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.309 +0.9.310 diff --git a/frontend/dist/assets/AnalyzerFilterPanel-DPT1vjKV.js b/frontend/dist/assets/AnalyzerFilterPanel-BjXbv0-E.js similarity index 98% rename from frontend/dist/assets/AnalyzerFilterPanel-DPT1vjKV.js rename to frontend/dist/assets/AnalyzerFilterPanel-BjXbv0-E.js index ca334321..1dc1e5d4 100644 --- a/frontend/dist/assets/AnalyzerFilterPanel-DPT1vjKV.js +++ b/frontend/dist/assets/AnalyzerFilterPanel-BjXbv0-E.js @@ -1,4 +1,4 @@ -import{e as U,c_ as J,ao as q,aa as G,cE as Q,cs as V,r as d,j as n,bM as K,B as Y}from"./index-i0xzpXop.js";import{c as Z}from"./node-types-rVJPSDxd.js";import{C as W}from"./circle-question-mark-CJCLhkb9.js";import{F as ee}from"./funnel-CitfWrkD.js";import{S as te}from"./search-DsTk_ZsM.js";/** +import{e as U,c_ as J,ao as q,aa as G,cE as Q,cs as V,r as d,j as n,bM as K,B as Y}from"./index-CN4vD05c.js";import{c as Z}from"./node-types-UozthSpR.js";import{C as W}from"./circle-question-mark-z2YWN8ID.js";import{F as ee}from"./funnel-Bd2d2Gy-.js";import{S as te}from"./search-D1TEdb7u.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/AutoConfigureDialog-C9ytM4jL.js b/frontend/dist/assets/AutoConfigureDialog-LhNiSavq.js similarity index 98% rename from frontend/dist/assets/AutoConfigureDialog-C9ytM4jL.js rename to frontend/dist/assets/AutoConfigureDialog-LhNiSavq.js index 065e568e..dd74b721 100644 --- a/frontend/dist/assets/AutoConfigureDialog-C9ytM4jL.js +++ b/frontend/dist/assets/AutoConfigureDialog-LhNiSavq.js @@ -1 +1 @@ -import{r as f,ef as Q,j as e,a7 as X,aa as Z,c3 as M,cs as U,cE as V,ew as G,eB as ee,aC as ae,aK as se,aD as te,a2 as J,bY as ne,B as w,c as g,aE as le}from"./index-i0xzpXop.js";import{C as ie}from"./PageLayout-B4RCJ-XT.js";import{W as re}from"./wand-sparkles-DBzA3PXL.js";import{A as oe}from"./arrow-right-BZS-u7CW.js";const ce={0:"1-byte",1:"2-byte",2:"3-byte"};function de(s){return ce[s]??`${s+1}-byte`}function ke({nodeName:s,publicKey:a,pathHashMode:r}){const[c,n]=f.useState(null),[o,m]=f.useState(null);f.useEffect(()=>{let l=!1;return(async()=>{try{const p=await Q();if(l)return;if(p.success&&p.data){const h=p.data;n(Array.isArray(h.configured)?h.configured:[]),m(Array.isArray(h.configured_companions)?h.configured_companions:[])}}catch{}})(),()=>{l=!0}},[]);const y=l=>{var p;return((p=l.settings)==null?void 0:p.node_name)||l.name};return e.jsxs(ie,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Z,{}),title:"Node Information"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 sm:gap-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater Name"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:e.jsxs("div",{children:[e.jsx("p",{className:"type-data text-fg-primary truncate font-mono",title:s,children:s}),a&&e.jsx("div",{className:"mt-1 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:a})})]})}),r!=null&&e.jsxs("div",{className:"mt-4",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Path Hash Size"}),e.jsx("p",{className:"type-data text-fg-primary mt-0.5 font-mono",children:de(r)})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Room Servers"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:c===null?e.jsx("span",{className:"type-data text-fg-muted",children:"—"}):c.length===0?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-muted",children:"None"})]}):c.map(l=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary truncate",title:y(l),children:y(l)})]}),(l.public_key||l.identity_key)&&e.jsx("div",{className:"mt-1 pl-5 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:l.public_key||l.identity_key})})]},l.name))})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Companions"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:o===null?e.jsx("span",{className:"type-data text-fg-muted",children:"—"}):o.length===0?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-sys-cyan flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-muted",children:"None"})]}):o.map(l=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-sys-cyan flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary truncate",title:y(l),children:y(l)})]}),(l.public_key||l.identity_key)&&e.jsx("div",{className:"mt-1 pl-5 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:l.public_key||l.identity_key})})]},l.name))})]})]})]})}const j=168,S={sparse:50,light:200,moderate:500,dense:1e3},me={sparse:{bucketCapacity:3,refillTokens:1,refillIntervalHours:1,minIntervalSeconds:15,violationThreshold:2,basePenaltyMinutes:30,penaltyMultiplier:2,maxPenaltyHours:12,violationDecayHours:2,ewmaAlpha:.15,hysteresisMinutes:8},light:{bucketCapacity:2,refillTokens:1,refillIntervalHours:1,minIntervalSeconds:20,violationThreshold:2,basePenaltyMinutes:60,penaltyMultiplier:3,maxPenaltyHours:24,violationDecayHours:2,ewmaAlpha:.12,hysteresisMinutes:6},moderate:{bucketCapacity:2,refillTokens:1,refillIntervalHours:2,minIntervalSeconds:30,violationThreshold:1,basePenaltyMinutes:120,penaltyMultiplier:4,maxPenaltyHours:48,violationDecayHours:4,ewmaAlpha:.1,hysteresisMinutes:5},dense:{bucketCapacity:1,refillTokens:1,refillIntervalHours:4,minIntervalSeconds:60,violationThreshold:1,basePenaltyMinutes:180,penaltyMultiplier:4,maxPenaltyHours:72,violationDecayHours:6,ewmaAlpha:.08,hysteresisMinutes:3},congested:{bucketCapacity:1,refillTokens:1,refillIntervalHours:8,minIntervalSeconds:120,violationThreshold:1,basePenaltyMinutes:360,penaltyMultiplier:4,maxPenaltyHours:168,violationDecayHours:12,ewmaAlpha:.03,hysteresisMinutes:2}};function pe(s){return si.type===4))==null?void 0:h.count)??0,c=a.drop_reasons??[],n=((N=c.find(i=>i.reason==="advert rate limit exceeded"))==null?void 0:N.count)??0,o=c.filter(i=>i.reason.startsWith("advert penalty box")).reduce((i,d)=>i+d.count,0),m=((_=c.find(i=>i.reason==="Duplicate"))==null?void 0:_.count)??0;let y=0;try{const i=await G("/api/advert_rate_limit_stats");i.success&&i.data&&(y=i.data.tracked_pubkeys??Object.keys(i.data.bucket_states??{}).length)}catch{y=Math.max(1,Math.round(r/j/12))}const l=a.total_packets/j,p=r/j;return{hours:j,totalPackets:a.total_packets,transmittedPackets:a.transmitted_packets,droppedPackets:a.dropped_packets,packetsPerHour:l,advertsPerHour:p,advertPercent:a.total_packets>0?r/a.total_packets*100:0,advertCount:r,trackedSources:Math.max(1,y),advertsPerSourcePerHour:p/Math.max(1,y),rateLimitDrops:n,penaltyBoxDrops:o,duplicateDrops:m,meshDensity:pe(l)}}function ue(s){const a=me[s.meshDensity],r=s.packetsPerHour/60,c=Math.max(.01,B(r*.2)),n=Math.max(c+.01,B(r*.5)),o=Math.max(n+.01,B(r*.9));return{tokenBucket:{enabled:!0,bucket_capacity:a.bucketCapacity,refill_tokens:a.refillTokens,refill_interval_seconds:a.refillIntervalHours*3600,min_interval_seconds:a.minIntervalSeconds},penaltyBox:{enabled:!0,violation_threshold:a.violationThreshold,base_penalty_seconds:a.basePenaltyMinutes*60,penalty_multiplier:a.penaltyMultiplier,max_penalty_seconds:a.maxPenaltyHours*3600,violation_decay_seconds:a.violationDecayHours*3600},adaptive:{enabled:!0,ewma_alpha:a.ewmaAlpha,hysteresis_seconds:a.hysteresisMinutes*60,thresholds:{quiet_max:c,normal_max:n,busy_max:o}}}}async function ye(s){const a=await xe(),r=ue(a);return{analysis:a,recommended:r,current:{tokenBucket:s.tokenBucket??null,penaltyBox:s.penaltyBox??null,adaptive:s.adaptive??null}}}function B(s){return Math.round(s*100)/100}function k(s){if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m`;const a=s/3600;return a===Math.floor(a)?`${a}h`:`${a.toFixed(1)}h`}function A(s){return s.toLocaleString(void 0,{maximumFractionDigits:1})}const he={sparse:"Sparse",light:"Light",moderate:"Moderate",dense:"Dense",congested:"Congested"},fe={sparse:"text-sys-green",light:"text-sys-cyan",moderate:"text-sys-blue",dense:"text-sys-amber",congested:"text-sys-red"},ge={rate_limit_enabled:!1,bucket_capacity:10,refill_tokens:5,refill_interval_seconds:3600,min_interval_seconds:0,penalty_enabled:!1,violation_threshold:5,base_penalty_seconds:1800,penalty_multiplier:2,max_penalty_seconds:86400,violation_decay_seconds:21600,adaptive_enabled:!1,ewma_alpha:.1,hysteresis_seconds:300,quiet_max:2,normal_max:6,busy_max:10},Ne=["rate_limit_enabled","bucket_capacity","refill_tokens","refill_interval_seconds","min_interval_seconds","penalty_enabled","violation_threshold","base_penalty_seconds","penalty_multiplier","max_penalty_seconds","violation_decay_seconds","adaptive_enabled","ewma_alpha","hysteresis_seconds","quiet_max","normal_max","busy_max"];function D({title:s,enabled:a,defaultOpen:r=!1,children:c}){const[n,o]=f.useState(r);return e.jsxs("div",{className:"bg-subtle-fill radius-inner overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>o(!n),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-subtle-fill-hover transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"type-label text-fg-muted",children:s}),e.jsx("span",{className:g("type-data-xs px-1.5 py-0.5 rounded-full font-medium uppercase tracking-wide",a?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:a?"On":"Off"})]}),e.jsx(le,{className:g("w-4 h-4 text-fg-muted transition-transform",n&&"rotate-180")})]}),n&&e.jsx("div",{className:"px-4 pb-4 pt-1 space-y-1",children:c})]})}function u({label:s,current:a,recommended:r,format:c=n=>String(n)}){const n=a!=null?c(a):"—",o=c(r),m=a!=null&&n!==o;return e.jsxs("div",{className:"flex items-center justify-between gap-2 py-1",children:[e.jsx("span",{className:"type-body-sm text-fg-muted flex-1 min-w-0 truncate",children:s}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:g("data-box data-box-compact",m?"text-fg-muted line-through opacity-60":"text-fg-secondary"),children:n}),m&&e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{className:"data-box data-box-compact text-sys-blue font-medium",children:o})]})]})]})}function we({open:s,onClose:a,currentConfig:r,onApplied:c}){var C,H,P,T,I,R,E,L,$,z,F,O,q,Y;const[n,o]=f.useState("idle"),[m,y]=f.useState(null),[l,p]=f.useState(null),h=f.useCallback(async()=>{o("analyzing"),p(null);try{const t=await ye(r);y(t),o("ready")}catch(t){p(t instanceof Error?t.message:"Analysis failed"),o("error")}},[r]),N=f.useCallback(async()=>{if(!m)return;o("applying"),p(null);const{tokenBucket:t,penaltyBox:b,adaptive:v}=m.recommended,K={rate_limit_enabled:t.enabled,bucket_capacity:t.bucket_capacity,refill_tokens:t.refill_tokens,refill_interval_seconds:t.refill_interval_seconds,min_interval_seconds:t.min_interval_seconds,penalty_enabled:b.enabled,violation_threshold:b.violation_threshold,base_penalty_seconds:b.base_penalty_seconds,penalty_multiplier:b.penalty_multiplier,max_penalty_seconds:b.max_penalty_seconds,violation_decay_seconds:b.violation_decay_seconds,adaptive_enabled:v.enabled,ewma_alpha:v.ewma_alpha,hysteresis_seconds:v.hysteresis_seconds,quiet_max:v.thresholds.quiet_max,normal_max:v.thresholds.normal_max,busy_max:v.thresholds.busy_max};try{const W=await ee(K);W.success?(o("applied"),c==null||c()):(p(W.error||"Failed to apply settings"),o("error"))}catch{p("Failed to apply settings"),o("error")}},[m,c]),_=f.useCallback(()=>{a(),setTimeout(()=>{o("idle"),y(null),p(null)},300)},[a]);s&&n==="idle"&&h();const i=m==null?void 0:m.analysis,d=m==null?void 0:m.recommended,x=m==null?void 0:m.current;return e.jsxs(ae,{open:s,onClose:_,size:"lg",children:[e.jsx(se,{icon:e.jsx(re,{size:20}),title:"Auto-Configure",onClose:_}),e.jsxs(te,{className:"flex flex-col gap-5 max-h-[70vh] overflow-y-auto",children:[n==="analyzing"&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12",children:[e.jsx(J,{className:"w-6 h-6 text-sys-blue animate-spin"}),e.jsx("p",{className:"type-body-sm text-fg-muted",children:"Analyzing 7 days of mesh traffic…"})]}),n==="error"&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-8",children:[e.jsx(ne,{className:"w-6 h-6 text-sys-amber"}),e.jsx("p",{className:"type-body-sm text-fg-secondary",children:l}),e.jsx(w,{plain:!0,onClick:h,className:"text-sys-blue",children:"Retry"})]}),(n==="ready"||n==="applying"||n==="applied")&&i&&d&&x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"type-micro mb-3",children:"7-DAY ANALYSIS"}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Pkts/hr"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:A(i.packetsPerHour)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Adverts/hr"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:A(i.advertsPerHour)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Sources"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:i.trackedSources})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Density"}),e.jsx("div",{className:g("data-box data-box-fill data-box-left",fe[i.meshDensity]),children:he[i.meshDensity]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(D,{title:"Token Bucket of Shame",enabled:d.tokenBucket.enabled,defaultOpen:!0,children:[e.jsx(u,{label:"Bucket Capacity",current:(C=x.tokenBucket)==null?void 0:C.bucket_capacity,recommended:d.tokenBucket.bucket_capacity,format:t=>`${t} tokens`}),e.jsx(u,{label:"Refill Tokens",current:(H=x.tokenBucket)==null?void 0:H.refill_tokens,recommended:d.tokenBucket.refill_tokens,format:t=>`${t} tokens`}),e.jsx(u,{label:"Refill Interval",current:(P=x.tokenBucket)==null?void 0:P.refill_interval_seconds,recommended:d.tokenBucket.refill_interval_seconds,format:t=>k(t)}),e.jsx(u,{label:"Min Interval",current:(T=x.tokenBucket)==null?void 0:T.min_interval_seconds,recommended:d.tokenBucket.min_interval_seconds,format:t=>`${t}s`})]}),e.jsxs(D,{title:"Jail",enabled:d.penaltyBox.enabled,children:[e.jsx(u,{label:"Violation Threshold",current:(I=x.penaltyBox)==null?void 0:I.violation_threshold,recommended:d.penaltyBox.violation_threshold,format:t=>`${t} violations`}),e.jsx(u,{label:"Base Penalty",current:(R=x.penaltyBox)==null?void 0:R.base_penalty_seconds,recommended:d.penaltyBox.base_penalty_seconds,format:t=>k(t)}),e.jsx(u,{label:"Multiplier",current:(E=x.penaltyBox)==null?void 0:E.penalty_multiplier,recommended:d.penaltyBox.penalty_multiplier,format:t=>`${t}×`}),e.jsx(u,{label:"Max Penalty",current:(L=x.penaltyBox)==null?void 0:L.max_penalty_seconds,recommended:d.penaltyBox.max_penalty_seconds,format:t=>k(t)}),e.jsx(u,{label:"Violation Decay",current:($=x.penaltyBox)==null?void 0:$.violation_decay_seconds,recommended:d.penaltyBox.violation_decay_seconds,format:t=>k(t)})]}),e.jsxs(D,{title:"Adaptive Tiers",enabled:d.adaptive.enabled,children:[e.jsx(u,{label:"EWMA α",current:(z=x.adaptive)==null?void 0:z.ewma_alpha,recommended:d.adaptive.ewma_alpha}),e.jsx(u,{label:"Hysteresis",current:(F=x.adaptive)==null?void 0:F.hysteresis_seconds,recommended:d.adaptive.hysteresis_seconds,format:t=>k(t)}),e.jsx(u,{label:"Quiet Max",current:(O=x.adaptive)==null?void 0:O.thresholds.quiet_max,recommended:d.adaptive.thresholds.quiet_max,format:t=>`${t} pkts/min`}),e.jsx(u,{label:"Normal Max",current:(q=x.adaptive)==null?void 0:q.thresholds.normal_max,recommended:d.adaptive.thresholds.normal_max,format:t=>`${t} pkts/min`}),e.jsx(u,{label:"Busy Max",current:(Y=x.adaptive)==null?void 0:Y.thresholds.busy_max,recommended:d.adaptive.thresholds.busy_max,format:t=>`${t} pkts/min`})]})]}),e.jsxs("div",{className:g("flex justify-between gap-4 pt-1",n==="applied"?"items-center":"items-end"),children:[n==="applied"?e.jsx("span",{className:"type-body-sm text-zinc-500",children:"Settings applied"}):e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Analyzed"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[A(i.totalPackets)," packets"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:n==="applied"?e.jsx(w,{color:"primary",onClick:_,children:"Done"}):e.jsxs(e.Fragment,{children:[e.jsx(w,{plain:!0,onClick:_,children:"Cancel"}),e.jsx(w,{color:"primary",onClick:N,disabled:n==="applying",children:n==="applying"?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 animate-spin"}),"Applying…"]}):"Apply All"})]})})]})]})]})]})}export{we as A,ke as N,ge as S,Ne as a}; +import{r as f,ef as Q,j as e,a7 as X,aa as Z,c3 as M,cs as U,cE as V,ew as G,eB as ee,aC as ae,aK as se,aD as te,a2 as J,bY as ne,B as w,c as g,aE as le}from"./index-CN4vD05c.js";import{C as ie}from"./PageLayout-DJSWC4zL.js";import{W as re}from"./wand-sparkles-Bg4EWlYl.js";import{A as oe}from"./arrow-right-9ryFJ0vV.js";const ce={0:"1-byte",1:"2-byte",2:"3-byte"};function de(s){return ce[s]??`${s+1}-byte`}function ke({nodeName:s,publicKey:a,pathHashMode:r}){const[c,n]=f.useState(null),[o,m]=f.useState(null);f.useEffect(()=>{let l=!1;return(async()=>{try{const p=await Q();if(l)return;if(p.success&&p.data){const h=p.data;n(Array.isArray(h.configured)?h.configured:[]),m(Array.isArray(h.configured_companions)?h.configured_companions:[])}}catch{}})(),()=>{l=!0}},[]);const y=l=>{var p;return((p=l.settings)==null?void 0:p.node_name)||l.name};return e.jsxs(ie,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Z,{}),title:"Node Information"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 sm:gap-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater Name"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:e.jsxs("div",{children:[e.jsx("p",{className:"type-data text-fg-primary truncate font-mono",title:s,children:s}),a&&e.jsx("div",{className:"mt-1 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:a})})]})}),r!=null&&e.jsxs("div",{className:"mt-4",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Path Hash Size"}),e.jsx("p",{className:"type-data text-fg-primary mt-0.5 font-mono",children:de(r)})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Room Servers"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:c===null?e.jsx("span",{className:"type-data text-fg-muted",children:"—"}):c.length===0?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-muted",children:"None"})]}):c.map(l=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary truncate",title:y(l),children:y(l)})]}),(l.public_key||l.identity_key)&&e.jsx("div",{className:"mt-1 pl-5 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:l.public_key||l.identity_key})})]},l.name))})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-fg-secondary",children:"Companions"}),e.jsx("div",{className:"mt-0.5 sm:mt-1 space-y-2",children:o===null?e.jsx("span",{className:"type-data text-fg-muted",children:"—"}):o.length===0?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-sys-cyan flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-muted",children:"None"})]}):o.map(l=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-sys-cyan flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary truncate",title:y(l),children:y(l)})]}),(l.public_key||l.identity_key)&&e.jsx("div",{className:"mt-1 pl-5 min-w-0",children:e.jsx(M,{copy:!0,truncate:"css",className:"w-full",size:"responsive",children:l.public_key||l.identity_key})})]},l.name))})]})]})]})}const j=168,S={sparse:50,light:200,moderate:500,dense:1e3},me={sparse:{bucketCapacity:3,refillTokens:1,refillIntervalHours:1,minIntervalSeconds:15,violationThreshold:2,basePenaltyMinutes:30,penaltyMultiplier:2,maxPenaltyHours:12,violationDecayHours:2,ewmaAlpha:.15,hysteresisMinutes:8},light:{bucketCapacity:2,refillTokens:1,refillIntervalHours:1,minIntervalSeconds:20,violationThreshold:2,basePenaltyMinutes:60,penaltyMultiplier:3,maxPenaltyHours:24,violationDecayHours:2,ewmaAlpha:.12,hysteresisMinutes:6},moderate:{bucketCapacity:2,refillTokens:1,refillIntervalHours:2,minIntervalSeconds:30,violationThreshold:1,basePenaltyMinutes:120,penaltyMultiplier:4,maxPenaltyHours:48,violationDecayHours:4,ewmaAlpha:.1,hysteresisMinutes:5},dense:{bucketCapacity:1,refillTokens:1,refillIntervalHours:4,minIntervalSeconds:60,violationThreshold:1,basePenaltyMinutes:180,penaltyMultiplier:4,maxPenaltyHours:72,violationDecayHours:6,ewmaAlpha:.08,hysteresisMinutes:3},congested:{bucketCapacity:1,refillTokens:1,refillIntervalHours:8,minIntervalSeconds:120,violationThreshold:1,basePenaltyMinutes:360,penaltyMultiplier:4,maxPenaltyHours:168,violationDecayHours:12,ewmaAlpha:.03,hysteresisMinutes:2}};function pe(s){return si.type===4))==null?void 0:h.count)??0,c=a.drop_reasons??[],n=((N=c.find(i=>i.reason==="advert rate limit exceeded"))==null?void 0:N.count)??0,o=c.filter(i=>i.reason.startsWith("advert penalty box")).reduce((i,d)=>i+d.count,0),m=((_=c.find(i=>i.reason==="Duplicate"))==null?void 0:_.count)??0;let y=0;try{const i=await G("/api/advert_rate_limit_stats");i.success&&i.data&&(y=i.data.tracked_pubkeys??Object.keys(i.data.bucket_states??{}).length)}catch{y=Math.max(1,Math.round(r/j/12))}const l=a.total_packets/j,p=r/j;return{hours:j,totalPackets:a.total_packets,transmittedPackets:a.transmitted_packets,droppedPackets:a.dropped_packets,packetsPerHour:l,advertsPerHour:p,advertPercent:a.total_packets>0?r/a.total_packets*100:0,advertCount:r,trackedSources:Math.max(1,y),advertsPerSourcePerHour:p/Math.max(1,y),rateLimitDrops:n,penaltyBoxDrops:o,duplicateDrops:m,meshDensity:pe(l)}}function ue(s){const a=me[s.meshDensity],r=s.packetsPerHour/60,c=Math.max(.01,B(r*.2)),n=Math.max(c+.01,B(r*.5)),o=Math.max(n+.01,B(r*.9));return{tokenBucket:{enabled:!0,bucket_capacity:a.bucketCapacity,refill_tokens:a.refillTokens,refill_interval_seconds:a.refillIntervalHours*3600,min_interval_seconds:a.minIntervalSeconds},penaltyBox:{enabled:!0,violation_threshold:a.violationThreshold,base_penalty_seconds:a.basePenaltyMinutes*60,penalty_multiplier:a.penaltyMultiplier,max_penalty_seconds:a.maxPenaltyHours*3600,violation_decay_seconds:a.violationDecayHours*3600},adaptive:{enabled:!0,ewma_alpha:a.ewmaAlpha,hysteresis_seconds:a.hysteresisMinutes*60,thresholds:{quiet_max:c,normal_max:n,busy_max:o}}}}async function ye(s){const a=await xe(),r=ue(a);return{analysis:a,recommended:r,current:{tokenBucket:s.tokenBucket??null,penaltyBox:s.penaltyBox??null,adaptive:s.adaptive??null}}}function B(s){return Math.round(s*100)/100}function k(s){if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m`;const a=s/3600;return a===Math.floor(a)?`${a}h`:`${a.toFixed(1)}h`}function A(s){return s.toLocaleString(void 0,{maximumFractionDigits:1})}const he={sparse:"Sparse",light:"Light",moderate:"Moderate",dense:"Dense",congested:"Congested"},fe={sparse:"text-sys-green",light:"text-sys-cyan",moderate:"text-sys-blue",dense:"text-sys-amber",congested:"text-sys-red"},ge={rate_limit_enabled:!1,bucket_capacity:10,refill_tokens:5,refill_interval_seconds:3600,min_interval_seconds:0,penalty_enabled:!1,violation_threshold:5,base_penalty_seconds:1800,penalty_multiplier:2,max_penalty_seconds:86400,violation_decay_seconds:21600,adaptive_enabled:!1,ewma_alpha:.1,hysteresis_seconds:300,quiet_max:2,normal_max:6,busy_max:10},Ne=["rate_limit_enabled","bucket_capacity","refill_tokens","refill_interval_seconds","min_interval_seconds","penalty_enabled","violation_threshold","base_penalty_seconds","penalty_multiplier","max_penalty_seconds","violation_decay_seconds","adaptive_enabled","ewma_alpha","hysteresis_seconds","quiet_max","normal_max","busy_max"];function D({title:s,enabled:a,defaultOpen:r=!1,children:c}){const[n,o]=f.useState(r);return e.jsxs("div",{className:"bg-subtle-fill radius-inner overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>o(!n),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-subtle-fill-hover transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"type-label text-fg-muted",children:s}),e.jsx("span",{className:g("type-data-xs px-1.5 py-0.5 rounded-full font-medium uppercase tracking-wide",a?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:a?"On":"Off"})]}),e.jsx(le,{className:g("w-4 h-4 text-fg-muted transition-transform",n&&"rotate-180")})]}),n&&e.jsx("div",{className:"px-4 pb-4 pt-1 space-y-1",children:c})]})}function u({label:s,current:a,recommended:r,format:c=n=>String(n)}){const n=a!=null?c(a):"—",o=c(r),m=a!=null&&n!==o;return e.jsxs("div",{className:"flex items-center justify-between gap-2 py-1",children:[e.jsx("span",{className:"type-body-sm text-fg-muted flex-1 min-w-0 truncate",children:s}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:g("data-box data-box-compact",m?"text-fg-muted line-through opacity-60":"text-fg-secondary"),children:n}),m&&e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{className:"data-box data-box-compact text-sys-blue font-medium",children:o})]})]})]})}function we({open:s,onClose:a,currentConfig:r,onApplied:c}){var C,H,P,T,I,R,E,L,$,z,F,O,q,Y;const[n,o]=f.useState("idle"),[m,y]=f.useState(null),[l,p]=f.useState(null),h=f.useCallback(async()=>{o("analyzing"),p(null);try{const t=await ye(r);y(t),o("ready")}catch(t){p(t instanceof Error?t.message:"Analysis failed"),o("error")}},[r]),N=f.useCallback(async()=>{if(!m)return;o("applying"),p(null);const{tokenBucket:t,penaltyBox:b,adaptive:v}=m.recommended,K={rate_limit_enabled:t.enabled,bucket_capacity:t.bucket_capacity,refill_tokens:t.refill_tokens,refill_interval_seconds:t.refill_interval_seconds,min_interval_seconds:t.min_interval_seconds,penalty_enabled:b.enabled,violation_threshold:b.violation_threshold,base_penalty_seconds:b.base_penalty_seconds,penalty_multiplier:b.penalty_multiplier,max_penalty_seconds:b.max_penalty_seconds,violation_decay_seconds:b.violation_decay_seconds,adaptive_enabled:v.enabled,ewma_alpha:v.ewma_alpha,hysteresis_seconds:v.hysteresis_seconds,quiet_max:v.thresholds.quiet_max,normal_max:v.thresholds.normal_max,busy_max:v.thresholds.busy_max};try{const W=await ee(K);W.success?(o("applied"),c==null||c()):(p(W.error||"Failed to apply settings"),o("error"))}catch{p("Failed to apply settings"),o("error")}},[m,c]),_=f.useCallback(()=>{a(),setTimeout(()=>{o("idle"),y(null),p(null)},300)},[a]);s&&n==="idle"&&h();const i=m==null?void 0:m.analysis,d=m==null?void 0:m.recommended,x=m==null?void 0:m.current;return e.jsxs(ae,{open:s,onClose:_,size:"lg",children:[e.jsx(se,{icon:e.jsx(re,{size:20}),title:"Auto-Configure",onClose:_}),e.jsxs(te,{className:"flex flex-col gap-5 max-h-[70vh] overflow-y-auto",children:[n==="analyzing"&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12",children:[e.jsx(J,{className:"w-6 h-6 text-sys-blue animate-spin"}),e.jsx("p",{className:"type-body-sm text-fg-muted",children:"Analyzing 7 days of mesh traffic…"})]}),n==="error"&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-8",children:[e.jsx(ne,{className:"w-6 h-6 text-sys-amber"}),e.jsx("p",{className:"type-body-sm text-fg-secondary",children:l}),e.jsx(w,{plain:!0,onClick:h,className:"text-sys-blue",children:"Retry"})]}),(n==="ready"||n==="applying"||n==="applied")&&i&&d&&x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"type-micro mb-3",children:"7-DAY ANALYSIS"}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Pkts/hr"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:A(i.packetsPerHour)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Adverts/hr"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:A(i.advertsPerHour)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Sources"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:i.trackedSources})]}),e.jsxs("div",{children:[e.jsx("div",{className:"data-box-label",children:"Density"}),e.jsx("div",{className:g("data-box data-box-fill data-box-left",fe[i.meshDensity]),children:he[i.meshDensity]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(D,{title:"Token Bucket of Shame",enabled:d.tokenBucket.enabled,defaultOpen:!0,children:[e.jsx(u,{label:"Bucket Capacity",current:(C=x.tokenBucket)==null?void 0:C.bucket_capacity,recommended:d.tokenBucket.bucket_capacity,format:t=>`${t} tokens`}),e.jsx(u,{label:"Refill Tokens",current:(H=x.tokenBucket)==null?void 0:H.refill_tokens,recommended:d.tokenBucket.refill_tokens,format:t=>`${t} tokens`}),e.jsx(u,{label:"Refill Interval",current:(P=x.tokenBucket)==null?void 0:P.refill_interval_seconds,recommended:d.tokenBucket.refill_interval_seconds,format:t=>k(t)}),e.jsx(u,{label:"Min Interval",current:(T=x.tokenBucket)==null?void 0:T.min_interval_seconds,recommended:d.tokenBucket.min_interval_seconds,format:t=>`${t}s`})]}),e.jsxs(D,{title:"Jail",enabled:d.penaltyBox.enabled,children:[e.jsx(u,{label:"Violation Threshold",current:(I=x.penaltyBox)==null?void 0:I.violation_threshold,recommended:d.penaltyBox.violation_threshold,format:t=>`${t} violations`}),e.jsx(u,{label:"Base Penalty",current:(R=x.penaltyBox)==null?void 0:R.base_penalty_seconds,recommended:d.penaltyBox.base_penalty_seconds,format:t=>k(t)}),e.jsx(u,{label:"Multiplier",current:(E=x.penaltyBox)==null?void 0:E.penalty_multiplier,recommended:d.penaltyBox.penalty_multiplier,format:t=>`${t}×`}),e.jsx(u,{label:"Max Penalty",current:(L=x.penaltyBox)==null?void 0:L.max_penalty_seconds,recommended:d.penaltyBox.max_penalty_seconds,format:t=>k(t)}),e.jsx(u,{label:"Violation Decay",current:($=x.penaltyBox)==null?void 0:$.violation_decay_seconds,recommended:d.penaltyBox.violation_decay_seconds,format:t=>k(t)})]}),e.jsxs(D,{title:"Adaptive Tiers",enabled:d.adaptive.enabled,children:[e.jsx(u,{label:"EWMA α",current:(z=x.adaptive)==null?void 0:z.ewma_alpha,recommended:d.adaptive.ewma_alpha}),e.jsx(u,{label:"Hysteresis",current:(F=x.adaptive)==null?void 0:F.hysteresis_seconds,recommended:d.adaptive.hysteresis_seconds,format:t=>k(t)}),e.jsx(u,{label:"Quiet Max",current:(O=x.adaptive)==null?void 0:O.thresholds.quiet_max,recommended:d.adaptive.thresholds.quiet_max,format:t=>`${t} pkts/min`}),e.jsx(u,{label:"Normal Max",current:(q=x.adaptive)==null?void 0:q.thresholds.normal_max,recommended:d.adaptive.thresholds.normal_max,format:t=>`${t} pkts/min`}),e.jsx(u,{label:"Busy Max",current:(Y=x.adaptive)==null?void 0:Y.thresholds.busy_max,recommended:d.adaptive.thresholds.busy_max,format:t=>`${t} pkts/min`})]})]}),e.jsxs("div",{className:g("flex justify-between gap-4 pt-1",n==="applied"?"items-center":"items-end"),children:[n==="applied"?e.jsx("span",{className:"type-body-sm text-zinc-500",children:"Settings applied"}):e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Analyzed"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[A(i.totalPackets)," packets"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:n==="applied"?e.jsx(w,{color:"primary",onClick:_,children:"Done"}):e.jsxs(e.Fragment,{children:[e.jsx(w,{plain:!0,onClick:_,children:"Cancel"}),e.jsx(w,{color:"primary",onClick:N,disabled:n==="applying",children:n==="applying"?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 animate-spin"}),"Applying…"]}):"Apply All"})]})})]})]})]})]})}export{we as A,ke as N,ge as S,Ne as a}; diff --git a/frontend/dist/assets/BasemapLayer-Bv4kYAcR.js b/frontend/dist/assets/BasemapLayer-B81nTsqc.js similarity index 95% rename from frontend/dist/assets/BasemapLayer-Bv4kYAcR.js rename to frontend/dist/assets/BasemapLayer-B81nTsqc.js index bc4432fe..dc435c2a 100644 --- a/frontend/dist/assets/BasemapLayer-Bv4kYAcR.js +++ b/frontend/dist/assets/BasemapLayer-B81nTsqc.js @@ -1 +1 @@ -import{r as o}from"./index-i0xzpXop.js";import{u as w}from"./maplibre-gl-B20pCOz8.js";const C={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},x={light:"basemap-light-",dark:"basemap-dark-"},k={};async function E(i){if(k[i])return k[i];const t=await(await fetch(C[i])).json();return k[i]=t,t}function R({mode:i}){const{current:l}=w(),[t,b]=o.useState(null),u=o.useRef({light:!1,dark:!1}),m=o.useRef({light:[],dark:[]});o.useEffect(()=>{const e=()=>{var a;const s=(a=l==null?void 0:l.getMap)==null?void 0:a.call(l);s&&!t&&b(s)};e();const r=setInterval(e,50),c=setTimeout(()=>clearInterval(r),5e3);return()=>{clearInterval(r),clearTimeout(c)}},[l,t]);const g=o.useCallback(async(e,r,c)=>{var L,I;if(u.current[r])return;const s=x[r],a=await E(r),d=[];for(const[y,f]of Object.entries(a.sources||{})){const n=s+y;e.getSource(n)||e.addSource(n,f)}const v=(I=(((L=e.getStyle())==null?void 0:L.layers)||[]).find(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-")))==null?void 0:I.id;for(const y of a.layers||[]){const f=s+y.id;if(d.push(f),e.getLayer(f))continue;const n={...y,id:f};"source"in n&&typeof n.source=="string"&&(n.source=s+n.source),n.layout||(n.layout={}),n.layout.visibility=c?"visible":"none";try{e.addLayer(n,v)}catch(S){console.warn(`[BasemapLayer] Failed to add layer ${f}:`,S)}}m.current[r]=d,u.current[r]=!0},[]),h=o.useCallback((e,r,c)=>{const s=m.current[r],a=c?"visible":"none";for(const d of s)if(e.getLayer(d))try{e.setLayoutProperty(d,"visibility",a)}catch{}},[]),p=o.useCallback(e=>{var s;const c=(((s=e.getStyle())==null?void 0:s.layers)||[]).filter(a=>!a.id.startsWith("basemap-light-")&&!a.id.startsWith("basemap-dark-"));for(const a of c)try{e.moveLayer(a.id)}catch{}},[]);return o.useEffect(()=>{if(!t)return;const e=r=>{t.hasImage(r.id)||t.addImage(r.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return t.on("styleimagemissing",e),()=>{t.off("styleimagemissing",e)}},[t]),o.useEffect(()=>{if(!t)return;let e=!1;const r=async()=>{if(!e)try{await Promise.all([g(t,"light",i==="light"),g(t,"dark",i==="dark")]),e||p(t)}catch(s){console.error("[BasemapLayer] Setup error:",s)}};t.isStyleLoaded()?r():(t.once("style.load",r),t.once("load",()=>{!e&&!u.current.light&&r()}));const c=()=>{e||setTimeout(()=>{!e&&u.current.light&&u.current.dark&&p(t)},100)};return t.on("styledata",c),()=>{e=!0,t.off("styledata",c)}},[t,g,p,i]),o.useEffect(()=>{t&&(!u.current.light||!u.current.dark||(h(t,"light",i==="light"),h(t,"dark",i==="dark")))},[t,i,h]),null}export{R as B}; +import{r as o}from"./index-CN4vD05c.js";import{u as w}from"./maplibre-gl-CRRd6W2P.js";const C={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},x={light:"basemap-light-",dark:"basemap-dark-"},k={};async function E(i){if(k[i])return k[i];const t=await(await fetch(C[i])).json();return k[i]=t,t}function R({mode:i}){const{current:l}=w(),[t,b]=o.useState(null),u=o.useRef({light:!1,dark:!1}),m=o.useRef({light:[],dark:[]});o.useEffect(()=>{const e=()=>{var a;const s=(a=l==null?void 0:l.getMap)==null?void 0:a.call(l);s&&!t&&b(s)};e();const r=setInterval(e,50),c=setTimeout(()=>clearInterval(r),5e3);return()=>{clearInterval(r),clearTimeout(c)}},[l,t]);const g=o.useCallback(async(e,r,c)=>{var L,I;if(u.current[r])return;const s=x[r],a=await E(r),d=[];for(const[y,f]of Object.entries(a.sources||{})){const n=s+y;e.getSource(n)||e.addSource(n,f)}const v=(I=(((L=e.getStyle())==null?void 0:L.layers)||[]).find(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-")))==null?void 0:I.id;for(const y of a.layers||[]){const f=s+y.id;if(d.push(f),e.getLayer(f))continue;const n={...y,id:f};"source"in n&&typeof n.source=="string"&&(n.source=s+n.source),n.layout||(n.layout={}),n.layout.visibility=c?"visible":"none";try{e.addLayer(n,v)}catch(S){console.warn(`[BasemapLayer] Failed to add layer ${f}:`,S)}}m.current[r]=d,u.current[r]=!0},[]),h=o.useCallback((e,r,c)=>{const s=m.current[r],a=c?"visible":"none";for(const d of s)if(e.getLayer(d))try{e.setLayoutProperty(d,"visibility",a)}catch{}},[]),p=o.useCallback(e=>{var s;const c=(((s=e.getStyle())==null?void 0:s.layers)||[]).filter(a=>!a.id.startsWith("basemap-light-")&&!a.id.startsWith("basemap-dark-"));for(const a of c)try{e.moveLayer(a.id)}catch{}},[]);return o.useEffect(()=>{if(!t)return;const e=r=>{t.hasImage(r.id)||t.addImage(r.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return t.on("styleimagemissing",e),()=>{t.off("styleimagemissing",e)}},[t]),o.useEffect(()=>{if(!t)return;let e=!1;const r=async()=>{if(!e)try{await Promise.all([g(t,"light",i==="light"),g(t,"dark",i==="dark")]),e||p(t)}catch(s){console.error("[BasemapLayer] Setup error:",s)}};t.isStyleLoaded()?r():(t.once("style.load",r),t.once("load",()=>{!e&&!u.current.light&&r()}));const c=()=>{e||setTimeout(()=>{!e&&u.current.light&&u.current.dark&&p(t)},100)};return t.on("styledata",c),()=>{e=!0,t.off("styledata",c)}},[t,g,p,i]),o.useEffect(()=>{t&&(!u.current.light||!u.current.dark||(h(t,"light",i==="light"),h(t,"dark",i==="dark")))},[t,i,h]),null}export{R as B}; diff --git a/frontend/dist/assets/ChatBubble-DL8lfbnv.js b/frontend/dist/assets/ChatBubble-CFCWQdGy.js similarity index 96% rename from frontend/dist/assets/ChatBubble-DL8lfbnv.js rename to frontend/dist/assets/ChatBubble-CFCWQdGy.js index cabfc38d..b3e80f2a 100644 --- a/frontend/dist/assets/ChatBubble-DL8lfbnv.js +++ b/frontend/dist/assets/ChatBubble-CFCWQdGy.js @@ -1 +1 @@ -import{r as B,j as e,c as s}from"./index-i0xzpXop.js";import{e as M,g as W,a as E,b as S,f as g,c as b}from"./chat-utils-BdAUDg3r.js";const v=["","text-[42px]","text-[36px]","text-[30px]"],O=B.memo(function({senderName:x,text:n,timestamp:d,nameAccessory:y,bubbleAccessory:c,className:o,isOutgoing:N,status:t,onRetry:m,onRetryAsFlood:h,retryAttempt:p,maxRetries:l,signed:w,echoCount:r,bubbleVariant:V="accent",onMentionClick:f}){const{emoji:u,cleanName:j}=M(x),k=W(j),C=E(x),a=S(n);return N?e.jsxs("div",{className:s("group flex flex-col items-end w-full p-2",o),children:[e.jsxs("div",{className:"flex items-end gap-1.5 max-w-[80%]",children:[c,a>0?e.jsx("p",{className:s("leading-none",v[a]),children:n.trim()}):e.jsx("div",{className:s("inline-block px-3.5 py-2.5","rounded-2xl rounded-br-md",t==="failed"?"bg-sys-red depth-raised-soft":"bg-sys-blue depth-raised-soft"),children:e.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:g(n,{isOutgoing:!0,onMentionClick:f})})})]}),e.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-0.5 mr-1",children:[r!=null&&r>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-sys-green tabular-nums font-medium",children:[e.jsxs("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M17 1l4 4-4 4"}),e.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),e.jsx("path",{d:"M7 23l-4-4 4-4"}),e.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]}),r]}),t==="confirmed"&&e.jsxs("svg",{className:"w-3 h-3 text-sys-green",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("polyline",{points:"3 12 8 17 14 6"}),e.jsx("polyline",{points:"10 12 15 17 21 6"})]}),t==="sent"&&e.jsx("svg",{className:"w-3 h-3 text-fg-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),t==="pending"&&e.jsx("svg",{className:"w-3 h-3 text-chat-timestamp animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),t==="retrying"&&e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-3 h-3 text-sys-amber animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p!=null&&l!=null&&e.jsxs("span",{className:"text-[10px] text-sys-amber font-medium tabular-nums",children:["Retry ",p,"/",l]})]}),t==="unconfirmed"&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-amber flex-shrink-0"}),t==="failed"&&e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"w-3 h-3 text-sys-red",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),l!=null&&l>0&&e.jsxs("span",{className:"text-[10px] text-sys-red/70",children:["after ",l," ",l===1?"retry":"retries"]}),m&&e.jsx("button",{onClick:m,className:"text-[10px] font-medium text-sys-red hover:text-sys-red/80 underline underline-offset-2 transition-colors",children:"Retry"}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] text-fg-muted/50",children:"·"}),e.jsx("button",{onClick:h,className:"text-[10px] font-medium text-sys-amber hover:text-sys-amber/80 underline underline-offset-2 transition-colors",children:"Flood"})]})]}),e.jsx("span",{className:"text-[10px] text-chat-timestamp tabular-nums",children:b(d)})]})]}):e.jsxs("div",{className:s("group flex items-start gap-4 w-full p-2",o),children:[e.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[e.jsx("div",{className:s("clay-avatar w-9 h-9",u?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{"--avatar-color":k},children:u||C}),e.jsx("span",{className:"text-xs text-chat-timestamp tabular-nums h-4 leading-4",children:b(d)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 -mt-[3px] mb-1",children:[e.jsx("span",{className:"text-[13px] font-normal text-chat-incoming-name truncate leading-tight tabular-nums",children:j}),w&&e.jsxs("svg",{className:"w-3.5 h-3.5 text-sys-green flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("title",{children:"Ed25519 signed message"}),e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),e.jsx("polyline",{points:"9 12 11 14 15 10"})]}),y]}),e.jsxs("div",{className:"flex items-end gap-1.5",children:[a>0?e.jsx("p",{className:s("leading-none",v[a]),children:n.trim()}):e.jsx("div",{className:s("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-chat-incoming depth-raised-soft"),children:e.jsx("p",{className:"text-sm text-fg-primary leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:g(n,{onMentionClick:f})})}),c]})]})]})});function T({text:i}){return e.jsx("div",{className:"flex justify-center my-1",children:e.jsx("span",{className:s("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:i})})}export{O as C,T as S}; +import{r as B,j as e,c as s}from"./index-CN4vD05c.js";import{e as M,g as W,a as E,b as S,f as g,c as b}from"./chat-utils-BLzyljgm.js";const v=["","text-[42px]","text-[36px]","text-[30px]"],O=B.memo(function({senderName:x,text:n,timestamp:d,nameAccessory:y,bubbleAccessory:c,className:o,isOutgoing:N,status:t,onRetry:m,onRetryAsFlood:h,retryAttempt:p,maxRetries:l,signed:w,echoCount:r,bubbleVariant:V="accent",onMentionClick:f}){const{emoji:u,cleanName:j}=M(x),k=W(j),C=E(x),a=S(n);return N?e.jsxs("div",{className:s("group flex flex-col items-end w-full p-2",o),children:[e.jsxs("div",{className:"flex items-end gap-1.5 max-w-[80%]",children:[c,a>0?e.jsx("p",{className:s("leading-none",v[a]),children:n.trim()}):e.jsx("div",{className:s("inline-block px-3.5 py-2.5","rounded-2xl rounded-br-md",t==="failed"?"bg-sys-red depth-raised-soft":"bg-sys-blue depth-raised-soft"),children:e.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:g(n,{isOutgoing:!0,onMentionClick:f})})})]}),e.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-0.5 mr-1",children:[r!=null&&r>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-sys-green tabular-nums font-medium",children:[e.jsxs("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M17 1l4 4-4 4"}),e.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),e.jsx("path",{d:"M7 23l-4-4 4-4"}),e.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]}),r]}),t==="confirmed"&&e.jsxs("svg",{className:"w-3 h-3 text-sys-green",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("polyline",{points:"3 12 8 17 14 6"}),e.jsx("polyline",{points:"10 12 15 17 21 6"})]}),t==="sent"&&e.jsx("svg",{className:"w-3 h-3 text-fg-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),t==="pending"&&e.jsx("svg",{className:"w-3 h-3 text-chat-timestamp animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),t==="retrying"&&e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-3 h-3 text-sys-amber animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p!=null&&l!=null&&e.jsxs("span",{className:"text-[10px] text-sys-amber font-medium tabular-nums",children:["Retry ",p,"/",l]})]}),t==="unconfirmed"&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-amber flex-shrink-0"}),t==="failed"&&e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"w-3 h-3 text-sys-red",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),l!=null&&l>0&&e.jsxs("span",{className:"text-[10px] text-sys-red/70",children:["after ",l," ",l===1?"retry":"retries"]}),m&&e.jsx("button",{onClick:m,className:"text-[10px] font-medium text-sys-red hover:text-sys-red/80 underline underline-offset-2 transition-colors",children:"Retry"}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] text-fg-muted/50",children:"·"}),e.jsx("button",{onClick:h,className:"text-[10px] font-medium text-sys-amber hover:text-sys-amber/80 underline underline-offset-2 transition-colors",children:"Flood"})]})]}),e.jsx("span",{className:"text-[10px] text-chat-timestamp tabular-nums",children:b(d)})]})]}):e.jsxs("div",{className:s("group flex items-start gap-4 w-full p-2",o),children:[e.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[e.jsx("div",{className:s("clay-avatar w-9 h-9",u?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{"--avatar-color":k},children:u||C}),e.jsx("span",{className:"text-xs text-chat-timestamp tabular-nums h-4 leading-4",children:b(d)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 -mt-[3px] mb-1",children:[e.jsx("span",{className:"text-[13px] font-normal text-chat-incoming-name truncate leading-tight tabular-nums",children:j}),w&&e.jsxs("svg",{className:"w-3.5 h-3.5 text-sys-green flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("title",{children:"Ed25519 signed message"}),e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),e.jsx("polyline",{points:"9 12 11 14 15 10"})]}),y]}),e.jsxs("div",{className:"flex items-end gap-1.5",children:[a>0?e.jsx("p",{className:s("leading-none",v[a]),children:n.trim()}):e.jsx("div",{className:s("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-chat-incoming depth-raised-soft"),children:e.jsx("p",{className:"text-sm text-fg-primary leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:g(n,{onMentionClick:f})})}),c]})]})]})});function T({text:i}){return e.jsx("div",{className:"flex justify-center my-1",children:e.jsx("span",{className:s("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:i})})}export{O as C,T as S}; diff --git a/frontend/dist/assets/CollisionExplorerModal-DAlBzVhS.js b/frontend/dist/assets/CollisionExplorerModal-CDRCTbR-.js similarity index 96% rename from frontend/dist/assets/CollisionExplorerModal-DAlBzVhS.js rename to frontend/dist/assets/CollisionExplorerModal-CDRCTbR-.js index d750ae8b..20ac0349 100644 --- a/frontend/dist/assets/CollisionExplorerModal-DAlBzVhS.js +++ b/frontend/dist/assets/CollisionExplorerModal-CDRCTbR-.js @@ -1 +1 @@ -import{r as c,a6 as L,ch as S,ab as H,j as e,aC as k,bY as R,aD as B,c$ as E,b$ as T,c as N,ao as D,V as M,a3 as P,a0 as _,a1 as z,cs as I,cE as W}from"./index-i0xzpXop.js";import{M as $,S as F,L as Y,a as q}from"./maplibre-gl-B20pCOz8.js";import{B as A}from"./BasemapLayer-Bv4kYAcR.js";import{M as U}from"./map-pin-C051lstq.js";import{S as V}from"./share-2-B5yQaExh.js";const G={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"};function w({node:o,isHovered:v,onHover:f}){const[g,p]=c.useState(!1),y=c.useCallback(async d=>{d.stopPropagation(),await P(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=V,r="text-sys-blue";return m?(n=I,r="text-signal-fair"):l?(n=W,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(M,{color:"green",compact:!0,children:"NBR"}),o.isRepeater&&e.jsx(M,{color:"zinc",compact:!0,children:"RPT"}),o.isHub&&e.jsx(M,{color:"indigo",compact:!0,children:"HUB"})]}),e.jsxs("button",{onClick:y,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(z,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function C({nodes:o,hoveredHash:v,onHover:f}){const g=E(),p=c.useRef(null),y=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]),b=y&&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(U,{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",b?"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",b?"opacity-100":"opacity-0"),children:e.jsxs($,{ref:p,initialViewState:{longitude:r.longitude,latitude:r.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:G,attributionControl:!1,onLoad:j,children:[e.jsx(A,{mode:g}),d&&e.jsx(F,{id:"collision-edges",type:"geojson",data:d,children:e.jsx(Y,{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=D(a.hash);return e.jsx(q,{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(M,{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 J({isOpen:o,prefix:v,candidateHashes:f,onClose:g}){const p=L(),y=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:y.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,y]),j=c.useMemo(()=>d.some(s=>s.latitude!=null&&s.longitude!=null&&(s.latitude!==0||s.longitude!==0)),[d]),b=c.useCallback(s=>{l(s)},[]),a=j?"4xl":"lg";return o?e.jsxs(k,{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(R,{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:b})}),e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(w,{node:s,isHovered:m===s.hash,onHover:b},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(w,{node:s,isHovered:m===s.hash,onHover:b},s.hash))})}),e.jsx("div",{className:"overflow-hidden p-2",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:b})})]}):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(w,{node:s,isHovered:m===s.hash,onHover:b},s.hash))})})]})]}):null}const ee=c.memo(J);export{ee as C}; +import{r as c,a6 as L,ch as S,ab as H,j as e,aC as k,bY as R,aD as B,c$ as E,b$ as T,c as N,ao as D,V as M,a3 as P,a0 as _,a1 as z,cs as I,cE as W}from"./index-CN4vD05c.js";import{M as $,S as F,L as Y,a as q}from"./maplibre-gl-CRRd6W2P.js";import{B as A}from"./BasemapLayer-B81nTsqc.js";import{M as U}from"./map-pin-W8m2dIyd.js";import{S as V}from"./share-2-FGmu8UDX.js";const G={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"};function w({node:o,isHovered:v,onHover:f}){const[g,p]=c.useState(!1),y=c.useCallback(async d=>{d.stopPropagation(),await P(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=V,r="text-sys-blue";return m?(n=I,r="text-signal-fair"):l?(n=W,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(M,{color:"green",compact:!0,children:"NBR"}),o.isRepeater&&e.jsx(M,{color:"zinc",compact:!0,children:"RPT"}),o.isHub&&e.jsx(M,{color:"indigo",compact:!0,children:"HUB"})]}),e.jsxs("button",{onClick:y,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(z,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function C({nodes:o,hoveredHash:v,onHover:f}){const g=E(),p=c.useRef(null),y=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]),b=y&&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(U,{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",b?"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",b?"opacity-100":"opacity-0"),children:e.jsxs($,{ref:p,initialViewState:{longitude:r.longitude,latitude:r.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:G,attributionControl:!1,onLoad:j,children:[e.jsx(A,{mode:g}),d&&e.jsx(F,{id:"collision-edges",type:"geojson",data:d,children:e.jsx(Y,{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=D(a.hash);return e.jsx(q,{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(M,{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 J({isOpen:o,prefix:v,candidateHashes:f,onClose:g}){const p=L(),y=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:y.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,y]),j=c.useMemo(()=>d.some(s=>s.latitude!=null&&s.longitude!=null&&(s.latitude!==0||s.longitude!==0)),[d]),b=c.useCallback(s=>{l(s)},[]),a=j?"4xl":"lg";return o?e.jsxs(k,{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(R,{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:b})}),e.jsx("div",{className:"p-2",children:d.map(s=>e.jsx(w,{node:s,isHovered:m===s.hash,onHover:b},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(w,{node:s,isHovered:m===s.hash,onHover:b},s.hash))})}),e.jsx("div",{className:"overflow-hidden p-2",children:e.jsx(C,{nodes:d,hoveredHash:m,onHover:b})})]}):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(w,{node:s,isHovered:m===s.hash,onHover:b},s.hash))})})]})]}):null}const ee=c.memo(J);export{ee as C}; diff --git a/frontend/dist/assets/Companion-CSLLhavp.js b/frontend/dist/assets/Companion-CSLLhavp.js deleted file mode 100644 index cbcdab60..00000000 --- a/frontend/dist/assets/Companion-CSLLhavp.js +++ /dev/null @@ -1,72 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompanionPathMap-D5FruuYA.js","assets/index-i0xzpXop.js","assets/usePipelineStore-BqTRxIqB.js","assets/node-types-rVJPSDxd.js","assets/car-aFMoKQAR.js","assets/map-pin-off-CPSqCYZk.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css","assets/CompanionEchoMap-BcAn2gmm.js"])))=>i.map(i=>d[i]); -import{aX as nn,fB as gs,aZ as Zs,a_ as rn,aY as Ct,a$ as ea,r as n,b0 as ln,b1 as he,b4 as Ce,aT as Q,b8 as q,b5 as xe,bi as on,b9 as jt,bd as St,be as _t,bj as cn,bf as Se,bg as ot,bk as dn,bh as fe,bl as ys,bm as un,bn as mn,bo as at,bp as pn,bq as xn,br as hn,aW as Ze,b6 as fn,fD as gn,d7 as Te,fE as ta,bt as yn,bu as te,bv as bn,bC as vn,dk as jn,dl as wn,bE as Nn,fF as kn,bs as $e,bD as it,bx as Cn,fG as Rt,bG as bs,fH as ct,b2 as qe,bz as sa,bA as Sn,bB as _n,d5 as vs,d8 as js,fC as Rn,bF as In,b3 as En,bb as Mn,bc as Pn,bw as aa,d3 as na,e as ae,j as e,c as P,a0 as be,fI as Tn,cZ as de,fJ as se,cE as ye,cs as dt,aa as ze,bM as ut,f2 as _e,f3 as Re,f4 as Ie,d as ge,fK as $n,fL as Dn,m as ue,fM as Fn,cT as nt,aC as je,aK as Ee,dK as He,aD as we,a2 as oe,bY as Be,eJ as Me,B as H,fN as Ln,fO as mt,au as On,Q as An,fP as zn,_ as ra,ca as Hn,V as De,fQ as Bn,dy as Gn,fR as It,fS as Kn,fT as Un,bI as wt,fU as qn,fV as Vn,fW as Wn,dJ as Qn,a1 as Et,ef as Yn,fX as Xn,fY as Jn,fZ as la,fq as Zn,f_ as er,f$ as tr,I as pe,C as ws,g0 as oa,g1 as sr,g2 as ar,g3 as nr,g4 as rr,g5 as lr,g6 as or,g7 as ir,g8 as cr,g9 as dr,ga as ur,gb as mr,a6 as pr,gc as xr,gd as hr,ge as fr,gf as gr,gg as yr,gh as br,gi as vr,gj as jr,gk as wr,gl as Nr,eE as kr}from"./index-i0xzpXop.js";import{P as Ns,a as ks,B as Cs,C as Ss}from"./PageLayout-B4RCJ-XT.js";import{e as Mt,g as Pt,a as Tt}from"./chat-utils-BdAUDg3r.js";import{c as _s,S as Cr,a as Sr}from"./SignalIndicator-D8uG_rJC.js";import{b as _r,F as Rr,y as Ir,R as Er,T as Mr,w as Pr,A as Tr,M as ia}from"./map-pin-C051lstq.js";import{p as $r,a as et,c as W,f as Xe,b as Dr,L as Fr,S as Je,s as Lr,u as Or,d as Ar}from"./element-movement-BD3SL-GU.js";import{s as zr}from"./use-text-value-T4f0bwXS.js";import{F as Hr}from"./use-tree-walker-B4ov8RnQ.js";import{a as tt}from"./index-CBEGRHd5.js";import{S as Rs}from"./search-DsTk_ZsM.js";import{S as Br}from"./share-2-B5yQaExh.js";import{R as Ge,L as Gr}from"./route-Df1YhBTq.js";import{R as ca}from"./rotate-ccw-DqV8JyUZ.js";import{T as Ke}from"./trash-2-DCqpUdF7.js";import{H as Fe}from"./hash-CyK-Kad6.js";import{C as Kr}from"./check-check-AfNqagLY.js";import{P as Ue}from"./plus-Bb8eT78f.js";import{S as Ur,C as qr}from"./ChatBubble-DL8lfbnv.js";import{p as Vr}from"./payload-detail-Bh2WvEK0.js";import{A as Wr}from"./arrow-down-SlBTV0Nc.js";import{C as Qr}from"./chevron-right-DsOuIRi8.js";import{C as da}from"./circle-alert-PnLnz8pa.js";import{f as Yr,c as Xr,a as Jr,M as Zr}from"./variants-Bbq7uzV_.js";import{C as ua}from"./clock-F-4SScS_.js";import{A as ma}from"./activity-DQoaymFw.js";import{T as pa}from"./thermometer-DhPCT8Cn.js";import{S as el}from"./shield-check-DlsLo8Eo.js";import{W as Is}from"./wand-sparkles-DBzA3PXL.js";import{C as tl}from"./compass-0fhguiKE.js";import{G as Es}from"./git-branch-DrsZ9sUq.js";import{F as re,L as le,D as ke}from"./fieldset-DCj-Bavz.js";import{C as xa}from"./ConfirmModal-CtS0orbM.js";import{K as ha}from"./key-round-BpDWKeL5.js";import{F as fa,P as sl}from"./pencil-8q_J08l4.js";var al=Object.defineProperty,nl=(t,s,a)=>s in t?al(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,Ms=(t,s,a)=>(nl(t,typeof s!="symbol"?s+"":s,a),a),Z=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Z||{}),rt=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(rt||{}),G=(t=>(t[t.OpenMenu=0]="OpenMenu",t[t.CloseMenu=1]="CloseMenu",t[t.GoToItem=2]="GoToItem",t[t.Search=3]="Search",t[t.ClearSearch=4]="ClearSearch",t[t.RegisterItems=5]="RegisterItems",t[t.UnregisterItems=6]="UnregisterItems",t[t.SetButtonElement=7]="SetButtonElement",t[t.SetItemsElement=8]="SetItemsElement",t[t.SortItems=9]="SortItems",t[t.MarkButtonAsMoved=10]="MarkButtonAsMoved",t))(G||{});function Ps(t,s=a=>a){let a=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=ea(s(t.items.slice()),i=>i.dataRef.current.domRef.current),l=a?r.indexOf(a):null;return l===-1&&(l=null),{items:r,activeItemIndex:l}}let rl={1(t){if(t.menuState===1)return t;let s=t.buttonElement?et.Tracked(Dr(t.buttonElement)):t.buttonPositionState;return{...t,activeItemIndex:null,pendingFocus:{focus:W.Nothing},menuState:1,buttonPositionState:s}},0(t,s){return t.menuState===0?t:{...t,__demoMode:!1,pendingFocus:s.focus,menuState:0,buttonPositionState:et.Idle}},2:(t,s)=>{var a,r,l,i,o;if(t.menuState===1)return t;let x={...t,searchQuery:"",activationTrigger:(a=s.trigger)!=null?a:1,__demoMode:!1};if(s.focus===W.Nothing)return{...x,activeItemIndex:null};if(s.focus===W.Specific)return{...x,activeItemIndex:t.items.findIndex(c=>c.id===s.id)};if(s.focus===W.Previous){let c=t.activeItemIndex;if(c!==null){let b=t.items[c].dataRef.current.domRef,y=Xe(s,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:g=>g.id,resolveDisabled:g=>g.dataRef.current.disabled});if(y!==null){let g=t.items[y].dataRef.current.domRef;if(((r=b.current)==null?void 0:r.previousElementSibling)===g.current||((l=g.current)==null?void 0:l.previousElementSibling)===null)return{...x,activeItemIndex:y}}}}else if(s.focus===W.Next){let c=t.activeItemIndex;if(c!==null){let b=t.items[c].dataRef.current.domRef,y=Xe(s,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:g=>g.id,resolveDisabled:g=>g.dataRef.current.disabled});if(y!==null){let g=t.items[y].dataRef.current.domRef;if(((i=b.current)==null?void 0:i.nextElementSibling)===g.current||((o=g.current)==null?void 0:o.nextElementSibling)===null)return{...x,activeItemIndex:y}}}}let p=Ps(t),C=Xe(s,{resolveItems:()=>p.items,resolveActiveIndex:()=>p.activeItemIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...x,...p,activeItemIndex:C}},3:(t,s)=>{let a=t.searchQuery!==""?0:1,r=t.searchQuery+s.value.toLowerCase(),l=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+a).concat(t.items.slice(0,t.activeItemIndex+a)):t.items).find(o=>{var x;return((x=o.dataRef.current.textValue)==null?void 0:x.startsWith(r))&&!o.dataRef.current.disabled}),i=l?t.items.indexOf(l):-1;return i===-1||i===t.activeItemIndex?{...t,searchQuery:r}:{...t,searchQuery:r,activeItemIndex:i,activationTrigger:1}},4(t){return t.searchQuery===""?t:{...t,searchQuery:"",searchActiveItemIndex:null}},5:(t,s)=>{let a=t.items.concat(s.items.map(l=>l)),r=t.activeItemIndex;return t.pendingFocus.focus!==W.Nothing&&(r=Xe(t.pendingFocus,{resolveItems:()=>a,resolveActiveIndex:()=>t.activeItemIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled})),{...t,items:a,activeItemIndex:r,pendingFocus:{focus:W.Nothing},pendingShouldSort:!0}},6:(t,s)=>{let a=t.items,r=[],l=new Set(s.items);for(let[i,o]of a.entries())if(l.has(o.id)&&(r.push(i),l.delete(o.id),l.size===0))break;if(r.length>0){a=a.slice();for(let i of r.reverse())a.splice(i,1)}return{...t,items:a,activationTrigger:1}},7:(t,s)=>t.buttonElement===s.element?t:{...t,buttonElement:s.element},8:(t,s)=>t.itemsElement===s.element?t:{...t,itemsElement:s.element},9:t=>t.pendingShouldSort?{...t,...Ps(t),pendingShouldSort:!1}:t,10(t){return t.buttonPositionState.kind!=="Tracked"?t:{...t,buttonPositionState:et.Moved}}};class $t extends nn{constructor(s){super(s),Ms(this,"actions",{registerItem:gs(()=>{let a=[],r=new Set;return[(l,i)=>{r.has(i)||(r.add(i),a.push({id:l,dataRef:i}))},()=>(r.clear(),this.send({type:5,items:a.splice(0)}))]}),unregisterItem:gs(()=>{let a=[];return[r=>a.push(r),()=>this.send({type:6,items:a.splice(0)})]})}),Ms(this,"selectors",{activeDescendantId(a){var r;let l=a.activeItemIndex,i=a.items;return l===null||(r=i[l])==null?void 0:r.id},isActive(a,r){var l;let i=a.activeItemIndex,o=a.items;return i!==null?((l=o[i])==null?void 0:l.id)===r:!1},shouldScrollIntoView(a,r){return a.__demoMode||a.menuState!==0||a.activationTrigger===0?!1:this.isActive(a,r)},didButtonMove(a){return a.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let a=this.state.id,r=Zs.get(null);this.disposables.add(r.on(rn.Push,l=>{!r.selectors.isTop(l,a)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>r.actions.push(a)),this.on(1,()=>r.actions.pop(a))}this.disposables.group(a=>{this.on(1,r=>{r.buttonElement&&(a.dispose(),a.add($r(r.buttonElement,r.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:s,__demoMode:a=!1}){return new $t({id:s,__demoMode:a,menuState:a?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:W.Nothing},buttonPositionState:et.Idle})}reduce(s,a){return Ct(a.type,rl,s,a)}}const ga=n.createContext(null);function Dt(t){let s=n.useContext(ga);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,ya),a}return s}function ya({id:t,__demoMode:s=!1}){let a=n.useMemo(()=>$t.new({id:t,__demoMode:s}),[]);return ln(()=>a.dispose()),a}let ll=n.Fragment;function ol(t,s){let a=n.useId(),{__demoMode:r=!1,...l}=t,i=ya({id:a,__demoMode:r}),[o,x,p]=xe(i,w=>[w.menuState,w.itemsElement,w.buttonElement]),C=Ce(s),c=Zs.get(null),b=xe(c,n.useCallback(w=>c.selectors.isTop(w,a),[c,a]));vn(b,[p,x],(w,f)=>{var M;i.send({type:G.CloseMenu}),jn(f,wn.Loose)||(w.preventDefault(),(M=i.state.buttonElement)==null||M.focus())});let y=Q(()=>{i.send({type:G.CloseMenu})}),g=Se({open:o===Z.Open,close:y}),d={ref:C},v=fe();return te.createElement(Tr,null,te.createElement(ga.Provider,{value:i},te.createElement(Nn,{value:Ct(o,{[Z.Open]:at.Open,[Z.Closed]:at.Closed})},v({ourProps:d,theirProps:l,slot:g,defaultTag:ll,name:"Menu"}))))}let il="button";function cl(t,s){let a=Dt("Menu.Button"),r=n.useId(),{id:l=`headlessui-menu-button-${r}`,disabled:i=!1,autoFocus:o=!1,...x}=t,p=n.useRef(null),C=_r(),c=Ce(s,p,Rr(),Q(m=>a.send({type:G.SetButtonElement,element:m}))),b=Q(m=>{switch(m.key){case q.Space:case q.Enter:case q.ArrowDown:m.preventDefault(),m.stopPropagation(),a.send({type:G.OpenMenu,focus:{focus:W.First}});break;case q.ArrowUp:m.preventDefault(),m.stopPropagation(),a.send({type:G.OpenMenu,focus:{focus:W.Last}});break}}),y=Q(m=>{switch(m.key){case q.Space:m.preventDefault();break}}),[g,d,v]=xe(a,m=>[m.menuState,m.buttonElement,m.itemsElement]),w=g===Z.Open;Fr(w,{trigger:d,action:n.useCallback(m=>{if(d!=null&&d.contains(m.target))return Je.Ignore;let _=m.target.closest('[role="menuitem"]:not([data-disabled])');return on(_)?Je.Select(_):v!=null&&v.contains(m.target)?Je.Ignore:Je.Close},[d,v]),close:n.useCallback(()=>a.send({type:G.CloseMenu}),[]),select:n.useCallback(m=>m.click(),[])});let f=Lr(m=>{var _;i||(g===Z.Open?(jt.flushSync(()=>a.send({type:G.CloseMenu})),(_=p.current)==null||_.focus({preventScroll:!0})):(m.preventDefault(),a.send({type:G.OpenMenu,focus:{focus:W.Nothing},trigger:rt.Pointer})))}),{isFocusVisible:M,focusProps:I}=St({autoFocus:o}),{isHovered:R,hoverProps:j}=_t({isDisabled:i}),{pressed:k,pressProps:$}=cn({disabled:i}),N=Se({open:g===Z.Open,active:k||g===Z.Open,disabled:i,hover:R,focus:M,autofocus:o}),u=ot(C(),{ref:c,id:l,type:dn(t,p.current),"aria-haspopup":"menu","aria-controls":v==null?void 0:v.id,"aria-expanded":g===Z.Open,disabled:i||void 0,autoFocus:o,onKeyDown:b,onKeyUp:y},f,I,j,$);return fe()({ourProps:u,theirProps:x,slot:N,defaultTag:il,name:"Menu.Button"})}let dl="div",ul=bs.RenderStrategy|bs.Static;function ml(t,s){let a=n.useId(),{id:r=`headlessui-menu-items-${a}`,anchor:l,portal:i=!1,modal:o=!0,transition:x=!1,...p}=t,C=Ir(l),c=Dt("Menu.Items"),[b,y]=Er(C),g=Mr(),[d,v]=n.useState(null),w=Ce(s,C?b:null,Q(D=>c.send({type:G.SetItemsElement,element:D})),v),[f,M]=xe(c,D=>[D.menuState,D.buttonElement]),I=ys(M),R=ys(d);C&&(i=!0);let j=un(),[k,$]=mn(x,d,j!==null?(j&at.Open)===at.Open:f===Z.Open);pn(k,M,()=>{c.send({type:G.CloseMenu})});let N=xe(c,D=>D.__demoMode),u=N?!1:o&&f===Z.Open;xn(u,R);let m=N?!1:o&&f===Z.Open;hn(m,{allowed:n.useCallback(()=>[M,d],[M,d])});let _=xe(c,c.selectors.didButtonMove)?!1:k;n.useEffect(()=>{let D=d;D&&f===Z.Open&&(Ze(D)||D.focus({preventScroll:!0}))},[f,d]),Hr(f===Z.Open,{container:d,accept(D){return D.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:D.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(D){D.setAttribute("role","none")}});let h=fn(),T=Q(D=>{var K,ee,V;switch(h.dispose(),D.key){case q.Space:if(c.state.searchQuery!=="")return D.preventDefault(),D.stopPropagation(),c.send({type:G.Search,value:D.key});case q.Enter:if(D.preventDefault(),D.stopPropagation(),c.state.activeItemIndex!==null){let{dataRef:F}=c.state.items[c.state.activeItemIndex];(ee=(K=F.current)==null?void 0:K.domRef.current)==null||ee.click()}c.send({type:G.CloseMenu}),ta(c.state.buttonElement);break;case q.ArrowDown:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Next});case q.ArrowUp:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Previous});case q.Home:case q.PageUp:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.First});case q.End:case q.PageDown:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Last});case q.Escape:D.preventDefault(),D.stopPropagation(),jt.flushSync(()=>c.send({type:G.CloseMenu})),(V=c.state.buttonElement)==null||V.focus({preventScroll:!0});break;case q.Tab:D.preventDefault(),D.stopPropagation(),jt.flushSync(()=>c.send({type:G.CloseMenu})),gn(c.state.buttonElement,D.shiftKey?Te.Previous:Te.Next);break;default:D.key.length===1&&(c.send({type:G.Search,value:D.key}),h.setTimeout(()=>c.send({type:G.ClearSearch}),350));break}}),S=Q(D=>{switch(D.key){case q.Space:D.preventDefault();break}}),O=Se({open:f===Z.Open}),ie=ot(C?g():{},{"aria-activedescendant":xe(c,c.selectors.activeDescendantId),"aria-labelledby":xe(c,D=>{var K;return(K=D.buttonElement)==null?void 0:K.id}),id:r,onKeyDown:T,onKeyUp:S,role:"menu",tabIndex:f===Z.Open?0:void 0,ref:w,style:{...p.style,...y,"--button-width":Pr(k,M,!0).width},...yn($)}),Y=fe();return te.createElement(bn,{enabled:i?t.static||k:!1,ownerDocument:I},Y({ourProps:ie,theirProps:p,slot:O,defaultTag:dl,features:ul,visible:_,name:"Menu.Items"}))}let pl=n.Fragment;function xl(t,s){let a=n.useId(),{id:r=`headlessui-menu-item-${a}`,disabled:l=!1,...i}=t,o=Dt("Menu.Item"),x=xe(o,_=>o.selectors.isActive(_,r)),p=n.useRef(null),C=Ce(s,p),c=xe(o,_=>o.selectors.shouldScrollIntoView(_,r));$e(()=>{if(c)return Cn().requestAnimationFrame(()=>{var _,h;(h=(_=p.current)==null?void 0:_.scrollIntoView)==null||h.call(_,{block:"nearest"})})},[c,p]);let b=zr(p),y=n.useRef({disabled:l,domRef:p,get textValue(){return b()}});$e(()=>{y.current.disabled=l},[y,l]),$e(()=>(o.actions.registerItem(r,y),()=>o.actions.unregisterItem(r)),[y,r]);let g=Q(()=>{o.send({type:G.CloseMenu})}),d=Q(_=>{if(l)return _.preventDefault();o.send({type:G.CloseMenu}),ta(o.state.buttonElement)}),v=Q(()=>{if(l)return o.send({type:G.GoToItem,focus:W.Nothing});o.send({type:G.GoToItem,focus:W.Specific,id:r})}),w=Or(),f=Q(_=>w.update(_)),M=Q(_=>{w.wasMoved(_)&&(l||x||o.send({type:G.GoToItem,focus:W.Specific,id:r,trigger:rt.Pointer}))}),I=Q(_=>{w.wasMoved(_)&&(l||x&&o.state.activationTrigger===rt.Pointer&&o.send({type:G.GoToItem,focus:W.Nothing}))}),[R,j]=it(),[k,$]=Rt(),N=Se({active:x,focus:x,disabled:l,close:g}),u={id:r,ref:C,role:"menuitem",tabIndex:l===!0?void 0:-1,"aria-disabled":l===!0?!0:void 0,"aria-labelledby":R,"aria-describedby":k,disabled:void 0,onClick:d,onFocus:v,onPointerEnter:f,onMouseEnter:f,onPointerMove:M,onMouseMove:M,onPointerLeave:I,onMouseLeave:I},m=fe();return te.createElement(j,null,te.createElement($,null,m({ourProps:u,theirProps:i,slot:N,defaultTag:pl,name:"Menu.Item"})))}let hl="div";function fl(t,s){let[a,r]=it(),l=t,i={ref:s,"aria-labelledby":a,role:"group"},o=fe();return te.createElement(r,null,o({ourProps:i,theirProps:l,slot:{},defaultTag:hl,name:"Menu.Section"}))}let gl="header";function yl(t,s){let a=n.useId(),{id:r=`headlessui-menu-heading-${a}`,...l}=t,i=kn();$e(()=>i.register(r),[r,i.register]);let o={id:r,ref:s,role:"presentation",...i.props};return fe()({ourProps:o,theirProps:l,slot:{},defaultTag:gl,name:"Menu.Heading"})}let bl="div";function vl(t,s){let a=t,r={ref:s,role:"separator"};return fe()({ourProps:r,theirProps:a,slot:{},defaultTag:bl,name:"Menu.Separator"})}let jl=he(ol),ba=he(cl),va=he(ml),Nt=he(xl),wl=he(fl),Nl=he(yl),ja=he(vl),kl=Object.assign(jl,{Button:ba,Items:va,Item:Nt,Section:wl,Heading:Nl,Separator:ja});var Cl=(t=>(t[t.RegisterOption=0]="RegisterOption",t[t.UnregisterOption=1]="UnregisterOption",t))(Cl||{});let Sl={0(t,s){let a=[...t.options,{id:s.id,element:s.element,propsRef:s.propsRef}];return{...t,options:ea(a,r=>r.element.current)}},1(t,s){let a=t.options.slice(),r=t.options.findIndex(l=>l.id===s.id);return r===-1?t:(a.splice(r,1),{...t,options:a})}},Ft=n.createContext(null);Ft.displayName="RadioGroupDataContext";function Lt(t){let s=n.useContext(Ft);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,Lt),a}return s}let Ot=n.createContext(null);Ot.displayName="RadioGroupActionsContext";function At(t){let s=n.useContext(Ot);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,At),a}return s}function _l(t,s){return Ct(s.type,Sl,t,s)}let Rl="div";function Il(t,s){let a=n.useId(),r=sa(),{id:l=`headlessui-radiogroup-${a}`,value:i,form:o,name:x,onChange:p,by:C,disabled:c=r||!1,defaultValue:b,tabIndex:y=0,...g}=t,d=Ar(C),[v,w]=n.useReducer(_l,{options:[]}),f=v.options,[M,I]=it(),[R,j]=Rt(),k=n.useRef(null),$=Ce(k,s),N=Sn(b),[u,m]=_n(i,p,N),_=n.useMemo(()=>f.find(F=>!F.propsRef.current.disabled),[f]),h=n.useMemo(()=>f.some(F=>d(F.propsRef.current.value,u)),[f,u]),T=Q(F=>{var A;if(c||d(F,u))return!1;let z=(A=f.find(U=>d(U.propsRef.current.value,F)))==null?void 0:A.propsRef.current;return z!=null&&z.disabled?!1:(m==null||m(F),!0)}),S=Q(F=>{if(!k.current)return;let A=f.filter(z=>z.propsRef.current.disabled===!1).map(z=>z.element.current);switch(F.key){case q.Enter:Rn(F.currentTarget);break;case q.ArrowLeft:case q.ArrowUp:if(F.preventDefault(),F.stopPropagation(),vs(A,Te.Previous|Te.WrapAround)===js.Success){let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break;case q.ArrowRight:case q.ArrowDown:if(F.preventDefault(),F.stopPropagation(),vs(A,Te.Next|Te.WrapAround)===js.Success){let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break;case q.Space:{F.preventDefault(),F.stopPropagation();let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break}}),O=Q(F=>(w({type:0,...F}),()=>w({type:1,id:F.id}))),ie=n.useMemo(()=>({value:u,firstOption:_,containsCheckedOption:h,disabled:c,compare:d,tabIndex:y,...v}),[u,_,h,c,d,y,v]),Y=n.useMemo(()=>({registerOption:O,change:T}),[O,T]),D={ref:$,id:l,role:"radiogroup","aria-labelledby":M,"aria-describedby":R,onKeyDown:S},K=Se({value:u}),ee=n.useCallback(()=>{if(N!==void 0)return T(N)},[T,N]),V=fe();return te.createElement(j,{name:"RadioGroup.Description"},te.createElement(I,{name:"RadioGroup.Label"},te.createElement(Ot.Provider,{value:Y},te.createElement(Ft.Provider,{value:ie},x!=null&&te.createElement(In,{disabled:c,data:{[x]:u||"on"},overrides:{type:"radio",checked:u!=null},form:o,onReset:ee}),V({ourProps:D,theirProps:g,slot:K,defaultTag:Rl,name:"RadioGroup"})))))}let El="div";function Ml(t,s){var a;let r=Lt("RadioGroup.Option"),l=At("RadioGroup.Option"),i=n.useId(),{id:o=`headlessui-radiogroup-option-${i}`,value:x,disabled:p=r.disabled||!1,autoFocus:C=!1,...c}=t,b=n.useRef(null),y=Ce(b,s),[g,d]=it(),[v,w]=Rt(),f=aa({value:x,disabled:p});$e(()=>l.registerOption({id:o,element:b,propsRef:f}),[o,l,b,f]);let M=Q(h=>{var T;if(na(h.currentTarget))return h.preventDefault();l.change(x)&&((T=b.current)==null||T.focus())}),I=((a=r.firstOption)==null?void 0:a.id)===o,{isFocusVisible:R,focusProps:j}=St({autoFocus:C}),{isHovered:k,hoverProps:$}=_t({isDisabled:p}),N=r.compare(r.value,x),u=ot({ref:y,id:o,role:"radio","aria-checked":N?"true":"false","aria-labelledby":g,"aria-describedby":v,"aria-disabled":p?!0:void 0,tabIndex:p?-1:N||!r.containsCheckedOption&&I?r.tabIndex:-1,onClick:p?void 0:M,autoFocus:C},j,$),m=Se({checked:N,disabled:p,active:R,hover:k,focus:R,autofocus:C}),_=fe();return te.createElement(w,{name:"RadioGroup.Description"},te.createElement(d,{name:"RadioGroup.Label"},_({ourProps:u,theirProps:c,slot:m,defaultTag:El,name:"RadioGroup.Option"})))}let Pl="span";function Tl(t,s){var a;let r=Lt("Radio"),l=At("Radio"),i=n.useId(),o=En(),x=sa(),{id:p=o||`headlessui-radio-${i}`,value:C,disabled:c=r.disabled||x||!1,autoFocus:b=!1,...y}=t,g=n.useRef(null),d=Ce(g,s),v=Mn(),w=Pn(),f=aa({value:C,disabled:c});$e(()=>l.registerOption({id:p,element:g,propsRef:f}),[p,l,g,f]);let M=Q(_=>{var h;if(na(_.currentTarget))return _.preventDefault();l.change(C)&&((h=g.current)==null||h.focus())}),{isFocusVisible:I,focusProps:R}=St({autoFocus:b}),{isHovered:j,hoverProps:k}=_t({isDisabled:c}),$=((a=r.firstOption)==null?void 0:a.id)===p,N=r.compare(r.value,C),u=ot({ref:d,id:p,role:"radio","aria-checked":N?"true":"false","aria-labelledby":v,"aria-describedby":w,"aria-disabled":c?!0:void 0,tabIndex:c?-1:N||!r.containsCheckedOption&&$?r.tabIndex:-1,autoFocus:b,onClick:c?void 0:M},R,k),m=Se({checked:N,disabled:c,hover:j,focus:I,autofocus:b});return fe()({ourProps:u,theirProps:y,slot:m,defaultTag:Pl,name:"Radio"})}let $l=he(Il),Dl=he(Ml),pt=he(Tl),Fl=qe,Ll=ct,Ol=Object.assign($l,{Option:Dl,Radio:pt,Label:Fl,Description:Ll});/** - * @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 Al=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],zl=ae("arrow-left",Al);/** - * @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 Hl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],wa=ae("circle-dot",Hl);/** - * @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 Bl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],Gl=ae("crosshair",Bl);/** - * @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 Kl=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ul=ae("ellipsis-vertical",Kl);/** - * @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 ql=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Vl=ae("key",ql);/** - * @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 Wl=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],kt=ae("log-in",Wl);/** - * @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 Ql=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Yl=ae("panel-left-close",Ql);/** - * @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 Xl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Jl=ae("panel-left-open",Xl);/** - * @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 Zl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ts=ae("panel-right-close",Zl);/** - * @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 eo=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],to=ae("radar",eo);/** - * @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 so=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ao=ae("save",so);/** - * @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 no=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ro=ae("star",no);/** - * @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 lo=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zt=ae("upload",lo);/** - * @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 oo=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],io=ae("user-plus",oo),Ve={sm:{radio:"h-4 w-4",dot:"h-1.5 w-1.5",text:"text-sm",descText:"text-xs",padding:"py-2 px-3",segmentPadding:"py-1.5 px-2.5"},md:{radio:"h-5 w-5",dot:"h-2 w-2",text:"text-sm",descText:"text-xs",padding:"py-3 px-4",segmentPadding:"py-2 px-3"},lg:{radio:"h-6 w-6",dot:"h-2.5 w-2.5",text:"text-base",descText:"text-sm",padding:"py-4 px-5",segmentPadding:"py-2.5 px-4"}};function Na({checked:t,size:s,disabled:a}){const r=Ve[s];return e.jsx("span",{className:P("relative flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-150",r.radio,t?"border-sys-blue bg-sys-blue":"border-edge-subtle bg-subtle",!t&&!a&&"group-hover:border-edge-strong",a&&"opacity-50"),children:t&&e.jsx("span",{className:P(r.dot,"rounded-full bg-white")})})}function co({option:t,size:s}){const a=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:"group flex items-start gap-3 cursor-pointer ring-focus rounded-lg",children:({checked:r,disabled:l})=>e.jsxs(e.Fragment,{children:[e.jsx(Na,{checked:r,size:s,disabled:l}),e.jsxs("div",{className:"flex-1 min-w-0 select-none",children:[e.jsx(qe,{className:P(a.text,"font-medium cursor-pointer",l?"text-fg-muted":"text-fg-primary"),children:t.label}),t.description&&e.jsx(ct,{className:P(a.descText,"text-fg-muted mt-0.5"),children:t.description})]})]})})}function uo({option:t,size:s}){const a=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:P("group relative flex cursor-pointer ring-focus","radius-inset border-2 transition-all duration-150",a.padding),children:({checked:r,disabled:l})=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:P("absolute inset-0 radius-inset transition-colors",r?"border-sys-blue bg-sys-blue/5":"border-edge-subtle bg-subtle",!r&&!l&&"group-hover:border-edge-strong group-hover:bg-elevated",l&&"opacity-50"),style:{borderWidth:"inherit"}}),e.jsxs("div",{className:"relative flex items-start gap-3 w-full",children:[t.icon&&e.jsx("span",{className:P("shrink-0",r?"text-sys-blue":"text-fg-muted"),children:t.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(qe,{className:P(a.text,"font-medium cursor-pointer",l?"text-fg-muted":r?"text-sys-blue":"text-fg-primary"),children:t.label}),t.description&&e.jsx(ct,{className:P(a.descText,"text-fg-muted mt-0.5"),children:t.description})]}),e.jsx(Na,{checked:r,size:s,disabled:l})]})]})})}function mo({option:t,size:s,isFirst:a,isLast:r}){const l=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:P("group relative flex items-center justify-center cursor-pointer ring-focus","transition-all duration-150",l.segmentPadding,a&&"rounded-l-lg",r&&"rounded-r-lg"),children:({checked:i,disabled:o})=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:P("absolute inset-0 transition-colors",i?"bg-sys-blue":"bg-transparent",!i&&!o&&"group-hover:bg-subtle-fill",a&&"rounded-l-lg",r&&"rounded-r-lg",o&&"opacity-50")}),e.jsxs(qe,{className:P("relative z-10 font-medium cursor-pointer select-none",l.text,i?"text-white":o?"text-fg-muted":"text-fg-primary"),children:[t.icon&&e.jsx("span",{className:"mr-1.5 inline-flex",children:t.icon}),t.label]})]})})}function po({label:t,description:s,options:a,value:r,onChange:l,size:i="md",variant:o="simple",orientation:x="vertical",name:p,disabled:C,className:c}){const b=Ve[i];return e.jsxs(Ol,{value:r,onChange:l,name:p,disabled:C,className:P("space-y-3",c),children:[t&&e.jsx(qe,{className:P(b.text,"font-medium text-fg-primary"),children:t}),s&&e.jsx(ct,{className:P(b.descText,"text-fg-muted -mt-1"),children:s}),o==="segmented"?e.jsx("div",{className:"inline-flex rounded-lg bg-subtle-fill-strong p-0.5",children:a.map((y,g)=>e.jsx(mo,{option:y,size:i,isFirst:g===0,isLast:g===a.length-1},y.value))}):e.jsx("div",{className:P(o==="card"&&x==="horizontal"&&"grid grid-cols-2 gap-3 sm:grid-cols-3",o==="card"&&x==="vertical"&&"space-y-3",o==="simple"&&x==="horizontal"&&"flex flex-wrap gap-4",o==="simple"&&x==="vertical"&&"space-y-2"),children:a.map(y=>o==="card"?e.jsx(uo,{option:y,size:i},y.value):e.jsx(co,{option:y,size:i},y.value))})]})}function Ne({children:t,className:s,onClick:a,disabled:r=!1,destructive:l=!1,icon:i,trailing:o,href:x,checked:p}){const C=e.jsxs(e.Fragment,{children:[(i||p!==void 0)&&e.jsx("span",{className:P("flex-shrink-0 w-4 h-4 flex items-center justify-center","text-fg-muted",l&&"text-sys-red","group-data-[focus]:text-white"),children:p!==void 0?p?e.jsx(be,{className:"h-4 w-4 text-sys-blue group-data-[focus]:text-white"}):null:i}),e.jsx("span",{className:"flex-1 truncate",children:t}),o&&e.jsx("span",{className:"flex-shrink-0 text-fg-muted group-data-[focus]:text-white/70 text-xs",children:o})]}),c=P("group flex items-center gap-2 w-full","px-3 py-2 radius-control cursor-default","text-sm text-left","transition-colors","focus:outline-none",r?"opacity-50 cursor-not-allowed":[l?["text-sys-red","data-[focus]:bg-sys-red data-[focus]:text-white"]:["text-fg-primary","data-[focus]:bg-sys-blue data-[focus]:text-white"]],s);return x&&!r?e.jsx(Nt,{children:e.jsx("a",{href:x,className:c,children:C})}):e.jsx(Nt,{disabled:r,children:e.jsx("button",{type:"button",onClick:a,disabled:r,className:c,children:C})})}function xo({className:t}){return e.jsx(ja,{className:P("my-1 h-px bg-border-subtle",t)})}const ho=100,fo=101,go=102,yo=103,bo=104,vo=115,jo=116,wo=117,No=120,ko=125,Co=128,So=136;function _o(t){const s=new Tn(t),a=[];for(;s.getRemainingBytesCount()>=2;){const r=s.readUInt8(),l=s.readUInt8();if(r===0&&l===0)break;switch(l){case ho:a.push({channel:r,type:l,value:s.readUInt32BE()});break;case fo:a.push({channel:r,type:l,value:s.readInt16BE()});break;case go:a.push({channel:r,type:l,value:s.readUInt8()});break;case yo:a.push({channel:r,type:l,value:s.readInt16BE()/10});break;case bo:a.push({channel:r,type:l,value:s.readUInt8()/2});break;case vo:a.push({channel:r,type:l,value:s.readUInt16BE()/10});break;case jo:a.push({channel:r,type:l,value:s.readInt16BE()/100});break;case wo:a.push({channel:r,type:l,value:s.readInt16BE()/1e3});break;case No:a.push({channel:r,type:l,value:s.readUInt8()});break;case ko:a.push({channel:r,type:l,value:s.readUInt16BE()});break;case Co:a.push({channel:r,type:l,value:s.readUInt16BE()});break;case So:a.push({channel:r,type:l,value:{latitude:s.readInt24BE()/1e4,longitude:s.readInt24BE()/1e4,altitude:s.readInt24BE()/100}});break;default:return a}}return a}const ka="pymc_companion_contacts_micro",Ca="pymc_companion_favorites",yt=56;function $s(){try{return localStorage.getItem(ka)==="1"}catch{return!1}}function Ro(t){try{localStorage.setItem(ka,t?"1":"0")}catch{}}function Io(){try{const t=localStorage.getItem(Ca);return t?new Set(JSON.parse(t)):new Set}catch{return new Set}}function Eo(t){try{localStorage.setItem(Ca,JSON.stringify([...t]))}catch{}}function Mo({name:t,pubkey:s,advType:a,size:r="md",signal:l}){const i=(a??0)&15,o=r==="sm"?"w-5 h-5":"w-6 h-6",x=r==="sm"?"size-3":"size-3.5";if(i===2){const b=l&&l.rssi!==0,y=b?`RSSI: ${l.rssi} dBm · SNR: ${l.snr.toFixed(1)} dB${l.rtt_ms!=null?` · RTT: ${l.rtt_ms} ms`:""}`:void 0;return e.jsx("div",{className:P(o,"relative rounded-full flex items-center justify-center flex-shrink-0 ring-[1.5px]",b?"ring-transparent":"ring-sys-blue"),title:y,children:b?e.jsx(Cr,{rssi:l.rssi,snr:l.snr,compact:!0,showValues:!1}):e.jsx(ze,{className:P(x,"text-sys-blue")})})}if(i===3)return e.jsx("div",{className:P(o,"relative rounded-full flex items-center justify-center flex-shrink-0 ring-[1.5px] ring-sys-pink"),children:e.jsx(dt,{className:P(x,"text-sys-pink")})});if(!t)return e.jsx("div",{className:P(o,"relative rounded-full bg-sys-blue/12 flex items-center justify-center flex-shrink-0"),children:e.jsx("span",{className:"text-sys-blue font-mono text-[10px] font-bold",children:s.slice(0,4)})});const{emoji:p}=Mt(t),C=Pt(t),c=Tt(t);return e.jsx("div",{className:P(o,"relative clay-avatar",p?"text-base":"text-white text-[11px] font-bold"),style:{"--avatar-color":C},children:p||c})}const Ds=[{key:"companion",label:"Companions",icon:ye,color:"text-sys-blue"},{key:"room",label:"Room Servers",icon:dt,color:"text-sys-pink"},{key:"repeater",label:"Repeaters",icon:ze,color:"text-sys-blue"}];function Po(t){const s=(t.adv_type??0)&15;return s===3?"room":s===2?"repeater":"companion"}const To=4e3,$o=5e3,Do=2e3,Fo=8;function Lo({contact:t,isActive:s,unread:a,lastMsg:r,isFav:l,microContent:i,onSelect:o,onShowDetails:x,onShareContact:p,onResetPath:C,onRemoveContact:c,onPingContact:b,repeaterNeighborHashes:y,repeaterSignal:g,toggleFavorite:d}){const v=$n(t.public_key),w=Dn(t.public_key),[f,M]=n.useState(!1),[I,R]=n.useState(!1),j=n.useRef(null),[k,$]=n.useState("idle"),N=n.useRef(!1),u=n.useRef(null),[m,_]=n.useState({w:0,h:0});n.useEffect(()=>{if(v)N.current=!0,$("idle");else if(N.current){N.current=!1;const D=se.getState().pingResults.get(t.public_key),K=D!=null&&D.rssi!==0;$(K?"success":"failed")}},[v,t.public_key]),n.useEffect(()=>{if(k==="idle")return;const K=setTimeout(()=>$("idle"),k==="success"?$o:Do);return()=>clearTimeout(K)},[k]);const h=(v||k!=="idle")&&!f;n.useEffect(()=>{if(!h)return;const D=u.current;if(!D)return;const K=()=>{const V=D.offsetWidth,F=D.offsetHeight;_(A=>A.w===V&&A.h===F?A:{w:V,h:F})};K();const ee=new ResizeObserver(K);return ee.observe(D),()=>ee.disconnect()},[h]);const T=n.useCallback(()=>{M(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>M(!1),To)},[]),S=n.useCallback(()=>{M(!1),j.current&&clearTimeout(j.current)},[]),O=n.useCallback(async()=>{c&&(j.current&&clearTimeout(j.current),R(!0),await c(t.public_key),R(!1),M(!1))},[c,t.public_key]),ie=n.useMemo(()=>{const D=w&&w.rssi!==0,K=g&&g.rssi!==0;if(!D&&!K)return null;if(D&&!K)return{rssi:w.rssi,snr:w.snr_db,rtt_ms:w.rtt_ms};if(!D&&K)return{rssi:g.rssi,snr:g.snr};const ee=g.advertCount,V=3,F=ee+V;return{rssi:Math.round((g.rssi*ee+w.rssi*V)/F),snr:(g.snr*ee+w.snr_db*V)/F,rtt_ms:w.rtt_ms}},[w,g]),Y=f?"":k==="success"?"bg-sys-green/5":k==="failed"?"bg-sys-red/5":v?"bg-sys-blue/5":s?"bg-sys-blue":"hover:bg-elevated";return e.jsxs(ue.div,{ref:u,layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,className:P("group relative w-full flex items-center gap-2.5 px-2.5 py-[3px] radius-inner overflow-hidden","transition-[background-color,box-shadow] duration-150",Y),children:[e.jsx(ge,{children:h&&m.w>0&&(k!=="idle"?e.jsx(ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{opacity:{duration:.15}},className:P("absolute inset-0 radius-inner ring-2 ring-inset pointer-events-none z-[2]",k==="success"?"ring-sys-green":"ring-sys-red")},`ping-${k}`):e.jsx(Fn,{borderRadius:Fo,width:m.w,height:m.h,color:"blue"},"ping-crawl"))}),e.jsxs("div",{className:"grid flex-1 min-w-0 [&>*]:col-start-1 [&>*]:row-start-1",children:[e.jsxs("div",{className:P("flex items-center gap-2.5",f&&!i&&"invisible pointer-events-none"),children:[e.jsxs("button",{onClick:()=>o({type:"contact",id:t.public_key}),className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mo,{name:t.name,pubkey:t.public_key,advType:t.adv_type,signal:ie}),a>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-sys-red ring-2 ring-body"})]}),!i&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("span",{className:P("text-sm truncate flex-1",s?"text-white font-medium":l?"text-sys-amber font-bold":"text-fg-primary font-medium"),children:t.name||t.public_key.slice(0,12)+"…"})}),k==="success"&&w?e.jsxs("div",{className:"text-[11px] text-sys-green font-medium truncate tabular-nums",children:[w.rssi," dBm · ",w.snr_db.toFixed(1)," dB",w.rtt_ms!=null&&` · ${w.rtt_ms} ms`]}):k==="failed"?e.jsx("div",{className:"text-[11px] text-sys-red font-medium truncate",children:"No response"}):r?e.jsx("div",{className:P("text-[11px] truncate",s?"text-white/70":"text-fg-muted"),children:r.text}):null]})]}),!i&&e.jsx("div",{className:"relative flex-shrink-0 w-[18px] h-[18px] flex items-center justify-center",children:e.jsx(kl,{as:"div",className:"absolute inset-0",children:({open:D})=>e.jsxs(e.Fragment,{children:[e.jsx(ba,{className:P("absolute inset-0 flex items-center justify-center rounded transition-[opacity,background-color] duration-100","focus:outline-none",s?"hover:bg-white/15":"hover:bg-subtle-fill",D?"opacity-100":"opacity-0 group-hover:opacity-100"),"aria-label":"Contact options",children:e.jsx(Ul,{className:P("h-3.5 w-3.5 transition-colors",s?"text-white/60 hover:text-white":"text-fg-muted hover:text-sys-blue")})}),e.jsxs(va,{anchor:"right start",transition:!0,className:P("min-w-[10rem] max-w-[20rem]","radius-inset p-1 ml-1","surface-elevated","focus:outline-none z-50","transition-[opacity,transform]","data-[closed]:opacity-0 data-[closed]:scale-[0.98] data-[closed]:translate-x-[-4px]","data-[enter]:duration-150 data-[leave]:duration-100","data-[enter]:ease-out data-[leave]:ease-in"),children:[e.jsx(Ne,{icon:e.jsx(nt,{className:"w-4 h-4"}),onClick:()=>{x==null||x({type:"contact",id:t.public_key})},children:"Details"}),p&&e.jsx(Ne,{icon:e.jsx(Br,{className:"w-4 h-4"}),onClick:()=>p(t.public_key),children:"Share"}),e.jsx(Ne,{icon:e.jsx(Ge,{className:"w-4 h-4"}),onClick:()=>o({type:"contact",id:t.public_key}),children:"Set Path"}),C&&e.jsx(Ne,{icon:e.jsx(ca,{className:"w-4 h-4"}),onClick:()=>C(t.public_key),children:"Reset Path"}),b&&e.jsx(Ne,{icon:e.jsx(Gl,{className:"w-4 h-4"}),onClick:()=>b(t.public_key),disabled:!(y!=null&&y.has(t.public_key)),children:"Ping"}),c&&e.jsx(Ne,{icon:e.jsx(Ke,{className:"w-4 h-4"}),destructive:!0,onClick:T,children:"Remove Contact"}),e.jsx(xo,{}),e.jsx(Ne,{icon:e.jsx(ro,{className:P("w-4 h-4 group-data-[focus]:text-white group-data-[focus]:fill-white",l?"text-sys-amber fill-sys-amber":"text-fg-muted")}),onClick:()=>d(t.public_key),children:l?"Unfavorite":"Favorite"})]})]})})})]}),!i&&e.jsx("div",{className:P("flex items-center gap-1.5 self-center",!f&&"invisible pointer-events-none"),children:I?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"w-3.5 h-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:S,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-zinc-500/80 hover:bg-zinc-500 depth-stroke-raised transition-colors",children:e.jsx("span",{className:"text-[11px] font-semibold text-white",children:"Cancel"})}),e.jsx("button",{onClick:O,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-sys-red/80 hover:bg-sys-red depth-stroke-raised transition-colors",children:e.jsx(Ke,{className:"w-4 h-4 text-white"})})]})})]})]},t.public_key)}const Fs={excellent:4,good:3,fair:2,weak:1,poor:0};function Ls(t,s,a){const r=s==null?void 0:s.get(t),l=r&&r.rssi!==0,i=a==null?void 0:a.get(t),o=i&&typeof i.rssi=="number"&&i.rssi!==0;if(!l&&!o)return null;if(o&&!l)return i.rssi;if(!o&&l)return r.rssi;const x=r.advertCount,p=3;return Math.round((r.rssi*x+i.rssi*p)/(x+p))}function Oo(t,s,a,r,l){return[...t].sort((i,o)=>{var C,c,b,y;const x=s.has(i.public_key)?0:1,p=s.has(o.public_key)?0:1;if(x!==p)return x-p;if(a){const g=((c=(C=a.get(i.public_key))==null?void 0:C.at(-1))==null?void 0:c.timestamp)??0,d=((y=(b=a.get(o.public_key))==null?void 0:b.at(-1))==null?void 0:y.timestamp)??0;if(g!==d)return d-g}if(r){const g=Ls(i.public_key,r,l),d=Ls(o.public_key,r,l);if(g!=null&&d==null)return-1;if(g==null&&d!=null)return 1;if(g!=null&&d!=null){const v=Fs[_s(g)]??0,w=Fs[_s(d)]??0;if(v!==w)return w-v}}return(i.name||"").localeCompare(o.name||"")})}const Ao=n.memo(n.forwardRef(function({contacts:s,selectedConversation:a,unreadMap:r,messages:l,onSelect:i,onShowDetails:o,onShareContact:x,onResetPath:p,onRemoveContact:C,onPingContact:c,repeaterNeighborHashes:b,repeaterSignalMap:y,isLoading:g,splitPercent:d=50,onMicroChange:v,className:w},f){const[M,I]=n.useState($s),[R,j]=n.useState($s),[k,$]=n.useState(""),[N,u]=n.useState(!1),[m,_]=n.useState(Io),h=n.useRef(null),T=n.useRef(null),S=n.useCallback(F=>{T.current=F,typeof f=="function"?f(F):f&&(f.current=F)},[f]),O=n.useCallback(()=>{I(F=>{const A=!F;Ro(A);const z=T.current;if(A&&j(!0),z){let U=0;const ne=z.parentElement;if(A)U=(ne==null?void 0:ne.offsetWidth)??z.offsetWidth;else if(ne){const We=ne.style.width;ne.style.width="var(--companion-side)",U=ne.offsetWidth,ne.style.width=We}const xt=A?yt:Math.round(d/100*U);tt(z,{width:`${xt}px`},{...de.layoutResize,onComplete(){z.style.width=A?`${yt}px`:`${d}%`,A||j(!1)}})}return v==null||v(A),A})},[d,v]),ie=n.useCallback(F=>{_(A=>{const z=new Set(A);return z.has(F)?z.delete(F):z.add(F),Eo(z),z})},[]),Y=N||k.length>0,D=n.useMemo(()=>{const F=new Set,A=s.filter(U=>F.has(U.public_key)?!1:(F.add(U.public_key),!0));if(!k.trim())return A;const z=k.toLowerCase();return A.filter(U=>{var ne;return((ne=U.name)==null?void 0:ne.toLowerCase().includes(z))||U.public_key.toLowerCase().includes(z)})},[s,k]),K=se(F=>F.pingResults),ee=n.useMemo(()=>{const F=new Map;for(const A of Ds)F.set(A.key,[]);for(const A of D)F.get(Po(A)).push(A);return Ds.map(A=>({...A,items:Oo(F.get(A.key),m,l,A.key==="repeater"?y:void 0,A.key==="repeater"?K:void 0)})).filter(A=>A.items.length>0)},[D,m,l,y,K]),V=(a==null?void 0:a.type)==="contact"?a.id:null;return e.jsxs("div",{ref:S,className:P("flex-shrink-0 overflow-hidden flex flex-col h-full",w),style:{width:M?yt:`${d}%`},children:[e.jsx("div",{className:P("flex items-center border-b border-edge-subtle flex-shrink-0",R?"justify-center p-2":"gap-2 px-3 py-2"),children:R?e.jsx("button",{onClick:O,className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:"Expand contacts",children:e.jsx(Jl,{className:"w-3.5 h-3.5 text-fg-muted"})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide flex-shrink-0",children:"Contacts"}),e.jsxs("div",{className:"flex items-center gap-1 ml-auto flex-shrink-0",children:[e.jsx("button",{onClick:()=>{Y?($(""),u(!1)):(u(!0),setTimeout(()=>{var F;return(F=h.current)==null?void 0:F.focus()},50))},className:P("p-1 rounded transition-colors flex-shrink-0",Y?"bg-sys-blue/10 text-sys-blue":"hover:bg-subtle-fill text-fg-muted"),title:Y?"Close search":"Search contacts",children:e.jsx(Rs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:O,className:"p-1 hover:bg-subtle-fill rounded transition-colors flex-shrink-0",title:"Collapse contacts",children:e.jsx(Yl,{className:"w-3.5 h-3.5 text-fg-muted"})})]})]})}),!R&&Y&&e.jsxs("div",{className:"relative px-2.5 py-2 border-b border-edge-subtle/50 flex-shrink-0",children:[e.jsx(Rs,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none"}),e.jsx("input",{ref:h,type:"text",value:k,onChange:F=>$(F.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:"Search contacts…",className:"w-full pl-8 pr-8 py-1.5 text-sm radius-inner bg-input-bg border border-input-border text-fg-primary placeholder:text-fg-muted/50 ring-focus-inset hover:border-edge-strong transition-colors",autoFocus:!0}),e.jsx("button",{onClick:()=>{$(""),u(!1)},className:"absolute right-5 top-1/2 -translate-y-1/2 p-0.5 hover:bg-subtle-fill rounded",children:e.jsx(ut,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),g&&e.jsx("div",{className:"flex items-center justify-center flex-1",children:e.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-sys-blue border-t-transparent"})}),!g&&e.jsxs("div",{className:P("flex-1 overflow-y-auto min-h-0",R?"px-0":"px-1.5"),style:{contain:"layout style paint"},children:[ee.map(F=>{const A=F.icon;return e.jsxs(_e,{defaultOpen:!0,className:"mb-1",children:[e.jsxs(Re,{className:P("px-2 py-1 flex items-center gap-1.5 w-full","text-left radius-inner hover:bg-subtle-fill-strong transition-colors"),children:[e.jsx(A,{className:P("w-3.5 h-3.5",F.color)}),!R&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:F.label}),e.jsx("span",{className:"type-data-xs text-fg-muted/50 ml-auto",children:F.items.length})]})]}),e.jsx(Ie,{children:e.jsx(ge,{initial:!1,mode:"popLayout",children:F.items.map(z=>{var U;return e.jsx(Lo,{contact:z,isActive:V===z.public_key,unread:r.get(z.public_key)??0,lastMsg:(U=l.get(z.public_key))==null?void 0:U.at(-1),isFav:m.has(z.public_key),microContent:R,onSelect:i,onShowDetails:o,onShareContact:x,onResetPath:p,onRemoveContact:C,onPingContact:c,repeaterNeighborHashes:b,repeaterSignal:y==null?void 0:y.get(z.public_key),toggleFavorite:ie},z.public_key)})})})]},F.key)}),D.length===0&&e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-sm text-fg-muted",children:k?"No matches":"No contacts yet"})})]})]})}));function zo({open:t,onClose:s}){const a=se(u=>u.discoverImportableChannels),r=se(u=>u.getEmptyChannelSlots),l=se(u=>u.importChannel),i=se(u=>u.refreshChannels),[o,x]=n.useState("discover"),[p,C]=n.useState([]),[c,b]=n.useState([]),[y,g]=n.useState(null),d=n.useRef(!1);n.useEffect(()=>{if(!t)return;x("discover"),C([]),b([]),g(null),d.current=!1;let u=!1;return(async()=>{try{const[m,_]=await Promise.all([a(),r()]);if(u)return;if(b(_),m.length===0){g("No channels found in repeater history. Decoded messages may still be loading."),x("select");return}_.length===0&&g("No empty channel slots on device. Delete a channel first to make room."),C(m.map(h=>({name:h.name,alreadyOnDevice:h.alreadyOnDevice,selected:!h.alreadyOnDevice,status:"pending"}))),x("select")}catch(m){u||(g(m instanceof Error?m.message:"Discovery failed"),x("select"))}})(),()=>{u=!0}},[t,a,r]);const v=n.useCallback(u=>{C(m=>m.map(_=>_.name===u&&!_.alreadyOnDevice?{..._,selected:!_.selected}:_))},[]),w=n.useCallback(()=>{C(u=>u.map(m=>m.alreadyOnDevice?m:{...m,selected:!0}))},[]),f=n.useCallback(()=>{C(u=>u.map(m=>m.alreadyOnDevice?m:{...m,selected:!1}))},[]),M=n.useMemo(()=>p.filter(u=>!u.alreadyOnDevice).length,[p]),I=n.useMemo(()=>p.filter(u=>u.selected&&!u.alreadyOnDevice).length,[p]),R=n.useMemo(()=>p.filter(u=>u.status==="done").length,[p]),j=n.useMemo(()=>p.filter(u=>u.status==="failed").length,[p]),k=n.useCallback(async()=>{x("import"),d.current=!1;const u=p.filter(_=>_.selected&&!_.alreadyOnDevice),m=[...c];for(const _ of u){if(d.current)break;const h=m.shift();if(h===void 0){C(S=>S.map(O=>O.name===_.name&&O.status==="pending"?{...O,status:"failed"}:O));continue}C(S=>S.map(O=>O.name===_.name?{...O,status:"sending"}:O)),await new Promise(S=>setTimeout(S,150));const T=await l(_.name,h);C(S=>S.map(O=>O.name===_.name?{...O,status:T?"done":"failed"}:O)),T||m.unshift(h),d.current||await new Promise(S=>setTimeout(S,300))}await i(),x("complete")},[p,c,l,i]),$=n.useCallback(()=>{d.current=!0},[]),N=u=>{switch(u){case"pending":return e.jsx(wa,{className:"w-3.5 h-3.5 text-fg-muted"});case"sending":return e.jsx(oe,{className:"w-3.5 h-3.5 text-sys-blue animate-spin"});case"done":return e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"});case"failed":return e.jsx(ut,{className:"w-3.5 h-3.5 text-sys-red"})}};return e.jsxs(je,{open:t,onClose:o==="import"?()=>{}:s,size:"sm",children:[e.jsx(Ee,{icon:e.jsx(He,{className:"w-5 h-5"}),title:"Import Channels",onClose:o==="import"?void 0:s}),e.jsxs(we,{className:"!py-3 !px-0",children:[o==="discover"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 px-6",children:[e.jsx(oe,{className:"w-6 h-6 text-sys-blue animate-spin"}),e.jsx("p",{className:"text-sm text-fg-secondary",children:"Scanning repeater history…"}),e.jsx("p",{className:"text-[11px] text-fg-muted",children:"Waiting for decoded messages"})]}),o==="select"&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-start gap-2 mx-4 mb-3 p-2.5 radius-inner bg-sys-amber/8 border border-sys-amber/20",children:[e.jsx(Be,{className:"w-3.5 h-3.5 text-sys-amber flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-fg-secondary",children:y})]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"text-[11px] text-fg-muted",children:[M," discoverable · ",c.length," slot",c.length!==1?"s":""," free"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:w,className:"text-[11px] text-sys-blue hover:underline",children:"All"}),e.jsx("span",{className:"text-fg-muted/40",children:"·"}),e.jsx("button",{onClick:f,className:"text-[11px] text-sys-blue hover:underline",children:"None"})]})]}),e.jsx("div",{className:"max-h-[320px] overflow-y-auto",children:p.map(u=>e.jsxs("button",{onClick:()=>v(u.name),disabled:u.alreadyOnDevice,className:P("w-full flex items-center gap-3 px-4 py-2 transition-colors",u.alreadyOnDevice?"opacity-40 cursor-default":"hover:bg-subtle-fill"),children:[e.jsx("div",{className:P("w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 transition-colors",u.alreadyOnDevice?"border-fg-muted/30 bg-fg-muted/10":u.selected?"border-sys-blue bg-sys-blue":"border-edge-subtle"),children:(u.selected||u.alreadyOnDevice)&&e.jsx(be,{className:"w-3 h-3 text-white"})}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-primary truncate",children:u.name})]}),u.alreadyOnDevice&&e.jsx("span",{className:"text-[10px] text-fg-muted bg-subtle-fill px-1.5 py-0.5 rounded flex-shrink-0",children:"on device"})]},u.name))})]})]}),(o==="import"||o==="complete")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 border-b border-edge-subtle",children:[e.jsx("span",{className:"text-[11px] text-fg-muted",children:o==="import"?"Importing channels…":"Import complete"}),e.jsxs("span",{className:"text-[11px] tabular-nums text-fg-secondary",children:[R+j," / ",p.filter(u=>u.selected&&!u.alreadyOnDevice).length]})]}),e.jsx("div",{className:"max-h-[320px] overflow-y-auto",children:p.filter(u=>u.selected&&!u.alreadyOnDevice).map(u=>e.jsxs("div",{className:P("flex items-center gap-3 px-4 py-2",u.status==="sending"&&"bg-sys-blue/5",u.status==="done"&&"bg-sys-green/5",u.status==="failed"&&"bg-sys-red/5"),children:[e.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:N(u.status)}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:P("text-sm truncate",u.status==="done"?"text-fg-primary":"text-fg-secondary"),children:u.name})]}),e.jsx("span",{className:P("text-[10px] flex-shrink-0",u.status==="sending"&&"text-sys-blue",u.status==="done"&&"text-sys-green",u.status==="failed"&&"text-sys-red",u.status==="pending"&&"text-fg-muted"),children:u.status==="sending"?"sending…":u.status==="done"?"added":u.status==="failed"?"failed":"waiting"})]},u.name))})]})]}),e.jsxs(Me,{children:[o==="select"&&e.jsxs(e.Fragment,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsxs(H,{color:"primary",onClick:k,disabled:I===0||c.length===0,children:[e.jsx(He,{className:"w-4 h-4"}),"Import ",I," ",I===1?"Channel":"Channels"]})]}),o==="import"&&e.jsx(H,{plain:!0,onClick:$,children:"Stop"}),o==="complete"&&e.jsxs(e.Fragment,{children:[j>0&&e.jsxs("span",{className:"text-xs text-sys-red flex items-center gap-1 mr-auto",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),j," failed"]}),e.jsxs(H,{color:"primary",onClick:s,children:[e.jsx(Kr,{className:"w-4 h-4"}),"Done — ",R," imported"]})]})]})]})}const Ho=4e3;function Bo(t){const s=t.frequency_hz/1e3,a=t.bandwidth_hz/1e3;return`${s} · SF${t.spreading_factor} · ${a}k`}function Go({channel:t,isActive:s,unread:a,lastMsg:r,isLoadingMessages:l,selfInfo:i,onSelect:o,onDeleteChannel:x}){const[p,C]=n.useState(!1),[c,b]=n.useState(!1),y=n.useRef(null),g=n.useCallback(()=>{C(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>C(!1),Ho)},[]),d=n.useCallback(()=>{C(!1),y.current&&clearTimeout(y.current)},[]),v=n.useCallback(async()=>{x&&(y.current&&clearTimeout(y.current),b(!0),await x(t.index),b(!1),C(!1))},[x,t.index]),w=t.name.toLowerCase()==="public",f=x&&!w;return e.jsx(ue.div,{layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,className:P("group w-full flex items-center gap-2.5 px-2.5 py-1 radius-inner","transition-[background-color] duration-150",p?"":s?"bg-sys-blue":"hover:bg-subtle-fill-strong"),children:e.jsxs("div",{className:"grid flex-1 min-w-0 [&>*]:col-start-1 [&>*]:row-start-1",children:[e.jsxs("div",{className:P("flex items-center gap-2.5 min-w-0",p&&"invisible pointer-events-none"),children:[e.jsx("button",{onClick:()=>o({type:"channel",id:String(t.index)}),className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:P("text-sm flex-shrink-0",s?"text-white font-semibold":r?"text-fg-primary font-semibold":"text-fg-secondary font-normal"),children:t.name}),w&&i&&e.jsx("span",{className:P("text-[9px] font-medium px-1.5 py-px rounded-full whitespace-nowrap truncate",s?"text-white/80 bg-white/15":"text-fg-muted/70 bg-subtle-fill"),children:Bo(i)})]}),r&&e.jsx("div",{className:P("text-[11px] truncate pl-2",s?"text-white/70":"text-fg-muted"),children:r.text})]})}),e.jsx("div",{className:"flex items-center flex-shrink-0",children:l?e.jsx("span",{className:"h-1.5 w-6 rounded-full bg-fg-muted/20 animate-pulse"}):f?e.jsxs("div",{className:"relative w-[18px] h-[18px] flex items-center justify-center",children:[a>0&&e.jsx("span",{className:"absolute inset-0 flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-[10px] font-bold leading-none group-hover:invisible transition-[visibility] duration-100",children:a>99?"99+":a}),e.jsx("button",{onClick:g,className:P("absolute inset-0 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 transition-[opacity,background-color] duration-100",s?"hover:bg-white/15":"hover:bg-subtle-fill"),title:"Remove channel",children:e.jsx(Ke,{className:P("w-3 h-3 transition-colors",s?"text-white/60 hover:text-white":"text-fg-muted hover:text-sys-red")})})]}):a>0?e.jsx("span",{className:"min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-[10px] font-bold flex items-center justify-center leading-none",children:a>99?"99+":a}):null})]}),e.jsx("div",{className:P("flex items-center gap-1.5 self-center",!p&&"invisible pointer-events-none"),children:c?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"w-3.5 h-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:d,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-zinc-500/80 hover:bg-zinc-500 depth-stroke-raised transition-colors",children:e.jsx("span",{className:"text-[11px] font-semibold text-white",children:"Cancel"})}),e.jsx("button",{onClick:v,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-sys-red/80 hover:bg-sys-red depth-stroke-raised transition-colors",children:e.jsx(Ke,{className:"w-4 h-4 text-white"})})]})})]})})}const Ko=n.memo(n.forwardRef(function({channels:s,selectedConversation:a,unreadMap:r,messages:l,onSelect:i,onAddChannel:o,onDeleteChannel:x,className:p},C){const c=Ln(),b=mt(),[y,g]=n.useState(!1),d=n.useMemo(()=>{const w=new Set,f=s.filter(M=>w.has(M.index)?!1:(w.add(M.index),!0));return f.sort((M,I)=>{var N,u,m,_;const R=M.name.toLowerCase()==="public",j=I.name.toLowerCase()==="public";if(R&&!j)return-1;if(!R&&j)return 1;const k=((u=(N=l.get(`ch:${M.index}`))==null?void 0:N.at(-1))==null?void 0:u.timestamp)??0,$=((_=(m=l.get(`ch:${I.index}`))==null?void 0:m.at(-1))==null?void 0:_.timestamp)??0;return k!==$?$-k:M.name.localeCompare(I.name)}),f},[s,l]),v=(a==null?void 0:a.type)==="channel"?a.id:null;return e.jsxs("div",{ref:C,className:P("flex-1 min-w-0 overflow-hidden flex flex-col h-full",p),children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-edge-subtle flex-shrink-0 overflow-hidden whitespace-nowrap",children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide flex-shrink-0",children:"Channels"}),e.jsxs("div",{className:"flex items-center gap-1 ml-auto flex-shrink-0",children:[e.jsx("button",{onClick:()=>g(!0),className:"p-1 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Import channels from repeater history",children:e.jsx(He,{className:"w-3.5 h-3.5 text-fg-muted"})}),o&&e.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Add channel",children:e.jsx(Ue,{className:"w-3.5 h-3.5 text-fg-muted"})})]})]}),e.jsx(zo,{open:y,onClose:()=>g(!1)}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 px-1.5 py-1",style:{contain:"layout style paint"},children:d.length===0?e.jsxs("div",{className:"px-1.5 py-4 space-y-2",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"No channels"}),o&&e.jsxs("button",{onClick:o,className:"inline-flex items-center gap-1.5 px-2 py-1.5 text-xs font-medium text-sys-blue hover:bg-sys-blue/8 rounded transition-colors",children:[e.jsx(Ue,{className:"w-3.5 h-3.5"}),"Add Channel"]})]}):e.jsx(ge,{initial:!1,mode:"popLayout",children:d.map(w=>{var f;return e.jsx(Go,{channel:w,isActive:v===String(w.index),unread:r.get(`ch:${w.index}`)??0,lastMsg:(f=l.get(`ch:${w.index}`))==null?void 0:f.at(-1),isLoadingMessages:c,selfInfo:b,onSelect:i,onDeleteChannel:x},w.index)})})})]})}));function Uo(t,s){const a=new Map;for(const[r,l]of t){const i=l.decoded;if(!(i!=null&&i.decrypted)||i.senderName!==s)continue;const o=i.timestamp??l.timestamp,x=Math.floor(o/30),p=`${i.text}:${x}`;a.has(p)||a.set(p,r)}return a}function qo(t){const s=mt(),a=On(),r=An(),l=s==null?void 0:s.node_name,i=n.useMemo(()=>l?Uo(a,l):new Map,[a,l]);return n.useMemo(()=>{const o=new Map;if(!l||i.size===0)return o;const x=new Map;for(const c of t){if(!c.is_outgoing||!c.is_channel)continue;const b=Math.floor(c.timestamp/30);let y=!1;for(const g of[b-1,b,b+1]){const d=i.get(`${c.text}:${g}`);if(d){const v=x.get(d)??[];v.push(c.id),x.set(d,v),y=!0;break}}}if(x.size===0)return o;const p=new Set(x.keys()),C=new Map;for(const c of r)p.has(c.packet_hash)&&C.set(c.packet_hash,(C.get(c.packet_hash)??0)+1);for(const[c,b]of x){const y=C.get(c)??0,g=Math.max(0,y-1);for(const d of b)o.set(d,g)}return o},[t,l,i,r])}const Vo=n.lazy(()=>ra(()=>import("./CompanionPathMap-D5FruuYA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(t=>({default:t.CompanionPathMap}))),Wo=n.lazy(()=>ra(()=>import("./CompanionEchoMap-BcAn2gmm.js"),__vite__mapDeps([8,1,2,3,5,6,7])).then(t=>({default:t.CompanionEchoMap}))),Os=e.jsx("div",{className:"rounded-lg bg-elevated flex items-center justify-center",style:{aspectRatio:"16 / 10"},children:e.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})});function Qo(t){const s=new Date(t*1e3),r=Math.floor((new Date().getTime()-s.getTime())/864e5);return r===0?"Today":r===1?"Yesterday":s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Yo(t){const s=new Date(t*1e3);return`${s.getFullYear()}-${s.getMonth()}-${s.getDate()}`}function Xo(t){const s=new Map;for(const a of t)a.name&&s.set(a.public_key,a.name);return s}function Jo(t){const s=new Map;for(const a of t)s.set(a.public_key,a);return s}function Zo(t){if(!t)return[];const s=[];for(let a=0;ar.public_key.startsWith(t));return(a==null?void 0:a.name)||null}function ti(t,s){return t.is_outgoing?"You":t.sender_name?t.sender_name:s.get(t.sender_key)??t.sender_key.slice(0,8)}const si=n.memo(function({msg:s,contact:a,contacts:r,selfInfo:l,echoCount:i,channelName:o,children:x}){const[p,C]=n.useState(!1),[c,b]=n.useState(!1),[y,g]=n.useState(0),d=n.useRef(null),v=s.path_len,w=!s.is_outgoing,f=w&&v!=null,M=s.is_outgoing&&s.is_channel&&(i??0)>0,I=(o==null?void 0:o.toLowerCase().includes("wardrive"))??!1,R=n.useMemo(()=>I&&w?Vr(s.text):null,[I,w,s.text]),j=f||M,k=n.useMemo(()=>{const T=[];if(s.path_hops&&s.path_hops.length>0)T.push({hops:s.path_hops,snr:s.path_snr,rssi:s.path_rssi});else if(w&&(a!=null&&a.out_path)){const S=Zo(a.out_path);S.length>0&&T.push({hops:S})}if(s.alternate_paths)for(const S of s.alternate_paths)T.push(S);return T},[s.path_hops,s.path_snr,s.path_rssi,s.alternate_paths,w,a==null?void 0:a.out_path]),$=y1,m=(N==null?void 0:N.snr)??s.msg_snr,_=()=>{b(!0),C(T=>!T)},h=n.useCallback(T=>{var S;T.propertyName==="grid-template-rows"&&(p?(S=d.current)==null||S.scrollIntoView({block:"nearest",behavior:"smooth"}):b(!1))},[p]);return e.jsxs("div",{ref:d,className:P("rounded-xl px-2 py-1 -mx-2 transition-colors duration-150",j&&"hover:bg-subtle-fill cursor-pointer"),onClick:()=>j&&_(),children:[x,j&&e.jsx("div",{className:"grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.83,0,0.17,1)]",style:{gridTemplateRows:p?"1fr":"0fr"},onTransitionEnd:h,children:e.jsxs("div",{className:"overflow-hidden",children:[c&&f&&e.jsxs("div",{className:"mt-1.5 ml-13 space-y-1",children:[u&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",onClick:T=>T.stopPropagation(),children:k.map((T,S)=>e.jsxs("button",{onClick:()=>g(S),className:P("flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] transition-colors",S===$?"bg-sys-blue/15 text-sys-blue font-semibold":"bg-subtle-fill text-fg-muted hover:text-fg-secondary"),children:[e.jsx(Ge,{className:"w-2.5 h-2.5"}),T.hops.length||v,T.snr!=null&&e.jsxs("span",{className:"ml-0.5 opacity-70",children:[T.snr>0?"+":"",T.snr.toFixed(1)]})]},S))}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(Ge,{className:"w-3 h-3 text-fg-muted flex-shrink-0"}),v===0&&!N?e.jsx("span",{className:"text-[10px] text-fg-muted font-medium",children:"Direct"}):N&&N.hops.length>0?N.hops.map((T,S)=>{const O=ei(T,r);return e.jsxs("span",{className:"contents",children:[S>0&&e.jsx(Qr,{className:"w-2.5 h-2.5 text-fg-muted/50 flex-shrink-0"}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-subtle-fill text-[10px]",children:[e.jsx("span",{className:"font-mono text-fg-primary",children:T}),O&&e.jsxs("span",{className:"text-fg-muted",children:["(",O,")"]})]})]},S)}):e.jsxs("span",{className:"text-[10px] text-fg-muted font-medium",children:[v," hop",v>1?"s":""]}),m!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-fg-muted ml-0.5",children:[e.jsx(Sr,{className:"w-2.5 h-2.5"}),m>0?"+":"",m.toFixed(1),"dB"]}),(N==null?void 0:N.rssi)!=null&&e.jsxs("span",{className:"text-[10px] text-fg-muted",children:[N.rssi,"dBm"]})]}),N&&N.hops.length>=1&&e.jsx(n.Suspense,{fallback:Os,children:e.jsx(Vo,{hops:N.hops,contacts:r,selfInfo:l,snr:m,wardriveCoords:R??void 0,wardriveSenderName:s.sender_name})})]}),c&&M&&e.jsx("div",{className:"mt-1.5",children:e.jsx(n.Suspense,{fallback:Os,children:e.jsx(Wo,{text:s.text,timestamp:s.timestamp,contacts:r})})})]})})]})}),ai=n.memo(function({messages:s,contacts:a,className:r,conversationKey:l,onRetry:i,onRetryAsFlood:o,onMentionClick:x,historyLoading:p,historyExhausted:C,onLoadOlder:c,channelName:b}){const y=n.useRef(null),g=n.useRef(null),[d,v]=n.useState(!1),w=n.useRef(s.length),f=n.useRef(0),M=n.useRef(l);n.useEffect(()=>{if(l!==M.current){M.current=l,w.current=s.length,f.current=0,v(!1);const m=y.current;m&&(m.scrollTop=m.scrollHeight)}},[l,s.length]);const I=n.useMemo(()=>Xo(a),[a]),R=n.useMemo(()=>Jo(a),[a]),j=mt(),k=qo(s);n.useEffect(()=>{var _;const m=y.current;if(m){if(s.length>w.current&&f.current>0){const h=m.scrollHeight-f.current;if(h>0&&m.scrollTop<200){m.scrollTop+=h,w.current=s.length,f.current=0;return}}w.current=s.length,d||(_=g.current)==null||_.scrollIntoView({behavior:"smooth"})}},[s.length,d]);const $=n.useCallback(()=>{const m=y.current;if(!m)return;const _=m.scrollHeight-m.scrollTop-m.clientHeight;v(_>100),m.scrollTop<80&&c&&!p&&!C&&(f.current=m.scrollHeight,c())},[c,p,C]),N=n.useCallback(()=>{var m;(m=g.current)==null||m.scrollIntoView({behavior:"smooth"}),v(!1)},[]);let u="";return e.jsxs("div",{className:P("relative flex flex-col",r),children:[e.jsxs("div",{ref:y,onScroll:$,className:"flex-1 overflow-y-auto min-h-0 px-4 py-3",children:[p&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(oe,{className:"w-4 h-4 text-fg-muted animate-spin"})}),s.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-sm text-fg-muted",children:C?"No messages yet":"Loading messages…"})}):s.map(m=>{const _=Yo(m.timestamp),h=_!==u;u=_;const T=m.is_outgoing?m.failed?"failed":m.confirmed?"confirmed":m.unconfirmed?"unconfirmed":(m.retryAttempt??0)>0?"retrying":m.sent?"sent":"pending":void 0,S=m.is_channel&&m.channel_idx!=null?`ch:${m.channel_idx}`:m.sender_key;return e.jsxs("div",{children:[h&&e.jsx(Ur,{text:Qo(m.timestamp)}),e.jsx(si,{msg:m,contact:R.get(m.sender_key),contacts:a,selfInfo:j,echoCount:k.get(m.id),channelName:b,children:e.jsx(qr,{senderName:ti(m,I),text:m.text,timestamp:m.timestamp,isOutgoing:m.is_outgoing,status:T,onRetry:i&&m.failed?()=>i(S,m.id):void 0,onRetryAsFlood:o&&m.failed&&!m.is_channel?()=>o(S,m.id):void 0,retryAttempt:m.retryAttempt,maxRetries:m.maxRetries,echoCount:k.get(m.id),signed:!m.is_outgoing&&m.txt_type===zn.SignedPlain,bubbleVariant:"subtle",onMentionClick:x})})]},m.id)}),e.jsx("div",{ref:g})]}),e.jsx("button",{onClick:N,className:P("absolute bottom-4 right-4 w-8 h-8 rounded-full bg-sys-blue flex items-center justify-center shadow-lg","hover:bg-sys-blue/90 transition-all duration-200",d?"opacity-100 translate-y-0":"opacity-0 translate-y-2 pointer-events-none"),children:e.jsx(Wr,{className:"w-4 h-4 text-white"})})]})}),ni=6,ri=n.memo(function({onSend:s,disabled:a,placeholder:r="Type a message…",className:l,mentionNames:i=[]}){const[o,x]=n.useState(""),[p,C]=n.useState(!1),c=n.useRef(null),[b,y]=n.useState(null),[g,d]=n.useState(-1),[v,w]=n.useState(0),f=n.useMemo(()=>{if(b==null)return[];const N=b.toLowerCase();return i.filter(u=>u.toLowerCase().includes(N)).slice(0,ni)},[b,i]),M=f.length>0;n.useEffect(()=>{w(0)},[f]);const I=n.useCallback(()=>{y(null),d(-1),w(0)},[]),R=n.useCallback(N=>{var S;if(g<0)return;const u=o.slice(0,g),m=((S=c.current)==null?void 0:S.selectionStart)??o.length,_=o.slice(m),h=`@[${N}] `,T=u+h+_;x(T),I(),requestAnimationFrame(()=>{var ie,Y;const O=u.length+h.length;(ie=c.current)==null||ie.setSelectionRange(O,O),(Y=c.current)==null||Y.focus()})},[o,g,I]),j=n.useCallback(async()=>{var u;const N=o.trim();!N||p||a||(C(!0),I(),x(""),await s(N),C(!1),(u=c.current)==null||u.focus())},[o,p,a,s,I]),k=n.useCallback(N=>{const u=N.target.value;x(u);const m=N.target.selectionStart??u.length,_=u.slice(0,m),h=_.lastIndexOf("@");if(h>=0){const T=h>0?_[h-1]:" ";if(/\s/.test(T)||h===0){const S=_.slice(h+1);if(!S.includes(" ")&&!S.includes("[")){y(S),d(h);return}}}I()},[I]),$=n.useCallback(N=>{if(M){if(N.key==="ArrowDown"){N.preventDefault(),w(u=>(u+1)%f.length);return}if(N.key==="ArrowUp"){N.preventDefault(),w(u=>(u-1+f.length)%f.length);return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault(),R(f[v]);return}if(N.key==="Escape"){N.preventDefault(),I();return}}N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),j())},[j,M,f,v,R,I]);return e.jsxs("div",{className:P("relative flex items-center gap-2 p-3 border-t border-edge-subtle",l),children:[M&&e.jsx("div",{className:"absolute bottom-full left-3 right-3 mb-1 radius-inset surface-elevated depth-raised overflow-hidden z-50",children:f.map((N,u)=>{const m=Pt(N),{emoji:_,cleanName:h}=Mt(N),T=Tt(N);return e.jsxs("button",{onMouseDown:S=>{S.preventDefault(),R(N)},className:P("w-full flex items-center gap-2.5 px-3 py-1.5 text-left transition-colors",u===v?"bg-sys-blue/10":"hover:bg-subtle-fill"),children:[e.jsx("div",{className:P("clay-avatar w-5 h-5",_?"text-xs":"text-white text-[9px] font-bold"),style:{"--avatar-color":m},children:_||T}),e.jsx("span",{className:"text-sm text-fg-primary truncate",children:h})]},N)})}),e.jsx("input",{ref:c,type:"text",value:o,onChange:k,onKeyDown:$,onBlur:()=>{setTimeout(I,150)},placeholder:r,disabled:a,className:"flex-1 min-w-0 w-full px-4 py-3 text-sm radius-inner bg-input-bg border border-input-border text-fg-primary placeholder:text-fg-muted/50 ring-focus-inset hover:border-edge-strong transition-colors"}),e.jsx("button",{onClick:j,disabled:!o.trim()||p||a,className:P("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center transition-colors",o.trim()&&!a?"clay-send text-white":"bg-subtle-fill text-fg-muted cursor-not-allowed"),children:e.jsx(Hn,{className:"w-4.5 h-4.5 -translate-x-[0.5px] translate-y-[0.5px]",strokeWidth:2.5})})]})}),Ht="pymc_companion_room_pwd_";function li(t){try{return localStorage.getItem(`${Ht}${t}`)}catch{return null}}function oi(t,s){try{localStorage.setItem(`${Ht}${t}`,s)}catch{}}function As(t){try{localStorage.removeItem(`${Ht}${t}`)}catch{}}const ii=n.memo(function({contact:s,loginStatus:a,onLogin:r,className:l}){const[i,o]=n.useState(""),[x,p]=n.useState(!0),[C,c]=n.useState(null),[b,y]=n.useState(!1),g=n.useRef(null),d=n.useRef(!0),v=s.public_key,w=n.useRef(v);w.current!==v&&(w.current=v,y(!1),c(null),o("")),n.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),n.useEffect(()=>{if(b||a==="success")return;const R=li(v);if(!R){y(!0);return}y(!0),(async()=>{const j=await r(v,R);d.current&&(j||(As(v),c("Saved password rejected — please re-enter.")))})()},[v,b,a,r]);const f=n.useCallback(async()=>{c(null);const R=await r(v,i);d.current&&(R?x&&i?oi(v,i):As(v):c("Login failed — check your password and try again."))},[v,i,x,r]),M=n.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),f())},[f]),I=a==="pending";return I&&!i?e.jsxs("div",{className:P("flex-1 flex flex-col items-center justify-center gap-3",l),children:[e.jsx(oe,{className:"w-6 h-6 text-sys-pink animate-spin"}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Connecting to ",s.name||"room server","…"]})]}):e.jsx(ue.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},className:P("flex-1 flex flex-col items-center justify-center px-6",l),children:e.jsxs("div",{className:"w-full max-w-xs space-y-5",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-pink bg-sys-pink/8",children:e.jsx(dt,{className:"size-7 text-sys-pink"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"type-body font-medium text-fg-primary",children:s.name||"Room Server"}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Enter the room password to join, or try logging in without one — some servers allow open access."})]})]}),(C||a==="failed")&&e.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg bg-sys-red/8 border border-sys-red/15",children:[e.jsx(da,{className:"w-3.5 h-3.5 text-sys-red flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-sys-red leading-relaxed",children:C||"Login failed — check your password and try again."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{ref:g,type:"password",value:i,onChange:R=>o(R.target.value),onKeyDown:M,placeholder:"Room password",disabled:I,autoFocus:!0,className:"w-full surface-input rounded-lg px-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-muted/50 focus:outline-none focus:ring-1 focus:ring-sys-pink/40"}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:R=>p(R.target.checked),disabled:I,className:"surface-checkbox w-3.5 h-3.5 rounded accent-sys-pink"}),e.jsx("span",{className:"text-xs text-fg-muted",children:"Remember password"})]}),e.jsxs(H,{color:"pink",className:"w-full justify-center",disabled:I,onClick:f,children:[I?e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}):e.jsx(kt,{"data-slot":"icon"}),I?"Connecting…":"Login"]})]}),e.jsx("p",{className:"text-[10px] text-fg-muted/60 text-center leading-relaxed",children:"The server determines your permissions based on the password. Admin and guest passwords grant different access levels."})]})})});function zs(t,s){return[t,s].sort().join("-")}function st(t){return t.substring(0,2)}function ci(t){var a,r;const s=(r=(a=t.traceQuality)==null?void 0:a.composite)==null?void 0:r.mean;return s!=null&&s!==0?Math.max(.1,s+20):Math.max(.1,t.strength*20)}function di(t,s,a,r){const{edgeMap:l}=a;if(l.size===0)return null;const i=new Map;for(const[,j]of l){const k=j.fromHash,$=j.toHash;i.has(k)||i.set(k,[]),i.has($)||i.set($,[]),i.get(k).push({neighbor:$,edge:j}),i.get($).push({neighbor:k,edge:j})}const o=new Set(i.keys()),x=Hs(t,o),p=Hs(s,o);if(!x||!p||x===p)return null;const C=new Map,c=new Map,b=new Set,y=[];for(C.set(x,0),c.set(x,null),y.push({node:x,cost:0});y.length>0;){y.sort(($,N)=>$.cost-N.cost);const j=y.shift();if(b.has(j.node))continue;if(b.add(j.node),j.node===p)break;const k=i.get(j.node)??[];for(const{neighbor:$,edge:N}of k){if(b.has($))continue;const u=ci(N),m=j.cost+1/u,_=C.get($)??1/0;m<_&&(C.set($,m),c.set($,j.node),y.push({node:$,cost:m}))}}if(!c.has(p))return null;const g=[];let d=p;for(;d!==null;)g.unshift(d),d=c.get(d)??null;if(g[0]!==x||g.length<2)return null;const v=new Map;for(const j of r)v.set(st(j.public_key),j);const w=g.slice(1,-1),f=w.map((j,k)=>{var T,S;const $=st(j),N=v.get($);let u=0;const m=g[k],_=zs(m,j),h=l.get(_);return(S=(T=h==null?void 0:h.traceQuality)==null?void 0:T.composite)!=null&&S.mean?u=h.traceQuality.composite.mean:(h==null?void 0:h.avgSnr)!=null&&(u=h.avgSnr),{hash:j,prefix:$,name:(N==null?void 0:N.name)||null,snr:u}});let M=0,I=0;for(let j=0;j0?M/I:0;return{hops:w.map(st),confidence:R,via:f}}function Hs(t,s){if(s.has(t))return t;const a=st(t);let r=null,l=0;for(const i of s)if(i.startsWith(a)||t.startsWith(i.substring(0,2))){let o=0;const x=Math.min(t.length,i.length);for(let p=0;pl&&(l=o,r=i)}return r}function Bs(t){switch(t&15){case 1:return"Companion";case 2:return"Repeater";case 3:return"Room Server";default:return"Unknown"}}function Gs(t){switch(t&15){case 1:return"blue";case 2:return"green";case 3:return"indigo";default:return"zinc"}}function ui(t){return(t&15)===2}const Ks=n.memo(function({contact:s,channel:a,contacts:r=[],selfPubKey:l,embedded:i=!1,onResetPath:o,onRequestStatus:x,onRequestTelemetry:p,onLoginToRepeater:C,onLogoutFromRepeater:c,onGetNeighbours:b,onTraceContactPath:y,onDiscoverPath:g,onExportContact:d,onSetContactPath:v,className:w}){const[f,M]=n.useState({}),I=(s==null?void 0:s.public_key)??null,[R,j]=n.useState(I);if(I!==R&&(j(I),M({})),!s&&!a)return i?null:e.jsx("div",{className:P("flex items-center justify-center h-full",w),children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Select a conversation"})});async function k(m,_){M(T=>({...T,[m]:"loading"}));const h=await _();M(T=>({...T,[m]:h?"done":"error"})),setTimeout(()=>M(T=>({...T,[m]:"idle"})),2e3)}const $=a?e.jsxs("div",{className:"space-y-4",children:[!i&&e.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3 border-b border-edge-subtle",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-sys-indigo/15 flex items-center justify-center shadow-md",children:e.jsx(Fe,{className:"size-7 text-sys-indigo"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"type-body font-medium text-fg-primary",children:a.name}),e.jsxs(De,{color:"indigo",children:["Channel ",a.index]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Index"}),e.jsx("span",{className:"font-mono text-fg-primary",children:a.index})]}),e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Type"}),e.jsx("span",{className:"text-fg-primary",children:"Broadcast"})]})]}),e.jsx("div",{className:"pt-2 border-t border-edge-subtle",children:e.jsx("p",{className:"type-data-xs text-fg-muted/70",children:"Channel messages are broadcast-encrypted. Sender identity is not available due to MeshCore protocol limitations."})})]}):null,N=s?e.jsxs("div",{className:"space-y-4",children:[!i&&e.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3 border-b border-edge-subtle",children:[e.jsx(fi,{contact:s}),e.jsxs("div",{className:"text-center",children:[e.jsxs("h3",{className:"type-body font-medium text-fg-primary flex items-center justify-center gap-1",children:[s.name||"Unknown",e.jsx(qs,{pubkey:s.public_key})]}),e.jsx(De,{color:Gs(s.adv_type),children:Bs(s.adv_type)})]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{color:Gs(s.adv_type),children:Bs(s.adv_type)}),e.jsx(qs,{pubkey:s.public_key})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Public Key"}),e.jsx("span",{className:"font-mono text-fg-primary break-all text-[10px]",children:s.public_key})]}),e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(Ge,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"Path Length"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:s.out_path_len})]}),(s.gps_lat!==0||s.gps_lon!==0)&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(ia,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"GPS"}),e.jsxs("span",{className:"text-fg-primary ml-auto font-mono text-[10px]",children:[s.gps_lat.toFixed(5),", ",s.gps_lon.toFixed(5)]})]}),(s.lastmod>0||s.last_advert_timestamp>0)&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(ua,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"Last Heard"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:new Date((s.lastmod||s.last_advert_timestamp)*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),s.last_advert_timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:"Last Advert"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:new Date(s.last_advert_timestamp*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),e.jsx(yi,{contact:s,contacts:r,selfPubKey:l,onSetContactPath:v,onDiscoverPath:g,actionState:f,setActionState:M,runAction:k}),e.jsxs("div",{className:"space-y-2 pt-2 border-t border-edge-subtle",children:[e.jsxs(H,{color:f.reset==="done"?"success":f.reset==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.reset==="loading",onClick:()=>k("reset",()=>o(s.public_key)),children:[e.jsx(ca,{"data-slot":"icon"}),f.reset==="loading"?"Resetting…":f.reset==="done"?"Reset!":"Reset Path"]}),e.jsxs(H,{color:f.status==="done"?"success":f.status==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.status==="loading",onClick:()=>k("status",()=>x(s.public_key)),children:[e.jsx(ma,{"data-slot":"icon"}),f.status==="loading"?"Requesting…":"Request Status"]}),e.jsxs(H,{color:f.telemetry==="done"?"success":f.telemetry==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.telemetry==="loading",onClick:()=>k("telemetry",()=>p(s.public_key)),children:[e.jsx(pa,{"data-slot":"icon"}),f.telemetry==="loading"?"Requesting…":"Request Telemetry"]})]}),d&&e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center",onClick:()=>d(s.public_key),children:[e.jsx(zt,{"data-slot":"icon"}),"Export Contact"]}),ui(s.adv_type)&&e.jsxs(e.Fragment,{children:[e.jsx(bi,{pubkey:s.public_key,onLogin:C,onLogout:c,actionState:f,runAction:k}),e.jsx(vi,{pubkey:s.public_key,onGetNeighbours:b,actionState:f,runAction:k}),e.jsx(ji,{pubkey:s.public_key,contact:s,onTrace:y,actionState:f,runAction:k})]}),e.jsx(mi,{pubkey:s.public_key}),e.jsx(hi,{pubkey:s.public_key})]}):null,u=$??N;return i?e.jsx("div",{className:w,children:u}):e.jsx("div",{className:P("flex flex-col h-full overflow-y-auto",w),children:e.jsx(ge,{mode:"wait",children:a?e.jsx(ue.div,{variants:Yr,initial:"hidden",animate:"visible",exit:"exit",className:"p-4",children:$},`ch-${a.index}`):s?e.jsx(ue.div,{variants:Xr,initial:"hidden",animate:"visible",exit:"exit",className:"p-4",children:N},`contact-${s.public_key}`):null})})});function Us(t){const s=Math.floor(t/86400),a=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${r}m`:`${r}m`}function mi({pubkey:t}){const s=Vn(t);return s?e.jsxs(_e,{defaultOpen:!0,className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(ma,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Status"})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(J,{label:"Battery",value:`${(s.battMilliVolts/1e3).toFixed(2)}V`}),e.jsx(J,{label:"Noise Floor",value:`${s.noiseFloor} dBm`}),e.jsx(J,{label:"Last RSSI",value:`${s.lastRssi} dBm`}),e.jsx(J,{label:"Last SNR",value:`${(s.lastSnr/4).toFixed(1)} dB`}),e.jsx(J,{label:"Uptime",value:Us(s.totalUpTimeSecs)}),e.jsx(J,{label:"Air Time",value:Us(s.totalAirTimeSecs)}),e.jsx(J,{label:"TX Queue",value:String(s.currTxQueueLen)}),e.jsx(J,{label:"Packets Rx",value:String(s.nPacketsRecv)}),e.jsx(J,{label:"Packets Tx",value:String(s.nPacketsSent)}),e.jsx(J,{label:"Flood Rx/Tx",value:`${s.nRecvFlood}/${s.nSentFlood}`}),e.jsx(J,{label:"Direct Rx/Tx",value:`${s.nRecvDirect}/${s.nSentDirect}`}),e.jsx(J,{label:"Dups (D/F)",value:`${s.nDirectDups}/${s.nFloodDups}`}),s.errEvents>0&&e.jsx(J,{label:"Errors",value:String(s.errEvents)})]})})]}):null}function J({label:t,value:s}){return e.jsxs("div",{className:"flex items-center justify-between type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:t}),e.jsx("span",{className:"text-fg-primary font-mono text-[10px]",children:s})]})}function pi(t){switch(t){case 100:return"Generic";case 101:return"Luminosity";case 102:return"Presence";case 103:return"Temperature";case 104:return"Humidity";case 115:return"Pressure";case 116:return"Voltage";case 117:return"Current";case 120:return"Percentage";case 125:return"Concentration";case 128:return"Power";case 136:return"GPS";default:return`Type ${t}`}}function xi(t){switch(t){case 103:return"°C";case 104:return"%";case 115:return" hPa";case 116:return"V";case 117:return"A";case 120:return"%";case 125:return" ppm";case 128:return"W";default:return""}}function hi({pubkey:t}){const s=Wn(t);if(!s)return null;const a=_o(s.lppSensorData);return a.length===0?null:e.jsxs(_e,{defaultOpen:!0,className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(pa,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Telemetry"})]}),e.jsx(Ie,{children:e.jsx("div",{className:"space-y-1.5 py-1",children:a.map((r,l)=>typeof r.value=="object"?e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(J,{label:`Ch${r.channel} GPS Lat`,value:r.value.latitude.toFixed(5)}),e.jsx(J,{label:`Ch${r.channel} GPS Lon`,value:r.value.longitude.toFixed(5)}),e.jsx(J,{label:`Ch${r.channel} GPS Alt`,value:`${r.value.altitude.toFixed(1)}m`})]},l):e.jsx(J,{label:`Ch${r.channel} ${pi(r.type)}`,value:`${typeof r.value=="number"?r.value.toFixed(r.type===103||r.type===116?2:0):r.value}${xi(r.type)}`},l))})})]})}function fi({contact:t}){const{emoji:s}=Mt(t.name||""),a=Pt(t.name||t.public_key),r=t.name?Tt(t.name):t.public_key.slice(0,2).toUpperCase();return(t.adv_type&15)===2?e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center shadow-md ring-[1.5px] ring-sys-blue",children:e.jsx(ze,{className:"size-7 text-sys-blue"})}):(t.adv_type&15)===3?e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center shadow-md ring-[1.5px] ring-sys-pink",children:e.jsx(dt,{className:"size-7 text-sys-pink"})}):e.jsx("div",{className:P("w-14 h-14 clay-avatar",s?"text-2xl":"text-white text-lg font-bold"),style:{"--avatar-color":a},children:s||r})}function qs({pubkey:t}){return Bn().get(t)!==!0?null:e.jsx("span",{title:"Ed25519 verified identity",children:e.jsx(el,{className:"w-4 h-4 text-sys-green flex-shrink-0"})})}const bt=64;function gi(t){if(!t)return[];const s=[];for(let a=0;a0,j=gi(t.out_path),k=n.useCallback(async()=>{if(!r)return;const u=c.split(",").map(h=>h.trim()).filter(Boolean);if(u.length===0){g("Enter at least one hop");return}if(u.length>bt){g(`Max ${bt} hops`);return}if(!u.every(h=>/^[0-9a-fA-F]{1,2}$/.test(h))){g("Each hop must be 1-2 hex characters");return}g(null),o(h=>({...h,path:"loading"}));const _=await r(t.public_key,u);o(h=>({...h,path:_?"done":"error"})),_&&C(!1),setTimeout(()=>o(h=>({...h,path:"idle"})),2e3)},[r,c,t.public_key,o]),$=n.useCallback(()=>{if(!a){f("Self identity not available");return}const u=di(a,t.public_key,M,s);u?(v(u),f(null)):(v(null),f("No route found in topology"))},[a,t.public_key,M,s]),N=n.useCallback(async()=>{if(!r||!d)return;o(m=>({...m,path:"loading"}));const u=await r(t.public_key,d.hops);o(m=>({...m,path:u?"done":"error"})),u&&(v(null),f(null)),setTimeout(()=>o(m=>({...m,path:"idle"})),2e3)},[r,d,t.public_key,o]);return e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(Ge,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Path"}),e.jsx("span",{className:"ml-auto text-[10px] text-fg-muted font-mono",children:R?`${I} hop${I>1?"s":""}`:"direct"})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-2 py-1",children:[j.length>0&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx("span",{className:"text-fg-muted type-data-xs",children:"Route"}),j.map((u,m)=>e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill font-mono text-[10px] text-fg-primary",children:u},m))]}),d&&e.jsxs("div",{className:"space-y-1.5 p-2 rounded-md bg-sys-green/5 border border-sys-green/20",children:[e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-sys-green",children:[e.jsx(Is,{className:"w-3 h-3"}),e.jsxs("span",{children:["Auto-route (",d.via.length," hop",d.via.length!==1?"s":"",", ",Math.round(d.confidence*100),"% confidence)"]})]}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:d.via.map((u,m)=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-subtle-fill text-[10px]",children:[e.jsx("span",{className:"font-mono text-fg-primary",children:u.prefix}),u.name&&e.jsxs("span",{className:"text-fg-muted",children:["(",u.name,")"]}),u.snr!==0&&e.jsx("span",{className:P("font-mono",lt(u.snr)),children:u.snr.toFixed(1)})]},m))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(H,{color:i.path==="done"?"success":"primary",outline:!0,className:"flex-1 justify-center text-xs",disabled:i.path==="loading",onClick:N,children:[e.jsx(be,{"data-slot":"icon"}),i.path==="loading"?"Saving…":"Accept"]}),e.jsxs(H,{plain:!0,className:"text-xs",onClick:()=>{v(null),f(null)},children:[e.jsx(ut,{"data-slot":"icon"}),"Dismiss"]})]})]}),w&&!d&&e.jsx("p",{className:"text-[9px] text-sys-amber",children:w}),r&&!d&&e.jsx("div",{className:"flex items-center gap-2",children:p?e.jsxs("div",{className:"space-y-1.5 flex-1",children:[e.jsx("input",{type:"text",value:c,onChange:u=>{b(u.target.value),g(null)},placeholder:"e.g. a3, f7, 1b",className:"w-full surface-input rounded-md px-2 py-1 text-[10px] font-mono text-fg-primary placeholder:text-fg-muted/50"}),e.jsxs("p",{className:"text-[9px] text-fg-muted/60",children:["Comma-separated hex hop bytes (max ",bt,")"]}),y&&e.jsx("p",{className:"text-[9px] text-sys-red",children:y}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(H,{color:i.path==="done"?"success":i.path==="error"?"danger":"primary",outline:!0,className:"flex-1 justify-center text-xs",disabled:i.path==="loading"||!c.trim(),onClick:k,children:[e.jsx(ao,{"data-slot":"icon"}),i.path==="loading"?"Saving…":"Save"]}),e.jsx(H,{plain:!0,className:"text-xs",onClick:()=>{C(!1),g(null)},children:"Cancel"})]})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{C(!0),b(j.length>0?j.join(", "):""),g(null)},className:"text-[10px] text-sys-blue hover:text-sys-blue/80 transition-colors",children:"Edit path…"}),a&&M.edgeMap.size>0&&e.jsxs("button",{onClick:$,className:"inline-flex items-center gap-0.5 text-[10px] text-sys-indigo hover:text-sys-indigo/80 transition-colors",children:[e.jsx(Is,{className:"w-3 h-3"}),"Auto-route"]}),l&&e.jsxs("button",{onClick:()=>x("discover",()=>l(t.public_key)),disabled:i.discover==="loading",className:P("inline-flex items-center gap-0.5 text-[10px] transition-colors disabled:opacity-50",i.discover==="error"?"text-sys-red":"text-sys-green hover:text-sys-green/80"),children:[e.jsx(tl,{className:"w-3 h-3"}),i.discover==="loading"?"Discovering…":i.discover==="done"?"Discovered!":i.discover==="error"?"Failed":"Discover"]})]})})]})})]})}function bi({pubkey:t,onLogin:s,onLogout:a,actionState:r,runAction:l}){const[i,o]=n.useState(""),x=It(t);return s?e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(kt,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Login"}),x!=="idle"&&e.jsx(De,{color:x==="success"?"green":x==="failed"?"red":"amber",className:"ml-auto text-[9px]",children:x})]}),e.jsx(Ie,{children:e.jsx("div",{className:"space-y-1.5 py-1",children:x==="success"&&a?e.jsxs(H,{color:r.logout==="done"?"success":r.logout==="error"?"danger":"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.logout==="loading",onClick:()=>l("logout",()=>a(t)),children:[e.jsx(Kn,{"data-slot":"icon"}),r.logout==="loading"?"Disconnecting…":"Disconnect"]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"password",value:i,onChange:p=>o(p.target.value),placeholder:"Repeater password",className:"w-full surface-input rounded-md px-2 py-1 text-[10px] text-fg-primary placeholder:text-fg-muted/50"}),e.jsxs(H,{color:x==="failed"?"danger":"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.login==="loading"||!i.trim(),onClick:()=>l("login",()=>s(t,i)),children:[e.jsx(kt,{"data-slot":"icon"}),r.login==="loading"?"Logging in…":"Login"]})]})})})]}):null}function vi({pubkey:t,onGetNeighbours:s,actionState:a,runAction:r}){const l=Un(t),i=It(t);return s?e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(wt,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Neighbours"}),l&&e.jsx("span",{className:"ml-auto text-[10px] text-fg-muted",children:l.total})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center text-xs",disabled:a.neighbours==="loading"||i!=="success",onClick:()=>r("neighbours",()=>s(t)),children:[e.jsx(wt,{"data-slot":"icon"}),a.neighbours==="loading"?"Loading…":"Get Neighbours"]}),i!=="success"&&e.jsx("p",{className:"text-[9px] text-fg-muted/60",children:"Login required to query neighbours"}),l&&l.neighbours.length>0&&e.jsx("div",{className:"space-y-1",children:[...l.neighbours].sort((o,x)=>x.snr-o.snr).map((o,x)=>e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-primary font-mono text-[10px] w-16 truncate",children:o.name||o.prefixHex.slice(0,8)}),e.jsx("span",{className:"text-fg-muted text-[9px]",children:Ni(o.heardAgo)}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 ml-auto",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-subtle-fill overflow-hidden",children:e.jsx("div",{className:P("h-full rounded-full",wi(o.snr)),style:{width:`${Math.min(100,Math.max(5,(o.snr+20)/35*100))}%`}})}),e.jsx("span",{className:P("font-mono text-[9px] w-8 text-right",lt(o.snr)),children:o.snr.toFixed(1)})]})]},x))})]})})]}):null}function ji({pubkey:t,contact:s,onTrace:a,actionState:r,runAction:l}){const i=qn(t);if(!a)return null;const o=s.out_path_len>0;return e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(Es,{className:"w-3.5 h-3.5 text-sys-indigo"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Trace"}),i&&e.jsxs("span",{className:"ml-auto text-[10px] text-fg-muted",children:[i.pathLen," hops"]})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.trace==="loading"||!o,onClick:()=>l("trace",()=>a(t)),children:[e.jsx(Es,{"data-slot":"icon"}),r.trace==="loading"?"Tracing…":"Trace Path"]}),!o&&e.jsx("p",{className:"text-[9px] text-fg-muted/60",children:"Direct neighbour — no path to trace"}),i&&i.hops.length>0&&e.jsxs("div",{className:"space-y-1",children:[i.hops.map((x,p)=>e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted text-[9px] w-3",children:p+1}),e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill font-mono text-[10px] text-fg-primary",children:x.hash}),x.name&&e.jsx("span",{className:"text-fg-muted text-[10px] truncate",children:x.name}),e.jsxs("span",{className:P("font-mono text-[10px] ml-auto",lt(x.snr)),children:[x.snr.toFixed(1)," dB"]})]},p)),e.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-1 border-t border-edge-subtle",children:[e.jsx("span",{className:"text-fg-muted",children:"Last SNR"}),e.jsxs("span",{className:P("font-mono text-[10px]",lt(i.lastSnr)),children:[i.lastSnr.toFixed(1)," dB"]})]})]})]})})]})}function lt(t){return t>5?"text-sys-green":t>0?"text-sys-amber":"text-sys-red"}function wi(t){return t>5?"bg-sys-green":t>0?"bg-sys-amber":"bg-sys-red"}function Ni(t){return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}const Vs=128,Ws=/^[0-9a-fA-F]+$/;function ki({open:t,onClose:s}){const a=se(S=>S.exportPrivateKey),r=se(S=>S.importPrivateKey),[l,i]=n.useState("export"),[o,x]=n.useState(null),[p,C]=n.useState(!1),[c,b]=n.useState(!1),[y,g]=n.useState(""),[d,v]=n.useState(!1),[w,f]=n.useState(!1),[M,I]=n.useState(!1),[R,j]=n.useState(!1),[k,$]=n.useState(null),[N,u]=n.useState(!1);t!==N&&(u(t),t&&(i("export"),x(null),C(!1),b(!1),g(""),v(!1),f(!1),I(!1),j(!1),$(null)));const m=n.useCallback(async()=>{C(!0),$(null),j(!1);try{const S=await a();S==="disabled"?j(!0):x(S.hex)}catch(S){$(S instanceof Error?S.message:"Export failed")}finally{C(!1)}},[a]),_=n.useCallback(async()=>{if(o)try{await navigator.clipboard.writeText(o),b(!0),setTimeout(()=>b(!1),2e3)}catch{$("Failed to copy to clipboard")}},[o]),h=y.length===Vs&&Ws.test(y),T=n.useCallback(async()=>{f(!1),v(!0),$(null),j(!1);try{await r(y)==="disabled"?j(!0):I(!0)}catch(S){$(S instanceof Error?S.message:"Import failed")}finally{v(!1)}},[r,y]);return e.jsxs(e.Fragment,{children:[e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:e.jsx(ha,{className:"w-5 h-5"}),title:"Key Management",onClose:s}),e.jsxs(we,{children:[R&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3 mb-4 rounded-lg bg-sys-amber/10 border border-sys-amber/20",children:[e.jsx(Qn,{className:"w-4 h-4 text-sys-amber flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"type-body-sm font-medium text-sys-amber",children:"Key operations disabled"}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-0.5",children:"This device's firmware has disabled private key export/import. This is a security setting configured at build time and cannot be changed remotely."})]})]}),e.jsx("div",{className:"flex gap-1 mb-4 p-0.5 rounded-lg bg-subtle-fill",children:["export","import"].map(S=>e.jsxs("button",{onClick:()=>{i(S),$(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 px-3 rounded-md text-sm font-medium transition-colors",l===S?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[S==="export"?e.jsx(He,{className:"w-3.5 h-3.5"}):e.jsx(zt,{className:"w-3.5 h-3.5"}),S==="export"?"Export":"Import"]},S))}),l==="export"&&e.jsx("div",{className:"space-y-4",children:o?e.jsxs(re,{children:[e.jsx(le,{children:"Private Key (64 bytes)"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"p-3 rounded-lg bg-subtle-fill border border-edge-subtle font-mono text-xs break-all select-all leading-relaxed",children:o}),e.jsx("button",{onClick:_,className:"absolute top-2 right-2 p-1.5 rounded-md hover:bg-subtle-fill-strong transition-colors",title:"Copy to clipboard",children:c?e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"}):e.jsx(Et,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),e.jsx(ke,{children:e.jsxs("span",{className:"flex items-start gap-1.5 mt-1",children:[e.jsx(Be,{className:"w-3 h-3 text-sys-amber flex-shrink-0 mt-0.5"}),"This key controls your mesh identity. Never share it."]})})]}):e.jsxs("div",{className:"text-center py-4",children:[e.jsx("p",{className:"type-body-sm text-fg-muted mb-3",children:"Export your device's private key for backup. Keep it secret — anyone with this key can impersonate your mesh identity."}),e.jsx(H,{color:"primary",onClick:m,disabled:p||R,children:p?"Exporting…":"Export Private Key"})]})}),l==="import"&&e.jsx("div",{className:"space-y-4",children:M?e.jsxs("div",{className:"text-center py-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-green/10 mx-auto mb-3 flex items-center justify-center",children:e.jsx(be,{className:"w-5 h-5 text-sys-green"})}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:"Key imported successfully"}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:"The device identity has been updated. You may need to reconnect."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(le,{children:"Private Key (128 hex characters)"}),e.jsx("textarea",{value:y,onChange:S=>g(S.target.value.replace(/\s/g,"")),placeholder:"Paste your 128-character hex private key here…",rows:3,className:"w-full p-3 rounded-lg bg-subtle-fill border border-edge-subtle font-mono text-xs resize-none focus:outline-none focus:ring-2 focus:ring-sys-blue/50 placeholder:text-fg-muted/40"}),e.jsxs(ke,{children:[y.length>0&&!h&&e.jsx("span",{className:"text-sys-red",children:Ws.test(y)?`${y.length}/${Vs} characters`:"Invalid characters — hex only (0-9, a-f)"}),y.length>0&&h&&e.jsx("span",{className:"text-sys-green",children:"Valid key format ✓"})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-lg bg-sys-red/5 border border-sys-red/10",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-red flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-data-xs text-fg-muted",children:["Importing a key ",e.jsx("strong",{className:"text-fg-secondary",children:"permanently replaces"})," the device's current identity. All existing contacts will see you as a new node."]})]})]})}),k&&e.jsx("p",{className:"type-data-xs text-sys-red mt-3",children:k})]}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Close"}),l==="import"&&!M&&e.jsx(H,{color:"danger",onClick:()=>f(!0),disabled:!h||d||R,children:d?"Importing…":"Import Key"})]})]}),e.jsx(xa,{isOpen:w,title:"Replace Device Identity?",message:"This will permanently replace the device's Ed25519 private key. The current identity cannot be recovered unless you have a backup. Continue?",confirmLabel:"Replace Key",cancelLabel:"Cancel",variant:"danger",onConfirm:T,onCancel:()=>f(!1)})]})}function Sa(t){return t.settings??{}}const _a="pymc_companion_recent_regions",Bt=8;function Ra(){try{const t=localStorage.getItem(_a);return t?JSON.parse(t).slice(0,Bt):[]}catch{return[]}}function Ci(t){try{localStorage.setItem(_a,JSON.stringify(t.slice(0,Bt)))}catch{}}function Si(t){const s=Ra().filter(r=>r!==t);s.unshift(t);const a=s.slice(0,Bt);return Ci(a),a}function Qs(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _i({open:t,onClose:s,mode:a,identity:r,onSave:l}){const i=a==="edit"&&r,[o,x]=n.useState(""),[p,C]=n.useState(""),[c,b]=n.useState(""),[y,g]=n.useState(!1),[d,v]=n.useState(""),[w,f]=n.useState(5e3),[M,I]=n.useState("0.0.0.0"),[R,j]=n.useState(!1),[k,$]=n.useState(null),[N,u]=n.useState(""),m=`${t}-${(r==null?void 0:r.name)??""}-${a}`;if(m!==N)if(u(m),$(null),j(!1),g(!1),i){const h=Sa(r);x(r.name),C(""),b(r.identity_key??""),v(h.node_name??r.name),f(h.tcp_port??5e3),I(h.bind_address??"0.0.0.0")}else x(""),C(""),b(""),v(""),f(5e3),I("0.0.0.0");const _=n.useCallback(async()=>{var h,T;if(!i&&!o.trim()){$("Name is required");return}j(!0),$(null);try{if(i){const S={name:r.name,new_name:p,identity_key:c,type:"companion",settings:{node_name:d,tcp_port:w,bind_address:M}},O=await er(S);if(!O.success&&!((h=O.data)!=null&&h.message))throw new Error(O.error||"Failed")}else{const S={name:o.trim(),identity_key:c,type:"companion",settings:{node_name:d||o.trim(),tcp_port:w??5e3,bind_address:M||"0.0.0.0"}},O=await tr(S);if(!O.success&&!((T=O.data)!=null&&T.message))throw new Error(O.error||"Failed")}await l(),s()}catch(S){$(S instanceof Error?S.message:"Operation failed")}finally{j(!1)}},[i,r,o,p,c,d,w,M,l,s]);return e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:i?void 0:e.jsx(ye,{className:"w-5 h-5"}),title:i?"Edit Companion":"Add Companion",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-5",children:[i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{color:r.registered?"green":"red",children:r.registered?"Active":"Inactive"}),r.hash&&e.jsx("span",{className:"type-data-xs text-fg-muted",children:r.hash})]}),i?e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(le,{children:"Current Name"}),e.jsx(pe,{value:r.name,disabled:!0})]}),e.jsxs(re,{children:[e.jsxs(le,{children:["New Name ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(pe,{value:p,onChange:h=>C(h.target.value),placeholder:"Leave empty to keep current name"})]})]}):e.jsxs(re,{children:[e.jsx(le,{children:"Name"}),e.jsx(pe,{value:o,onChange:h=>x(h.target.value),placeholder:"e.g., TestCompanion",autoFocus:!0})]}),e.jsxs(re,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(le,{children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>g(h=>!h),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:y?"Hide":"Show"})]}),y&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{value:c,onChange:h=>b(h.target.value),placeholder:i?"Leave empty to keep current key":"Leave empty to auto-generate",className:"font-mono"}),e.jsx(ke,{children:"32 or 64 bytes hex."})]})]}),e.jsxs(re,{children:[e.jsx(le,{children:"Node Name"}),e.jsx(pe,{value:d,onChange:h=>v(h.target.value),placeholder:"Display name"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(re,{children:[e.jsx(le,{children:"TCP Port"}),e.jsx(pe,{type:"number",min:1,max:65535,value:w,onChange:h=>f(parseInt(h.target.value,10)||5e3)})]}),e.jsxs(re,{children:[e.jsx(le,{children:"Bind Address"}),e.jsx(pe,{value:M,onChange:h=>I(h.target.value),placeholder:"0.0.0.0"})]})]}),k&&e.jsx("p",{className:"type-data-xs text-sys-red",children:k})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsx(H,{color:"primary",onClick:_,disabled:R,children:R?"Saving…":i?"Save":"Create"})]})]})}function Ri(){const t=Jn(),s=la(),{setFloodScope:a,clearFloodScope:r}=se.getState(),[l,i]=n.useState(""),[o,x]=n.useState(!1),[p,C]=n.useState(Ra),[c,b]=n.useState(null),y=n.useRef(null),g=l.trim()?Qs(l.trim()):"",d=n.useCallback(async f=>{const M=Qs(f);if(!M)return;x(!0),b(null),i(""),C(Si(M)),await a(M)||b("Failed to set transport key on device"),x(!1)},[a]),v=n.useCallback(async()=>{x(!0),b(null),await r()||b("Failed to clear transport key on device"),x(!1)},[r]),w=n.useCallback(f=>{f.key==="Enter"&&g&&(f.preventDefault(),d(g))},[g,d]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-lg bg-sys-blue/5 border border-sys-blue/10",children:[e.jsx(nt,{className:"w-4 h-4 text-sys-blue flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-data-xs text-fg-muted",children:["A transport key filters which flood packets the companion device forwards. Set a region name to derive a SHA-256 transport key from ",e.jsx("code",{className:"text-fg-secondary",children:"#name"}),". Only one transport key can be active at a time."]})]}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"w-4 h-4 text-fg-muted"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Active Transport Key"})]}),t?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-sys-green/10 text-sys-green type-data font-medium",children:[e.jsx(ia,{className:"w-3.5 h-3.5"}),"#",t]}),e.jsx("button",{onClick:v,disabled:o||!s,className:"p-1.5 rounded-lg hover:bg-sys-red/10 transition-colors disabled:opacity-50",title:"Clear transport key",children:o?e.jsx(oe,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsx(ut,{className:"w-3.5 h-3.5 text-fg-muted hover:text-sys-red"})})]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-subtle-fill-strong text-fg-muted type-data",children:[e.jsx(Zn,{className:"w-3.5 h-3.5"}),"Global (no filter)"]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Set Region"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-muted/50 type-data",children:"#"}),e.jsx("input",{ref:y,type:"text",value:l,onChange:f=>i(f.target.value),onKeyDown:w,placeholder:"e.g., south-bay",disabled:!s,className:"w-full pl-7 pr-3 py-2 rounded-lg bg-subtle-fill border border-edge-subtle text-sm text-fg-primary placeholder:text-fg-muted/40 focus:outline-none focus:ring-2 focus:ring-sys-blue/50 disabled:opacity-50"})]}),e.jsxs(H,{color:"primary",onClick:()=>d(g),disabled:!g||o||!s,children:[o?e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}):null,"Set"]})]}),g&&g!==l.trim().toLowerCase()&&e.jsxs("p",{className:"type-data-xs text-fg-muted mt-1",children:["Will set as ",e.jsxs("span",{className:"font-mono text-fg-secondary",children:["#",g]})]})]}),p.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(ua,{className:"w-3.5 h-3.5 text-fg-muted/50"}),e.jsx("span",{className:"type-label text-fg-muted",children:"Recent Regions"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(f=>e.jsx("button",{onClick:()=>d(f),disabled:o||!s,className:P("inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium transition-colors","disabled:opacity-50 disabled:cursor-not-allowed",f===t?"bg-sys-green/10 text-sys-green":"bg-subtle-fill hover:bg-subtle-fill-strong text-fg-secondary"),children:e.jsxs("span",{className:"font-mono",children:["#",f]})},f))})]}),!s&&e.jsx("p",{className:"type-data-xs text-sys-amber",children:"Companion device is not connected. Connect to a companion to manage transport keys."}),c&&e.jsx("p",{className:"type-data-xs text-sys-red",children:c})]})}function Ys({open:t,onClose:s,onRefresh:a}){const[r,l]=n.useState("companions"),[i,o]=n.useState(null),[x,p]=n.useState(!0),[C,c]=n.useState(!1),[b,y]=n.useState("create"),[g,d]=n.useState(null),[v,w]=n.useState(null),[f,M]=n.useState(!1),[I,R]=n.useState(!1),j=n.useRef(!0);n.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const[k,$]=n.useState(!1);t!==k&&($(t),t&&l("companions"));const N=n.useCallback(async()=>{p(!0);try{const h=await Yn();j.current&&h.success&&h.data&&o(h.data)}catch{}finally{j.current&&p(!1)}},[]);n.useEffect(()=>{t&&N()},[t,N]);const u=(i==null?void 0:i.configured_companions)??[],m=n.useCallback(async()=>{await N(),a==null||a()},[N,a]),_=n.useCallback(async()=>{if(v){M(!0);try{await Xn(v.name,"companion"),await m()}catch{}finally{j.current&&(M(!1),w(null))}}},[v,m]);return e.jsxs(e.Fragment,{children:[e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:e.jsx(ye,{className:"w-5 h-5"}),title:"Companion Configuration",onClose:s}),e.jsxs(we,{children:[e.jsx("div",{className:"flex gap-1 mb-4 p-0.5 rounded-lg bg-subtle-fill",children:[["companions","Companions",ye],["transport","Transport Key",fa]].map(([h,T,S])=>e.jsxs("button",{onClick:()=>l(h),className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 px-3 rounded-md text-sm font-medium transition-colors",r===h?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(S,{className:"w-3.5 h-3.5"}),T]},h))}),r==="companions"&&e.jsx(e.Fragment,{children:x?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(oe,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading…"})]}):u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(h=>{const T=Sa(h);return e.jsxs("div",{className:"bg-subtle-fill radius-inner p-3 hover:bg-subtle-fill-strong transition-base",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:P("h-2 w-2 rounded-full flex-shrink-0",h.registered?"bg-sys-green":"bg-sys-red")}),e.jsx("h3",{className:"type-body-sm text-fg-primary font-medium truncate flex-1",children:h.name}),e.jsx(De,{color:h.registered?"green":"red",children:h.registered?"Active":"Inactive"}),e.jsx(H,{color:"primary",plain:!0,onClick:()=>{d(h),y("edit"),c(!0)},children:e.jsx(sl,{"data-slot":"icon"})}),e.jsx(H,{color:"danger",plain:!0,onClick:()=>w(h),children:e.jsx(Ke,{"data-slot":"icon"})})]}),e.jsxs("div",{className:"mt-1.5 type-data-xs text-fg-muted pl-5",children:[T.node_name||h.name," · Port ",T.tcp_port??5e3," · ",T.bind_address||"0.0.0.0"]})]},h.name)})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:e.jsx(ye,{className:"w-5 h-5 text-fg-muted/50"})}),e.jsx("p",{className:"text-sm text-fg-muted",children:"No companions configured"})]})}),r==="transport"&&e.jsx(Ri,{})]}),e.jsxs(Me,{children:[r==="companions"&&e.jsx(H,{plain:!0,onClick:()=>R(!0),title:"Key Management",children:e.jsx(ha,{"data-slot":"icon"})}),e.jsx("div",{className:"flex-1"}),e.jsx(H,{plain:!0,onClick:s,children:"Close"}),r==="companions"&&e.jsxs(H,{color:"primary",onClick:()=>{d(null),y("create"),c(!0)},children:[e.jsx(Ue,{"data-slot":"icon"})," Add Companion"]})]})]}),e.jsx(_i,{open:C,onClose:()=>c(!1),mode:b,identity:g,onSave:m}),e.jsx(xa,{isOpen:!!v,title:"Delete Companion",message:`Delete '${v==null?void 0:v.name}'? A service restart is required.`,confirmLabel:f?"Deleting…":"Delete",cancelLabel:"Cancel",variant:"danger",onConfirm:_,onCancel:()=>w(null)}),e.jsx(ki,{open:I,onClose:()=>R(!1)})]})}const Ii=n.memo(function({companions:s,selected:a,onSelect:r}){return s.length<2?null:e.jsx("select",{value:a??"",onChange:l=>r(l.target.value),className:"px-2 py-1 text-sm bg-transparent border border-edge-subtle radius-inner text-fg-primary focus:outline-none focus:ring-1 focus:ring-sys-blue/40",children:s.map(l=>e.jsx("option",{value:l.companion_name,children:l.node_name||l.companion_name},l.companion_name))})}),Ae=[{value:"Chat Node",label:"Companions"},{value:"Room Server",label:"Room Servers"},{value:"Repeater",label:"Repeaters"}],Ei=[{value:"all",label:"All time"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function Mi(t){switch(t){case"24h":return 24;case"7d":return 168;case"30d":return 720;default:return}}function Pi({open:t,onClose:s,companionName:a,onImport:r}){const[l,i]=n.useState(()=>new Set(Ae.map(R=>R.value))),[o,x]=n.useState("all"),[p,C]=n.useState(""),[c,b]=n.useState(!1),[y,g]=n.useState(null),[d,v]=n.useState(t);t!==d&&(v(t),t&&(i(new Set(Ae.map(R=>R.value))),x("all"),C(""),b(!1),g(null)));const w=l.size===Ae.length;function f(R){i(j=>{const k=new Set(j);return k.has(R)?k.delete(R):k.add(R),k})}function M(){i(w?new Set:new Set(Ae.map(R=>R.value)))}const I=n.useCallback(async()=>{if(!(l.size===0||c)){b(!0),g(null);try{const R={types:[...l],hours:Mi(o)},j=parseInt(p,10);j>0&&(R.limit=j);const k=await r(R);g(k)}finally{b(!1)}}},[l,o,p,c,r]);return e.jsxs(je,{open:t,onClose:s,size:"sm",children:[e.jsx(Ee,{title:"Import repeater contacts",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("p",{className:"text-sm text-fg-secondary",children:["Seed ",e.jsx("strong",{className:"text-fg-primary",children:a})," with contacts from the repeater's adverts. Results are ordered by most recent first."]}),e.jsxs(re,{children:[e.jsx(le,{children:"Contact types"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx(ws,{checked:w,indeterminate:l.size>0&&!w,onChange:M,label:"All types",size:"sm"}),e.jsx("div",{className:"ml-6 space-y-1.5",children:Ae.map(R=>e.jsx(ws,{checked:l.has(R.value),onChange:()=>f(R.value),label:R.label,size:"sm"},R.value))})]})]}),e.jsx(po,{label:"Recency",value:o,onChange:x,options:Ei,orientation:"horizontal",size:"sm"}),e.jsxs(re,{children:[e.jsxs(le,{children:["Import at most ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(optional)"})]}),e.jsx(pe,{type:"number",min:1,value:p,onChange:R=>C(R.target.value),placeholder:"No limit",className:"mt-1"}),e.jsx(ke,{children:"Leave empty for no cap."})]}),y&&e.jsxs("p",{className:"text-sm text-sys-green font-medium",children:["Imported ",y.added," new contact",y.added!==1?"s":""," (",y.total," total)"]})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsx(H,{color:"primary",onClick:I,disabled:c||l.size===0,children:c?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}),"Importing…"]}):"Import"})]})]})}const Ti=["alameda","alpine","amador","butte","calaveras","colusa","contracosta","contra-costa","delnorte","del-norte","eldorado","el-dorado","fresno","glenn","humboldt","imperial","inyo","kern","kings","lake","lassen","losangeles","los-angeles","la-county","madera","marin","mariposa","mendocino","merced","modoc","mono","monterey","napa","nevada","orange","oc","placer","plumas","riverside","sacramento","sac","sanbenito","san-benito","sanbernardino","san-bernardino","sandiego","san-diego","sd","sanfrancisco","san-francisco","sf","sanjoaquin","san-joaquin","sanluisobispo","san-luis-obispo","slo","sanmateo","san-mateo","santabarbara","santa-barbara","sb","santaclara","santa-clara","santacruz","santa-cruz","shasta","sierra","siskiyou","solano","sonoma","stanislaus","sutter","tehama","trinity","tulare","tuolumne","ventura","yolo","yuba","losangeles","los-angeles","la","hollywood","westhollywood","west-hollywood","weho","beverlyhills","beverly-hills","santamonica","santa-monica","culvercity","culver-city","marinadelrey","marina-del-rey","venice","venicebeach","venice-beach","malibu","palisades","pacificpalisades","pacific-palisades","brentwood","westwood","westla","west-la","dtla","downtown","downtownla","downtown-la","koreatown","ktown","silverlake","silver-lake","losfeliz","los-feliz","echopark","echo-park","eastla","east-la","boyleheights","boyle-heights","highlandpark","highland-park","eaglerock","eagle-rock","pasadena","southpasadena","south-pasadena","glendale","burbank","tolucalake","toluca-lake","studiocity","studio-city","shermanoaks","sherman-oaks","encino","tarzana","reseda","vannuys","van-nuys","northhollywood","north-hollywood","noho","woodlandhills","woodland-hills","calabasas","topanga","agourahills","agoura-hills","thousandoaks","thousand-oaks","simivalley","simi-valley","simi","moorpark","camarillo","oxnard","porthueneme","port-hueneme","ventura","ojai","sfv","sfvalley","sf-valley","thevalley","the-valley","sanfernando","san-fernando","sanfernandovalley","san-fernando-valley","pacoima","sylmar","sunland","tujunga","sunlandtujunga","lakeviewterrace","lakeview-terrace","shadowhills","shadow-hills","chatsworth","northridge","granadahills","granada-hills","missionhills","mission-hills","panoramacity","panorama-city","arleta","sunvalley","sun-valley","santaclarita","santa-clarita","scv","valencia","newhall","saugus","canyoncountry","canyon-country","castaic","stevenson","stevensonranch","stevenson-ranch","acton","agua-dulce","aguadulce","palmdale","lancaster","antelopevalley","antelope-valley","av","avmesh","av-mesh","quartz-hill","quartzhill","littlerock","little-rock","pearblossom","pear-blossom","lakelosangeles","lake-los-angeles","highdesert","high-desert","hd","hdmesh","hd-mesh","victorville","hesperia","applevalley","apple-valley","barstow","adelanto","phelan","pinon-hills","pinonhills","wrightwood","bigbear","big-bear","lakeisabella","lake-isabella","inlandempire","inland-empire","ie","riverside","corona","moreno-valley","morenovalley","fontana","ontario","rancho","ranchocucamonga","rancho-cucamonga","upland","claremont","pomona","azusa","glendora","covina","westcovina","west-covina","diamondbar","diamond-bar","chino","chinohills","chino-hills","sanbernardinocity","rialto","colton","redlands","yuciapa","yucaipa","beaumont","banning","hemet","perris","menifee","temecula","murrieta","wildomar","lakeland","lakeelsinore","lake-elsinore","orangecounty","orange-county","oc","anaheim","fullerton","santaana","santa-ana","irvine","costamesa","costa-mesa","newportbeach","newport-beach","newport","huntingtonbeach","huntington-beach","hb","surfcity","surf-city","lagunabeach","laguna-beach","lagunaniguel","laguna-niguel","sanclemente","san-clemente","danapoint","dana-point","missionviejo","mission-viejo","lakeforest","lake-forest","rsm","ranchosantamargarita","rancho-santa-margarita","alisoviejo","aliso-viejo","tustin","orange","yorbalinda","yorba-linda","brea","lahabra","la-habra","placentia","buenapark","buena-park","cypress","losalamitojos","sealbeach","seal-beach","gardengrove","garden-grove","westminster","stanton","fountainvalley","sandiego","san-diego","sd","sdmesh","sd-mesh","lajolla","la-jolla","pacificbeach","pacific-beach","pb","missionbeach","mission-beach","oceanbeach","ocean-beach","ob","pointloma","point-loma","coronado","hillcrest","northpark","north-park","southpark","south-park","normalheights","normal-heights","cityheights","city-heights","lamesa","la-mesa","elcajon","el-cajon","santee","lakeside","poway","ramona","julian","alpine","escondido","sanmarcos","san-marcos","vista","oceanside","carlsbad","encinitas","delmar","del-mar","solanabeanch","solana-beach","chulavista","chula-vista","nationalcity","national-city","imperialbeach","imperial-beach","ib","southbay","south-bay","torrance","gardena","hawthorne","lawndale","redondo","redondobeach","hermosa","hermosabeach","manhattan","manhattanbeach","manhattan-beach","elsegundo","el-segundo","palosverdes","palos-verdes","pv","ranchopalosverdes","rancho-palos-verdes","sanpedro","san-pedro","wilmington","carson","compton","longbeach","long-beach","lb","signalhill","signal-hill","lakewood","cerritos","artesia","lamirada","la-mirada","norwalk","whittier","lahabra","la-habra-heights","downey","bellflower","paramount","southgate","south-gate","lynwood","bellgardens","bell-gardens","cudahy","huntingtonpark","maywood","vernon","commerce","montebello","picorivera","pico-rivera","montereypark","monterey-park","alhambra","sanmarinno","san-marino","arcadia","monrovia","duarte","azusa","irwindale","baldwinpark","baldwin-park","elmonbte","el-monte","southelmonte","south-el-monte","rosemead","temple-city","templecity","sangabriel","san-gabriel","santabarbara","santa-barbara","sb","goleta","carpinteria","montecito","islavista","isla-vista","iv","ucsb","slo","sanluisobispo","san-luis-obispo","morrobay","morro-bay","pismobeach","pismo-beach","pismo","shellbeach","shell-beach","arroyogrande","arroyo-grande","groverbeach","grover-beach","oceano","santamaria","santa-maria","lompoc","vandenberg","solvang","buellton","losalamos","los-alamos","atascadero","pasorobles","paso-robles","paso","cambria","cayucos","sansiemon","san-simeon","hearst","fresno","clovis","visalia","tulare","hanford","porterville","bakersfield","bako","delano","wasco","shafter","taft","tehachapi","stockton","tracy","manteca","lodi","modesto","turlock","merced","madera","chowchilla","losabnos","los-banos","sacramento","sac","sactown","westsacramento","west-sacramento","westsac","elkgrove","elk-grove","folsom","ranchocordova","rancho-cordova","roseville","rocklin","lincoln","citrus-heights","citrusheights","fair-oaks","fairoaks","carmichael","orangevale","davis","woodland","dixon","vacaville","fairfield","vallejo","bayarea","bay-area","sfbay","sf-bay","sanfrancisco","san-francisco","sf","sfmesh","sf-mesh","oakland","eastbay","east-bay","berkeley","emeryville","alameda","sanleandro","san-leandro","hayward","fremont","unioncity","union-city","newark","milpitas","sanjose","san-jose","sj","campbell","saratoga","losgartos","los-gatos","sunnyvale","santaclara","santa-clara","cupertino","mountainview","mountain-view","paloalto","palo-alto","menlopark","menlo-park","atherton","redwoodcity","redwood-city","sancarlos","san-carlos","belmont","sanmateo","san-mateo","fostercity","foster-city","burlingame","sanbruno","san-bruno","southsanfrancisco","ssf","dalycity","daly-city","pacifica","halfmoonbay","half-moon-bay","hmb","santacruz","santa-cruz","capitola","scottsvalley","scotts-valley","watsonville","aptos","soquel","concord","walnutcreek","walnut-creek","pleasant-hill","pleasanthill","martinez","antioch","pittsburg","brentwood","oakley","discovery-bay","livermore","pleasanton","dublin","sanramon","san-ramon","danville","richmond","sanpablo","san-pablo","pinole","hercules","napa","sonoma","petaluma","santarosa","santa-rosa","rohnertpark","novato","sanrafael","san-rafael","sausalito","tiburon","millvalley","mill-valley","redding","chico","oroville","paradise","reddingbluff","redbluff","red-bluff","shasta","mtshasta","mt-shasta","eureka","arcata","fortuna","mckibleyville","ukiah","fortbragg","fort-bragg","willits","yreka","weed","dunsmuir","tahoe","laketahoe","lake-tahoe","southlaketahoe","south-lake-tahoe","truckee","squaw","squawvalley","squaw-valley","northstar","mammoth","mammothlakes","mammoth-lakes","bishopca","bishop","placerville","tahoe-city","tahoecity","kings-beach","kingsbeach","incline","inclinevillage","incline-village","maricopa","pima","pinal","yavapai","yuma","mohave","coconino","cochise","navajo","apache","gila","santacruzaz","graham","lapaz","la-paz","greenlee","arizona","az","azmesh","az-mesh","phoenix","phx","phoenixmesh","phoenix-mesh","scottsdale","tempe","mesa","gilbert","chandler","glendale","peoria","surprize","avondale","goodyear","buckeye","litchfieldpark","litchfield-park","tolleson","laveen","paradisevalley","paradise-valley","pv","carefree","cavekreek","cave-creek","fountainhills","fountain-hills","rioverde","rio-verde","queencreek","queen-creek","santan","san-tan","santanvalley","ahwatukee","southmountain","south-mountain","anthem","newriver","new-river","apachejunction","apache-junction","aj","goldcanyon","gold-canyon","tucson","tucsomesh","tucson-mesh","orovalley","oro-valley","marana","catalina","catalinafoothills","saddlebrooke","casagrande","casa-grande","eloy","coolidge","florence","sierravista","sierra-vista","bisbee","tombstone","benson","douglas","nogales","tubac","greenvalley","green-valley","sahuarita","flagstaff","flag","flagmesh","sedona","cottonwood","clarkdale","prescott","prescottvalley","prescott-valley","dewey","chino-valley","chinovalley","williams","grandcanyon","grand-canyon","tusayan","page","marble-canyon","showlow","show-low","pinetop","pinetoplakeside","lakeside","snowflake","taylor","payson","pine","strawberry","camp-verde","campverde","winslow","holbrook","stjohns","springerville","eagar","yuma","yumamesh","fortuna-foothills","sanluisaz","san-luis","lakehavasu","lake-havasu","havasu","havasucity","lake-havasu-city","bullheadcity","bullhead-city","bullhead","laughlin","kingman","goldenkvalley","golden-valley","parker","quartzsite","wickenburg","lasvegas","las-vegas","vegas","vegasmesh","vegas-mesh","lv","henderson","boulder-city","bouldercity","northlasvegas","north-las-vegas","nlv","summerlin","enterprise","pahrump","mesquite","reno","sparks","carsoncity","carson-city","incline","bajacalifornia","baja-california","baja","bajamesh","tijuana","tj","mexicali","ensenada","tecate","rosarito","sanfelipe","san-felipe","sanluis","sanluisriocoalorado","brabant","flevoland","gelderland","noordbrabant","noordholland","zuid-holland","zuidholland","zeeland","twente","alkmaar","almere","amsterdam","amstelland","capelleaandenijssel","denhaag","dordrecht","drechtsteden","eindhoven","haarlem","hellevoetsluis","hilversum","katwijk","lelystad","maassluis","middelburg","rijnmond","rotterdam","tilburg","utrecht","vlissingen","voorburg","voorne-putten","walcheren","west-friesland","zaandam","zaanstreek-waterland","024-bot","afrithonbot","ai","amradio","analyser","angrynerds","bemesh","bot","buch","burgernet","chat","chatgpt","dares","dekroeg","dtis","emergency","english","evenvroegopstaan","fosdem","gezellig","gmr","gmrbot","goedemorgen","gyverbot","haagscourant","hackerspacenijmegen","hamradio","hamradionederland","hetweerinjegemeente","hsnl","jokes","kanalen","koffie","linux","meshcore","nerd","nl-alert","nl-prio","noodkanaal","nsagov","pi4hm","pi4utr","pingbot","sensemakers","sports","survival","test","testing","uitdagingen","valleibot","valleirug","vleesboek","wardrive","weer","swl","qso","qrz","cq","dx","sstv","aprs","winlink","aredn","hamnet","emcomm","emcommplanning","races","ares","auxcomm","simplex","repeater","uhf","vhf","2m","70cm","440"],$i=new Set(Ti);function Di(){return crypto.getRandomValues(new Uint8Array(16))}function Xs(t){return Array.from(t).map(s=>s.toString(16).padStart(2,"0")).join("")}function vt(t){const s=t.replace(/\s/g,"");if(s.length!==32||!/^[0-9a-fA-F]+$/.test(s))return null;const a=new Uint8Array(16);for(let r=0;r<16;r++)a[r]=parseInt(s.slice(r*2,r*2+2),16);return a}async function Fi(t){const a=`#${oa(t)}`,r=new TextEncoder().encode(a);return(await sr(r)).slice(0,16)}const Js=[{key:"create-private",label:"Create Private",icon:Gr,desc:"Generate a new private channel with a random key"},{key:"join-private",label:"Join Private",icon:Vl,desc:"Join an existing private channel using a shared key"},{key:"join-hashtag",label:"Join Hashtag",icon:Fe,desc:"Join a public hashtag channel (key derived from name)"}];function Li({open:t,onClose:s,channels:a,onAddChannel:r}){var _;const[l,i]=n.useState("join-hashtag"),[o,x]=n.useState(""),[p,C]=n.useState(""),[c,b]=n.useState(null),[y,g]=n.useState(!1),[d,v]=n.useState(""),[w,f]=n.useState(!1),[M,I]=n.useState(t);t!==M&&(I(t),t&&(i("join-hashtag"),x(""),C(""),b(null),g(!1),v(""),f(!1)));const R=n.useMemo(()=>a.length===0?0:Math.max(...a.map(h=>h.index))+1,[a]),j=n.useMemo(()=>l!=="join-hashtag"?"":oa(o),[l,o]),k=n.useMemo(()=>{if(!o.trim())return null;const h=l==="join-hashtag"&&j?`#${j}`:o.trim();return a.find(T=>T.name===h)??null},[o,l,j,a]),$=n.useMemo(()=>l==="join-hashtag"&&j?$i.has(j):!1,[l,j]),N=n.useMemo(()=>{if(!o.trim()||k)return!1;switch(l){case"create-private":return o.trim().length>0&&o.trim().length<=32;case"join-private":return o.trim().length>0&&vt(p)!==null;case"join-hashtag":return j.length>0;default:return!1}},[l,o,p,j,k]),u=n.useCallback(async()=>{c&&(await navigator.clipboard.writeText(Xs(c)),f(!0),setTimeout(()=>f(!1),2e3))},[c]),m=n.useCallback(async()=>{if(!(!N||y)){g(!0),v("");try{let h,T;switch(l){case"create-private":{h=Di(),T=o.trim();break}case"join-private":{const O=vt(p);if(!O){v("Invalid hex key (must be 32 hex chars = 16 bytes)");return}h=O,T=o.trim();break}case"join-hashtag":{h=await Fi(o),T=`#${j}`;break}default:return}if(await r(R,T,h)){if(l==="create-private"){b(h);return}s()}else v("Failed to add channel — device may be unreachable")}catch(h){v(h instanceof Error?h.message:"Unknown error")}finally{g(!1)}}},[N,y,l,o,p,j,R,r,s]);return e.jsxs(je,{open:t,onClose:s,size:"sm",children:[e.jsx(Ee,{title:"Add Channel",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1 p-0.5 radius-inner bg-zinc-950/5",children:Js.map(h=>{const T=h.icon,S=l===h.key;return e.jsxs("button",{onClick:()=>{i(h.key),v(""),b(null)},className:P("flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors",S?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(T,{className:"w-3.5 h-3.5"}),h.label]},h.key)})}),e.jsx("p",{className:"text-xs text-fg-muted",children:(_=Js.find(h=>h.key===l))==null?void 0:_.desc}),c&&l==="create-private"&&e.jsxs("div",{className:"p-3 radius-inner bg-sys-green/8 border border-sys-green/20 space-y-2",children:[e.jsx("p",{className:"text-xs text-sys-green font-medium",children:"Channel created! Share this key with others:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-[11px] font-mono text-fg-primary bg-zinc-950/10 px-2 py-1 rounded break-all",children:Xs(c)}),e.jsx("button",{onClick:u,className:"p-1.5 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Copy key",children:w?e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"}):e.jsx(Et,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),e.jsx("p",{className:"text-[11px] text-fg-muted",children:"Save this key — it cannot be recovered later."})]}),e.jsxs(re,{children:[e.jsx(le,{children:l==="join-hashtag"?"Hashtag name":"Channel name"}),e.jsx(pe,{type:"text",value:o,onChange:h=>x(h.target.value),placeholder:l==="join-hashtag"?"e.g. south-bay":"e.g. My Channel",maxLength:32,className:"mt-1",disabled:!!c}),l==="join-hashtag"&&j&&j!==o&&e.jsxs(ke,{className:"mt-1",children:["Will be registered as ",e.jsxs("code",{className:"text-fg-primary font-mono text-[11px]",children:["#",j]})]}),l==="join-hashtag"&&$&&e.jsx(ke,{className:"mt-1 text-sys-green",children:"Known region channel"})]}),k&&e.jsxs("div",{className:"flex items-start gap-2 p-2.5 radius-inner bg-sys-red/8 border border-sys-red/20",children:[e.jsx(Be,{className:"w-3.5 h-3.5 text-sys-red flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs text-fg-secondary",children:["Channel ",e.jsx("strong",{className:"text-fg-primary",children:k.name})," already exists at slot ",k.index,". Remove it first to re-add."]})]}),l==="join-private"&&e.jsxs(re,{children:[e.jsxs(le,{children:["Channel key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(32 hex chars)"})]}),e.jsx(pe,{type:"text",value:p,onChange:h=>C(h.target.value),placeholder:"e.g. a1b2c3d4e5f6...",maxLength:32,className:"mt-1 font-mono text-xs"}),p&&!vt(p)&&e.jsx(ke,{className:"mt-1 text-sys-red",children:"Must be exactly 32 hex characters (16 bytes)"})]}),e.jsxs("p",{className:"text-[11px] text-fg-muted",children:["Will be assigned to channel slot ",e.jsx("strong",{className:"text-fg-primary",children:R})]}),d&&e.jsx("p",{className:"text-xs text-sys-red font-medium",children:d})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:c?"Done":"Cancel"}),!c&&e.jsx(H,{color:"primary",onClick:m,disabled:!N||y,children:y?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 animate-spin"}),"Adding…"]}):l==="create-private"?"Create Channel":"Join Channel"})]})]})}const Oi=202,Ai=/^[0-9a-fA-F]+$/;function zi(t){const s=t.replace(/\s/g,"");return s.length>=Oi&&s.length%2===0&&Ai.test(s)}const Hi=n.memo(function({open:s,onClose:a,contacts:r,exportPubKey:l,onExport:i,onImport:o}){const[x,p]=n.useState(l?"export":"import"),[C,c]=n.useState(l??""),[b,y]=n.useState(""),[g,d]=n.useState(""),[v,w]=n.useState(!1),[f,M]=n.useState(!1),[I,R]=n.useState(!1),[j,k]=n.useState(null),[$,N]=n.useState(!1),u=n.useRef(null);n.useEffect(()=>{s&&(p(l?"export":"import"),c(l??""),y(""),d(""),w(!1),M(!1),R(!1),k(null),N(!1))},[s,l]);const m=n.useCallback(()=>{a()},[a]),_=n.useCallback(async()=>{if(!C)return;w(!0),k(null),y("");const S=await i(C);w(!1),S?y(S):k("Failed to export contact advert")},[C,i]),h=n.useCallback(async()=>{if(b)try{await navigator.clipboard.writeText(b),R(!0),setTimeout(()=>R(!1),2e3)}catch{k("Failed to copy to clipboard")}},[b]),T=n.useCallback(async()=>{const S=g.replace(/\s/g,"");if(!zi(S)){k("Invalid hex — must be at least 202 hex characters (101 bytes)");return}M(!0),k(null);const O=await o(S);M(!1),O?(N(!0),d(""),setTimeout(()=>m(),1500)):k("Import failed — check the hex string and try again")},[g,o,m]);return e.jsxs(je,{open:s,onClose:m,children:[e.jsx(ar,{children:"Contact Import / Export"}),e.jsxs(we,{children:[e.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg bg-subtle-fill mb-4",children:[e.jsxs("button",{onClick:()=>{p("export"),k(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md text-xs font-medium transition-colors",x==="export"?"bg-surface shadow-sm text-fg-primary":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(zt,{className:"w-3.5 h-3.5"}),"Export"]}),e.jsxs("button",{onClick:()=>{p("import"),k(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md text-xs font-medium transition-colors",x==="import"?"bg-surface shadow-sm text-fg-primary":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(He,{className:"w-3.5 h-3.5"}),"Import"]})]}),x==="export"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-fg-muted mb-1",children:"Select contact"}),e.jsxs("select",{value:C,onChange:S=>{c(S.target.value),y(""),k(null)},className:"w-full surface-input rounded-lg px-3 py-2 text-sm text-fg-primary",children:[e.jsx("option",{value:"",children:"Choose a contact…"}),r.map(S=>e.jsx("option",{value:S.public_key,children:S.name||S.public_key.slice(0,12)},S.public_key))]})]}),e.jsx(H,{color:"primary",outline:!0,className:"w-full justify-center",disabled:!C||v,onClick:_,children:v?"Exporting…":"Export Advert"}),b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("textarea",{readOnly:!0,value:b,rows:4,className:"w-full surface-input rounded-lg px-3 py-2 text-[10px] font-mono text-fg-primary break-all resize-none"}),e.jsxs(H,{color:I?"success":"primary",outline:!0,className:"w-full justify-center",onClick:h,children:[I?e.jsx(be,{"data-slot":"icon"}):e.jsx(Et,{"data-slot":"icon"}),I?"Copied!":"Copy to Clipboard"]})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-fg-muted mb-1",children:"Paste advert hex string"}),e.jsx("textarea",{ref:u,value:g,onChange:S=>{d(S.target.value),k(null),N(!1)},placeholder:"Paste exported advert hex here…",rows:4,className:"w-full surface-input rounded-lg px-3 py-2 text-[10px] font-mono text-fg-primary break-all resize-none placeholder:text-fg-muted/50"}),e.jsx("p",{className:"text-[10px] text-fg-muted/70 mt-1",children:"Minimum 101 bytes (202 hex characters): 32B pubkey + 4B timestamp + 64B signature + appData"})]}),$&&e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sys-green/10 text-sys-green text-xs font-medium",children:[e.jsx(be,{className:"w-3.5 h-3.5"}),"Contact imported successfully"]}),e.jsx(H,{color:"primary",outline:!0,className:"w-full justify-center",disabled:!g.trim()||f,onClick:T,children:f?"Importing…":"Import Contact"})]}),j&&e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 mt-3 rounded-lg bg-sys-red/10 text-sys-red text-xs",children:[e.jsx(da,{className:"w-3.5 h-3.5 flex-shrink-0"}),j]})]}),e.jsx(Me,{children:e.jsx(H,{plain:!0,onClick:m,children:"Close"})})]})});function wc(){var us,ms,ps,xs,hs,fs;const t=nr(),s=rr(),a=lr(),r=or(),l=ir(),i=cr(),o=mt(),x=dr(),p=ur(),C=mr(),c=pr(),b=n.useMemo(()=>{if(l.length===0)return r;const E=new Set(r.map(L=>L.public_key));return[...r,...l.filter(L=>!E.has(L.public_key))]},[r,l]),y=n.useMemo(()=>{const E=new Set;if(!(c!=null&&c.neighbors))return E;const L=[];for(const[B,X]of Object.entries(c.neighbors))X.zero_hop&&L.push((B.startsWith("0x")?B.slice(2):B).toLowerCase());for(const B of b){const X=B.public_key.toLowerCase();for(const ce of L)if(X===ce||X.startsWith(ce)){E.add(B.public_key);break}}return E},[c==null?void 0:c.neighbors,b]),g=n.useMemo(()=>{const E=new Map;if(!(c!=null&&c.neighbors))return E;const L=[];for(const[B,X]of Object.entries(c.neighbors))X.zero_hop&&X.rssi!=null&&X.snr!=null&&X.rssi!==0&&L.push({hash:(B.startsWith("0x")?B.slice(2):B).toLowerCase(),rssi:X.rssi,snr:X.snr,advertCount:X.advert_count??1});if(L.length===0)return E;for(const B of b){const X=B.public_key.toLowerCase();for(const ce of L)if(X===ce.hash||X.startsWith(ce.hash)){E.set(B.public_key,{rssi:ce.rssi,snr:ce.snr,advertCount:ce.advertCount});break}}return E},[c==null?void 0:c.neighbors,b]),d=xr(),v=hr(),w=la(),f=fr(),M=gr(),I=yr(),R=br(),j=vr(),[k,$]=jr(),[N,u]=n.useState(!1),[m,_]=n.useState(!1),[h,T]=n.useState(!1),[S,O]=n.useState(!1),[ie,Y]=n.useState(null),[D,K]=n.useState(!1),[ee,V]=n.useState(!1),[F,A]=n.useState(!0),z="pymc_companion_contacts_micro",U="pymc_companion_split",[ne,xt]=n.useState(()=>{try{return localStorage.getItem(z)==="1"}catch{return!1}}),We=25,Gt=75,[ht,Kt]=n.useState(()=>{try{const E=Number(localStorage.getItem(U));return E>=We&&E<=Gt?E:50}catch{return 50}}),Qe=n.useRef(null),Le=n.useRef(null),Ut=n.useRef(null),Ye=n.useRef(!1),Oe=n.useRef(ht);Oe.current=ht;const Ia=n.useCallback(E=>{E.preventDefault(),E.target.setPointerCapture(E.pointerId),Ye.current=!0},[]),Ea=n.useCallback(E=>{if(!Ye.current||!Qe.current)return;const L=Qe.current.getBoundingClientRect(),B=Math.round(Math.min(Gt,Math.max(We,(E.clientX-L.left)/L.width*100)));Oe.current=B,Le.current&&(Le.current.style.width=`${B}%`)},[]),qt=n.useCallback(()=>{if(!Ye.current)return;Ye.current=!1;const E=Oe.current;Kt(E);try{localStorage.setItem(U,String(E))}catch{}},[]),Ma=n.useCallback(()=>{Oe.current=50,Le.current&&tt(Le.current,{width:"50%"},de.layoutResize),Kt(50);try{localStorage.setItem(U,String(50))}catch{}},[]),Pa=n.useCallback(E=>{xt(E);const L=Qe.current,B=Ut.current;if(!L)return;const X=L.getBoundingClientRect().width;L.style.width=E?"var(--companion-side-micro)":"var(--companion-side)";const ce=L.getBoundingClientRect().width;if(L.style.width=`${X}px`,B){const tn=E?56:Oe.current/100*ce,sn=B.offsetWidth,an=Math.max(0,ce-tn-12);B.style.flex="none",B.style.width=`${sn}px`,tt(B,{width:`${an}px`},{...de.layoutResize,onComplete(){B.style.flex="",B.style.width=""}})}tt(L,{width:`${ce}px`},{...de.layoutResize,onComplete(){L.style.width=E?"var(--companion-side-micro)":"var(--companion-side)"}})},[]),{selectCompanion:Ta,selectConversation:ve,sendMessage:Vt,sendChannelMessage:Wt,retryMessage:$a,retryMessageAsFlood:Da,resetPath:ft,shareContact:Fa,removeContact:La,addChannel:Oa,requestStatus:Qt,requestTelemetry:Yt,loginToRepeater:gt,logoutFromRepeater:Xt,getNeighbours:Jt,traceContactPath:Zt,discoverPath:es,pingContact:Aa,markAsRead:ts,fetchCompanions:ss,seedFromRepeater:za,exportContactAdvert:Ha,importContactAdvert:Ba,setContactPath:as,deleteChannel:Ga,loadOlderMessages:Ka}=se.getState(),Ua=n.useCallback(E=>{ve(E),window.innerWidth>=1280?K(!0):V(!0)},[ve]),ns=se(E=>E.messages),rs=se(E=>E.unreadMap);n.useEffect(()=>{ts()},[d,ts]),n.useEffect(()=>{const E=k.get("dm");E&&b.length>0&&b.find(B=>B.public_key===E)&&(ve({type:"contact",id:E}),$({},{replace:!0}))},[k,b,ve,$]);const qa=n.useMemo(()=>{const E=new Set;for(const L of b)L.name&&E.add(L.name);for(const L of v)L.sender_name&&!L.is_outgoing&&E.add(L.sender_name);return[...E].sort((L,B)=>L.localeCompare(B))},[b,v]),ls=n.useMemo(()=>{const E=new Map;for(const L of b)L.name&&E.set(L.name.toLowerCase(),L.public_key);for(const L of v)if(L.sender_name&&L.sender_key&&L.sender_key!=="unknown"&&!L.is_outgoing){const B=L.sender_name.toLowerCase();E.has(B)||E.set(B,L.sender_key)}return E},[b,v]),Va=n.useCallback(E=>{const L=ls.get(E.toLowerCase());L&&(ve({type:"contact",id:L}),K(!0))},[ls,ve]),Wa=n.useCallback(async E=>d?d.type==="channel"?Wt(Number(d.id),E):Vt(d.id,E):!1,[d,Vt,Wt]),Qa=w&&!f,os=I!=null&&(I.adv_type&15)===3,is=It(os?I.public_key:null),Ya=os&&is!=="success",cs=wr(),[me,Pe]=n.useState("idle"),Xa=n.useCallback(async()=>{Pe("flood-sending");const E=await se.getState().sendFloodAdvert();Pe(E?"flood-done":"idle"),E&&setTimeout(()=>Pe(L=>L==="flood-done"?"idle":L),2e3)},[]),Ja=n.useCallback(async()=>{Pe("zero-sending");const E=await se.getState().sendZeroHopAdvert();Pe(E?"zero-done":"idle"),E&&setTimeout(()=>Pe(L=>L==="zero-done"?"idle":L),2e3)},[]),Za=e.jsxs("div",{className:"flex items-center gap-2",children:[w&&a&&e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsxs("button",{onClick:Xa,disabled:me!=="idle"&&me!=="zero-done",className:P("inline-flex items-center gap-2 px-3.5 py-2 rounded-xl text-xs font-semibold transition-all duration-150","bg-surface depth-raised-soft hover:depth-raised active:depth-inset","disabled:opacity-50 disabled:cursor-not-allowed",me==="flood-done"?"text-sys-green":"text-fg-secondary hover:text-fg-primary"),title:"A Flood Advert will announce your presence and broadcast your node ID and name anywhere a repeater will repeat it",children:[me==="flood-sending"?e.jsx(oe,{className:"w-4 h-4 animate-spin"}):e.jsx(to,{className:"w-4 h-4"}),e.jsx("span",{children:me==="flood-done"?"Sent!":"Flood Advert"})]}),e.jsxs("button",{onClick:Ja,disabled:me!=="idle"&&me!=="flood-done",className:P("inline-flex items-center gap-2 px-3.5 py-2 rounded-xl text-xs font-semibold transition-all duration-150","bg-surface depth-raised-soft hover:depth-raised active:depth-inset","disabled:opacity-50 disabled:cursor-not-allowed",me==="zero-done"?"text-sys-green":"text-fg-secondary hover:text-fg-primary"),title:"A Local Advert, or “Zero Hop” advert will not be repeated by local repeaters, but will be heard by those within range",children:[me==="zero-sending"?e.jsx(oe,{className:"w-4 h-4 animate-spin"}):e.jsx(wa,{className:"w-4 h-4"}),e.jsx("span",{children:me==="zero-done"?"Sent!":"Local Advert"})]})]}),e.jsx("button",{onClick:()=>Nr.getState().toggleFocusMode(),className:"hidden lg:flex p-1.5 hover:bg-subtle-fill rounded transition-colors",title:cs?"Collapse view":"Expand view",children:cs?e.jsx(Jr,{className:"w-4 h-4 text-fg-muted"}):e.jsx(Zr,{className:"w-4 h-4 text-fg-muted"})})]}),en=e.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[e.jsx(ge,{children:C.length>0&&e.jsx(ue.div,{layout:!0,initial:{opacity:0,scale:.9,width:0},animate:{opacity:1,scale:1,width:"auto"},exit:{opacity:0,scale:.9,width:0},transition:de.fade,className:"flex items-center gap-1 overflow-hidden",children:C.map(E=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-green/10 text-[11px] text-sys-green font-medium whitespace-nowrap",children:[e.jsx(ze,{className:"w-2.5 h-2.5"}),E.name]},E.pubHex))},"advert-notifs")}),e.jsx(ge,{children:!w&&e.jsxs(ue.span,{initial:{opacity:0,scale:.9,width:0},animate:{opacity:1,scale:1,width:"auto"},exit:{opacity:0,scale:.9,width:0},transition:de.fade,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-amber/10 text-[11px] text-sys-amber font-medium whitespace-nowrap overflow-hidden",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 flex-shrink-0",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-amber opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-sys-amber"})]}),"Reconnecting…"]},"disconnected")}),a&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>_(!0),disabled:x,className:"data-box flex items-center gap-1 cursor-pointer hover:bg-subtle-fill-strong transition-colors disabled:opacity-50",title:p>0?`${p} contacts seeded from repeater — click to refresh`:"Seed contacts from repeater adverts",children:[x?e.jsx(oe,{className:"w-3.5 h-3.5 text-sys-blue animate-spin"}):e.jsx(io,{className:"w-3.5 h-3.5 text-sys-blue"}),p>0&&e.jsxs("span",{className:"text-sys-blue",children:["+",p]})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${b.length} contacts${p>0?` (${p} from repeater)`:""}`,children:[e.jsx(wt,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:b.length})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${a.channels_count} channels`,children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:a.channels_count})]})]}),e.jsx(Ii,{companions:t,selected:s,onSelect:Ta}),e.jsx(H,{plain:!0,onClick:()=>u(!0),title:"Companion configuration",children:e.jsx(kr,{"data-slot":"icon"})})]});if(t.length===0&&!f)return e.jsxs(Ns,{children:[e.jsx(ks,{title:"Companion",icon:e.jsx(ye,{}),controls:e.jsxs(H,{color:"primary",outline:!0,onClick:()=>u(!0),children:[e.jsx(Ue,{"data-slot":"icon"}),"Add Companion"]})}),e.jsx(Cs,{ready:!0,children:e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(ye,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted mb-1",children:"No companions configured"}),e.jsx("p",{className:"type-body-sm text-fg-muted/70 mb-4",children:"Add a companion to start messaging mesh contacts"}),e.jsxs(H,{color:"primary",outline:!0,onClick:()=>u(!0),children:[e.jsx(Ue,{"data-slot":"icon"}),"Add Companion"]})]})}),e.jsx(Ys,{open:N,onClose:()=>u(!1),onRefresh:ss})]});const ds=d?d.type==="channel"?((us=i.find(E=>String(E.index)===d.id))==null?void 0:us.name)??"Channel":((ms=b.find(E=>E.public_key===d.id))==null?void 0:ms.name)??d.id.slice(0,8):null;return e.jsxs(Ns,{children:[e.jsx(ks,{title:(o==null?void 0:o.node_name)||"Companion",icon:e.jsx(ye,{}),leading:Za,controls:en}),e.jsx(Cs,{children:e.jsxs("div",{className:"companion-layout flex gap-4",style:{height:"calc(100vh - 11rem)",minHeight:400},children:[e.jsxs("div",{ref:Qe,className:P("flex-shrink-0 flex h-full overflow-hidden radius-inner bg-surface/80 backdrop-blur-lg depth-raised",F?"":"hidden md:flex"),style:{width:ne?"var(--companion-side-micro)":"var(--companion-side)"},children:[e.jsx(Ao,{ref:Le,contacts:b,selectedConversation:d,unreadMap:rs,messages:ns,onSelect:E=>{ve(E),window.innerWidth<768&&A(!1)},onShowDetails:Ua,onShareContact:Fa,onResetPath:ft,onRemoveContact:La,onPingContact:Aa,repeaterNeighborHashes:y,repeaterSignalMap:g,isLoading:f,splitPercent:ht,onMicroChange:Pa}),e.jsx("div",{className:"group/divider flex-shrink-0 self-stretch flex items-center justify-center w-3 cursor-col-resize select-none touch-none",onPointerDown:Ia,onPointerMove:Ea,onPointerUp:qt,onPointerCancel:qt,onDoubleClick:Ma,children:e.jsx("div",{className:"w-px h-full my-2 bg-edge-subtle/50 group-hover/divider:bg-sys-blue/50 group-active/divider:bg-sys-blue transition-colors"})}),e.jsx(Ko,{ref:Ut,channels:i,selectedConversation:d,unreadMap:rs,messages:ns,onSelect:E=>{ve(E),window.innerWidth<768&&A(!1)},onAddChannel:()=>T(!0),onDeleteChannel:Ga})]}),e.jsxs(Ss,{noPadding:!0,radius:"sm",className:"flex-1 flex flex-col min-w-0 overflow-hidden relative",children:[e.jsx(ge,{children:M&&e.jsxs(ue.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:de.fade,className:"flex items-center justify-center gap-2 px-3 py-1.5 bg-sys-red/10 border-b border-sys-red/20",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-sys-red flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-sys-red font-medium truncate",children:M})]},"error-banner")}),!F&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-edge-subtle md:hidden",children:[e.jsx("button",{onClick:()=>A(!0),className:"p-1 hover:bg-subtle-fill rounded transition-colors",children:e.jsx(zl,{className:"w-4 h-4 text-fg-secondary"})}),e.jsx("span",{className:"text-sm text-fg-primary font-medium truncate flex-1",children:ds}),d&&e.jsx("button",{onClick:()=>V(!0),className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:"Details",children:e.jsx(nt,{className:"w-4 h-4 text-fg-muted"})})]}),e.jsxs("div",{className:"hidden md:flex items-center justify-between px-3 py-1.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"text-sm text-fg-primary font-medium truncate",children:ds??"Select a conversation"}),e.jsx(ge,{children:d&&e.jsx(ue.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,onClick:()=>{window.innerWidth>=1280?K(E=>!E):V(!0)},className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:D?"Hide detail panel":"Show details",children:D&&window.innerWidth>=1280?e.jsx(Ts,{className:"w-4 h-4 text-fg-muted"}):e.jsx(nt,{className:"w-4 h-4 text-fg-muted"})},"ctx-toggle")})]}),Ya&&I?e.jsx(ii,{contact:I,loginStatus:is,onLogin:gt}):e.jsxs(e.Fragment,{children:[e.jsx(ai,{messages:v,contacts:b,className:"flex-1 min-h-0",conversationKey:d?d.type==="channel"?`ch:${d.id}`:d.id:void 0,onRetry:$a,onRetryAsFlood:Da,onMentionClick:Va,historyLoading:R,historyExhausted:d?j.get(d.type==="channel"?`ch:${d.id}`:d.id)??!1:!0,onLoadOlder:d?()=>Ka(d.type==="channel"?`ch:${d.id}`:d.id):void 0,channelName:(d==null?void 0:d.type)==="channel"?(ps=i.find(E=>String(E.index)===d.id))==null?void 0:ps.name:void 0}),d&&e.jsx(ri,{onSend:Wa,disabled:!Qa,mentionNames:qa,placeholder:d.type==="channel"?`Message ${((xs=i.find(E=>String(E.index)===d.id))==null?void 0:xs.name)??"channel"}`:`Message ${((hs=b.find(E=>E.public_key===d.id))==null?void 0:hs.name)??"contact"}`})]})]}),e.jsx(ue.div,{initial:!1,animate:{width:D&&d?"var(--companion-context)":"0px",opacity:D&&d?1:0},transition:de.layoutResize,className:"hidden xl:block flex-shrink-0 overflow-hidden",style:{pointerEvents:D&&d?"auto":"none"},children:d&&e.jsxs(Ss,{neomorphic:!0,noPadding:!0,radius:"sm",className:"h-full relative",children:[e.jsx(ge,{children:D&&e.jsx(ue.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,onClick:()=>K(!1),className:"absolute top-2 left-2 z-10 p-1 hover:bg-subtle-fill rounded-lg transition-colors",title:"Hide detail panel",children:e.jsx(Ts,{className:"w-4 h-4 text-fg-muted"})},"ctx-close")}),e.jsx(Ks,{contact:d.type==="contact"?I:null,channel:d.type==="channel"?i.find(E=>String(E.index)===d.id)??null:null,contacts:b,selfPubKey:(o==null?void 0:o.public_key)??null,onResetPath:ft,onRequestStatus:Qt,onRequestTelemetry:Yt,onLoginToRepeater:gt,onLogoutFromRepeater:Xt,onGetNeighbours:Jt,onTraceContactPath:Zt,onDiscoverPath:es,onExportContact:E=>{Y(E),O(!0)},onSetContactPath:as})]})})]})}),e.jsx(Ys,{open:N,onClose:()=>u(!1),onRefresh:ss}),e.jsx(Pi,{open:m,onClose:()=>_(!1),companionName:s??"companion",onImport:za}),e.jsx(Hi,{open:S,onClose:()=>{O(!1),Y(null)},contacts:b,exportPubKey:ie,onExport:Ha,onImport:Ba}),e.jsx(Li,{open:h,onClose:()=>T(!1),channels:i,onAddChannel:Oa}),e.jsxs(je,{open:ee,onClose:()=>V(!1),size:"md",children:[e.jsx(Ee,{icon:(d==null?void 0:d.type)==="channel"?e.jsx(Fe,{className:"w-5 h-5"}):I&&(I.adv_type&15)===2?e.jsx(ze,{className:"w-5 h-5"}):e.jsx(ye,{className:"w-5 h-5"}),title:(d==null?void 0:d.type)==="channel"?((fs=i.find(E=>String(E.index)===d.id))==null?void 0:fs.name)??"Channel":(I==null?void 0:I.name)||"Contact Details",onClose:()=>V(!1)}),e.jsx(we,{className:"max-h-[70vh] overflow-y-auto",children:e.jsx(Ks,{embedded:!0,contact:(d==null?void 0:d.type)==="contact"?I:null,channel:(d==null?void 0:d.type)==="channel"?i.find(E=>String(E.index)===d.id)??null:null,contacts:b,selfPubKey:(o==null?void 0:o.public_key)??null,onResetPath:ft,onRequestStatus:Qt,onRequestTelemetry:Yt,onLoginToRepeater:gt,onLogoutFromRepeater:Xt,onGetNeighbours:Jt,onTraceContactPath:Zt,onDiscoverPath:es,onExportContact:E=>{Y(E),O(!0)},onSetContactPath:as})})]})]})}export{wc as default}; diff --git a/frontend/dist/assets/Companion-qTbNLFUD.js b/frontend/dist/assets/Companion-qTbNLFUD.js new file mode 100644 index 00000000..bbc1ab25 --- /dev/null +++ b/frontend/dist/assets/Companion-qTbNLFUD.js @@ -0,0 +1,72 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompanionPathMap-DmNbWPuj.js","assets/index-CN4vD05c.js","assets/usePipelineStore-BTv04vLL.js","assets/node-types-UozthSpR.js","assets/car-CMkH36na.js","assets/map-pin-off-VHAD8rJE.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css","assets/CompanionEchoMap-Cmhesaku.js"])))=>i.map(i=>d[i]); +import{aX as nn,fB as gs,aZ as Zs,a_ as rn,aY as Ct,a$ as ea,r as n,b0 as ln,b1 as xe,b4 as Ce,aT as Q,b8 as q,b5 as he,bi as on,b9 as jt,bd as St,be as _t,bj as cn,bf as Se,bg as ot,bk as dn,bh as fe,bl as ys,bm as un,bn as mn,bo as at,bp as pn,bq as hn,br as xn,aW as Ze,b6 as fn,fD as gn,d7 as Te,fE as ta,bt as yn,bu as te,bv as bn,bC as vn,dk as jn,dl as wn,bE as Nn,fF as kn,bs as $e,bD as it,bx as Cn,fG as Rt,bG as bs,fH as ct,b2 as qe,bz as sa,bA as Sn,bB as _n,d5 as vs,d8 as js,fC as Rn,bF as In,b3 as En,bb as Mn,bc as Pn,bw as aa,d3 as na,e as ae,j as e,c as P,a0 as be,fI as Tn,cZ as de,fJ as se,cE as ye,cs as dt,aa as ze,bM as ut,f2 as _e,f3 as Re,f4 as Ie,d as ge,fK as $n,fL as Dn,m as ue,fM as Fn,cT as nt,aC as je,aK as Ee,dK as He,aD as we,a2 as oe,bY as Be,eJ as Me,B as H,fN as Ln,fO as mt,au as An,Q as On,fP as zn,_ as ra,ca as Hn,V as De,fQ as Bn,dy as Gn,fR as It,fS as Kn,fT as Un,bI as wt,fU as qn,fV as Vn,fW as Wn,dJ as Qn,a1 as Et,ef as Yn,fX as Xn,fY as Jn,fZ as la,fq as Zn,f_ as er,f$ as tr,I as pe,C as ws,g0 as oa,g1 as sr,g2 as ar,g3 as nr,g4 as rr,g5 as lr,g6 as or,g7 as ir,g8 as cr,g9 as dr,ga as ur,gb as mr,a6 as pr,gc as hr,gd as xr,ge as fr,gf as gr,gg as yr,gh as br,gi as vr,gj as jr,gk as wr,gl as Nr,eE as kr}from"./index-CN4vD05c.js";import{P as Ns,a as ks,B as Cs,C as Ss}from"./PageLayout-DJSWC4zL.js";import{e as Mt,g as Pt,a as Tt}from"./chat-utils-BLzyljgm.js";import{c as _s,S as Cr,a as Sr}from"./SignalIndicator-BpXSkqBv.js";import{b as _r,F as Rr,y as Ir,R as Er,T as Mr,w as Pr,A as Tr,M as ia}from"./map-pin-W8m2dIyd.js";import{p as $r,a as et,c as W,f as Xe,b as Dr,L as Fr,S as Je,s as Lr,u as Ar,d as Or}from"./element-movement-22ZdBM88.js";import{s as zr}from"./use-text-value-DHtdh4JM.js";import{F as Hr}from"./use-tree-walker-Dw8GtAHe.js";import{a as tt}from"./index-CnWrze_V.js";import{S as Rs}from"./search-D1TEdb7u.js";import{S as Br}from"./share-2-FGmu8UDX.js";import{R as Ge,L as Gr}from"./route-4Pe810jq.js";import{R as ca}from"./rotate-ccw-D-KWB9ub.js";import{T as Ke}from"./trash-2-DqmFYXqQ.js";import{H as Fe}from"./hash-vaiKl847.js";import{C as Kr}from"./check-check-CL5EVU8z.js";import{P as Ue}from"./plus-3025QRmd.js";import{S as Ur,C as qr}from"./ChatBubble-CFCWQdGy.js";import{p as Vr}from"./payload-detail-DXAypO28.js";import{A as Wr}from"./arrow-down-BuVueZSW.js";import{C as Qr}from"./chevron-right-BCotFXkU.js";import{C as da}from"./circle-alert-NywFrEoZ.js";import{f as Yr,c as Xr,a as Jr,M as Zr}from"./variants-WkuRUM3u.js";import{C as ua}from"./clock-jH_gnOTU.js";import{A as ma}from"./activity-ZoAXCcWm.js";import{T as pa}from"./thermometer-lyVPAuKn.js";import{S as el}from"./shield-check-WAIr0NHG.js";import{W as Is}from"./wand-sparkles-Bg4EWlYl.js";import{C as tl}from"./compass-Ddh177-W.js";import{G as Es}from"./git-branch-DpI9mavY.js";import{F as re,L as le,D as ke}from"./fieldset-D4C8gyQW.js";import{C as ha}from"./ConfirmModal-CH_Er4VJ.js";import{K as xa}from"./key-round-CiTX8EjL.js";import{F as fa,P as sl}from"./pencil-BEPIyoAD.js";var al=Object.defineProperty,nl=(t,s,a)=>s in t?al(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,Ms=(t,s,a)=>(nl(t,typeof s!="symbol"?s+"":s,a),a),Z=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Z||{}),rt=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(rt||{}),G=(t=>(t[t.OpenMenu=0]="OpenMenu",t[t.CloseMenu=1]="CloseMenu",t[t.GoToItem=2]="GoToItem",t[t.Search=3]="Search",t[t.ClearSearch=4]="ClearSearch",t[t.RegisterItems=5]="RegisterItems",t[t.UnregisterItems=6]="UnregisterItems",t[t.SetButtonElement=7]="SetButtonElement",t[t.SetItemsElement=8]="SetItemsElement",t[t.SortItems=9]="SortItems",t[t.MarkButtonAsMoved=10]="MarkButtonAsMoved",t))(G||{});function Ps(t,s=a=>a){let a=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=ea(s(t.items.slice()),i=>i.dataRef.current.domRef.current),l=a?r.indexOf(a):null;return l===-1&&(l=null),{items:r,activeItemIndex:l}}let rl={1(t){if(t.menuState===1)return t;let s=t.buttonElement?et.Tracked(Dr(t.buttonElement)):t.buttonPositionState;return{...t,activeItemIndex:null,pendingFocus:{focus:W.Nothing},menuState:1,buttonPositionState:s}},0(t,s){return t.menuState===0?t:{...t,__demoMode:!1,pendingFocus:s.focus,menuState:0,buttonPositionState:et.Idle}},2:(t,s)=>{var a,r,l,i,o;if(t.menuState===1)return t;let h={...t,searchQuery:"",activationTrigger:(a=s.trigger)!=null?a:1,__demoMode:!1};if(s.focus===W.Nothing)return{...h,activeItemIndex:null};if(s.focus===W.Specific)return{...h,activeItemIndex:t.items.findIndex(c=>c.id===s.id)};if(s.focus===W.Previous){let c=t.activeItemIndex;if(c!==null){let y=t.items[c].dataRef.current.domRef,g=Xe(s,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:b=>b.id,resolveDisabled:b=>b.dataRef.current.disabled});if(g!==null){let b=t.items[g].dataRef.current.domRef;if(((r=y.current)==null?void 0:r.previousElementSibling)===b.current||((l=b.current)==null?void 0:l.previousElementSibling)===null)return{...h,activeItemIndex:g}}}}else if(s.focus===W.Next){let c=t.activeItemIndex;if(c!==null){let y=t.items[c].dataRef.current.domRef,g=Xe(s,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:b=>b.id,resolveDisabled:b=>b.dataRef.current.disabled});if(g!==null){let b=t.items[g].dataRef.current.domRef;if(((i=y.current)==null?void 0:i.nextElementSibling)===b.current||((o=b.current)==null?void 0:o.nextElementSibling)===null)return{...h,activeItemIndex:g}}}}let p=Ps(t),v=Xe(s,{resolveItems:()=>p.items,resolveActiveIndex:()=>p.activeItemIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...h,...p,activeItemIndex:v}},3:(t,s)=>{let a=t.searchQuery!==""?0:1,r=t.searchQuery+s.value.toLowerCase(),l=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+a).concat(t.items.slice(0,t.activeItemIndex+a)):t.items).find(o=>{var h;return((h=o.dataRef.current.textValue)==null?void 0:h.startsWith(r))&&!o.dataRef.current.disabled}),i=l?t.items.indexOf(l):-1;return i===-1||i===t.activeItemIndex?{...t,searchQuery:r}:{...t,searchQuery:r,activeItemIndex:i,activationTrigger:1}},4(t){return t.searchQuery===""?t:{...t,searchQuery:"",searchActiveItemIndex:null}},5:(t,s)=>{let a=t.items.concat(s.items.map(l=>l)),r=t.activeItemIndex;return t.pendingFocus.focus!==W.Nothing&&(r=Xe(t.pendingFocus,{resolveItems:()=>a,resolveActiveIndex:()=>t.activeItemIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled})),{...t,items:a,activeItemIndex:r,pendingFocus:{focus:W.Nothing},pendingShouldSort:!0}},6:(t,s)=>{let a=t.items,r=[],l=new Set(s.items);for(let[i,o]of a.entries())if(l.has(o.id)&&(r.push(i),l.delete(o.id),l.size===0))break;if(r.length>0){a=a.slice();for(let i of r.reverse())a.splice(i,1)}return{...t,items:a,activationTrigger:1}},7:(t,s)=>t.buttonElement===s.element?t:{...t,buttonElement:s.element},8:(t,s)=>t.itemsElement===s.element?t:{...t,itemsElement:s.element},9:t=>t.pendingShouldSort?{...t,...Ps(t),pendingShouldSort:!1}:t,10(t){return t.buttonPositionState.kind!=="Tracked"?t:{...t,buttonPositionState:et.Moved}}};class $t extends nn{constructor(s){super(s),Ms(this,"actions",{registerItem:gs(()=>{let a=[],r=new Set;return[(l,i)=>{r.has(i)||(r.add(i),a.push({id:l,dataRef:i}))},()=>(r.clear(),this.send({type:5,items:a.splice(0)}))]}),unregisterItem:gs(()=>{let a=[];return[r=>a.push(r),()=>this.send({type:6,items:a.splice(0)})]})}),Ms(this,"selectors",{activeDescendantId(a){var r;let l=a.activeItemIndex,i=a.items;return l===null||(r=i[l])==null?void 0:r.id},isActive(a,r){var l;let i=a.activeItemIndex,o=a.items;return i!==null?((l=o[i])==null?void 0:l.id)===r:!1},shouldScrollIntoView(a,r){return a.__demoMode||a.menuState!==0||a.activationTrigger===0?!1:this.isActive(a,r)},didButtonMove(a){return a.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let a=this.state.id,r=Zs.get(null);this.disposables.add(r.on(rn.Push,l=>{!r.selectors.isTop(l,a)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>r.actions.push(a)),this.on(1,()=>r.actions.pop(a))}this.disposables.group(a=>{this.on(1,r=>{r.buttonElement&&(a.dispose(),a.add($r(r.buttonElement,r.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:s,__demoMode:a=!1}){return new $t({id:s,__demoMode:a,menuState:a?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:W.Nothing},buttonPositionState:et.Idle})}reduce(s,a){return Ct(a.type,rl,s,a)}}const ga=n.createContext(null);function Dt(t){let s=n.useContext(ga);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,ya),a}return s}function ya({id:t,__demoMode:s=!1}){let a=n.useMemo(()=>$t.new({id:t,__demoMode:s}),[]);return ln(()=>a.dispose()),a}let ll=n.Fragment;function ol(t,s){let a=n.useId(),{__demoMode:r=!1,...l}=t,i=ya({id:a,__demoMode:r}),[o,h,p]=he(i,k=>[k.menuState,k.itemsElement,k.buttonElement]),v=Ce(s),c=Zs.get(null),y=he(c,n.useCallback(k=>c.selectors.isTop(k,a),[c,a]));vn(y,[p,h],(k,f)=>{var M;i.send({type:G.CloseMenu}),jn(f,wn.Loose)||(k.preventDefault(),(M=i.state.buttonElement)==null||M.focus())});let g=Q(()=>{i.send({type:G.CloseMenu})}),b=Se({open:o===Z.Open,close:g}),d={ref:v},N=fe();return te.createElement(Tr,null,te.createElement(ga.Provider,{value:i},te.createElement(Nn,{value:Ct(o,{[Z.Open]:at.Open,[Z.Closed]:at.Closed})},N({ourProps:d,theirProps:l,slot:b,defaultTag:ll,name:"Menu"}))))}let il="button";function cl(t,s){let a=Dt("Menu.Button"),r=n.useId(),{id:l=`headlessui-menu-button-${r}`,disabled:i=!1,autoFocus:o=!1,...h}=t,p=n.useRef(null),v=_r(),c=Ce(s,p,Rr(),Q(m=>a.send({type:G.SetButtonElement,element:m}))),y=Q(m=>{switch(m.key){case q.Space:case q.Enter:case q.ArrowDown:m.preventDefault(),m.stopPropagation(),a.send({type:G.OpenMenu,focus:{focus:W.First}});break;case q.ArrowUp:m.preventDefault(),m.stopPropagation(),a.send({type:G.OpenMenu,focus:{focus:W.Last}});break}}),g=Q(m=>{switch(m.key){case q.Space:m.preventDefault();break}}),[b,d,N]=he(a,m=>[m.menuState,m.buttonElement,m.itemsElement]),k=b===Z.Open;Fr(k,{trigger:d,action:n.useCallback(m=>{if(d!=null&&d.contains(m.target))return Je.Ignore;let R=m.target.closest('[role="menuitem"]:not([data-disabled])');return on(R)?Je.Select(R):N!=null&&N.contains(m.target)?Je.Ignore:Je.Close},[d,N]),close:n.useCallback(()=>a.send({type:G.CloseMenu}),[]),select:n.useCallback(m=>m.click(),[])});let f=Lr(m=>{var R;i||(b===Z.Open?(jt.flushSync(()=>a.send({type:G.CloseMenu})),(R=p.current)==null||R.focus({preventScroll:!0})):(m.preventDefault(),a.send({type:G.OpenMenu,focus:{focus:W.Nothing},trigger:rt.Pointer})))}),{isFocusVisible:M,focusProps:I}=St({autoFocus:o}),{isHovered:_,hoverProps:j}=_t({isDisabled:i}),{pressed:C,pressProps:$}=cn({disabled:i}),w=Se({open:b===Z.Open,active:C||b===Z.Open,disabled:i,hover:_,focus:M,autofocus:o}),u=ot(v(),{ref:c,id:l,type:dn(t,p.current),"aria-haspopup":"menu","aria-controls":N==null?void 0:N.id,"aria-expanded":b===Z.Open,disabled:i||void 0,autoFocus:o,onKeyDown:y,onKeyUp:g},f,I,j,$);return fe()({ourProps:u,theirProps:h,slot:w,defaultTag:il,name:"Menu.Button"})}let dl="div",ul=bs.RenderStrategy|bs.Static;function ml(t,s){let a=n.useId(),{id:r=`headlessui-menu-items-${a}`,anchor:l,portal:i=!1,modal:o=!0,transition:h=!1,...p}=t,v=Ir(l),c=Dt("Menu.Items"),[y,g]=Er(v),b=Mr(),[d,N]=n.useState(null),k=Ce(s,v?y:null,Q(D=>c.send({type:G.SetItemsElement,element:D})),N),[f,M]=he(c,D=>[D.menuState,D.buttonElement]),I=ys(M),_=ys(d);v&&(i=!0);let j=un(),[C,$]=mn(h,d,j!==null?(j&at.Open)===at.Open:f===Z.Open);pn(C,M,()=>{c.send({type:G.CloseMenu})});let w=he(c,D=>D.__demoMode),u=w?!1:o&&f===Z.Open;hn(u,_);let m=w?!1:o&&f===Z.Open;xn(m,{allowed:n.useCallback(()=>[M,d],[M,d])});let R=he(c,c.selectors.didButtonMove)?!1:C;n.useEffect(()=>{let D=d;D&&f===Z.Open&&(Ze(D)||D.focus({preventScroll:!0}))},[f,d]),Hr(f===Z.Open,{container:d,accept(D){return D.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:D.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(D){D.setAttribute("role","none")}});let x=fn(),T=Q(D=>{var K,ee,V;switch(x.dispose(),D.key){case q.Space:if(c.state.searchQuery!=="")return D.preventDefault(),D.stopPropagation(),c.send({type:G.Search,value:D.key});case q.Enter:if(D.preventDefault(),D.stopPropagation(),c.state.activeItemIndex!==null){let{dataRef:F}=c.state.items[c.state.activeItemIndex];(ee=(K=F.current)==null?void 0:K.domRef.current)==null||ee.click()}c.send({type:G.CloseMenu}),ta(c.state.buttonElement);break;case q.ArrowDown:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Next});case q.ArrowUp:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Previous});case q.Home:case q.PageUp:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.First});case q.End:case q.PageDown:return D.preventDefault(),D.stopPropagation(),c.send({type:G.GoToItem,focus:W.Last});case q.Escape:D.preventDefault(),D.stopPropagation(),jt.flushSync(()=>c.send({type:G.CloseMenu})),(V=c.state.buttonElement)==null||V.focus({preventScroll:!0});break;case q.Tab:D.preventDefault(),D.stopPropagation(),jt.flushSync(()=>c.send({type:G.CloseMenu})),gn(c.state.buttonElement,D.shiftKey?Te.Previous:Te.Next);break;default:D.key.length===1&&(c.send({type:G.Search,value:D.key}),x.setTimeout(()=>c.send({type:G.ClearSearch}),350));break}}),S=Q(D=>{switch(D.key){case q.Space:D.preventDefault();break}}),A=Se({open:f===Z.Open}),ie=ot(v?b():{},{"aria-activedescendant":he(c,c.selectors.activeDescendantId),"aria-labelledby":he(c,D=>{var K;return(K=D.buttonElement)==null?void 0:K.id}),id:r,onKeyDown:T,onKeyUp:S,role:"menu",tabIndex:f===Z.Open?0:void 0,ref:k,style:{...p.style,...g,"--button-width":Pr(C,M,!0).width},...yn($)}),Y=fe();return te.createElement(bn,{enabled:i?t.static||C:!1,ownerDocument:I},Y({ourProps:ie,theirProps:p,slot:A,defaultTag:dl,features:ul,visible:R,name:"Menu.Items"}))}let pl=n.Fragment;function hl(t,s){let a=n.useId(),{id:r=`headlessui-menu-item-${a}`,disabled:l=!1,...i}=t,o=Dt("Menu.Item"),h=he(o,R=>o.selectors.isActive(R,r)),p=n.useRef(null),v=Ce(s,p),c=he(o,R=>o.selectors.shouldScrollIntoView(R,r));$e(()=>{if(c)return Cn().requestAnimationFrame(()=>{var R,x;(x=(R=p.current)==null?void 0:R.scrollIntoView)==null||x.call(R,{block:"nearest"})})},[c,p]);let y=zr(p),g=n.useRef({disabled:l,domRef:p,get textValue(){return y()}});$e(()=>{g.current.disabled=l},[g,l]),$e(()=>(o.actions.registerItem(r,g),()=>o.actions.unregisterItem(r)),[g,r]);let b=Q(()=>{o.send({type:G.CloseMenu})}),d=Q(R=>{if(l)return R.preventDefault();o.send({type:G.CloseMenu}),ta(o.state.buttonElement)}),N=Q(()=>{if(l)return o.send({type:G.GoToItem,focus:W.Nothing});o.send({type:G.GoToItem,focus:W.Specific,id:r})}),k=Ar(),f=Q(R=>k.update(R)),M=Q(R=>{k.wasMoved(R)&&(l||h||o.send({type:G.GoToItem,focus:W.Specific,id:r,trigger:rt.Pointer}))}),I=Q(R=>{k.wasMoved(R)&&(l||h&&o.state.activationTrigger===rt.Pointer&&o.send({type:G.GoToItem,focus:W.Nothing}))}),[_,j]=it(),[C,$]=Rt(),w=Se({active:h,focus:h,disabled:l,close:b}),u={id:r,ref:v,role:"menuitem",tabIndex:l===!0?void 0:-1,"aria-disabled":l===!0?!0:void 0,"aria-labelledby":_,"aria-describedby":C,disabled:void 0,onClick:d,onFocus:N,onPointerEnter:f,onMouseEnter:f,onPointerMove:M,onMouseMove:M,onPointerLeave:I,onMouseLeave:I},m=fe();return te.createElement(j,null,te.createElement($,null,m({ourProps:u,theirProps:i,slot:w,defaultTag:pl,name:"Menu.Item"})))}let xl="div";function fl(t,s){let[a,r]=it(),l=t,i={ref:s,"aria-labelledby":a,role:"group"},o=fe();return te.createElement(r,null,o({ourProps:i,theirProps:l,slot:{},defaultTag:xl,name:"Menu.Section"}))}let gl="header";function yl(t,s){let a=n.useId(),{id:r=`headlessui-menu-heading-${a}`,...l}=t,i=kn();$e(()=>i.register(r),[r,i.register]);let o={id:r,ref:s,role:"presentation",...i.props};return fe()({ourProps:o,theirProps:l,slot:{},defaultTag:gl,name:"Menu.Heading"})}let bl="div";function vl(t,s){let a=t,r={ref:s,role:"separator"};return fe()({ourProps:r,theirProps:a,slot:{},defaultTag:bl,name:"Menu.Separator"})}let jl=xe(ol),ba=xe(cl),va=xe(ml),Nt=xe(hl),wl=xe(fl),Nl=xe(yl),ja=xe(vl),kl=Object.assign(jl,{Button:ba,Items:va,Item:Nt,Section:wl,Heading:Nl,Separator:ja});var Cl=(t=>(t[t.RegisterOption=0]="RegisterOption",t[t.UnregisterOption=1]="UnregisterOption",t))(Cl||{});let Sl={0(t,s){let a=[...t.options,{id:s.id,element:s.element,propsRef:s.propsRef}];return{...t,options:ea(a,r=>r.element.current)}},1(t,s){let a=t.options.slice(),r=t.options.findIndex(l=>l.id===s.id);return r===-1?t:(a.splice(r,1),{...t,options:a})}},Ft=n.createContext(null);Ft.displayName="RadioGroupDataContext";function Lt(t){let s=n.useContext(Ft);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,Lt),a}return s}let At=n.createContext(null);At.displayName="RadioGroupActionsContext";function Ot(t){let s=n.useContext(At);if(s===null){let a=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,Ot),a}return s}function _l(t,s){return Ct(s.type,Sl,t,s)}let Rl="div";function Il(t,s){let a=n.useId(),r=sa(),{id:l=`headlessui-radiogroup-${a}`,value:i,form:o,name:h,onChange:p,by:v,disabled:c=r||!1,defaultValue:y,tabIndex:g=0,...b}=t,d=Or(v),[N,k]=n.useReducer(_l,{options:[]}),f=N.options,[M,I]=it(),[_,j]=Rt(),C=n.useRef(null),$=Ce(C,s),w=Sn(y),[u,m]=_n(i,p,w),R=n.useMemo(()=>f.find(F=>!F.propsRef.current.disabled),[f]),x=n.useMemo(()=>f.some(F=>d(F.propsRef.current.value,u)),[f,u]),T=Q(F=>{var O;if(c||d(F,u))return!1;let z=(O=f.find(U=>d(U.propsRef.current.value,F)))==null?void 0:O.propsRef.current;return z!=null&&z.disabled?!1:(m==null||m(F),!0)}),S=Q(F=>{if(!C.current)return;let O=f.filter(z=>z.propsRef.current.disabled===!1).map(z=>z.element.current);switch(F.key){case q.Enter:Rn(F.currentTarget);break;case q.ArrowLeft:case q.ArrowUp:if(F.preventDefault(),F.stopPropagation(),vs(O,Te.Previous|Te.WrapAround)===js.Success){let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break;case q.ArrowRight:case q.ArrowDown:if(F.preventDefault(),F.stopPropagation(),vs(O,Te.Next|Te.WrapAround)===js.Success){let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break;case q.Space:{F.preventDefault(),F.stopPropagation();let z=f.find(U=>Ze(U.element.current));z&&T(z.propsRef.current.value)}break}}),A=Q(F=>(k({type:0,...F}),()=>k({type:1,id:F.id}))),ie=n.useMemo(()=>({value:u,firstOption:R,containsCheckedOption:x,disabled:c,compare:d,tabIndex:g,...N}),[u,R,x,c,d,g,N]),Y=n.useMemo(()=>({registerOption:A,change:T}),[A,T]),D={ref:$,id:l,role:"radiogroup","aria-labelledby":M,"aria-describedby":_,onKeyDown:S},K=Se({value:u}),ee=n.useCallback(()=>{if(w!==void 0)return T(w)},[T,w]),V=fe();return te.createElement(j,{name:"RadioGroup.Description"},te.createElement(I,{name:"RadioGroup.Label"},te.createElement(At.Provider,{value:Y},te.createElement(Ft.Provider,{value:ie},h!=null&&te.createElement(In,{disabled:c,data:{[h]:u||"on"},overrides:{type:"radio",checked:u!=null},form:o,onReset:ee}),V({ourProps:D,theirProps:b,slot:K,defaultTag:Rl,name:"RadioGroup"})))))}let El="div";function Ml(t,s){var a;let r=Lt("RadioGroup.Option"),l=Ot("RadioGroup.Option"),i=n.useId(),{id:o=`headlessui-radiogroup-option-${i}`,value:h,disabled:p=r.disabled||!1,autoFocus:v=!1,...c}=t,y=n.useRef(null),g=Ce(y,s),[b,d]=it(),[N,k]=Rt(),f=aa({value:h,disabled:p});$e(()=>l.registerOption({id:o,element:y,propsRef:f}),[o,l,y,f]);let M=Q(x=>{var T;if(na(x.currentTarget))return x.preventDefault();l.change(h)&&((T=y.current)==null||T.focus())}),I=((a=r.firstOption)==null?void 0:a.id)===o,{isFocusVisible:_,focusProps:j}=St({autoFocus:v}),{isHovered:C,hoverProps:$}=_t({isDisabled:p}),w=r.compare(r.value,h),u=ot({ref:g,id:o,role:"radio","aria-checked":w?"true":"false","aria-labelledby":b,"aria-describedby":N,"aria-disabled":p?!0:void 0,tabIndex:p?-1:w||!r.containsCheckedOption&&I?r.tabIndex:-1,onClick:p?void 0:M,autoFocus:v},j,$),m=Se({checked:w,disabled:p,active:_,hover:C,focus:_,autofocus:v}),R=fe();return te.createElement(k,{name:"RadioGroup.Description"},te.createElement(d,{name:"RadioGroup.Label"},R({ourProps:u,theirProps:c,slot:m,defaultTag:El,name:"RadioGroup.Option"})))}let Pl="span";function Tl(t,s){var a;let r=Lt("Radio"),l=Ot("Radio"),i=n.useId(),o=En(),h=sa(),{id:p=o||`headlessui-radio-${i}`,value:v,disabled:c=r.disabled||h||!1,autoFocus:y=!1,...g}=t,b=n.useRef(null),d=Ce(b,s),N=Mn(),k=Pn(),f=aa({value:v,disabled:c});$e(()=>l.registerOption({id:p,element:b,propsRef:f}),[p,l,b,f]);let M=Q(R=>{var x;if(na(R.currentTarget))return R.preventDefault();l.change(v)&&((x=b.current)==null||x.focus())}),{isFocusVisible:I,focusProps:_}=St({autoFocus:y}),{isHovered:j,hoverProps:C}=_t({isDisabled:c}),$=((a=r.firstOption)==null?void 0:a.id)===p,w=r.compare(r.value,v),u=ot({ref:d,id:p,role:"radio","aria-checked":w?"true":"false","aria-labelledby":N,"aria-describedby":k,"aria-disabled":c?!0:void 0,tabIndex:c?-1:w||!r.containsCheckedOption&&$?r.tabIndex:-1,autoFocus:y,onClick:c?void 0:M},_,C),m=Se({checked:w,disabled:c,hover:j,focus:I,autofocus:y});return fe()({ourProps:u,theirProps:g,slot:m,defaultTag:Pl,name:"Radio"})}let $l=xe(Il),Dl=xe(Ml),pt=xe(Tl),Fl=qe,Ll=ct,Al=Object.assign($l,{Option:Dl,Radio:pt,Label:Fl,Description:Ll});/** + * @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 Ol=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],zl=ae("arrow-left",Ol);/** + * @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 Hl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],wa=ae("circle-dot",Hl);/** + * @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 Bl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],Gl=ae("crosshair",Bl);/** + * @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 Kl=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ul=ae("ellipsis-vertical",Kl);/** + * @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 ql=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Vl=ae("key",ql);/** + * @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 Wl=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],kt=ae("log-in",Wl);/** + * @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 Ql=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Yl=ae("panel-left-close",Ql);/** + * @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 Xl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Jl=ae("panel-left-open",Xl);/** + * @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 Zl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ts=ae("panel-right-close",Zl);/** + * @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 eo=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],to=ae("radar",eo);/** + * @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 so=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ao=ae("save",so);/** + * @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 no=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ro=ae("star",no);/** + * @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 lo=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zt=ae("upload",lo);/** + * @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 oo=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],io=ae("user-plus",oo),Ve={sm:{radio:"h-4 w-4",dot:"h-1.5 w-1.5",text:"text-sm",descText:"text-xs",padding:"py-2 px-3",segmentPadding:"py-1.5 px-2.5"},md:{radio:"h-5 w-5",dot:"h-2 w-2",text:"text-sm",descText:"text-xs",padding:"py-3 px-4",segmentPadding:"py-2 px-3"},lg:{radio:"h-6 w-6",dot:"h-2.5 w-2.5",text:"text-base",descText:"text-sm",padding:"py-4 px-5",segmentPadding:"py-2.5 px-4"}};function Na({checked:t,size:s,disabled:a}){const r=Ve[s];return e.jsx("span",{className:P("relative flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-150",r.radio,t?"border-sys-blue bg-sys-blue":"border-edge-subtle bg-subtle",!t&&!a&&"group-hover:border-edge-strong",a&&"opacity-50"),children:t&&e.jsx("span",{className:P(r.dot,"rounded-full bg-white")})})}function co({option:t,size:s}){const a=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:"group flex items-start gap-3 cursor-pointer ring-focus rounded-lg",children:({checked:r,disabled:l})=>e.jsxs(e.Fragment,{children:[e.jsx(Na,{checked:r,size:s,disabled:l}),e.jsxs("div",{className:"flex-1 min-w-0 select-none",children:[e.jsx(qe,{className:P(a.text,"font-medium cursor-pointer",l?"text-fg-muted":"text-fg-primary"),children:t.label}),t.description&&e.jsx(ct,{className:P(a.descText,"text-fg-muted mt-0.5"),children:t.description})]})]})})}function uo({option:t,size:s}){const a=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:P("group relative flex cursor-pointer ring-focus","radius-inset border-2 transition-all duration-150",a.padding),children:({checked:r,disabled:l})=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:P("absolute inset-0 radius-inset transition-colors",r?"border-sys-blue bg-sys-blue/5":"border-edge-subtle bg-subtle",!r&&!l&&"group-hover:border-edge-strong group-hover:bg-elevated",l&&"opacity-50"),style:{borderWidth:"inherit"}}),e.jsxs("div",{className:"relative flex items-start gap-3 w-full",children:[t.icon&&e.jsx("span",{className:P("shrink-0",r?"text-sys-blue":"text-fg-muted"),children:t.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(qe,{className:P(a.text,"font-medium cursor-pointer",l?"text-fg-muted":r?"text-sys-blue":"text-fg-primary"),children:t.label}),t.description&&e.jsx(ct,{className:P(a.descText,"text-fg-muted mt-0.5"),children:t.description})]}),e.jsx(Na,{checked:r,size:s,disabled:l})]})]})})}function mo({option:t,size:s,isFirst:a,isLast:r}){const l=Ve[s];return e.jsx(pt,{value:t.value,disabled:t.disabled,className:P("group relative flex items-center justify-center cursor-pointer ring-focus","transition-all duration-150",l.segmentPadding,a&&"rounded-l-lg",r&&"rounded-r-lg"),children:({checked:i,disabled:o})=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:P("absolute inset-0 transition-colors",i?"bg-sys-blue":"bg-transparent",!i&&!o&&"group-hover:bg-subtle-fill",a&&"rounded-l-lg",r&&"rounded-r-lg",o&&"opacity-50")}),e.jsxs(qe,{className:P("relative z-10 font-medium cursor-pointer select-none",l.text,i?"text-white":o?"text-fg-muted":"text-fg-primary"),children:[t.icon&&e.jsx("span",{className:"mr-1.5 inline-flex",children:t.icon}),t.label]})]})})}function po({label:t,description:s,options:a,value:r,onChange:l,size:i="md",variant:o="simple",orientation:h="vertical",name:p,disabled:v,className:c}){const y=Ve[i];return e.jsxs(Al,{value:r,onChange:l,name:p,disabled:v,className:P("space-y-3",c),children:[t&&e.jsx(qe,{className:P(y.text,"font-medium text-fg-primary"),children:t}),s&&e.jsx(ct,{className:P(y.descText,"text-fg-muted -mt-1"),children:s}),o==="segmented"?e.jsx("div",{className:"inline-flex rounded-lg bg-subtle-fill-strong p-0.5",children:a.map((g,b)=>e.jsx(mo,{option:g,size:i,isFirst:b===0,isLast:b===a.length-1},g.value))}):e.jsx("div",{className:P(o==="card"&&h==="horizontal"&&"grid grid-cols-2 gap-3 sm:grid-cols-3",o==="card"&&h==="vertical"&&"space-y-3",o==="simple"&&h==="horizontal"&&"flex flex-wrap gap-4",o==="simple"&&h==="vertical"&&"space-y-2"),children:a.map(g=>o==="card"?e.jsx(uo,{option:g,size:i},g.value):e.jsx(co,{option:g,size:i},g.value))})]})}function Ne({children:t,className:s,onClick:a,disabled:r=!1,destructive:l=!1,icon:i,trailing:o,href:h,checked:p}){const v=e.jsxs(e.Fragment,{children:[(i||p!==void 0)&&e.jsx("span",{className:P("flex-shrink-0 w-4 h-4 flex items-center justify-center","text-fg-muted",l&&"text-sys-red","group-data-[focus]:text-white"),children:p!==void 0?p?e.jsx(be,{className:"h-4 w-4 text-sys-blue group-data-[focus]:text-white"}):null:i}),e.jsx("span",{className:"flex-1 truncate",children:t}),o&&e.jsx("span",{className:"flex-shrink-0 text-fg-muted group-data-[focus]:text-white/70 text-xs",children:o})]}),c=P("group flex items-center gap-2 w-full","px-3 py-2 radius-control cursor-default","text-sm text-left","transition-colors","focus:outline-none",r?"opacity-50 cursor-not-allowed":[l?["text-sys-red","data-[focus]:bg-sys-red data-[focus]:text-white"]:["text-fg-primary","data-[focus]:bg-sys-blue data-[focus]:text-white"]],s);return h&&!r?e.jsx(Nt,{children:e.jsx("a",{href:h,className:c,children:v})}):e.jsx(Nt,{disabled:r,children:e.jsx("button",{type:"button",onClick:a,disabled:r,className:c,children:v})})}function ho({className:t}){return e.jsx(ja,{className:P("my-1 h-px bg-border-subtle",t)})}const xo=100,fo=101,go=102,yo=103,bo=104,vo=115,jo=116,wo=117,No=120,ko=125,Co=128,So=136;function _o(t){const s=new Tn(t),a=[];for(;s.getRemainingBytesCount()>=2;){const r=s.readUInt8(),l=s.readUInt8();if(r===0&&l===0)break;switch(l){case xo:a.push({channel:r,type:l,value:s.readUInt32BE()});break;case fo:a.push({channel:r,type:l,value:s.readInt16BE()});break;case go:a.push({channel:r,type:l,value:s.readUInt8()});break;case yo:a.push({channel:r,type:l,value:s.readInt16BE()/10});break;case bo:a.push({channel:r,type:l,value:s.readUInt8()/2});break;case vo:a.push({channel:r,type:l,value:s.readUInt16BE()/10});break;case jo:a.push({channel:r,type:l,value:s.readInt16BE()/100});break;case wo:a.push({channel:r,type:l,value:s.readInt16BE()/1e3});break;case No:a.push({channel:r,type:l,value:s.readUInt8()});break;case ko:a.push({channel:r,type:l,value:s.readUInt16BE()});break;case Co:a.push({channel:r,type:l,value:s.readUInt16BE()});break;case So:a.push({channel:r,type:l,value:{latitude:s.readInt24BE()/1e4,longitude:s.readInt24BE()/1e4,altitude:s.readInt24BE()/100}});break;default:return a}}return a}const ka="pymc_companion_contacts_micro",Ca="pymc_companion_favorites",yt=56;function $s(){try{return localStorage.getItem(ka)==="1"}catch{return!1}}function Ro(t){try{localStorage.setItem(ka,t?"1":"0")}catch{}}function Io(){try{const t=localStorage.getItem(Ca);return t?new Set(JSON.parse(t)):new Set}catch{return new Set}}function Eo(t){try{localStorage.setItem(Ca,JSON.stringify([...t]))}catch{}}function Mo({name:t,pubkey:s,advType:a,size:r="md",signal:l}){const i=(a??0)&15,o=r==="sm"?"w-5 h-5":"w-6 h-6",h=r==="sm"?"size-3":"size-3.5";if(i===2){const y=l&&l.rssi!==0,g=y?`RSSI: ${l.rssi} dBm · SNR: ${l.snr.toFixed(1)} dB${l.rtt_ms!=null?` · RTT: ${l.rtt_ms} ms`:""}`:void 0;return e.jsx("div",{className:P(o,"relative rounded-full flex items-center justify-center flex-shrink-0 ring-[1.5px]",y?"ring-transparent":"ring-sys-blue"),title:g,children:y?e.jsx(Cr,{rssi:l.rssi,snr:l.snr,compact:!0,showValues:!1}):e.jsx(ze,{className:P(h,"text-sys-blue")})})}if(i===3)return e.jsx("div",{className:P(o,"relative rounded-full flex items-center justify-center flex-shrink-0 ring-[1.5px] ring-sys-pink"),children:e.jsx(dt,{className:P(h,"text-sys-pink")})});if(!t)return e.jsx("div",{className:P(o,"relative rounded-full bg-sys-blue/12 flex items-center justify-center flex-shrink-0"),children:e.jsx("span",{className:"text-sys-blue font-mono text-[10px] font-bold",children:s.slice(0,4)})});const{emoji:p}=Mt(t),v=Pt(t),c=Tt(t);return e.jsx("div",{className:P(o,"relative clay-avatar",p?"text-base":"text-white text-[11px] font-bold"),style:{"--avatar-color":v},children:p||c})}const Ds=[{key:"companion",label:"Companions",icon:ye,color:"text-sys-blue"},{key:"room",label:"Room Servers",icon:dt,color:"text-sys-pink"},{key:"repeater",label:"Repeaters",icon:ze,color:"text-sys-blue"}];function Po(t){const s=(t.adv_type??0)&15;return s===3?"room":s===2?"repeater":"companion"}const To=4e3,$o=5e3,Do=2e3,Fo=8;function Lo({contact:t,isActive:s,unread:a,lastMsg:r,isFav:l,microContent:i,onSelect:o,onShowDetails:h,onShareContact:p,onResetPath:v,onRemoveContact:c,onPingContact:y,repeaterNeighborHashes:g,repeaterSignal:b,toggleFavorite:d}){const N=$n(t.public_key),k=Dn(t.public_key),[f,M]=n.useState(!1),[I,_]=n.useState(!1),j=n.useRef(null),[C,$]=n.useState("idle"),w=n.useRef(!1),u=n.useRef(null),[m,R]=n.useState({w:0,h:0});n.useEffect(()=>{if(N)w.current=!0,$("idle");else if(w.current){w.current=!1;const D=se.getState().pingResults.get(t.public_key),K=D!=null&&D.rssi!==0;$(K?"success":"failed")}},[N,t.public_key]),n.useEffect(()=>{if(C==="idle")return;const K=setTimeout(()=>$("idle"),C==="success"?$o:Do);return()=>clearTimeout(K)},[C]);const x=(N||C!=="idle")&&!f;n.useEffect(()=>{if(!x)return;const D=u.current;if(!D)return;const K=()=>{const V=D.offsetWidth,F=D.offsetHeight;R(O=>O.w===V&&O.h===F?O:{w:V,h:F})};K();const ee=new ResizeObserver(K);return ee.observe(D),()=>ee.disconnect()},[x]);const T=n.useCallback(()=>{M(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>M(!1),To)},[]),S=n.useCallback(()=>{M(!1),j.current&&clearTimeout(j.current)},[]),A=n.useCallback(async()=>{c&&(j.current&&clearTimeout(j.current),_(!0),await c(t.public_key),_(!1),M(!1))},[c,t.public_key]),ie=n.useMemo(()=>{const D=k&&k.rssi!==0,K=b&&b.rssi!==0;if(!D&&!K)return null;if(D&&!K)return{rssi:k.rssi,snr:k.snr_db,rtt_ms:k.rtt_ms};if(!D&&K)return{rssi:b.rssi,snr:b.snr};const ee=b.advertCount,V=3,F=ee+V;return{rssi:Math.round((b.rssi*ee+k.rssi*V)/F),snr:(b.snr*ee+k.snr_db*V)/F,rtt_ms:k.rtt_ms}},[k,b]),Y=f?"":C==="success"?"bg-sys-green/5":C==="failed"?"bg-sys-red/5":N?"bg-sys-blue/5":s?"bg-sys-blue":"hover:bg-elevated";return e.jsxs(ue.div,{ref:u,layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,className:P("group relative w-full flex items-center gap-2.5 px-2.5 py-[3px] radius-inner overflow-hidden","transition-[background-color,box-shadow] duration-150",Y),children:[e.jsx(ge,{children:x&&m.w>0&&(C!=="idle"?e.jsx(ue.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{opacity:{duration:.15}},className:P("absolute inset-0 radius-inner ring-2 ring-inset pointer-events-none z-[2]",C==="success"?"ring-sys-green":"ring-sys-red")},`ping-${C}`):e.jsx(Fn,{borderRadius:Fo,width:m.w,height:m.h,color:"blue"},"ping-crawl"))}),e.jsxs("div",{className:"grid flex-1 min-w-0 [&>*]:col-start-1 [&>*]:row-start-1",children:[e.jsxs("div",{className:P("flex items-center gap-2.5",f&&!i&&"invisible pointer-events-none"),children:[e.jsxs("button",{onClick:()=>o({type:"contact",id:t.public_key}),className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mo,{name:t.name,pubkey:t.public_key,advType:t.adv_type,signal:ie}),a>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-sys-red ring-2 ring-body"})]}),!i&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("span",{className:P("text-sm truncate flex-1",s?"text-white font-medium":l?"text-sys-amber font-bold":"text-fg-primary font-medium"),children:t.name||t.public_key.slice(0,12)+"…"})}),C==="success"&&k?e.jsxs("div",{className:"text-[11px] text-sys-green font-medium truncate tabular-nums",children:[k.rssi," dBm · ",k.snr_db.toFixed(1)," dB",k.rtt_ms!=null&&` · ${k.rtt_ms} ms`]}):C==="failed"?e.jsx("div",{className:"text-[11px] text-sys-red font-medium truncate",children:"No response"}):r?e.jsx("div",{className:P("text-[11px] truncate",s?"text-white/70":"text-fg-muted"),children:r.text}):null]})]}),!i&&e.jsx("div",{className:"relative flex-shrink-0 w-[18px] h-[18px] flex items-center justify-center",children:e.jsx(kl,{as:"div",className:"absolute inset-0",children:({open:D})=>e.jsxs(e.Fragment,{children:[e.jsx(ba,{className:P("absolute inset-0 flex items-center justify-center rounded transition-[opacity,background-color] duration-100","focus:outline-none",s?"hover:bg-white/15":"hover:bg-subtle-fill",D?"opacity-100":"opacity-0 group-hover:opacity-100"),"aria-label":"Contact options",children:e.jsx(Ul,{className:P("h-3.5 w-3.5 transition-colors",s?"text-white/60 hover:text-white":"text-fg-muted hover:text-sys-blue")})}),e.jsxs(va,{anchor:"right start",transition:!0,className:P("min-w-[10rem] max-w-[20rem]","radius-inset p-1 ml-1","surface-elevated","focus:outline-none z-50","transition-[opacity,transform]","data-[closed]:opacity-0 data-[closed]:scale-[0.98] data-[closed]:translate-x-[-4px]","data-[enter]:duration-150 data-[leave]:duration-100","data-[enter]:ease-out data-[leave]:ease-in"),children:[e.jsx(Ne,{icon:e.jsx(nt,{className:"w-4 h-4"}),onClick:()=>{h==null||h({type:"contact",id:t.public_key})},children:"Details"}),p&&e.jsx(Ne,{icon:e.jsx(Br,{className:"w-4 h-4"}),onClick:()=>p(t.public_key),children:"Share"}),e.jsx(Ne,{icon:e.jsx(Ge,{className:"w-4 h-4"}),onClick:()=>o({type:"contact",id:t.public_key}),children:"Set Path"}),v&&e.jsx(Ne,{icon:e.jsx(ca,{className:"w-4 h-4"}),onClick:()=>v(t.public_key),children:"Reset Path"}),y&&e.jsx(Ne,{icon:e.jsx(Gl,{className:"w-4 h-4"}),onClick:()=>y(t.public_key),disabled:!(g!=null&&g.has(t.public_key)),children:"Ping"}),c&&e.jsx(Ne,{icon:e.jsx(Ke,{className:"w-4 h-4"}),destructive:!0,onClick:T,children:"Remove Contact"}),e.jsx(ho,{}),e.jsx(Ne,{icon:e.jsx(ro,{className:P("w-4 h-4 group-data-[focus]:text-white group-data-[focus]:fill-white",l?"text-sys-amber fill-sys-amber":"text-fg-muted")}),onClick:()=>d(t.public_key),children:l?"Unfavorite":"Favorite"})]})]})})})]}),!i&&e.jsx("div",{className:P("flex items-center gap-1.5 self-center",!f&&"invisible pointer-events-none"),children:I?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"w-3.5 h-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:S,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-zinc-500/80 hover:bg-zinc-500 depth-stroke-raised transition-colors",children:e.jsx("span",{className:"text-[11px] font-semibold text-white",children:"Cancel"})}),e.jsx("button",{onClick:A,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-sys-red/80 hover:bg-sys-red depth-stroke-raised transition-colors",children:e.jsx(Ke,{className:"w-4 h-4 text-white"})})]})})]})]},t.public_key)}const Fs={excellent:4,good:3,fair:2,weak:1,poor:0};function Ls(t,s,a){const r=s==null?void 0:s.get(t),l=r&&r.rssi!==0,i=a==null?void 0:a.get(t),o=i&&typeof i.rssi=="number"&&i.rssi!==0;if(!l&&!o)return null;if(o&&!l)return i.rssi;if(!o&&l)return r.rssi;const h=r.advertCount,p=3;return Math.round((r.rssi*h+i.rssi*p)/(h+p))}function Ao(t,s,a,r,l){return[...t].sort((i,o)=>{const h=s.has(i.public_key)?0:1,p=s.has(o.public_key)?0:1;if(h!==p)return h-p;if(a){const v=a.get(i.public_key),c=v&&v.length>0?v[v.length-1].timestamp:0,y=a.get(o.public_key),g=y&&y.length>0?y[y.length-1].timestamp:0;if(c!==g)return g-c}if(r){const v=Ls(i.public_key,r,l),c=Ls(o.public_key,r,l);if(v!=null&&c==null)return-1;if(v==null&&c!=null)return 1;if(v!=null&&c!=null){const y=Fs[_s(v)]??0,g=Fs[_s(c)]??0;if(y!==g)return g-y}}return(i.name||"").localeCompare(o.name||"")})}const Oo=n.memo(n.forwardRef(function({contacts:s,selectedConversation:a,unreadMap:r,messages:l,onSelect:i,onShowDetails:o,onShareContact:h,onResetPath:p,onRemoveContact:v,onPingContact:c,repeaterNeighborHashes:y,repeaterSignalMap:g,isLoading:b,splitPercent:d=50,onMicroChange:N,className:k},f){const[M,I]=n.useState($s),[_,j]=n.useState($s),[C,$]=n.useState(""),[w,u]=n.useState(!1),[m,R]=n.useState(Io),x=n.useRef(null),T=n.useRef(null),S=n.useCallback(F=>{T.current=F,typeof f=="function"?f(F):f&&(f.current=F)},[f]),A=n.useCallback(()=>{I(F=>{const O=!F;Ro(O);const z=T.current;if(O&&j(!0),z){let U=0;const ne=z.parentElement;if(O)U=(ne==null?void 0:ne.offsetWidth)??z.offsetWidth;else if(ne){const We=ne.style.width;ne.style.width="var(--companion-side)",U=ne.offsetWidth,ne.style.width=We}const ht=O?yt:Math.round(d/100*U);tt(z,{width:`${ht}px`},{...de.layoutResize,onComplete(){z.style.width=O?`${yt}px`:`${d}%`,O||j(!1)}})}return N==null||N(O),O})},[d,N]),ie=n.useCallback(F=>{R(O=>{const z=new Set(O);return z.has(F)?z.delete(F):z.add(F),Eo(z),z})},[]),Y=w||C.length>0,D=n.useMemo(()=>{const F=new Set,O=s.filter(U=>F.has(U.public_key)?!1:(F.add(U.public_key),!0));if(!C.trim())return O;const z=C.toLowerCase();return O.filter(U=>{var ne;return((ne=U.name)==null?void 0:ne.toLowerCase().includes(z))||U.public_key.toLowerCase().includes(z)})},[s,C]),K=se(F=>F.pingResults),ee=n.useMemo(()=>{const F=new Map;for(const O of Ds)F.set(O.key,[]);for(const O of D)F.get(Po(O)).push(O);return Ds.map(O=>({...O,items:Ao(F.get(O.key),m,l,O.key==="repeater"?g:void 0,O.key==="repeater"?K:void 0)})).filter(O=>O.items.length>0)},[D,m,l,g,K]),V=(a==null?void 0:a.type)==="contact"?a.id:null;return e.jsxs("div",{ref:S,className:P("flex-shrink-0 overflow-hidden flex flex-col h-full",k),style:{width:M?yt:`${d}%`},children:[e.jsx("div",{className:P("flex items-center border-b border-edge-subtle flex-shrink-0",_?"justify-center p-2":"gap-2 px-3 py-2"),children:_?e.jsx("button",{onClick:A,className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:"Expand contacts",children:e.jsx(Jl,{className:"w-3.5 h-3.5 text-fg-muted"})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide flex-shrink-0",children:"Contacts"}),e.jsxs("div",{className:"flex items-center gap-1 ml-auto flex-shrink-0",children:[e.jsx("button",{onClick:()=>{Y?($(""),u(!1)):(u(!0),setTimeout(()=>{var F;return(F=x.current)==null?void 0:F.focus()},50))},className:P("p-1 rounded transition-colors flex-shrink-0",Y?"bg-sys-blue/10 text-sys-blue":"hover:bg-subtle-fill text-fg-muted"),title:Y?"Close search":"Search contacts",children:e.jsx(Rs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A,className:"p-1 hover:bg-subtle-fill rounded transition-colors flex-shrink-0",title:"Collapse contacts",children:e.jsx(Yl,{className:"w-3.5 h-3.5 text-fg-muted"})})]})]})}),!_&&Y&&e.jsxs("div",{className:"relative px-2.5 py-2 border-b border-edge-subtle/50 flex-shrink-0",children:[e.jsx(Rs,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none"}),e.jsx("input",{ref:x,type:"text",value:C,onChange:F=>$(F.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:"Search contacts…",className:"w-full pl-8 pr-8 py-1.5 text-sm radius-inner bg-input-bg border border-input-border text-fg-primary placeholder:text-fg-muted/50 ring-focus-inset hover:border-edge-strong transition-colors",autoFocus:!0}),e.jsx("button",{onClick:()=>{$(""),u(!1)},className:"absolute right-5 top-1/2 -translate-y-1/2 p-0.5 hover:bg-subtle-fill rounded",children:e.jsx(ut,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),b&&e.jsx("div",{className:"flex items-center justify-center flex-1",children:e.jsx("div",{className:"w-5 h-5 animate-spin rounded-full border-2 border-sys-blue border-t-transparent"})}),!b&&e.jsxs("div",{className:P("flex-1 overflow-y-auto min-h-0",_?"px-0":"px-1.5"),style:{contain:"layout style paint"},children:[ee.map(F=>{const O=F.icon;return e.jsxs(_e,{defaultOpen:!0,className:"mb-1",children:[e.jsxs(Re,{className:P("px-2 py-1 flex items-center gap-1.5 w-full","text-left radius-inner hover:bg-subtle-fill-strong transition-colors"),children:[e.jsx(O,{className:P("w-3.5 h-3.5",F.color)}),!_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:F.label}),e.jsx("span",{className:"type-data-xs text-fg-muted/50 ml-auto",children:F.items.length})]})]}),e.jsx(Ie,{children:e.jsx(ge,{initial:!1,mode:"popLayout",children:F.items.map(z=>e.jsx(Lo,{contact:z,isActive:V===z.public_key,unread:r.get(z.public_key)??0,lastMsg:(()=>{const U=l.get(z.public_key);return U&&U.length>0?U[U.length-1]:void 0})(),isFav:m.has(z.public_key),microContent:_,onSelect:i,onShowDetails:o,onShareContact:h,onResetPath:p,onRemoveContact:v,onPingContact:c,repeaterNeighborHashes:y,repeaterSignal:g==null?void 0:g.get(z.public_key),toggleFavorite:ie},z.public_key))})})]},F.key)}),D.length===0&&e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-sm text-fg-muted",children:C?"No matches":"No contacts yet"})})]})]})}));function zo({open:t,onClose:s}){const a=se(u=>u.discoverImportableChannels),r=se(u=>u.getEmptyChannelSlots),l=se(u=>u.importChannel),i=se(u=>u.refreshChannels),[o,h]=n.useState("discover"),[p,v]=n.useState([]),[c,y]=n.useState([]),[g,b]=n.useState(null),d=n.useRef(!1);n.useEffect(()=>{if(!t)return;h("discover"),v([]),y([]),b(null),d.current=!1;let u=!1;return(async()=>{try{const[m,R]=await Promise.all([a(),r()]);if(u)return;if(y(R),m.length===0){b("No channels found in repeater history. Decoded messages may still be loading."),h("select");return}R.length===0&&b("No empty channel slots on device. Delete a channel first to make room."),v(m.map(x=>({name:x.name,alreadyOnDevice:x.alreadyOnDevice,selected:!x.alreadyOnDevice,status:"pending"}))),h("select")}catch(m){u||(b(m instanceof Error?m.message:"Discovery failed"),h("select"))}})(),()=>{u=!0}},[t,a,r]);const N=n.useCallback(u=>{v(m=>m.map(R=>R.name===u&&!R.alreadyOnDevice?{...R,selected:!R.selected}:R))},[]),k=n.useCallback(()=>{v(u=>u.map(m=>m.alreadyOnDevice?m:{...m,selected:!0}))},[]),f=n.useCallback(()=>{v(u=>u.map(m=>m.alreadyOnDevice?m:{...m,selected:!1}))},[]),M=n.useMemo(()=>p.filter(u=>!u.alreadyOnDevice).length,[p]),I=n.useMemo(()=>p.filter(u=>u.selected&&!u.alreadyOnDevice).length,[p]),_=n.useMemo(()=>p.filter(u=>u.status==="done").length,[p]),j=n.useMemo(()=>p.filter(u=>u.status==="failed").length,[p]),C=n.useCallback(async()=>{h("import"),d.current=!1;const u=p.filter(R=>R.selected&&!R.alreadyOnDevice),m=[...c];for(const R of u){if(d.current)break;const x=m.shift();if(x===void 0){v(S=>S.map(A=>A.name===R.name&&A.status==="pending"?{...A,status:"failed"}:A));continue}v(S=>S.map(A=>A.name===R.name?{...A,status:"sending"}:A)),await new Promise(S=>setTimeout(S,150));const T=await l(R.name,x);v(S=>S.map(A=>A.name===R.name?{...A,status:T?"done":"failed"}:A)),T||m.unshift(x),d.current||await new Promise(S=>setTimeout(S,300))}await i(),h("complete")},[p,c,l,i]),$=n.useCallback(()=>{d.current=!0},[]),w=u=>{switch(u){case"pending":return e.jsx(wa,{className:"w-3.5 h-3.5 text-fg-muted"});case"sending":return e.jsx(oe,{className:"w-3.5 h-3.5 text-sys-blue animate-spin"});case"done":return e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"});case"failed":return e.jsx(ut,{className:"w-3.5 h-3.5 text-sys-red"})}};return e.jsxs(je,{open:t,onClose:o==="import"?()=>{}:s,size:"sm",children:[e.jsx(Ee,{icon:e.jsx(He,{className:"w-5 h-5"}),title:"Import Channels",onClose:o==="import"?void 0:s}),e.jsxs(we,{className:"!py-3 !px-0",children:[o==="discover"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 px-6",children:[e.jsx(oe,{className:"w-6 h-6 text-sys-blue animate-spin"}),e.jsx("p",{className:"text-sm text-fg-secondary",children:"Scanning repeater history…"}),e.jsx("p",{className:"text-[11px] text-fg-muted",children:"Waiting for decoded messages"})]}),o==="select"&&e.jsxs(e.Fragment,{children:[g&&e.jsxs("div",{className:"flex items-start gap-2 mx-4 mb-3 p-2.5 radius-inner bg-sys-amber/8 border border-sys-amber/20",children:[e.jsx(Be,{className:"w-3.5 h-3.5 text-sys-amber flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-fg-secondary",children:g})]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"text-[11px] text-fg-muted",children:[M," discoverable · ",c.length," slot",c.length!==1?"s":""," free"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:k,className:"text-[11px] text-sys-blue hover:underline",children:"All"}),e.jsx("span",{className:"text-fg-muted/40",children:"·"}),e.jsx("button",{onClick:f,className:"text-[11px] text-sys-blue hover:underline",children:"None"})]})]}),e.jsx("div",{className:"max-h-[320px] overflow-y-auto",children:p.map(u=>e.jsxs("button",{onClick:()=>N(u.name),disabled:u.alreadyOnDevice,className:P("w-full flex items-center gap-3 px-4 py-2 transition-colors",u.alreadyOnDevice?"opacity-40 cursor-default":"hover:bg-subtle-fill"),children:[e.jsx("div",{className:P("w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 transition-colors",u.alreadyOnDevice?"border-fg-muted/30 bg-fg-muted/10":u.selected?"border-sys-blue bg-sys-blue":"border-edge-subtle"),children:(u.selected||u.alreadyOnDevice)&&e.jsx(be,{className:"w-3 h-3 text-white"})}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-primary truncate",children:u.name})]}),u.alreadyOnDevice&&e.jsx("span",{className:"text-[10px] text-fg-muted bg-subtle-fill px-1.5 py-0.5 rounded flex-shrink-0",children:"on device"})]},u.name))})]})]}),(o==="import"||o==="complete")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 border-b border-edge-subtle",children:[e.jsx("span",{className:"text-[11px] text-fg-muted",children:o==="import"?"Importing channels…":"Import complete"}),e.jsxs("span",{className:"text-[11px] tabular-nums text-fg-secondary",children:[_+j," / ",p.filter(u=>u.selected&&!u.alreadyOnDevice).length]})]}),e.jsx("div",{className:"max-h-[320px] overflow-y-auto",children:p.filter(u=>u.selected&&!u.alreadyOnDevice).map(u=>e.jsxs("div",{className:P("flex items-center gap-3 px-4 py-2",u.status==="sending"&&"bg-sys-blue/5",u.status==="done"&&"bg-sys-green/5",u.status==="failed"&&"bg-sys-red/5"),children:[e.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:w(u.status)}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:P("text-sm truncate",u.status==="done"?"text-fg-primary":"text-fg-secondary"),children:u.name})]}),e.jsx("span",{className:P("text-[10px] flex-shrink-0",u.status==="sending"&&"text-sys-blue",u.status==="done"&&"text-sys-green",u.status==="failed"&&"text-sys-red",u.status==="pending"&&"text-fg-muted"),children:u.status==="sending"?"sending…":u.status==="done"?"added":u.status==="failed"?"failed":"waiting"})]},u.name))})]})]}),e.jsxs(Me,{children:[o==="select"&&e.jsxs(e.Fragment,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsxs(H,{color:"primary",onClick:C,disabled:I===0||c.length===0,children:[e.jsx(He,{className:"w-4 h-4"}),"Import ",I," ",I===1?"Channel":"Channels"]})]}),o==="import"&&e.jsx(H,{plain:!0,onClick:$,children:"Stop"}),o==="complete"&&e.jsxs(e.Fragment,{children:[j>0&&e.jsxs("span",{className:"text-xs text-sys-red flex items-center gap-1 mr-auto",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),j," failed"]}),e.jsxs(H,{color:"primary",onClick:s,children:[e.jsx(Kr,{className:"w-4 h-4"}),"Done — ",_," imported"]})]})]})]})}const Ho=4e3;function Bo(t){const s=t.frequency_hz/1e3,a=t.bandwidth_hz/1e3;return`${s} · SF${t.spreading_factor} · ${a}k`}function Go({channel:t,isActive:s,unread:a,lastMsg:r,isLoadingMessages:l,selfInfo:i,onSelect:o,onDeleteChannel:h}){const[p,v]=n.useState(!1),[c,y]=n.useState(!1),g=n.useRef(null),b=n.useCallback(()=>{v(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>v(!1),Ho)},[]),d=n.useCallback(()=>{v(!1),g.current&&clearTimeout(g.current)},[]),N=n.useCallback(async()=>{h&&(g.current&&clearTimeout(g.current),y(!0),await h(t.index),y(!1),v(!1))},[h,t.index]),k=t.name.toLowerCase()==="public",f=h&&!k;return e.jsx(ue.div,{layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,className:P("group w-full flex items-center gap-2.5 px-2.5 py-1 radius-inner","transition-[background-color] duration-150",p?"":s?"bg-sys-blue":"hover:bg-subtle-fill-strong"),children:e.jsxs("div",{className:"grid flex-1 min-w-0 [&>*]:col-start-1 [&>*]:row-start-1",children:[e.jsxs("div",{className:P("flex items-center gap-2.5 min-w-0",p&&"invisible pointer-events-none"),children:[e.jsx("button",{onClick:()=>o({type:"channel",id:String(t.index)}),className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:P("text-sm flex-shrink-0",s?"text-white font-semibold":r?"text-fg-primary font-semibold":"text-fg-secondary font-normal"),children:t.name}),k&&i&&e.jsx("span",{className:P("text-[9px] font-medium px-1.5 py-px rounded-full whitespace-nowrap truncate",s?"text-white/80 bg-white/15":"text-fg-muted/70 bg-subtle-fill"),children:Bo(i)})]}),r&&e.jsx("div",{className:P("text-[11px] truncate pl-2",s?"text-white/70":"text-fg-muted"),children:r.text})]})}),e.jsx("div",{className:"flex items-center flex-shrink-0",children:l?e.jsx("span",{className:"h-1.5 w-6 rounded-full bg-fg-muted/20 animate-pulse"}):f?e.jsxs("div",{className:"relative w-[18px] h-[18px] flex items-center justify-center",children:[a>0&&e.jsx("span",{className:"absolute inset-0 flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-[10px] font-bold leading-none group-hover:invisible transition-[visibility] duration-100",children:a>99?"99+":a}),e.jsx("button",{onClick:b,className:P("absolute inset-0 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 transition-[opacity,background-color] duration-100",s?"hover:bg-white/15":"hover:bg-subtle-fill"),title:"Remove channel",children:e.jsx(Ke,{className:P("w-3 h-3 transition-colors",s?"text-white/60 hover:text-white":"text-fg-muted hover:text-sys-red")})})]}):a>0?e.jsx("span",{className:"min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-[10px] font-bold flex items-center justify-center leading-none",children:a>99?"99+":a}):null})]}),e.jsx("div",{className:P("flex items-center gap-1.5 self-center",!p&&"invisible pointer-events-none"),children:c?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"w-3.5 h-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:d,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-zinc-500/80 hover:bg-zinc-500 depth-stroke-raised transition-colors",children:e.jsx("span",{className:"text-[11px] font-semibold text-white",children:"Cancel"})}),e.jsx("button",{onClick:N,className:"flex-1 flex items-center justify-center py-1 radius-inner bg-sys-red/80 hover:bg-sys-red depth-stroke-raised transition-colors",children:e.jsx(Ke,{className:"w-4 h-4 text-white"})})]})})]})})}const Ko=n.memo(n.forwardRef(function({channels:s,selectedConversation:a,unreadMap:r,messages:l,onSelect:i,onAddChannel:o,onDeleteChannel:h,className:p},v){const c=Ln(),y=mt(),[g,b]=n.useState(!1),d=n.useMemo(()=>{const k=new Set,f=s.filter(M=>k.has(M.index)?!1:(k.add(M.index),!0));return f.sort((M,I)=>{const _=M.name.toLowerCase()==="public",j=I.name.toLowerCase()==="public";if(_&&!j)return-1;if(!_&&j)return 1;const C=l.get(`ch:${M.index}`),$=C&&C.length>0?C[C.length-1].timestamp:0,w=l.get(`ch:${I.index}`),u=w&&w.length>0?w[w.length-1].timestamp:0;return $!==u?u-$:M.name.localeCompare(I.name)}),f},[s,l]),N=(a==null?void 0:a.type)==="channel"?a.id:null;return e.jsxs("div",{ref:v,className:P("flex-1 min-w-0 overflow-hidden flex flex-col h-full",p),children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-edge-subtle flex-shrink-0 overflow-hidden whitespace-nowrap",children:[e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide flex-shrink-0",children:"Channels"}),e.jsxs("div",{className:"flex items-center gap-1 ml-auto flex-shrink-0",children:[e.jsx("button",{onClick:()=>b(!0),className:"p-1 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Import channels from repeater history",children:e.jsx(He,{className:"w-3.5 h-3.5 text-fg-muted"})}),o&&e.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Add channel",children:e.jsx(Ue,{className:"w-3.5 h-3.5 text-fg-muted"})})]})]}),e.jsx(zo,{open:g,onClose:()=>b(!1)}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 px-1.5 py-1",style:{contain:"layout style paint"},children:d.length===0?e.jsxs("div",{className:"px-1.5 py-4 space-y-2",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"No channels"}),o&&e.jsxs("button",{onClick:o,className:"inline-flex items-center gap-1.5 px-2 py-1.5 text-xs font-medium text-sys-blue hover:bg-sys-blue/8 rounded transition-colors",children:[e.jsx(Ue,{className:"w-3.5 h-3.5"}),"Add Channel"]})]}):e.jsx(ge,{initial:!1,mode:"popLayout",children:d.map(k=>e.jsx(Go,{channel:k,isActive:N===String(k.index),unread:r.get(`ch:${k.index}`)??0,lastMsg:(()=>{const f=l.get(`ch:${k.index}`);return f&&f.length>0?f[f.length-1]:void 0})(),isLoadingMessages:c,selfInfo:y,onSelect:i,onDeleteChannel:h},k.index))})})]})}));function Uo(t,s){const a=new Map;for(const[r,l]of t){const i=l.decoded;if(!(i!=null&&i.decrypted)||i.senderName!==s)continue;const o=i.timestamp??l.timestamp,h=Math.floor(o/30),p=`${i.text}:${h}`;a.has(p)||a.set(p,r)}return a}function qo(t){const s=mt(),a=An(),r=On(),l=s==null?void 0:s.node_name,i=n.useMemo(()=>l?Uo(a,l):new Map,[a,l]);return n.useMemo(()=>{const o=new Map;if(!l||i.size===0)return o;const h=new Map;for(const c of t){if(!c.is_outgoing||!c.is_channel)continue;const y=Math.floor(c.timestamp/30);let g=!1;for(const b of[y-1,y,y+1]){const d=i.get(`${c.text}:${b}`);if(d){const N=h.get(d)??[];N.push(c.id),h.set(d,N),g=!0;break}}}if(h.size===0)return o;const p=new Set(h.keys()),v=new Map;for(const c of r)p.has(c.packet_hash)&&v.set(c.packet_hash,(v.get(c.packet_hash)??0)+1);for(const[c,y]of h){const g=v.get(c)??0,b=Math.max(0,g-1);for(const d of y)o.set(d,b)}return o},[t,l,i,r])}const Vo=n.lazy(()=>ra(()=>import("./CompanionPathMap-DmNbWPuj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(t=>({default:t.CompanionPathMap}))),Wo=n.lazy(()=>ra(()=>import("./CompanionEchoMap-Cmhesaku.js"),__vite__mapDeps([8,1,2,3,5,6,7])).then(t=>({default:t.CompanionEchoMap}))),As=e.jsx("div",{className:"rounded-lg bg-elevated flex items-center justify-center",style:{aspectRatio:"16 / 10"},children:e.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})});function Qo(t){const s=new Date(t*1e3),r=Math.floor((new Date().getTime()-s.getTime())/864e5);return r===0?"Today":r===1?"Yesterday":s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Yo(t){const s=new Date(t*1e3);return`${s.getFullYear()}-${s.getMonth()}-${s.getDate()}`}function Xo(t){const s=new Map;for(const a of t)a.name&&s.set(a.public_key,a.name);return s}function Jo(t){const s=new Map;for(const a of t)s.set(a.public_key,a);return s}function Zo(t){if(!t)return[];const s=[];for(let a=0;ar.public_key.startsWith(t));return(a==null?void 0:a.name)||null}function ti(t,s){return t.is_outgoing?"You":t.sender_name?t.sender_name:s.get(t.sender_key)??t.sender_key.slice(0,8)}const si=n.memo(function({msg:s,contact:a,contacts:r,selfInfo:l,echoCount:i,channelName:o,children:h}){const[p,v]=n.useState(!1),[c,y]=n.useState(!1),[g,b]=n.useState(0),d=n.useRef(null),N=s.path_len,k=!s.is_outgoing,f=k&&N!=null,M=s.is_outgoing&&s.is_channel&&(i??0)>0,I=(o==null?void 0:o.toLowerCase().includes("wardrive"))??!1,_=n.useMemo(()=>I&&k?Vr(s.text):null,[I,k,s.text]),j=f||M,C=n.useMemo(()=>{const T=[];if(s.path_hops&&s.path_hops.length>0)T.push({hops:s.path_hops,snr:s.path_snr,rssi:s.path_rssi});else if(k&&(a!=null&&a.out_path)){const S=Zo(a.out_path);S.length>0&&T.push({hops:S})}if(s.alternate_paths)for(const S of s.alternate_paths)T.push(S);return T},[s.path_hops,s.path_snr,s.path_rssi,s.alternate_paths,k,a==null?void 0:a.out_path]),$=g1,m=(w==null?void 0:w.snr)??s.msg_snr,R=()=>{y(!0),v(T=>!T)},x=n.useCallback(T=>{var S;T.propertyName==="grid-template-rows"&&(p?(S=d.current)==null||S.scrollIntoView({block:"nearest",behavior:"smooth"}):y(!1))},[p]);return e.jsxs("div",{ref:d,className:P("rounded-xl px-2 py-1 -mx-2 transition-colors duration-150",j&&"hover:bg-subtle-fill cursor-pointer"),onClick:()=>j&&R(),children:[h,j&&e.jsx("div",{className:"grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.83,0,0.17,1)]",style:{gridTemplateRows:p?"1fr":"0fr"},onTransitionEnd:x,children:e.jsxs("div",{className:"overflow-hidden",children:[c&&f&&e.jsxs("div",{className:"mt-1.5 ml-13 space-y-1",children:[u&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",onClick:T=>T.stopPropagation(),children:C.map((T,S)=>e.jsxs("button",{onClick:()=>b(S),className:P("flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] transition-colors",S===$?"bg-sys-blue/15 text-sys-blue font-semibold":"bg-subtle-fill text-fg-muted hover:text-fg-secondary"),children:[e.jsx(Ge,{className:"w-2.5 h-2.5"}),T.hops.length||N,T.snr!=null&&e.jsxs("span",{className:"ml-0.5 opacity-70",children:[T.snr>0?"+":"",T.snr.toFixed(1)]})]},S))}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(Ge,{className:"w-3 h-3 text-fg-muted flex-shrink-0"}),N===0&&!w?e.jsx("span",{className:"text-[10px] text-fg-muted font-medium",children:"Direct"}):w&&w.hops.length>0?w.hops.map((T,S)=>{const A=ei(T,r);return e.jsxs("span",{className:"contents",children:[S>0&&e.jsx(Qr,{className:"w-2.5 h-2.5 text-fg-muted/50 flex-shrink-0"}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-subtle-fill text-[10px]",children:[e.jsx("span",{className:"font-mono text-fg-primary",children:T}),A&&e.jsxs("span",{className:"text-fg-muted",children:["(",A,")"]})]})]},S)}):e.jsxs("span",{className:"text-[10px] text-fg-muted font-medium",children:[N," hop",N>1?"s":""]}),m!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-fg-muted ml-0.5",children:[e.jsx(Sr,{className:"w-2.5 h-2.5"}),m>0?"+":"",m.toFixed(1),"dB"]}),(w==null?void 0:w.rssi)!=null&&e.jsxs("span",{className:"text-[10px] text-fg-muted",children:[w.rssi,"dBm"]})]}),w&&w.hops.length>=1&&e.jsx(n.Suspense,{fallback:As,children:e.jsx(Vo,{hops:w.hops,contacts:r,selfInfo:l,snr:m,wardriveCoords:_??void 0,wardriveSenderName:s.sender_name})})]}),c&&M&&e.jsx("div",{className:"mt-1.5",children:e.jsx(n.Suspense,{fallback:As,children:e.jsx(Wo,{text:s.text,timestamp:s.timestamp,contacts:r})})})]})})]})}),ai=n.memo(function({messages:s,contacts:a,className:r,conversationKey:l,onRetry:i,onRetryAsFlood:o,onMentionClick:h,historyLoading:p,historyExhausted:v,onLoadOlder:c,channelName:y}){const g=n.useRef(null),b=n.useRef(null),[d,N]=n.useState(!1),k=n.useRef(s.length),f=n.useRef(0),M=n.useRef(l);n.useEffect(()=>{if(l!==M.current){M.current=l,k.current=s.length,f.current=0,N(!1);const m=g.current;m&&(m.scrollTop=m.scrollHeight)}},[l,s.length]);const I=n.useMemo(()=>Xo(a),[a]),_=n.useMemo(()=>Jo(a),[a]),j=mt(),C=qo(s);n.useEffect(()=>{var R;const m=g.current;if(m){if(s.length>k.current&&f.current>0){const x=m.scrollHeight-f.current;if(x>0&&m.scrollTop<200){m.scrollTop+=x,k.current=s.length,f.current=0;return}}k.current=s.length,d||(R=b.current)==null||R.scrollIntoView({behavior:"smooth"})}},[s.length,d]);const $=n.useCallback(()=>{const m=g.current;if(!m)return;const R=m.scrollHeight-m.scrollTop-m.clientHeight;N(R>100),m.scrollTop<80&&c&&!p&&!v&&(f.current=m.scrollHeight,c())},[c,p,v]),w=n.useCallback(()=>{var m;(m=b.current)==null||m.scrollIntoView({behavior:"smooth"}),N(!1)},[]);let u="";return e.jsxs("div",{className:P("relative flex flex-col",r),children:[e.jsxs("div",{ref:g,onScroll:$,className:"flex-1 overflow-y-auto min-h-0 px-4 py-3",children:[p&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(oe,{className:"w-4 h-4 text-fg-muted animate-spin"})}),s.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-sm text-fg-muted",children:v?"No messages yet":"Loading messages…"})}):s.map(m=>{const R=Yo(m.timestamp),x=R!==u;u=R;const T=m.is_outgoing?m.failed?"failed":m.confirmed?"confirmed":m.unconfirmed?"unconfirmed":(m.retryAttempt??0)>0?"retrying":m.sent?"sent":"pending":void 0,S=m.is_channel&&m.channel_idx!=null?`ch:${m.channel_idx}`:m.sender_key;return e.jsxs("div",{children:[x&&e.jsx(Ur,{text:Qo(m.timestamp)}),e.jsx(si,{msg:m,contact:_.get(m.sender_key),contacts:a,selfInfo:j,echoCount:C.get(m.id),channelName:y,children:e.jsx(qr,{senderName:ti(m,I),text:m.text,timestamp:m.timestamp,isOutgoing:m.is_outgoing,status:T,onRetry:i&&m.failed?()=>i(S,m.id):void 0,onRetryAsFlood:o&&m.failed&&!m.is_channel?()=>o(S,m.id):void 0,retryAttempt:m.retryAttempt,maxRetries:m.maxRetries,echoCount:C.get(m.id),signed:!m.is_outgoing&&m.txt_type===zn.SignedPlain,bubbleVariant:"subtle",onMentionClick:h})})]},m.id)}),e.jsx("div",{ref:b})]}),e.jsx("button",{onClick:w,className:P("absolute bottom-4 right-4 w-8 h-8 rounded-full bg-sys-blue flex items-center justify-center shadow-lg","hover:bg-sys-blue/90 transition-all duration-200",d?"opacity-100 translate-y-0":"opacity-0 translate-y-2 pointer-events-none"),children:e.jsx(Wr,{className:"w-4 h-4 text-white"})})]})}),ni=6,ri=n.memo(function({onSend:s,disabled:a,placeholder:r="Type a message…",className:l,mentionNames:i=[]}){const[o,h]=n.useState(""),[p,v]=n.useState(!1),c=n.useRef(null),[y,g]=n.useState(null),[b,d]=n.useState(-1),[N,k]=n.useState(0),f=n.useMemo(()=>{if(y==null)return[];const w=y.toLowerCase();return i.filter(u=>u.toLowerCase().includes(w)).slice(0,ni)},[y,i]),M=f.length>0;n.useEffect(()=>{k(0)},[f]);const I=n.useCallback(()=>{g(null),d(-1),k(0)},[]),_=n.useCallback(w=>{var S;if(b<0)return;const u=o.slice(0,b),m=((S=c.current)==null?void 0:S.selectionStart)??o.length,R=o.slice(m),x=`@[${w}] `,T=u+x+R;h(T),I(),requestAnimationFrame(()=>{var ie,Y;const A=u.length+x.length;(ie=c.current)==null||ie.setSelectionRange(A,A),(Y=c.current)==null||Y.focus()})},[o,b,I]),j=n.useCallback(async()=>{var u;const w=o.trim();!w||p||a||(v(!0),I(),h(""),await s(w),v(!1),(u=c.current)==null||u.focus())},[o,p,a,s,I]),C=n.useCallback(w=>{const u=w.target.value;h(u);const m=w.target.selectionStart??u.length,R=u.slice(0,m),x=R.lastIndexOf("@");if(x>=0){const T=x>0?R[x-1]:" ";if(/\s/.test(T)||x===0){const S=R.slice(x+1);if(!S.includes(" ")&&!S.includes("[")){g(S),d(x);return}}}I()},[I]),$=n.useCallback(w=>{if(M){if(w.key==="ArrowDown"){w.preventDefault(),k(u=>(u+1)%f.length);return}if(w.key==="ArrowUp"){w.preventDefault(),k(u=>(u-1+f.length)%f.length);return}if(w.key==="Enter"||w.key==="Tab"){w.preventDefault(),_(f[N]);return}if(w.key==="Escape"){w.preventDefault(),I();return}}w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),j())},[j,M,f,N,_,I]);return e.jsxs("div",{className:P("relative flex items-center gap-2 p-3 border-t border-edge-subtle",l),children:[M&&e.jsx("div",{className:"absolute bottom-full left-3 right-3 mb-1 radius-inset surface-elevated depth-raised overflow-hidden z-50",children:f.map((w,u)=>{const m=Pt(w),{emoji:R,cleanName:x}=Mt(w),T=Tt(w);return e.jsxs("button",{onMouseDown:S=>{S.preventDefault(),_(w)},className:P("w-full flex items-center gap-2.5 px-3 py-1.5 text-left transition-colors",u===N?"bg-sys-blue/10":"hover:bg-subtle-fill"),children:[e.jsx("div",{className:P("clay-avatar w-5 h-5",R?"text-xs":"text-white text-[9px] font-bold"),style:{"--avatar-color":m},children:R||T}),e.jsx("span",{className:"text-sm text-fg-primary truncate",children:x})]},w)})}),e.jsx("input",{ref:c,type:"text",value:o,onChange:C,onKeyDown:$,onBlur:()=>{setTimeout(I,150)},placeholder:r,disabled:a,className:"flex-1 min-w-0 w-full px-4 py-3 text-sm radius-inner bg-input-bg border border-input-border text-fg-primary placeholder:text-fg-muted/50 ring-focus-inset hover:border-edge-strong transition-colors"}),e.jsx("button",{onClick:j,disabled:!o.trim()||p||a,className:P("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center transition-colors",o.trim()&&!a?"clay-send text-white":"bg-subtle-fill text-fg-muted cursor-not-allowed"),children:e.jsx(Hn,{className:"w-4.5 h-4.5 -translate-x-[0.5px] translate-y-[0.5px]",strokeWidth:2.5})})]})}),Ht="pymc_companion_room_pwd_";function li(t){try{return localStorage.getItem(`${Ht}${t}`)}catch{return null}}function oi(t,s){try{localStorage.setItem(`${Ht}${t}`,s)}catch{}}function Os(t){try{localStorage.removeItem(`${Ht}${t}`)}catch{}}const ii=n.memo(function({contact:s,loginStatus:a,onLogin:r,className:l}){const[i,o]=n.useState(""),[h,p]=n.useState(!0),[v,c]=n.useState(null),[y,g]=n.useState(!1),b=n.useRef(null),d=n.useRef(!0),N=s.public_key,k=n.useRef(N);k.current!==N&&(k.current=N,g(!1),c(null),o("")),n.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),n.useEffect(()=>{if(y||a==="success")return;const _=li(N);if(!_){g(!0);return}g(!0),(async()=>{const j=await r(N,_);d.current&&(j||(Os(N),c("Saved password rejected — please re-enter.")))})()},[N,y,a,r]);const f=n.useCallback(async()=>{c(null);const _=await r(N,i);d.current&&(_?h&&i?oi(N,i):Os(N):c("Login failed — check your password and try again."))},[N,i,h,r]),M=n.useCallback(_=>{_.key==="Enter"&&(_.preventDefault(),f())},[f]),I=a==="pending";return I&&!i?e.jsxs("div",{className:P("flex-1 flex flex-col items-center justify-center gap-3",l),children:[e.jsx(oe,{className:"w-6 h-6 text-sys-pink animate-spin"}),e.jsxs("p",{className:"text-sm text-fg-muted",children:["Connecting to ",s.name||"room server","…"]})]}):e.jsx(ue.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},className:P("flex-1 flex flex-col items-center justify-center px-6",l),children:e.jsxs("div",{className:"w-full max-w-xs space-y-5",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-pink bg-sys-pink/8",children:e.jsx(dt,{className:"size-7 text-sys-pink"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"type-body font-medium text-fg-primary",children:s.name||"Room Server"}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Enter the room password to join, or try logging in without one — some servers allow open access."})]})]}),(v||a==="failed")&&e.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg bg-sys-red/8 border border-sys-red/15",children:[e.jsx(da,{className:"w-3.5 h-3.5 text-sys-red flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-sys-red leading-relaxed",children:v||"Login failed — check your password and try again."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{ref:b,type:"password",value:i,onChange:_=>o(_.target.value),onKeyDown:M,placeholder:"Room password",disabled:I,autoFocus:!0,className:"w-full surface-input rounded-lg px-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-muted/50 focus:outline-none focus:ring-1 focus:ring-sys-pink/40"}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:_=>p(_.target.checked),disabled:I,className:"surface-checkbox w-3.5 h-3.5 rounded accent-sys-pink"}),e.jsx("span",{className:"text-xs text-fg-muted",children:"Remember password"})]}),e.jsxs(H,{color:"pink",className:"w-full justify-center",disabled:I,onClick:f,children:[I?e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}):e.jsx(kt,{"data-slot":"icon"}),I?"Connecting…":"Login"]})]}),e.jsx("p",{className:"text-[10px] text-fg-muted/60 text-center leading-relaxed",children:"The server determines your permissions based on the password. Admin and guest passwords grant different access levels."})]})})});function zs(t,s){return[t,s].sort().join("-")}function st(t){return t.substring(0,2)}function ci(t){var a,r;const s=(r=(a=t.traceQuality)==null?void 0:a.composite)==null?void 0:r.mean;return s!=null&&s!==0?Math.max(.1,s+20):Math.max(.1,t.strength*20)}function di(t,s,a,r){const{edgeMap:l}=a;if(l.size===0)return null;const i=new Map;for(const[,j]of l){const C=j.fromHash,$=j.toHash;i.has(C)||i.set(C,[]),i.has($)||i.set($,[]),i.get(C).push({neighbor:$,edge:j}),i.get($).push({neighbor:C,edge:j})}const o=new Set(i.keys()),h=Hs(t,o),p=Hs(s,o);if(!h||!p||h===p)return null;const v=new Map,c=new Map,y=new Set,g=[];for(v.set(h,0),c.set(h,null),g.push({node:h,cost:0});g.length>0;){g.sort(($,w)=>$.cost-w.cost);const j=g.shift();if(y.has(j.node))continue;if(y.add(j.node),j.node===p)break;const C=i.get(j.node)??[];for(const{neighbor:$,edge:w}of C){if(y.has($))continue;const u=ci(w),m=j.cost+1/u,R=v.get($)??1/0;m{var T,S;const $=st(j),w=N.get($);let u=0;const m=b[C],R=zs(m,j),x=l.get(R);return(S=(T=x==null?void 0:x.traceQuality)==null?void 0:T.composite)!=null&&S.mean?u=x.traceQuality.composite.mean:(x==null?void 0:x.avgSnr)!=null&&(u=x.avgSnr),{hash:j,prefix:$,name:(w==null?void 0:w.name)||null,snr:u}});let M=0,I=0;for(let j=0;j0?M/I:0;return{hops:k.map(st),confidence:_,via:f}}function Hs(t,s){if(s.has(t))return t;const a=st(t);let r=null,l=0;for(const i of s)if(i.startsWith(a)||t.startsWith(i.substring(0,2))){let o=0;const h=Math.min(t.length,i.length);for(let p=0;pl&&(l=o,r=i)}return r}function Bs(t){switch(t&15){case 1:return"Companion";case 2:return"Repeater";case 3:return"Room Server";default:return"Unknown"}}function Gs(t){switch(t&15){case 1:return"blue";case 2:return"green";case 3:return"indigo";default:return"zinc"}}function ui(t){return(t&15)===2}const Ks=n.memo(function({contact:s,channel:a,contacts:r=[],selfPubKey:l,embedded:i=!1,onResetPath:o,onRequestStatus:h,onRequestTelemetry:p,onLoginToRepeater:v,onLogoutFromRepeater:c,onGetNeighbours:y,onTraceContactPath:g,onDiscoverPath:b,onExportContact:d,onSetContactPath:N,className:k}){const[f,M]=n.useState({}),I=(s==null?void 0:s.public_key)??null,[_,j]=n.useState(I);if(I!==_&&(j(I),M({})),!s&&!a)return i?null:e.jsx("div",{className:P("flex items-center justify-center h-full",k),children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Select a conversation"})});async function C(m,R){M(T=>({...T,[m]:"loading"}));const x=await R();M(T=>({...T,[m]:x?"done":"error"})),setTimeout(()=>M(T=>({...T,[m]:"idle"})),2e3)}const $=a?e.jsxs("div",{className:"space-y-4",children:[!i&&e.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3 border-b border-edge-subtle",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-sys-indigo/15 flex items-center justify-center shadow-md",children:e.jsx(Fe,{className:"size-7 text-sys-indigo"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"type-body font-medium text-fg-primary",children:a.name}),e.jsxs(De,{color:"indigo",children:["Channel ",a.index]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Index"}),e.jsx("span",{className:"font-mono text-fg-primary",children:a.index})]}),e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Type"}),e.jsx("span",{className:"text-fg-primary",children:"Broadcast"})]})]}),e.jsx("div",{className:"pt-2 border-t border-edge-subtle",children:e.jsx("p",{className:"type-data-xs text-fg-muted/70",children:"Channel messages are broadcast-encrypted. Sender identity is not available due to MeshCore protocol limitations."})})]}):null,w=s?e.jsxs("div",{className:"space-y-4",children:[!i&&e.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3 border-b border-edge-subtle",children:[e.jsx(fi,{contact:s}),e.jsxs("div",{className:"text-center",children:[e.jsxs("h3",{className:"type-body font-medium text-fg-primary flex items-center justify-center gap-1",children:[s.name||"Unknown",e.jsx(qs,{pubkey:s.public_key})]}),e.jsx(De,{color:Gs(s.adv_type),children:Bs(s.adv_type)})]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{color:Gs(s.adv_type),children:Bs(s.adv_type)}),e.jsx(qs,{pubkey:s.public_key})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted w-20",children:"Public Key"}),e.jsx("span",{className:"font-mono text-fg-primary break-all text-[10px]",children:s.public_key})]}),e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(Ge,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"Path Length"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:s.out_path_len})]}),(s.gps_lat!==0||s.gps_lon!==0)&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(ia,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"GPS"}),e.jsxs("span",{className:"text-fg-primary ml-auto font-mono text-[10px]",children:[s.gps_lat.toFixed(5),", ",s.gps_lon.toFixed(5)]})]}),(s.lastmod>0||s.last_advert_timestamp>0)&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx(ua,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"Last Heard"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:new Date((s.lastmod||s.last_advert_timestamp)*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),s.last_advert_timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:"Last Advert"}),e.jsx("span",{className:"text-fg-primary ml-auto",children:new Date(s.last_advert_timestamp*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),e.jsx(yi,{contact:s,contacts:r,selfPubKey:l,onSetContactPath:N,onDiscoverPath:b,actionState:f,setActionState:M,runAction:C}),e.jsxs("div",{className:"space-y-2 pt-2 border-t border-edge-subtle",children:[e.jsxs(H,{color:f.reset==="done"?"success":f.reset==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.reset==="loading",onClick:()=>C("reset",()=>o(s.public_key)),children:[e.jsx(ca,{"data-slot":"icon"}),f.reset==="loading"?"Resetting…":f.reset==="done"?"Reset!":"Reset Path"]}),e.jsxs(H,{color:f.status==="done"?"success":f.status==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.status==="loading",onClick:()=>C("status",()=>h(s.public_key)),children:[e.jsx(ma,{"data-slot":"icon"}),f.status==="loading"?"Requesting…":"Request Status"]}),e.jsxs(H,{color:f.telemetry==="done"?"success":f.telemetry==="error"?"danger":"primary",outline:!0,className:"w-full justify-center",disabled:f.telemetry==="loading",onClick:()=>C("telemetry",()=>p(s.public_key)),children:[e.jsx(pa,{"data-slot":"icon"}),f.telemetry==="loading"?"Requesting…":"Request Telemetry"]})]}),d&&e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center",onClick:()=>d(s.public_key),children:[e.jsx(zt,{"data-slot":"icon"}),"Export Contact"]}),ui(s.adv_type)&&e.jsxs(e.Fragment,{children:[e.jsx(bi,{pubkey:s.public_key,onLogin:v,onLogout:c,actionState:f,runAction:C}),e.jsx(vi,{pubkey:s.public_key,onGetNeighbours:y,actionState:f,runAction:C}),e.jsx(ji,{pubkey:s.public_key,contact:s,onTrace:g,actionState:f,runAction:C})]}),e.jsx(mi,{pubkey:s.public_key}),e.jsx(xi,{pubkey:s.public_key})]}):null,u=$??w;return i?e.jsx("div",{className:k,children:u}):e.jsx("div",{className:P("flex flex-col h-full overflow-y-auto",k),children:e.jsx(ge,{mode:"wait",children:a?e.jsx(ue.div,{variants:Yr,initial:"hidden",animate:"visible",exit:"exit",className:"p-4",children:$},`ch-${a.index}`):s?e.jsx(ue.div,{variants:Xr,initial:"hidden",animate:"visible",exit:"exit",className:"p-4",children:w},`contact-${s.public_key}`):null})})});function Us(t){const s=Math.floor(t/86400),a=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${r}m`:`${r}m`}function mi({pubkey:t}){const s=Vn(t);return s?e.jsxs(_e,{defaultOpen:!0,className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(ma,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Status"})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(J,{label:"Battery",value:`${(s.battMilliVolts/1e3).toFixed(2)}V`}),e.jsx(J,{label:"Noise Floor",value:`${s.noiseFloor} dBm`}),e.jsx(J,{label:"Last RSSI",value:`${s.lastRssi} dBm`}),e.jsx(J,{label:"Last SNR",value:`${(s.lastSnr/4).toFixed(1)} dB`}),e.jsx(J,{label:"Uptime",value:Us(s.totalUpTimeSecs)}),e.jsx(J,{label:"Air Time",value:Us(s.totalAirTimeSecs)}),e.jsx(J,{label:"TX Queue",value:String(s.currTxQueueLen)}),e.jsx(J,{label:"Packets Rx",value:String(s.nPacketsRecv)}),e.jsx(J,{label:"Packets Tx",value:String(s.nPacketsSent)}),e.jsx(J,{label:"Flood Rx/Tx",value:`${s.nRecvFlood}/${s.nSentFlood}`}),e.jsx(J,{label:"Direct Rx/Tx",value:`${s.nRecvDirect}/${s.nSentDirect}`}),e.jsx(J,{label:"Dups (D/F)",value:`${s.nDirectDups}/${s.nFloodDups}`}),s.errEvents>0&&e.jsx(J,{label:"Errors",value:String(s.errEvents)})]})})]}):null}function J({label:t,value:s}){return e.jsxs("div",{className:"flex items-center justify-between type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:t}),e.jsx("span",{className:"text-fg-primary font-mono text-[10px]",children:s})]})}function pi(t){switch(t){case 100:return"Generic";case 101:return"Luminosity";case 102:return"Presence";case 103:return"Temperature";case 104:return"Humidity";case 115:return"Pressure";case 116:return"Voltage";case 117:return"Current";case 120:return"Percentage";case 125:return"Concentration";case 128:return"Power";case 136:return"GPS";default:return`Type ${t}`}}function hi(t){switch(t){case 103:return"°C";case 104:return"%";case 115:return" hPa";case 116:return"V";case 117:return"A";case 120:return"%";case 125:return" ppm";case 128:return"W";default:return""}}function xi({pubkey:t}){const s=Wn(t);if(!s)return null;const a=_o(s.lppSensorData);return a.length===0?null:e.jsxs(_e,{defaultOpen:!0,className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(pa,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Telemetry"})]}),e.jsx(Ie,{children:e.jsx("div",{className:"space-y-1.5 py-1",children:a.map((r,l)=>typeof r.value=="object"?e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(J,{label:`Ch${r.channel} GPS Lat`,value:r.value.latitude.toFixed(5)}),e.jsx(J,{label:`Ch${r.channel} GPS Lon`,value:r.value.longitude.toFixed(5)}),e.jsx(J,{label:`Ch${r.channel} GPS Alt`,value:`${r.value.altitude.toFixed(1)}m`})]},l):e.jsx(J,{label:`Ch${r.channel} ${pi(r.type)}`,value:`${typeof r.value=="number"?r.value.toFixed(r.type===103||r.type===116?2:0):r.value}${hi(r.type)}`},l))})})]})}function fi({contact:t}){const{emoji:s}=Mt(t.name||""),a=Pt(t.name||t.public_key),r=t.name?Tt(t.name):t.public_key.slice(0,2).toUpperCase();return(t.adv_type&15)===2?e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center shadow-md ring-[1.5px] ring-sys-blue",children:e.jsx(ze,{className:"size-7 text-sys-blue"})}):(t.adv_type&15)===3?e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center shadow-md ring-[1.5px] ring-sys-pink",children:e.jsx(dt,{className:"size-7 text-sys-pink"})}):e.jsx("div",{className:P("w-14 h-14 clay-avatar",s?"text-2xl":"text-white text-lg font-bold"),style:{"--avatar-color":a},children:s||r})}function qs({pubkey:t}){return Bn().get(t)!==!0?null:e.jsx("span",{title:"Ed25519 verified identity",children:e.jsx(el,{className:"w-4 h-4 text-sys-green flex-shrink-0"})})}const bt=64;function gi(t){if(!t)return[];const s=[];for(let a=0;a0,j=gi(t.out_path),C=n.useCallback(async()=>{if(!r)return;const u=c.split(",").map(x=>x.trim()).filter(Boolean);if(u.length===0){b("Enter at least one hop");return}if(u.length>bt){b(`Max ${bt} hops`);return}if(!u.every(x=>/^[0-9a-fA-F]{1,2}$/.test(x))){b("Each hop must be 1-2 hex characters");return}b(null),o(x=>({...x,path:"loading"}));const R=await r(t.public_key,u);o(x=>({...x,path:R?"done":"error"})),R&&v(!1),setTimeout(()=>o(x=>({...x,path:"idle"})),2e3)},[r,c,t.public_key,o]),$=n.useCallback(()=>{if(!a){f("Self identity not available");return}const u=di(a,t.public_key,M,s);u?(N(u),f(null)):(N(null),f("No route found in topology"))},[a,t.public_key,M,s]),w=n.useCallback(async()=>{if(!r||!d)return;o(m=>({...m,path:"loading"}));const u=await r(t.public_key,d.hops);o(m=>({...m,path:u?"done":"error"})),u&&(N(null),f(null)),setTimeout(()=>o(m=>({...m,path:"idle"})),2e3)},[r,d,t.public_key,o]);return e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(Ge,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Path"}),e.jsx("span",{className:"ml-auto text-[10px] text-fg-muted font-mono",children:_?`${I} hop${I>1?"s":""}`:"direct"})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-2 py-1",children:[j.length>0&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx("span",{className:"text-fg-muted type-data-xs",children:"Route"}),j.map((u,m)=>e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill font-mono text-[10px] text-fg-primary",children:u},m))]}),d&&e.jsxs("div",{className:"space-y-1.5 p-2 rounded-md bg-sys-green/5 border border-sys-green/20",children:[e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-sys-green",children:[e.jsx(Is,{className:"w-3 h-3"}),e.jsxs("span",{children:["Auto-route (",d.via.length," hop",d.via.length!==1?"s":"",", ",Math.round(d.confidence*100),"% confidence)"]})]}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:d.via.map((u,m)=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-subtle-fill text-[10px]",children:[e.jsx("span",{className:"font-mono text-fg-primary",children:u.prefix}),u.name&&e.jsxs("span",{className:"text-fg-muted",children:["(",u.name,")"]}),u.snr!==0&&e.jsx("span",{className:P("font-mono",lt(u.snr)),children:u.snr.toFixed(1)})]},m))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(H,{color:i.path==="done"?"success":"primary",outline:!0,className:"flex-1 justify-center text-xs",disabled:i.path==="loading",onClick:w,children:[e.jsx(be,{"data-slot":"icon"}),i.path==="loading"?"Saving…":"Accept"]}),e.jsxs(H,{plain:!0,className:"text-xs",onClick:()=>{N(null),f(null)},children:[e.jsx(ut,{"data-slot":"icon"}),"Dismiss"]})]})]}),k&&!d&&e.jsx("p",{className:"text-[9px] text-sys-amber",children:k}),r&&!d&&e.jsx("div",{className:"flex items-center gap-2",children:p?e.jsxs("div",{className:"space-y-1.5 flex-1",children:[e.jsx("input",{type:"text",value:c,onChange:u=>{y(u.target.value),b(null)},placeholder:"e.g. a3, f7, 1b",className:"w-full surface-input rounded-md px-2 py-1 text-[10px] font-mono text-fg-primary placeholder:text-fg-muted/50"}),e.jsxs("p",{className:"text-[9px] text-fg-muted/60",children:["Comma-separated hex hop bytes (max ",bt,")"]}),g&&e.jsx("p",{className:"text-[9px] text-sys-red",children:g}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(H,{color:i.path==="done"?"success":i.path==="error"?"danger":"primary",outline:!0,className:"flex-1 justify-center text-xs",disabled:i.path==="loading"||!c.trim(),onClick:C,children:[e.jsx(ao,{"data-slot":"icon"}),i.path==="loading"?"Saving…":"Save"]}),e.jsx(H,{plain:!0,className:"text-xs",onClick:()=>{v(!1),b(null)},children:"Cancel"})]})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{v(!0),y(j.length>0?j.join(", "):""),b(null)},className:"text-[10px] text-sys-blue hover:text-sys-blue/80 transition-colors",children:"Edit path…"}),a&&M.edgeMap.size>0&&e.jsxs("button",{onClick:$,className:"inline-flex items-center gap-0.5 text-[10px] text-sys-indigo hover:text-sys-indigo/80 transition-colors",children:[e.jsx(Is,{className:"w-3 h-3"}),"Auto-route"]}),l&&e.jsxs("button",{onClick:()=>h("discover",()=>l(t.public_key)),disabled:i.discover==="loading",className:P("inline-flex items-center gap-0.5 text-[10px] transition-colors disabled:opacity-50",i.discover==="error"?"text-sys-red":"text-sys-green hover:text-sys-green/80"),children:[e.jsx(tl,{className:"w-3 h-3"}),i.discover==="loading"?"Discovering…":i.discover==="done"?"Discovered!":i.discover==="error"?"Failed":"Discover"]})]})})]})})]})}function bi({pubkey:t,onLogin:s,onLogout:a,actionState:r,runAction:l}){const[i,o]=n.useState(""),h=It(t);return s?e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(kt,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Login"}),h!=="idle"&&e.jsx(De,{color:h==="success"?"green":h==="failed"?"red":"amber",className:"ml-auto text-[9px]",children:h})]}),e.jsx(Ie,{children:e.jsx("div",{className:"space-y-1.5 py-1",children:h==="success"&&a?e.jsxs(H,{color:r.logout==="done"?"success":r.logout==="error"?"danger":"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.logout==="loading",onClick:()=>l("logout",()=>a(t)),children:[e.jsx(Kn,{"data-slot":"icon"}),r.logout==="loading"?"Disconnecting…":"Disconnect"]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"password",value:i,onChange:p=>o(p.target.value),placeholder:"Repeater password",className:"w-full surface-input rounded-md px-2 py-1 text-[10px] text-fg-primary placeholder:text-fg-muted/50"}),e.jsxs(H,{color:h==="failed"?"danger":"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.login==="loading"||!i.trim(),onClick:()=>l("login",()=>s(t,i)),children:[e.jsx(kt,{"data-slot":"icon"}),r.login==="loading"?"Logging in…":"Login"]})]})})})]}):null}function vi({pubkey:t,onGetNeighbours:s,actionState:a,runAction:r}){const l=Un(t),i=It(t);return s?e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(wt,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Neighbours"}),l&&e.jsx("span",{className:"ml-auto text-[10px] text-fg-muted",children:l.total})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center text-xs",disabled:a.neighbours==="loading"||i!=="success",onClick:()=>r("neighbours",()=>s(t)),children:[e.jsx(wt,{"data-slot":"icon"}),a.neighbours==="loading"?"Loading…":"Get Neighbours"]}),i!=="success"&&e.jsx("p",{className:"text-[9px] text-fg-muted/60",children:"Login required to query neighbours"}),l&&l.neighbours.length>0&&e.jsx("div",{className:"space-y-1",children:[...l.neighbours].sort((o,h)=>h.snr-o.snr).map((o,h)=>e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-primary font-mono text-[10px] w-16 truncate",children:o.name||o.prefixHex.slice(0,8)}),e.jsx("span",{className:"text-fg-muted text-[9px]",children:Ni(o.heardAgo)}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 ml-auto",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-subtle-fill overflow-hidden",children:e.jsx("div",{className:P("h-full rounded-full",wi(o.snr)),style:{width:`${Math.min(100,Math.max(5,(o.snr+20)/35*100))}%`}})}),e.jsx("span",{className:P("font-mono text-[9px] w-8 text-right",lt(o.snr)),children:o.snr.toFixed(1)})]})]},h))})]})})]}):null}function ji({pubkey:t,contact:s,onTrace:a,actionState:r,runAction:l}){const i=qn(t);if(!a)return null;const o=s.out_path_len>0;return e.jsxs(_e,{className:"pt-2 border-t border-edge-subtle",children:[e.jsxs(Re,{className:"px-0 py-1 flex items-center gap-1.5 w-full text-left",children:[e.jsx(Es,{className:"w-3.5 h-3.5 text-sys-indigo"}),e.jsx("span",{className:"type-data-xs text-fg-muted uppercase tracking-wide",children:"Trace"}),i&&e.jsxs("span",{className:"ml-auto text-[10px] text-fg-muted",children:[i.pathLen," hops"]})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsxs(H,{color:"primary",outline:!0,className:"w-full justify-center text-xs",disabled:r.trace==="loading"||!o,onClick:()=>l("trace",()=>a(t)),children:[e.jsx(Es,{"data-slot":"icon"}),r.trace==="loading"?"Tracing…":"Trace Path"]}),!o&&e.jsx("p",{className:"text-[9px] text-fg-muted/60",children:"Direct neighbour — no path to trace"}),i&&i.hops.length>0&&e.jsxs("div",{className:"space-y-1",children:[i.hops.map((h,p)=>e.jsxs("div",{className:"flex items-center gap-2 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted text-[9px] w-3",children:p+1}),e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill font-mono text-[10px] text-fg-primary",children:h.hash}),h.name&&e.jsx("span",{className:"text-fg-muted text-[10px] truncate",children:h.name}),e.jsxs("span",{className:P("font-mono text-[10px] ml-auto",lt(h.snr)),children:[h.snr.toFixed(1)," dB"]})]},p)),e.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-1 border-t border-edge-subtle",children:[e.jsx("span",{className:"text-fg-muted",children:"Last SNR"}),e.jsxs("span",{className:P("font-mono text-[10px]",lt(i.lastSnr)),children:[i.lastSnr.toFixed(1)," dB"]})]})]})]})})]})}function lt(t){return t>5?"text-sys-green":t>0?"text-sys-amber":"text-sys-red"}function wi(t){return t>5?"bg-sys-green":t>0?"bg-sys-amber":"bg-sys-red"}function Ni(t){return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}const Vs=128,Ws=/^[0-9a-fA-F]+$/;function ki({open:t,onClose:s}){const a=se(S=>S.exportPrivateKey),r=se(S=>S.importPrivateKey),[l,i]=n.useState("export"),[o,h]=n.useState(null),[p,v]=n.useState(!1),[c,y]=n.useState(!1),[g,b]=n.useState(""),[d,N]=n.useState(!1),[k,f]=n.useState(!1),[M,I]=n.useState(!1),[_,j]=n.useState(!1),[C,$]=n.useState(null),[w,u]=n.useState(!1);t!==w&&(u(t),t&&(i("export"),h(null),v(!1),y(!1),b(""),N(!1),f(!1),I(!1),j(!1),$(null)));const m=n.useCallback(async()=>{v(!0),$(null),j(!1);try{const S=await a();S==="disabled"?j(!0):h(S.hex)}catch(S){$(S instanceof Error?S.message:"Export failed")}finally{v(!1)}},[a]),R=n.useCallback(async()=>{if(o)try{await navigator.clipboard.writeText(o),y(!0),setTimeout(()=>y(!1),2e3)}catch{$("Failed to copy to clipboard")}},[o]),x=g.length===Vs&&Ws.test(g),T=n.useCallback(async()=>{f(!1),N(!0),$(null),j(!1);try{await r(g)==="disabled"?j(!0):I(!0)}catch(S){$(S instanceof Error?S.message:"Import failed")}finally{N(!1)}},[r,g]);return e.jsxs(e.Fragment,{children:[e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:e.jsx(xa,{className:"w-5 h-5"}),title:"Key Management",onClose:s}),e.jsxs(we,{children:[_&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3 mb-4 rounded-lg bg-sys-amber/10 border border-sys-amber/20",children:[e.jsx(Qn,{className:"w-4 h-4 text-sys-amber flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"type-body-sm font-medium text-sys-amber",children:"Key operations disabled"}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-0.5",children:"This device's firmware has disabled private key export/import. This is a security setting configured at build time and cannot be changed remotely."})]})]}),e.jsx("div",{className:"flex gap-1 mb-4 p-0.5 rounded-lg bg-subtle-fill",children:["export","import"].map(S=>e.jsxs("button",{onClick:()=>{i(S),$(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 px-3 rounded-md text-sm font-medium transition-colors",l===S?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[S==="export"?e.jsx(He,{className:"w-3.5 h-3.5"}):e.jsx(zt,{className:"w-3.5 h-3.5"}),S==="export"?"Export":"Import"]},S))}),l==="export"&&e.jsx("div",{className:"space-y-4",children:o?e.jsxs(re,{children:[e.jsx(le,{children:"Private Key (64 bytes)"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"p-3 rounded-lg bg-subtle-fill border border-edge-subtle font-mono text-xs break-all select-all leading-relaxed",children:o}),e.jsx("button",{onClick:R,className:"absolute top-2 right-2 p-1.5 rounded-md hover:bg-subtle-fill-strong transition-colors",title:"Copy to clipboard",children:c?e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"}):e.jsx(Et,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),e.jsx(ke,{children:e.jsxs("span",{className:"flex items-start gap-1.5 mt-1",children:[e.jsx(Be,{className:"w-3 h-3 text-sys-amber flex-shrink-0 mt-0.5"}),"This key controls your mesh identity. Never share it."]})})]}):e.jsxs("div",{className:"text-center py-4",children:[e.jsx("p",{className:"type-body-sm text-fg-muted mb-3",children:"Export your device's private key for backup. Keep it secret — anyone with this key can impersonate your mesh identity."}),e.jsx(H,{color:"primary",onClick:m,disabled:p||_,children:p?"Exporting…":"Export Private Key"})]})}),l==="import"&&e.jsx("div",{className:"space-y-4",children:M?e.jsxs("div",{className:"text-center py-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-green/10 mx-auto mb-3 flex items-center justify-center",children:e.jsx(be,{className:"w-5 h-5 text-sys-green"})}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:"Key imported successfully"}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:"The device identity has been updated. You may need to reconnect."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(le,{children:"Private Key (128 hex characters)"}),e.jsx("textarea",{value:g,onChange:S=>b(S.target.value.replace(/\s/g,"")),placeholder:"Paste your 128-character hex private key here…",rows:3,className:"w-full p-3 rounded-lg bg-subtle-fill border border-edge-subtle font-mono text-xs resize-none focus:outline-none focus:ring-2 focus:ring-sys-blue/50 placeholder:text-fg-muted/40"}),e.jsxs(ke,{children:[g.length>0&&!x&&e.jsx("span",{className:"text-sys-red",children:Ws.test(g)?`${g.length}/${Vs} characters`:"Invalid characters — hex only (0-9, a-f)"}),g.length>0&&x&&e.jsx("span",{className:"text-sys-green",children:"Valid key format ✓"})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-lg bg-sys-red/5 border border-sys-red/10",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-red flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-data-xs text-fg-muted",children:["Importing a key ",e.jsx("strong",{className:"text-fg-secondary",children:"permanently replaces"})," the device's current identity. All existing contacts will see you as a new node."]})]})]})}),C&&e.jsx("p",{className:"type-data-xs text-sys-red mt-3",children:C})]}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Close"}),l==="import"&&!M&&e.jsx(H,{color:"danger",onClick:()=>f(!0),disabled:!x||d||_,children:d?"Importing…":"Import Key"})]})]}),e.jsx(ha,{isOpen:k,title:"Replace Device Identity?",message:"This will permanently replace the device's Ed25519 private key. The current identity cannot be recovered unless you have a backup. Continue?",confirmLabel:"Replace Key",cancelLabel:"Cancel",variant:"danger",onConfirm:T,onCancel:()=>f(!1)})]})}function Sa(t){return t.settings??{}}const _a="pymc_companion_recent_regions",Bt=8;function Ra(){try{const t=localStorage.getItem(_a);return t?JSON.parse(t).slice(0,Bt):[]}catch{return[]}}function Ci(t){try{localStorage.setItem(_a,JSON.stringify(t.slice(0,Bt)))}catch{}}function Si(t){const s=Ra().filter(r=>r!==t);s.unshift(t);const a=s.slice(0,Bt);return Ci(a),a}function Qs(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _i({open:t,onClose:s,mode:a,identity:r,onSave:l}){const i=a==="edit"&&r,[o,h]=n.useState(""),[p,v]=n.useState(""),[c,y]=n.useState(""),[g,b]=n.useState(!1),[d,N]=n.useState(""),[k,f]=n.useState(5e3),[M,I]=n.useState("0.0.0.0"),[_,j]=n.useState(!1),[C,$]=n.useState(null),[w,u]=n.useState(""),m=`${t}-${(r==null?void 0:r.name)??""}-${a}`;if(m!==w)if(u(m),$(null),j(!1),b(!1),i){const x=Sa(r);h(r.name),v(""),y(r.identity_key??""),N(x.node_name??r.name),f(x.tcp_port??5e3),I(x.bind_address??"0.0.0.0")}else h(""),v(""),y(""),N(""),f(5e3),I("0.0.0.0");const R=n.useCallback(async()=>{var x,T;if(!i&&!o.trim()){$("Name is required");return}j(!0),$(null);try{if(i){const S={name:r.name,new_name:p,identity_key:c,type:"companion",settings:{node_name:d,tcp_port:k,bind_address:M}},A=await er(S);if(!A.success&&!((x=A.data)!=null&&x.message))throw new Error(A.error||"Failed")}else{const S={name:o.trim(),identity_key:c,type:"companion",settings:{node_name:d||o.trim(),tcp_port:k??5e3,bind_address:M||"0.0.0.0"}},A=await tr(S);if(!A.success&&!((T=A.data)!=null&&T.message))throw new Error(A.error||"Failed")}await l(),s()}catch(S){$(S instanceof Error?S.message:"Operation failed")}finally{j(!1)}},[i,r,o,p,c,d,k,M,l,s]);return e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:i?void 0:e.jsx(ye,{className:"w-5 h-5"}),title:i?"Edit Companion":"Add Companion",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-5",children:[i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{color:r.registered?"green":"red",children:r.registered?"Active":"Inactive"}),r.hash&&e.jsx("span",{className:"type-data-xs text-fg-muted",children:r.hash})]}),i?e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(le,{children:"Current Name"}),e.jsx(pe,{value:r.name,disabled:!0})]}),e.jsxs(re,{children:[e.jsxs(le,{children:["New Name ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(pe,{value:p,onChange:x=>v(x.target.value),placeholder:"Leave empty to keep current name"})]})]}):e.jsxs(re,{children:[e.jsx(le,{children:"Name"}),e.jsx(pe,{value:o,onChange:x=>h(x.target.value),placeholder:"e.g., TestCompanion",autoFocus:!0})]}),e.jsxs(re,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(le,{children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>b(x=>!x),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:g?"Hide":"Show"})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{value:c,onChange:x=>y(x.target.value),placeholder:i?"Leave empty to keep current key":"Leave empty to auto-generate",className:"font-mono"}),e.jsx(ke,{children:"32 or 64 bytes hex."})]})]}),e.jsxs(re,{children:[e.jsx(le,{children:"Node Name"}),e.jsx(pe,{value:d,onChange:x=>N(x.target.value),placeholder:"Display name"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(re,{children:[e.jsx(le,{children:"TCP Port"}),e.jsx(pe,{type:"number",min:1,max:65535,value:k,onChange:x=>f(parseInt(x.target.value,10)||5e3)})]}),e.jsxs(re,{children:[e.jsx(le,{children:"Bind Address"}),e.jsx(pe,{value:M,onChange:x=>I(x.target.value),placeholder:"0.0.0.0"})]})]}),C&&e.jsx("p",{className:"type-data-xs text-sys-red",children:C})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsx(H,{color:"primary",onClick:R,disabled:_,children:_?"Saving…":i?"Save":"Create"})]})]})}function Ri(){const t=Jn(),s=la(),{setFloodScope:a,clearFloodScope:r}=se.getState(),[l,i]=n.useState(""),[o,h]=n.useState(!1),[p,v]=n.useState(Ra),[c,y]=n.useState(null),g=n.useRef(null),b=l.trim()?Qs(l.trim()):"",d=n.useCallback(async f=>{const M=Qs(f);if(!M)return;h(!0),y(null),i(""),v(Si(M)),await a(M)||y("Failed to set transport key on device"),h(!1)},[a]),N=n.useCallback(async()=>{h(!0),y(null),await r()||y("Failed to clear transport key on device"),h(!1)},[r]),k=n.useCallback(f=>{f.key==="Enter"&&b&&(f.preventDefault(),d(b))},[b,d]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-lg bg-sys-blue/5 border border-sys-blue/10",children:[e.jsx(nt,{className:"w-4 h-4 text-sys-blue flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-data-xs text-fg-muted",children:["A transport key filters which flood packets the companion device forwards. Set a region name to derive a SHA-256 transport key from ",e.jsx("code",{className:"text-fg-secondary",children:"#name"}),". Only one transport key can be active at a time."]})]}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"w-4 h-4 text-fg-muted"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Active Transport Key"})]}),t?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-sys-green/10 text-sys-green type-data font-medium",children:[e.jsx(ia,{className:"w-3.5 h-3.5"}),"#",t]}),e.jsx("button",{onClick:N,disabled:o||!s,className:"p-1.5 rounded-lg hover:bg-sys-red/10 transition-colors disabled:opacity-50",title:"Clear transport key",children:o?e.jsx(oe,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsx(ut,{className:"w-3.5 h-3.5 text-fg-muted hover:text-sys-red"})})]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-subtle-fill-strong text-fg-muted type-data",children:[e.jsx(Zn,{className:"w-3.5 h-3.5"}),"Global (no filter)"]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Set Region"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-muted/50 type-data",children:"#"}),e.jsx("input",{ref:g,type:"text",value:l,onChange:f=>i(f.target.value),onKeyDown:k,placeholder:"e.g., south-bay",disabled:!s,className:"w-full pl-7 pr-3 py-2 rounded-lg bg-subtle-fill border border-edge-subtle text-sm text-fg-primary placeholder:text-fg-muted/40 focus:outline-none focus:ring-2 focus:ring-sys-blue/50 disabled:opacity-50"})]}),e.jsxs(H,{color:"primary",onClick:()=>d(b),disabled:!b||o||!s,children:[o?e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}):null,"Set"]})]}),b&&b!==l.trim().toLowerCase()&&e.jsxs("p",{className:"type-data-xs text-fg-muted mt-1",children:["Will set as ",e.jsxs("span",{className:"font-mono text-fg-secondary",children:["#",b]})]})]}),p.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(ua,{className:"w-3.5 h-3.5 text-fg-muted/50"}),e.jsx("span",{className:"type-label text-fg-muted",children:"Recent Regions"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(f=>e.jsx("button",{onClick:()=>d(f),disabled:o||!s,className:P("inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium transition-colors","disabled:opacity-50 disabled:cursor-not-allowed",f===t?"bg-sys-green/10 text-sys-green":"bg-subtle-fill hover:bg-subtle-fill-strong text-fg-secondary"),children:e.jsxs("span",{className:"font-mono",children:["#",f]})},f))})]}),!s&&e.jsx("p",{className:"type-data-xs text-sys-amber",children:"Companion device is not connected. Connect to a companion to manage transport keys."}),c&&e.jsx("p",{className:"type-data-xs text-sys-red",children:c})]})}function Ys({open:t,onClose:s,onRefresh:a}){const[r,l]=n.useState("companions"),[i,o]=n.useState(null),[h,p]=n.useState(!0),[v,c]=n.useState(!1),[y,g]=n.useState("create"),[b,d]=n.useState(null),[N,k]=n.useState(null),[f,M]=n.useState(!1),[I,_]=n.useState(!1),j=n.useRef(!0);n.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const[C,$]=n.useState(!1);t!==C&&($(t),t&&l("companions"));const w=n.useCallback(async()=>{p(!0);try{const x=await Yn();j.current&&x.success&&x.data&&o(x.data)}catch{}finally{j.current&&p(!1)}},[]);n.useEffect(()=>{t&&w()},[t,w]);const u=(i==null?void 0:i.configured_companions)??[],m=n.useCallback(async()=>{await w(),a==null||a()},[w,a]),R=n.useCallback(async()=>{if(N){M(!0);try{await Xn(N.name,"companion"),await m()}catch{}finally{j.current&&(M(!1),k(null))}}},[N,m]);return e.jsxs(e.Fragment,{children:[e.jsxs(je,{open:t,onClose:s,size:"md",children:[e.jsx(Ee,{icon:e.jsx(ye,{className:"w-5 h-5"}),title:"Companion Configuration",onClose:s}),e.jsxs(we,{children:[e.jsx("div",{className:"flex gap-1 mb-4 p-0.5 rounded-lg bg-subtle-fill",children:[["companions","Companions",ye],["transport","Transport Key",fa]].map(([x,T,S])=>e.jsxs("button",{onClick:()=>l(x),className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 px-3 rounded-md text-sm font-medium transition-colors",r===x?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(S,{className:"w-3.5 h-3.5"}),T]},x))}),r==="companions"&&e.jsx(e.Fragment,{children:h?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(oe,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading…"})]}):u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(x=>{const T=Sa(x);return e.jsxs("div",{className:"bg-subtle-fill radius-inner p-3 hover:bg-subtle-fill-strong transition-base",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:P("h-2 w-2 rounded-full flex-shrink-0",x.registered?"bg-sys-green":"bg-sys-red")}),e.jsx("h3",{className:"type-body-sm text-fg-primary font-medium truncate flex-1",children:x.name}),e.jsx(De,{color:x.registered?"green":"red",children:x.registered?"Active":"Inactive"}),e.jsx(H,{color:"primary",plain:!0,onClick:()=>{d(x),g("edit"),c(!0)},children:e.jsx(sl,{"data-slot":"icon"})}),e.jsx(H,{color:"danger",plain:!0,onClick:()=>k(x),children:e.jsx(Ke,{"data-slot":"icon"})})]}),e.jsxs("div",{className:"mt-1.5 type-data-xs text-fg-muted pl-5",children:[T.node_name||x.name," · Port ",T.tcp_port??5e3," · ",T.bind_address||"0.0.0.0"]})]},x.name)})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:e.jsx(ye,{className:"w-5 h-5 text-fg-muted/50"})}),e.jsx("p",{className:"text-sm text-fg-muted",children:"No companions configured"})]})}),r==="transport"&&e.jsx(Ri,{})]}),e.jsxs(Me,{children:[r==="companions"&&e.jsx(H,{plain:!0,onClick:()=>_(!0),title:"Key Management",children:e.jsx(xa,{"data-slot":"icon"})}),e.jsx("div",{className:"flex-1"}),e.jsx(H,{plain:!0,onClick:s,children:"Close"}),r==="companions"&&e.jsxs(H,{color:"primary",onClick:()=>{d(null),g("create"),c(!0)},children:[e.jsx(Ue,{"data-slot":"icon"})," Add Companion"]})]})]}),e.jsx(_i,{open:v,onClose:()=>c(!1),mode:y,identity:b,onSave:m}),e.jsx(ha,{isOpen:!!N,title:"Delete Companion",message:`Delete '${N==null?void 0:N.name}'? A service restart is required.`,confirmLabel:f?"Deleting…":"Delete",cancelLabel:"Cancel",variant:"danger",onConfirm:R,onCancel:()=>k(null)}),e.jsx(ki,{open:I,onClose:()=>_(!1)})]})}const Ii=n.memo(function({companions:s,selected:a,onSelect:r}){return s.length<2?null:e.jsx("select",{value:a??"",onChange:l=>r(l.target.value),className:"px-2 py-1 text-sm bg-transparent border border-edge-subtle radius-inner text-fg-primary focus:outline-none focus:ring-1 focus:ring-sys-blue/40",children:s.map(l=>e.jsx("option",{value:l.companion_name,children:l.node_name||l.companion_name},l.companion_name))})}),Oe=[{value:"Chat Node",label:"Companions"},{value:"Room Server",label:"Room Servers"},{value:"Repeater",label:"Repeaters"}],Ei=[{value:"all",label:"All time"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function Mi(t){switch(t){case"24h":return 24;case"7d":return 168;case"30d":return 720;default:return}}function Pi({open:t,onClose:s,companionName:a,onImport:r}){const[l,i]=n.useState(()=>new Set(Oe.map(_=>_.value))),[o,h]=n.useState("all"),[p,v]=n.useState(""),[c,y]=n.useState(!1),[g,b]=n.useState(null),[d,N]=n.useState(t);t!==d&&(N(t),t&&(i(new Set(Oe.map(_=>_.value))),h("all"),v(""),y(!1),b(null)));const k=l.size===Oe.length;function f(_){i(j=>{const C=new Set(j);return C.has(_)?C.delete(_):C.add(_),C})}function M(){i(k?new Set:new Set(Oe.map(_=>_.value)))}const I=n.useCallback(async()=>{if(!(l.size===0||c)){y(!0),b(null);try{const _={types:[...l],hours:Mi(o)},j=parseInt(p,10);j>0&&(_.limit=j);const C=await r(_);b(C)}finally{y(!1)}}},[l,o,p,c,r]);return e.jsxs(je,{open:t,onClose:s,size:"sm",children:[e.jsx(Ee,{title:"Import repeater contacts",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("p",{className:"text-sm text-fg-secondary",children:["Seed ",e.jsx("strong",{className:"text-fg-primary",children:a})," with contacts from the repeater's adverts. Results are ordered by most recent first."]}),e.jsxs(re,{children:[e.jsx(le,{children:"Contact types"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx(ws,{checked:k,indeterminate:l.size>0&&!k,onChange:M,label:"All types",size:"sm"}),e.jsx("div",{className:"ml-6 space-y-1.5",children:Oe.map(_=>e.jsx(ws,{checked:l.has(_.value),onChange:()=>f(_.value),label:_.label,size:"sm"},_.value))})]})]}),e.jsx(po,{label:"Recency",value:o,onChange:h,options:Ei,orientation:"horizontal",size:"sm"}),e.jsxs(re,{children:[e.jsxs(le,{children:["Import at most ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(optional)"})]}),e.jsx(pe,{type:"number",min:1,value:p,onChange:_=>v(_.target.value),placeholder:"No limit",className:"mt-1"}),e.jsx(ke,{children:"Leave empty for no cap."})]}),g&&e.jsxs("p",{className:"text-sm text-sys-green font-medium",children:["Imported ",g.added," new contact",g.added!==1?"s":""," (",g.total," total)"]})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:"Cancel"}),e.jsx(H,{color:"primary",onClick:I,disabled:c||l.size===0,children:c?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-slot":"icon",className:"animate-spin"}),"Importing…"]}):"Import"})]})]})}const Ti=["alameda","alpine","amador","butte","calaveras","colusa","contracosta","contra-costa","delnorte","del-norte","eldorado","el-dorado","fresno","glenn","humboldt","imperial","inyo","kern","kings","lake","lassen","losangeles","los-angeles","la-county","madera","marin","mariposa","mendocino","merced","modoc","mono","monterey","napa","nevada","orange","oc","placer","plumas","riverside","sacramento","sac","sanbenito","san-benito","sanbernardino","san-bernardino","sandiego","san-diego","sd","sanfrancisco","san-francisco","sf","sanjoaquin","san-joaquin","sanluisobispo","san-luis-obispo","slo","sanmateo","san-mateo","santabarbara","santa-barbara","sb","santaclara","santa-clara","santacruz","santa-cruz","shasta","sierra","siskiyou","solano","sonoma","stanislaus","sutter","tehama","trinity","tulare","tuolumne","ventura","yolo","yuba","losangeles","los-angeles","la","hollywood","westhollywood","west-hollywood","weho","beverlyhills","beverly-hills","santamonica","santa-monica","culvercity","culver-city","marinadelrey","marina-del-rey","venice","venicebeach","venice-beach","malibu","palisades","pacificpalisades","pacific-palisades","brentwood","westwood","westla","west-la","dtla","downtown","downtownla","downtown-la","koreatown","ktown","silverlake","silver-lake","losfeliz","los-feliz","echopark","echo-park","eastla","east-la","boyleheights","boyle-heights","highlandpark","highland-park","eaglerock","eagle-rock","pasadena","southpasadena","south-pasadena","glendale","burbank","tolucalake","toluca-lake","studiocity","studio-city","shermanoaks","sherman-oaks","encino","tarzana","reseda","vannuys","van-nuys","northhollywood","north-hollywood","noho","woodlandhills","woodland-hills","calabasas","topanga","agourahills","agoura-hills","thousandoaks","thousand-oaks","simivalley","simi-valley","simi","moorpark","camarillo","oxnard","porthueneme","port-hueneme","ventura","ojai","sfv","sfvalley","sf-valley","thevalley","the-valley","sanfernando","san-fernando","sanfernandovalley","san-fernando-valley","pacoima","sylmar","sunland","tujunga","sunlandtujunga","lakeviewterrace","lakeview-terrace","shadowhills","shadow-hills","chatsworth","northridge","granadahills","granada-hills","missionhills","mission-hills","panoramacity","panorama-city","arleta","sunvalley","sun-valley","santaclarita","santa-clarita","scv","valencia","newhall","saugus","canyoncountry","canyon-country","castaic","stevenson","stevensonranch","stevenson-ranch","acton","agua-dulce","aguadulce","palmdale","lancaster","antelopevalley","antelope-valley","av","avmesh","av-mesh","quartz-hill","quartzhill","littlerock","little-rock","pearblossom","pear-blossom","lakelosangeles","lake-los-angeles","highdesert","high-desert","hd","hdmesh","hd-mesh","victorville","hesperia","applevalley","apple-valley","barstow","adelanto","phelan","pinon-hills","pinonhills","wrightwood","bigbear","big-bear","lakeisabella","lake-isabella","inlandempire","inland-empire","ie","riverside","corona","moreno-valley","morenovalley","fontana","ontario","rancho","ranchocucamonga","rancho-cucamonga","upland","claremont","pomona","azusa","glendora","covina","westcovina","west-covina","diamondbar","diamond-bar","chino","chinohills","chino-hills","sanbernardinocity","rialto","colton","redlands","yuciapa","yucaipa","beaumont","banning","hemet","perris","menifee","temecula","murrieta","wildomar","lakeland","lakeelsinore","lake-elsinore","orangecounty","orange-county","oc","anaheim","fullerton","santaana","santa-ana","irvine","costamesa","costa-mesa","newportbeach","newport-beach","newport","huntingtonbeach","huntington-beach","hb","surfcity","surf-city","lagunabeach","laguna-beach","lagunaniguel","laguna-niguel","sanclemente","san-clemente","danapoint","dana-point","missionviejo","mission-viejo","lakeforest","lake-forest","rsm","ranchosantamargarita","rancho-santa-margarita","alisoviejo","aliso-viejo","tustin","orange","yorbalinda","yorba-linda","brea","lahabra","la-habra","placentia","buenapark","buena-park","cypress","losalamitojos","sealbeach","seal-beach","gardengrove","garden-grove","westminster","stanton","fountainvalley","sandiego","san-diego","sd","sdmesh","sd-mesh","lajolla","la-jolla","pacificbeach","pacific-beach","pb","missionbeach","mission-beach","oceanbeach","ocean-beach","ob","pointloma","point-loma","coronado","hillcrest","northpark","north-park","southpark","south-park","normalheights","normal-heights","cityheights","city-heights","lamesa","la-mesa","elcajon","el-cajon","santee","lakeside","poway","ramona","julian","alpine","escondido","sanmarcos","san-marcos","vista","oceanside","carlsbad","encinitas","delmar","del-mar","solanabeanch","solana-beach","chulavista","chula-vista","nationalcity","national-city","imperialbeach","imperial-beach","ib","southbay","south-bay","torrance","gardena","hawthorne","lawndale","redondo","redondobeach","hermosa","hermosabeach","manhattan","manhattanbeach","manhattan-beach","elsegundo","el-segundo","palosverdes","palos-verdes","pv","ranchopalosverdes","rancho-palos-verdes","sanpedro","san-pedro","wilmington","carson","compton","longbeach","long-beach","lb","signalhill","signal-hill","lakewood","cerritos","artesia","lamirada","la-mirada","norwalk","whittier","lahabra","la-habra-heights","downey","bellflower","paramount","southgate","south-gate","lynwood","bellgardens","bell-gardens","cudahy","huntingtonpark","maywood","vernon","commerce","montebello","picorivera","pico-rivera","montereypark","monterey-park","alhambra","sanmarinno","san-marino","arcadia","monrovia","duarte","azusa","irwindale","baldwinpark","baldwin-park","elmonbte","el-monte","southelmonte","south-el-monte","rosemead","temple-city","templecity","sangabriel","san-gabriel","santabarbara","santa-barbara","sb","goleta","carpinteria","montecito","islavista","isla-vista","iv","ucsb","slo","sanluisobispo","san-luis-obispo","morrobay","morro-bay","pismobeach","pismo-beach","pismo","shellbeach","shell-beach","arroyogrande","arroyo-grande","groverbeach","grover-beach","oceano","santamaria","santa-maria","lompoc","vandenberg","solvang","buellton","losalamos","los-alamos","atascadero","pasorobles","paso-robles","paso","cambria","cayucos","sansiemon","san-simeon","hearst","fresno","clovis","visalia","tulare","hanford","porterville","bakersfield","bako","delano","wasco","shafter","taft","tehachapi","stockton","tracy","manteca","lodi","modesto","turlock","merced","madera","chowchilla","losabnos","los-banos","sacramento","sac","sactown","westsacramento","west-sacramento","westsac","elkgrove","elk-grove","folsom","ranchocordova","rancho-cordova","roseville","rocklin","lincoln","citrus-heights","citrusheights","fair-oaks","fairoaks","carmichael","orangevale","davis","woodland","dixon","vacaville","fairfield","vallejo","bayarea","bay-area","sfbay","sf-bay","sanfrancisco","san-francisco","sf","sfmesh","sf-mesh","oakland","eastbay","east-bay","berkeley","emeryville","alameda","sanleandro","san-leandro","hayward","fremont","unioncity","union-city","newark","milpitas","sanjose","san-jose","sj","campbell","saratoga","losgartos","los-gatos","sunnyvale","santaclara","santa-clara","cupertino","mountainview","mountain-view","paloalto","palo-alto","menlopark","menlo-park","atherton","redwoodcity","redwood-city","sancarlos","san-carlos","belmont","sanmateo","san-mateo","fostercity","foster-city","burlingame","sanbruno","san-bruno","southsanfrancisco","ssf","dalycity","daly-city","pacifica","halfmoonbay","half-moon-bay","hmb","santacruz","santa-cruz","capitola","scottsvalley","scotts-valley","watsonville","aptos","soquel","concord","walnutcreek","walnut-creek","pleasant-hill","pleasanthill","martinez","antioch","pittsburg","brentwood","oakley","discovery-bay","livermore","pleasanton","dublin","sanramon","san-ramon","danville","richmond","sanpablo","san-pablo","pinole","hercules","napa","sonoma","petaluma","santarosa","santa-rosa","rohnertpark","novato","sanrafael","san-rafael","sausalito","tiburon","millvalley","mill-valley","redding","chico","oroville","paradise","reddingbluff","redbluff","red-bluff","shasta","mtshasta","mt-shasta","eureka","arcata","fortuna","mckibleyville","ukiah","fortbragg","fort-bragg","willits","yreka","weed","dunsmuir","tahoe","laketahoe","lake-tahoe","southlaketahoe","south-lake-tahoe","truckee","squaw","squawvalley","squaw-valley","northstar","mammoth","mammothlakes","mammoth-lakes","bishopca","bishop","placerville","tahoe-city","tahoecity","kings-beach","kingsbeach","incline","inclinevillage","incline-village","maricopa","pima","pinal","yavapai","yuma","mohave","coconino","cochise","navajo","apache","gila","santacruzaz","graham","lapaz","la-paz","greenlee","arizona","az","azmesh","az-mesh","phoenix","phx","phoenixmesh","phoenix-mesh","scottsdale","tempe","mesa","gilbert","chandler","glendale","peoria","surprize","avondale","goodyear","buckeye","litchfieldpark","litchfield-park","tolleson","laveen","paradisevalley","paradise-valley","pv","carefree","cavekreek","cave-creek","fountainhills","fountain-hills","rioverde","rio-verde","queencreek","queen-creek","santan","san-tan","santanvalley","ahwatukee","southmountain","south-mountain","anthem","newriver","new-river","apachejunction","apache-junction","aj","goldcanyon","gold-canyon","tucson","tucsomesh","tucson-mesh","orovalley","oro-valley","marana","catalina","catalinafoothills","saddlebrooke","casagrande","casa-grande","eloy","coolidge","florence","sierravista","sierra-vista","bisbee","tombstone","benson","douglas","nogales","tubac","greenvalley","green-valley","sahuarita","flagstaff","flag","flagmesh","sedona","cottonwood","clarkdale","prescott","prescottvalley","prescott-valley","dewey","chino-valley","chinovalley","williams","grandcanyon","grand-canyon","tusayan","page","marble-canyon","showlow","show-low","pinetop","pinetoplakeside","lakeside","snowflake","taylor","payson","pine","strawberry","camp-verde","campverde","winslow","holbrook","stjohns","springerville","eagar","yuma","yumamesh","fortuna-foothills","sanluisaz","san-luis","lakehavasu","lake-havasu","havasu","havasucity","lake-havasu-city","bullheadcity","bullhead-city","bullhead","laughlin","kingman","goldenkvalley","golden-valley","parker","quartzsite","wickenburg","lasvegas","las-vegas","vegas","vegasmesh","vegas-mesh","lv","henderson","boulder-city","bouldercity","northlasvegas","north-las-vegas","nlv","summerlin","enterprise","pahrump","mesquite","reno","sparks","carsoncity","carson-city","incline","bajacalifornia","baja-california","baja","bajamesh","tijuana","tj","mexicali","ensenada","tecate","rosarito","sanfelipe","san-felipe","sanluis","sanluisriocoalorado","brabant","flevoland","gelderland","noordbrabant","noordholland","zuid-holland","zuidholland","zeeland","twente","alkmaar","almere","amsterdam","amstelland","capelleaandenijssel","denhaag","dordrecht","drechtsteden","eindhoven","haarlem","hellevoetsluis","hilversum","katwijk","lelystad","maassluis","middelburg","rijnmond","rotterdam","tilburg","utrecht","vlissingen","voorburg","voorne-putten","walcheren","west-friesland","zaandam","zaanstreek-waterland","024-bot","afrithonbot","ai","amradio","analyser","angrynerds","bemesh","bot","buch","burgernet","chat","chatgpt","dares","dekroeg","dtis","emergency","english","evenvroegopstaan","fosdem","gezellig","gmr","gmrbot","goedemorgen","gyverbot","haagscourant","hackerspacenijmegen","hamradio","hamradionederland","hetweerinjegemeente","hsnl","jokes","kanalen","koffie","linux","meshcore","nerd","nl-alert","nl-prio","noodkanaal","nsagov","pi4hm","pi4utr","pingbot","sensemakers","sports","survival","test","testing","uitdagingen","valleibot","valleirug","vleesboek","wardrive","weer","swl","qso","qrz","cq","dx","sstv","aprs","winlink","aredn","hamnet","emcomm","emcommplanning","races","ares","auxcomm","simplex","repeater","uhf","vhf","2m","70cm","440"],$i=new Set(Ti);function Di(){return crypto.getRandomValues(new Uint8Array(16))}function Xs(t){return Array.from(t).map(s=>s.toString(16).padStart(2,"0")).join("")}function vt(t){const s=t.replace(/\s/g,"");if(s.length!==32||!/^[0-9a-fA-F]+$/.test(s))return null;const a=new Uint8Array(16);for(let r=0;r<16;r++)a[r]=parseInt(s.slice(r*2,r*2+2),16);return a}async function Fi(t){const a=`#${oa(t)}`,r=new TextEncoder().encode(a);return(await sr(r)).slice(0,16)}const Js=[{key:"create-private",label:"Create Private",icon:Gr,desc:"Generate a new private channel with a random key"},{key:"join-private",label:"Join Private",icon:Vl,desc:"Join an existing private channel using a shared key"},{key:"join-hashtag",label:"Join Hashtag",icon:Fe,desc:"Join a public hashtag channel (key derived from name)"}];function Li({open:t,onClose:s,channels:a,onAddChannel:r}){var R;const[l,i]=n.useState("join-hashtag"),[o,h]=n.useState(""),[p,v]=n.useState(""),[c,y]=n.useState(null),[g,b]=n.useState(!1),[d,N]=n.useState(""),[k,f]=n.useState(!1),[M,I]=n.useState(t);t!==M&&(I(t),t&&(i("join-hashtag"),h(""),v(""),y(null),b(!1),N(""),f(!1)));const _=n.useMemo(()=>a.length===0?0:Math.max(...a.map(x=>x.index))+1,[a]),j=n.useMemo(()=>l!=="join-hashtag"?"":oa(o),[l,o]),C=n.useMemo(()=>{if(!o.trim())return null;const x=l==="join-hashtag"&&j?`#${j}`:o.trim();return a.find(T=>T.name===x)??null},[o,l,j,a]),$=n.useMemo(()=>l==="join-hashtag"&&j?$i.has(j):!1,[l,j]),w=n.useMemo(()=>{if(!o.trim()||C)return!1;switch(l){case"create-private":return o.trim().length>0&&o.trim().length<=32;case"join-private":return o.trim().length>0&&vt(p)!==null;case"join-hashtag":return j.length>0;default:return!1}},[l,o,p,j,C]),u=n.useCallback(async()=>{c&&(await navigator.clipboard.writeText(Xs(c)),f(!0),setTimeout(()=>f(!1),2e3))},[c]),m=n.useCallback(async()=>{if(!(!w||g)){b(!0),N("");try{let x,T;switch(l){case"create-private":{x=Di(),T=o.trim();break}case"join-private":{const A=vt(p);if(!A){N("Invalid hex key (must be 32 hex chars = 16 bytes)");return}x=A,T=o.trim();break}case"join-hashtag":{x=await Fi(o),T=`#${j}`;break}default:return}if(await r(_,T,x)){if(l==="create-private"){y(x);return}s()}else N("Failed to add channel — device may be unreachable")}catch(x){N(x instanceof Error?x.message:"Unknown error")}finally{b(!1)}}},[w,g,l,o,p,j,_,r,s]);return e.jsxs(je,{open:t,onClose:s,size:"sm",children:[e.jsx(Ee,{title:"Add Channel",onClose:s}),e.jsx(we,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1 p-0.5 radius-inner bg-zinc-950/5",children:Js.map(x=>{const T=x.icon,S=l===x.key;return e.jsxs("button",{onClick:()=>{i(x.key),N(""),y(null)},className:P("flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors",S?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(T,{className:"w-3.5 h-3.5"}),x.label]},x.key)})}),e.jsx("p",{className:"text-xs text-fg-muted",children:(R=Js.find(x=>x.key===l))==null?void 0:R.desc}),c&&l==="create-private"&&e.jsxs("div",{className:"p-3 radius-inner bg-sys-green/8 border border-sys-green/20 space-y-2",children:[e.jsx("p",{className:"text-xs text-sys-green font-medium",children:"Channel created! Share this key with others:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-[11px] font-mono text-fg-primary bg-zinc-950/10 px-2 py-1 rounded break-all",children:Xs(c)}),e.jsx("button",{onClick:u,className:"p-1.5 rounded hover:bg-subtle-fill transition-colors flex-shrink-0",title:"Copy key",children:k?e.jsx(be,{className:"w-3.5 h-3.5 text-sys-green"}):e.jsx(Et,{className:"w-3.5 h-3.5 text-fg-muted"})})]}),e.jsx("p",{className:"text-[11px] text-fg-muted",children:"Save this key — it cannot be recovered later."})]}),e.jsxs(re,{children:[e.jsx(le,{children:l==="join-hashtag"?"Hashtag name":"Channel name"}),e.jsx(pe,{type:"text",value:o,onChange:x=>h(x.target.value),placeholder:l==="join-hashtag"?"e.g. south-bay":"e.g. My Channel",maxLength:32,className:"mt-1",disabled:!!c}),l==="join-hashtag"&&j&&j!==o&&e.jsxs(ke,{className:"mt-1",children:["Will be registered as ",e.jsxs("code",{className:"text-fg-primary font-mono text-[11px]",children:["#",j]})]}),l==="join-hashtag"&&$&&e.jsx(ke,{className:"mt-1 text-sys-green",children:"Known region channel"})]}),C&&e.jsxs("div",{className:"flex items-start gap-2 p-2.5 radius-inner bg-sys-red/8 border border-sys-red/20",children:[e.jsx(Be,{className:"w-3.5 h-3.5 text-sys-red flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs text-fg-secondary",children:["Channel ",e.jsx("strong",{className:"text-fg-primary",children:C.name})," already exists at slot ",C.index,". Remove it first to re-add."]})]}),l==="join-private"&&e.jsxs(re,{children:[e.jsxs(le,{children:["Channel key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(32 hex chars)"})]}),e.jsx(pe,{type:"text",value:p,onChange:x=>v(x.target.value),placeholder:"e.g. a1b2c3d4e5f6...",maxLength:32,className:"mt-1 font-mono text-xs"}),p&&!vt(p)&&e.jsx(ke,{className:"mt-1 text-sys-red",children:"Must be exactly 32 hex characters (16 bytes)"})]}),e.jsxs("p",{className:"text-[11px] text-fg-muted",children:["Will be assigned to channel slot ",e.jsx("strong",{className:"text-fg-primary",children:_})]}),d&&e.jsx("p",{className:"text-xs text-sys-red font-medium",children:d})]})}),e.jsxs(Me,{children:[e.jsx(H,{plain:!0,onClick:s,children:c?"Done":"Cancel"}),!c&&e.jsx(H,{color:"primary",onClick:m,disabled:!w||g,children:g?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 animate-spin"}),"Adding…"]}):l==="create-private"?"Create Channel":"Join Channel"})]})]})}const Ai=202,Oi=/^[0-9a-fA-F]+$/;function zi(t){const s=t.replace(/\s/g,"");return s.length>=Ai&&s.length%2===0&&Oi.test(s)}const Hi=n.memo(function({open:s,onClose:a,contacts:r,exportPubKey:l,onExport:i,onImport:o}){const[h,p]=n.useState(l?"export":"import"),[v,c]=n.useState(l??""),[y,g]=n.useState(""),[b,d]=n.useState(""),[N,k]=n.useState(!1),[f,M]=n.useState(!1),[I,_]=n.useState(!1),[j,C]=n.useState(null),[$,w]=n.useState(!1),u=n.useRef(null);n.useEffect(()=>{s&&(p(l?"export":"import"),c(l??""),g(""),d(""),k(!1),M(!1),_(!1),C(null),w(!1))},[s,l]);const m=n.useCallback(()=>{a()},[a]),R=n.useCallback(async()=>{if(!v)return;k(!0),C(null),g("");const S=await i(v);k(!1),S?g(S):C("Failed to export contact advert")},[v,i]),x=n.useCallback(async()=>{if(y)try{await navigator.clipboard.writeText(y),_(!0),setTimeout(()=>_(!1),2e3)}catch{C("Failed to copy to clipboard")}},[y]),T=n.useCallback(async()=>{const S=b.replace(/\s/g,"");if(!zi(S)){C("Invalid hex — must be at least 202 hex characters (101 bytes)");return}M(!0),C(null);const A=await o(S);M(!1),A?(w(!0),d(""),setTimeout(()=>m(),1500)):C("Import failed — check the hex string and try again")},[b,o,m]);return e.jsxs(je,{open:s,onClose:m,children:[e.jsx(ar,{children:"Contact Import / Export"}),e.jsxs(we,{children:[e.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg bg-subtle-fill mb-4",children:[e.jsxs("button",{onClick:()=>{p("export"),C(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md text-xs font-medium transition-colors",h==="export"?"bg-surface shadow-sm text-fg-primary":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(zt,{className:"w-3.5 h-3.5"}),"Export"]}),e.jsxs("button",{onClick:()=>{p("import"),C(null)},className:P("flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-md text-xs font-medium transition-colors",h==="import"?"bg-surface shadow-sm text-fg-primary":"text-fg-muted hover:text-fg-secondary"),children:[e.jsx(He,{className:"w-3.5 h-3.5"}),"Import"]})]}),h==="export"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-fg-muted mb-1",children:"Select contact"}),e.jsxs("select",{value:v,onChange:S=>{c(S.target.value),g(""),C(null)},className:"w-full surface-input rounded-lg px-3 py-2 text-sm text-fg-primary",children:[e.jsx("option",{value:"",children:"Choose a contact…"}),r.map(S=>e.jsx("option",{value:S.public_key,children:S.name||S.public_key.slice(0,12)},S.public_key))]})]}),e.jsx(H,{color:"primary",outline:!0,className:"w-full justify-center",disabled:!v||N,onClick:R,children:N?"Exporting…":"Export Advert"}),y&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("textarea",{readOnly:!0,value:y,rows:4,className:"w-full surface-input rounded-lg px-3 py-2 text-[10px] font-mono text-fg-primary break-all resize-none"}),e.jsxs(H,{color:I?"success":"primary",outline:!0,className:"w-full justify-center",onClick:x,children:[I?e.jsx(be,{"data-slot":"icon"}):e.jsx(Et,{"data-slot":"icon"}),I?"Copied!":"Copy to Clipboard"]})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-fg-muted mb-1",children:"Paste advert hex string"}),e.jsx("textarea",{ref:u,value:b,onChange:S=>{d(S.target.value),C(null),w(!1)},placeholder:"Paste exported advert hex here…",rows:4,className:"w-full surface-input rounded-lg px-3 py-2 text-[10px] font-mono text-fg-primary break-all resize-none placeholder:text-fg-muted/50"}),e.jsx("p",{className:"text-[10px] text-fg-muted/70 mt-1",children:"Minimum 101 bytes (202 hex characters): 32B pubkey + 4B timestamp + 64B signature + appData"})]}),$&&e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sys-green/10 text-sys-green text-xs font-medium",children:[e.jsx(be,{className:"w-3.5 h-3.5"}),"Contact imported successfully"]}),e.jsx(H,{color:"primary",outline:!0,className:"w-full justify-center",disabled:!b.trim()||f,onClick:T,children:f?"Importing…":"Import Contact"})]}),j&&e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 mt-3 rounded-lg bg-sys-red/10 text-sys-red text-xs",children:[e.jsx(da,{className:"w-3.5 h-3.5 flex-shrink-0"}),j]})]}),e.jsx(Me,{children:e.jsx(H,{plain:!0,onClick:m,children:"Close"})})]})});function wc(){var us,ms,ps,hs,xs,fs;const t=nr(),s=rr(),a=lr(),r=or(),l=ir(),i=cr(),o=mt(),h=dr(),p=ur(),v=mr(),c=pr(),y=n.useMemo(()=>{if(l.length===0)return r;const E=new Set(r.map(L=>L.public_key));return[...r,...l.filter(L=>!E.has(L.public_key))]},[r,l]),g=n.useMemo(()=>{const E=new Set;if(!(c!=null&&c.neighbors))return E;const L=[];for(const[B,X]of Object.entries(c.neighbors))X.zero_hop&&L.push((B.startsWith("0x")?B.slice(2):B).toLowerCase());for(const B of y){const X=B.public_key.toLowerCase();for(const ce of L)if(X===ce||X.startsWith(ce)){E.add(B.public_key);break}}return E},[c==null?void 0:c.neighbors,y]),b=n.useMemo(()=>{const E=new Map;if(!(c!=null&&c.neighbors))return E;const L=[];for(const[B,X]of Object.entries(c.neighbors))X.zero_hop&&X.rssi!=null&&X.snr!=null&&X.rssi!==0&&L.push({hash:(B.startsWith("0x")?B.slice(2):B).toLowerCase(),rssi:X.rssi,snr:X.snr,advertCount:X.advert_count??1});if(L.length===0)return E;for(const B of y){const X=B.public_key.toLowerCase();for(const ce of L)if(X===ce.hash||X.startsWith(ce.hash)){E.set(B.public_key,{rssi:ce.rssi,snr:ce.snr,advertCount:ce.advertCount});break}}return E},[c==null?void 0:c.neighbors,y]),d=hr(),N=xr(),k=la(),f=fr(),M=gr(),I=yr(),_=br(),j=vr(),[C,$]=jr(),[w,u]=n.useState(!1),[m,R]=n.useState(!1),[x,T]=n.useState(!1),[S,A]=n.useState(!1),[ie,Y]=n.useState(null),[D,K]=n.useState(!1),[ee,V]=n.useState(!1),[F,O]=n.useState(!0),z="pymc_companion_contacts_micro",U="pymc_companion_split",[ne,ht]=n.useState(()=>{try{return localStorage.getItem(z)==="1"}catch{return!1}}),We=25,Gt=75,[xt,Kt]=n.useState(()=>{try{const E=Number(localStorage.getItem(U));return E>=We&&E<=Gt?E:50}catch{return 50}}),Qe=n.useRef(null),Le=n.useRef(null),Ut=n.useRef(null),Ye=n.useRef(!1),Ae=n.useRef(xt);Ae.current=xt;const Ia=n.useCallback(E=>{E.preventDefault(),E.target.setPointerCapture(E.pointerId),Ye.current=!0},[]),Ea=n.useCallback(E=>{if(!Ye.current||!Qe.current)return;const L=Qe.current.getBoundingClientRect(),B=Math.round(Math.min(Gt,Math.max(We,(E.clientX-L.left)/L.width*100)));Ae.current=B,Le.current&&(Le.current.style.width=`${B}%`)},[]),qt=n.useCallback(()=>{if(!Ye.current)return;Ye.current=!1;const E=Ae.current;Kt(E);try{localStorage.setItem(U,String(E))}catch{}},[]),Ma=n.useCallback(()=>{Ae.current=50,Le.current&&tt(Le.current,{width:"50%"},de.layoutResize),Kt(50);try{localStorage.setItem(U,String(50))}catch{}},[]),Pa=n.useCallback(E=>{ht(E);const L=Qe.current,B=Ut.current;if(!L)return;const X=L.getBoundingClientRect().width;L.style.width=E?"var(--companion-side-micro)":"var(--companion-side)";const ce=L.getBoundingClientRect().width;if(L.style.width=`${X}px`,B){const tn=E?56:Ae.current/100*ce,sn=B.offsetWidth,an=Math.max(0,ce-tn-12);B.style.flex="none",B.style.width=`${sn}px`,tt(B,{width:`${an}px`},{...de.layoutResize,onComplete(){B.style.flex="",B.style.width=""}})}tt(L,{width:`${ce}px`},{...de.layoutResize,onComplete(){L.style.width=E?"var(--companion-side-micro)":"var(--companion-side)"}})},[]),{selectCompanion:Ta,selectConversation:ve,sendMessage:Vt,sendChannelMessage:Wt,retryMessage:$a,retryMessageAsFlood:Da,resetPath:ft,shareContact:Fa,removeContact:La,addChannel:Aa,requestStatus:Qt,requestTelemetry:Yt,loginToRepeater:gt,logoutFromRepeater:Xt,getNeighbours:Jt,traceContactPath:Zt,discoverPath:es,pingContact:Oa,markAsRead:ts,fetchCompanions:ss,seedFromRepeater:za,exportContactAdvert:Ha,importContactAdvert:Ba,setContactPath:as,deleteChannel:Ga,loadOlderMessages:Ka}=se.getState(),Ua=n.useCallback(E=>{ve(E),window.innerWidth>=1280?K(!0):V(!0)},[ve]),ns=se(E=>E.messages),rs=se(E=>E.unreadMap);n.useEffect(()=>{ts()},[d,ts]),n.useEffect(()=>{const E=C.get("dm");E&&y.length>0&&y.find(B=>B.public_key===E)&&(ve({type:"contact",id:E}),$({},{replace:!0}))},[C,y,ve,$]);const qa=n.useMemo(()=>{const E=new Set;for(const L of y)L.name&&E.add(L.name);for(const L of N)L.sender_name&&!L.is_outgoing&&E.add(L.sender_name);return[...E].sort((L,B)=>L.localeCompare(B))},[y,N]),ls=n.useMemo(()=>{const E=new Map;for(const L of y)L.name&&E.set(L.name.toLowerCase(),L.public_key);for(const L of N)if(L.sender_name&&L.sender_key&&L.sender_key!=="unknown"&&!L.is_outgoing){const B=L.sender_name.toLowerCase();E.has(B)||E.set(B,L.sender_key)}return E},[y,N]),Va=n.useCallback(E=>{const L=ls.get(E.toLowerCase());L&&(ve({type:"contact",id:L}),K(!0))},[ls,ve]),Wa=n.useCallback(async E=>d?d.type==="channel"?Wt(Number(d.id),E):Vt(d.id,E):!1,[d,Vt,Wt]),Qa=k&&!f,os=I!=null&&(I.adv_type&15)===3,is=It(os?I.public_key:null),Ya=os&&is!=="success",cs=wr(),[me,Pe]=n.useState("idle"),Xa=n.useCallback(async()=>{Pe("flood-sending");const E=await se.getState().sendFloodAdvert();Pe(E?"flood-done":"idle"),E&&setTimeout(()=>Pe(L=>L==="flood-done"?"idle":L),2e3)},[]),Ja=n.useCallback(async()=>{Pe("zero-sending");const E=await se.getState().sendZeroHopAdvert();Pe(E?"zero-done":"idle"),E&&setTimeout(()=>Pe(L=>L==="zero-done"?"idle":L),2e3)},[]),Za=e.jsxs("div",{className:"flex items-center gap-2",children:[k&&a&&e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsxs("button",{onClick:Xa,disabled:me!=="idle"&&me!=="zero-done",className:P("inline-flex items-center gap-2 px-3.5 py-2 rounded-xl text-xs font-semibold transition-all duration-150","bg-surface depth-raised-soft hover:depth-raised active:depth-inset","disabled:opacity-50 disabled:cursor-not-allowed",me==="flood-done"?"text-sys-green":"text-fg-secondary hover:text-fg-primary"),title:"A Flood Advert will announce your presence and broadcast your node ID and name anywhere a repeater will repeat it",children:[me==="flood-sending"?e.jsx(oe,{className:"w-4 h-4 animate-spin"}):e.jsx(to,{className:"w-4 h-4"}),e.jsx("span",{children:me==="flood-done"?"Sent!":"Flood Advert"})]}),e.jsxs("button",{onClick:Ja,disabled:me!=="idle"&&me!=="flood-done",className:P("inline-flex items-center gap-2 px-3.5 py-2 rounded-xl text-xs font-semibold transition-all duration-150","bg-surface depth-raised-soft hover:depth-raised active:depth-inset","disabled:opacity-50 disabled:cursor-not-allowed",me==="zero-done"?"text-sys-green":"text-fg-secondary hover:text-fg-primary"),title:"A Local Advert, or “Zero Hop” advert will not be repeated by local repeaters, but will be heard by those within range",children:[me==="zero-sending"?e.jsx(oe,{className:"w-4 h-4 animate-spin"}):e.jsx(wa,{className:"w-4 h-4"}),e.jsx("span",{children:me==="zero-done"?"Sent!":"Local Advert"})]})]}),e.jsx("button",{onClick:()=>Nr.getState().toggleFocusMode(),className:"hidden lg:flex p-1.5 hover:bg-subtle-fill rounded transition-colors",title:cs?"Collapse view":"Expand view",children:cs?e.jsx(Jr,{className:"w-4 h-4 text-fg-muted"}):e.jsx(Zr,{className:"w-4 h-4 text-fg-muted"})})]}),en=e.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[e.jsx(ge,{children:v.length>0&&e.jsx(ue.div,{layout:!0,initial:{opacity:0,scale:.9,width:0},animate:{opacity:1,scale:1,width:"auto"},exit:{opacity:0,scale:.9,width:0},transition:de.fade,className:"flex items-center gap-1 overflow-hidden",children:v.map(E=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-green/10 text-[11px] text-sys-green font-medium whitespace-nowrap",children:[e.jsx(ze,{className:"w-2.5 h-2.5"}),E.name]},E.pubHex))},"advert-notifs")}),e.jsx(ge,{children:!k&&e.jsxs(ue.span,{initial:{opacity:0,scale:.9,width:0},animate:{opacity:1,scale:1,width:"auto"},exit:{opacity:0,scale:.9,width:0},transition:de.fade,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-amber/10 text-[11px] text-sys-amber font-medium whitespace-nowrap overflow-hidden",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 flex-shrink-0",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-amber opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-sys-amber"})]}),"Reconnecting…"]},"disconnected")}),a&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>R(!0),disabled:h,className:"data-box flex items-center gap-1 cursor-pointer hover:bg-subtle-fill-strong transition-colors disabled:opacity-50",title:p>0?`${p} contacts seeded from repeater — click to refresh`:"Seed contacts from repeater adverts",children:[h?e.jsx(oe,{className:"w-3.5 h-3.5 text-sys-blue animate-spin"}):e.jsx(io,{className:"w-3.5 h-3.5 text-sys-blue"}),p>0&&e.jsxs("span",{className:"text-sys-blue",children:["+",p]})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${y.length} contacts${p>0?` (${p} from repeater)`:""}`,children:[e.jsx(wt,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:y.length})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${a.channels_count} channels`,children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:a.channels_count})]})]}),e.jsx(Ii,{companions:t,selected:s,onSelect:Ta}),e.jsx(H,{plain:!0,onClick:()=>u(!0),title:"Companion configuration",children:e.jsx(kr,{"data-slot":"icon"})})]});if(t.length===0&&!f)return e.jsxs(Ns,{children:[e.jsx(ks,{title:"Companion",icon:e.jsx(ye,{}),controls:e.jsxs(H,{color:"primary",outline:!0,onClick:()=>u(!0),children:[e.jsx(Ue,{"data-slot":"icon"}),"Add Companion"]})}),e.jsx(Cs,{ready:!0,children:e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(ye,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted mb-1",children:"No companions configured"}),e.jsx("p",{className:"type-body-sm text-fg-muted/70 mb-4",children:"Add a companion to start messaging mesh contacts"}),e.jsxs(H,{color:"primary",outline:!0,onClick:()=>u(!0),children:[e.jsx(Ue,{"data-slot":"icon"}),"Add Companion"]})]})}),e.jsx(Ys,{open:w,onClose:()=>u(!1),onRefresh:ss})]});const ds=d?d.type==="channel"?((us=i.find(E=>String(E.index)===d.id))==null?void 0:us.name)??"Channel":((ms=y.find(E=>E.public_key===d.id))==null?void 0:ms.name)??d.id.slice(0,8):null;return e.jsxs(Ns,{children:[e.jsx(ks,{title:(o==null?void 0:o.node_name)||"Companion",icon:e.jsx(ye,{}),leading:Za,controls:en}),e.jsx(Cs,{children:e.jsxs("div",{className:"companion-layout flex gap-4",style:{height:"calc(100vh - 11rem)",minHeight:400},children:[e.jsxs("div",{ref:Qe,className:P("flex-shrink-0 flex h-full overflow-hidden radius-inner bg-surface/80 backdrop-blur-lg depth-raised",F?"":"hidden md:flex"),style:{width:ne?"var(--companion-side-micro)":"var(--companion-side)"},children:[e.jsx(Oo,{ref:Le,contacts:y,selectedConversation:d,unreadMap:rs,messages:ns,onSelect:E=>{ve(E),window.innerWidth<768&&O(!1)},onShowDetails:Ua,onShareContact:Fa,onResetPath:ft,onRemoveContact:La,onPingContact:Oa,repeaterNeighborHashes:g,repeaterSignalMap:b,isLoading:f,splitPercent:xt,onMicroChange:Pa}),e.jsx("div",{className:"group/divider flex-shrink-0 self-stretch flex items-center justify-center w-3 cursor-col-resize select-none touch-none",onPointerDown:Ia,onPointerMove:Ea,onPointerUp:qt,onPointerCancel:qt,onDoubleClick:Ma,children:e.jsx("div",{className:"w-px h-full my-2 bg-edge-subtle/50 group-hover/divider:bg-sys-blue/50 group-active/divider:bg-sys-blue transition-colors"})}),e.jsx(Ko,{ref:Ut,channels:i,selectedConversation:d,unreadMap:rs,messages:ns,onSelect:E=>{ve(E),window.innerWidth<768&&O(!1)},onAddChannel:()=>T(!0),onDeleteChannel:Ga})]}),e.jsxs(Ss,{noPadding:!0,radius:"sm",className:"flex-1 flex flex-col min-w-0 overflow-hidden relative",children:[e.jsx(ge,{children:M&&e.jsxs(ue.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:de.fade,className:"flex items-center justify-center gap-2 px-3 py-1.5 bg-sys-red/10 border-b border-sys-red/20",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-sys-red flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-sys-red font-medium truncate",children:M})]},"error-banner")}),!F&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-edge-subtle md:hidden",children:[e.jsx("button",{onClick:()=>O(!0),className:"p-1 hover:bg-subtle-fill rounded transition-colors",children:e.jsx(zl,{className:"w-4 h-4 text-fg-secondary"})}),e.jsx("span",{className:"text-sm text-fg-primary font-medium truncate flex-1",children:ds}),d&&e.jsx("button",{onClick:()=>V(!0),className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:"Details",children:e.jsx(nt,{className:"w-4 h-4 text-fg-muted"})})]}),e.jsxs("div",{className:"hidden md:flex items-center justify-between px-3 py-1.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"text-sm text-fg-primary font-medium truncate",children:ds??"Select a conversation"}),e.jsx(ge,{children:d&&e.jsx(ue.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,onClick:()=>{window.innerWidth>=1280?K(E=>!E):V(!0)},className:"p-1 hover:bg-subtle-fill rounded transition-colors",title:D?"Hide detail panel":"Show details",children:D&&window.innerWidth>=1280?e.jsx(Ts,{className:"w-4 h-4 text-fg-muted"}):e.jsx(nt,{className:"w-4 h-4 text-fg-muted"})},"ctx-toggle")})]}),Ya&&I?e.jsx(ii,{contact:I,loginStatus:is,onLogin:gt}):e.jsxs(e.Fragment,{children:[e.jsx(ai,{messages:N,contacts:y,className:"flex-1 min-h-0",conversationKey:d?d.type==="channel"?`ch:${d.id}`:d.id:void 0,onRetry:$a,onRetryAsFlood:Da,onMentionClick:Va,historyLoading:_,historyExhausted:d?j.get(d.type==="channel"?`ch:${d.id}`:d.id)??!1:!0,onLoadOlder:d?()=>Ka(d.type==="channel"?`ch:${d.id}`:d.id):void 0,channelName:(d==null?void 0:d.type)==="channel"?(ps=i.find(E=>String(E.index)===d.id))==null?void 0:ps.name:void 0}),d&&e.jsx(ri,{onSend:Wa,disabled:!Qa,mentionNames:qa,placeholder:d.type==="channel"?`Message ${((hs=i.find(E=>String(E.index)===d.id))==null?void 0:hs.name)??"channel"}`:`Message ${((xs=y.find(E=>E.public_key===d.id))==null?void 0:xs.name)??"contact"}`})]})]}),e.jsx(ue.div,{initial:!1,animate:{width:D&&d?"var(--companion-context)":"0px",opacity:D&&d?1:0},transition:de.layoutResize,className:"hidden xl:block flex-shrink-0 overflow-hidden",style:{pointerEvents:D&&d?"auto":"none"},children:d&&e.jsxs(Ss,{neomorphic:!0,noPadding:!0,radius:"sm",className:"h-full relative",children:[e.jsx(ge,{children:D&&e.jsx(ue.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:de.fade,onClick:()=>K(!1),className:"absolute top-2 left-2 z-10 p-1 hover:bg-subtle-fill rounded-lg transition-colors",title:"Hide detail panel",children:e.jsx(Ts,{className:"w-4 h-4 text-fg-muted"})},"ctx-close")}),e.jsx(Ks,{contact:d.type==="contact"?I:null,channel:d.type==="channel"?i.find(E=>String(E.index)===d.id)??null:null,contacts:y,selfPubKey:(o==null?void 0:o.public_key)??null,onResetPath:ft,onRequestStatus:Qt,onRequestTelemetry:Yt,onLoginToRepeater:gt,onLogoutFromRepeater:Xt,onGetNeighbours:Jt,onTraceContactPath:Zt,onDiscoverPath:es,onExportContact:E=>{Y(E),A(!0)},onSetContactPath:as})]})})]})}),e.jsx(Ys,{open:w,onClose:()=>u(!1),onRefresh:ss}),e.jsx(Pi,{open:m,onClose:()=>R(!1),companionName:s??"companion",onImport:za}),e.jsx(Hi,{open:S,onClose:()=>{A(!1),Y(null)},contacts:y,exportPubKey:ie,onExport:Ha,onImport:Ba}),e.jsx(Li,{open:x,onClose:()=>T(!1),channels:i,onAddChannel:Aa}),e.jsxs(je,{open:ee,onClose:()=>V(!1),size:"md",children:[e.jsx(Ee,{icon:(d==null?void 0:d.type)==="channel"?e.jsx(Fe,{className:"w-5 h-5"}):I&&(I.adv_type&15)===2?e.jsx(ze,{className:"w-5 h-5"}):e.jsx(ye,{className:"w-5 h-5"}),title:(d==null?void 0:d.type)==="channel"?((fs=i.find(E=>String(E.index)===d.id))==null?void 0:fs.name)??"Channel":(I==null?void 0:I.name)||"Contact Details",onClose:()=>V(!1)}),e.jsx(we,{className:"max-h-[70vh] overflow-y-auto",children:e.jsx(Ks,{embedded:!0,contact:(d==null?void 0:d.type)==="contact"?I:null,channel:(d==null?void 0:d.type)==="channel"?i.find(E=>String(E.index)===d.id)??null:null,contacts:y,selfPubKey:(o==null?void 0:o.public_key)??null,onResetPath:ft,onRequestStatus:Qt,onRequestTelemetry:Yt,onLoginToRepeater:gt,onLogoutFromRepeater:Xt,onGetNeighbours:Jt,onTraceContactPath:Zt,onDiscoverPath:es,onExportContact:E=>{Y(E),A(!0)},onSetContactPath:as})})]})]})}export{wc as default}; diff --git a/frontend/dist/assets/CompanionEchoMap-BcAn2gmm.js b/frontend/dist/assets/CompanionEchoMap-Cmhesaku.js similarity index 94% rename from frontend/dist/assets/CompanionEchoMap-BcAn2gmm.js rename to frontend/dist/assets/CompanionEchoMap-Cmhesaku.js index f269d3b3..f50ccd8b 100644 --- a/frontend/dist/assets/CompanionEchoMap-BcAn2gmm.js +++ b/frontend/dist/assets/CompanionEchoMap-Cmhesaku.js @@ -1 +1 @@ -import{r as i,c$ as K,a6 as T,Q as Y,fO as D,au as I,cB as J,g5 as Q,Z as q,O as X,j as a,c as V,V as k,cE as ee}from"./index-i0xzpXop.js";import{M as te,S as ne,L as se,a as R}from"./maplibre-gl-B20pCOz8.js";import{useSrcHashResolverMap as ae,useDiscoveredNodes as oe}from"./usePipelineStore-BqTRxIqB.js";import{M as re}from"./map-pin-off-CPSqCYZk.js";import"./node-types-rVJPSDxd.js";const le={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},A=X.amber,O=q[400],U=i.memo(function({prefix:c,name:o,isLocal:f,color:n}){const[r,u]=i.useState(!1);return a.jsx("div",{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{pointerEvents:"auto"},children:a.jsxs(k,{color:n,filled:!0,className:V("type-data-xs shadow-lg border border-current/30 transition-all duration-150 cursor-default",r&&"relative z-50"),children:[f&&a.jsx(ee,{className:"w-2.5 h-2.5 mr-0.5"}),c&&a.jsx("span",{className:"font-mono",children:c}),r&&o&&a.jsx("span",{className:c?"ml-0.5 opacity-75":"",children:o})]})})});function N(p,c){return p==null||c==null?!1:p!==0||c!==0}function ie(p,c,o){var u;const f=p.toUpperCase(),n=c.find(l=>l.public_key.toUpperCase().startsWith(f));if(n&&N(n.gps_lat,n.gps_lon))return{name:n.name||null,lat:n.gps_lat,lng:n.gps_lon,hasGps:!0};if(o.neighbors){const l=Object.entries(o.neighbors).find(([t])=>t.toUpperCase().startsWith(f));if(l){const[,t]=l;if(N(t.latitude,t.longitude))return{name:t.node_name||t.name||null,lat:t.latitude,lng:t.longitude,hasGps:!0}}}const r=o.srcHashMap.get(f);if(r){const l=o.discoveredNodes.get(r);if(l&&N(l.latitude,l.longitude))return{name:l.name||null,lat:l.latitude,lng:l.longitude,hasGps:!0};if(o.neighbors){const t=o.neighbors[r];if(t&&N(t.latitude,t.longitude))return{name:t.node_name||t.name||null,lat:t.latitude,lng:t.longitude,hasGps:!0}}}return{name:(n==null?void 0:n.name)||(r?((u=o.discoveredNodes.get(r))==null?void 0:u.name)??null:null),lat:0,lng:0,hasGps:!1}}function ce(p,c,o,f){const n=Math.floor(c/30);for(const r of[n-1,n,n+1])for(const[u,l]of o){const t=l.decoded;if(!(t!=null&&t.decrypted)||t.senderName!==f)continue;const v=t.timestamp??l.timestamp;if(Math.floor(v/30)===r&&t.text===p)return u}return null}function ue(p,c){const o=new Set,f=[];for(const n of c){if(n.packet_hash!==p||n.packet_origin==="tx_local")continue;const r=n.original_path??n.forwarded_path;if(!r||r.length===0)continue;const u=r[r.length-1].toUpperCase();o.has(u)||(o.add(u),f.push({prefix:u,snr:n.snr}))}return f}function he({text:p,timestamp:c,contacts:o,className:f}){const n=i.useRef(null),r=K(),u=T(),l=Y(),[t,v]=i.useState(!1),m=D(),C=I(),z=u==null?void 0:u.neighbors,E=ae(),B=oe(),M=J(),g=Q(),w=(m==null?void 0:m.node_name)??(g==null?void 0:g.node_name)??null,F=i.useMemo(()=>({neighbors:z,srcHashMap:E,discoveredNodes:B}),[z,E,B]),d=i.useMemo(()=>{const e=(m==null?void 0:m.node_name)||(g==null?void 0:g.node_name)||(g==null?void 0:g.companion_name)||"Me";return m&&N(m.latitude,m.longitude)?{prefix:m.public_key.slice(0,2).toUpperCase(),name:e,lat:m.latitude,lng:m.longitude}:M&&N(M.latitude,M.longitude)?{prefix:"",name:e,lat:M.latitude,lng:M.longitude}:null},[m,g,M]),L=i.useMemo(()=>w?ce(p,c,C,w):null,[p,c,C,w]),G=i.useMemo(()=>L?ue(L,l):[],[L,l]),j=i.useMemo(()=>G.map(e=>{const s=ie(e.prefix,o,F);return{prefix:e.prefix,snr:e.snr,...s}}),[G,o,F]),y=i.useMemo(()=>j.filter(e=>e.hasGps),[j]),$=i.useMemo(()=>j.filter(e=>!e.hasGps),[j]),_=i.useMemo(()=>{if(!d||y.length===0)return[];const e=[d.lng,d.lat];return y.map(s=>{const h=[s.lng,s.lat];return{from:e,to:h,midpoint:[(e[0]+h[0])/2,(e[1]+h[1])/2]}})},[d,y]),W=i.useMemo(()=>_.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[_]),H=i.useMemo(()=>{if(typeof document>"u")return{amber:A,zinc:O};const e=getComputedStyle(document.documentElement),s=e.getPropertyValue("--sys-amber").trim(),h=e.getPropertyValue("--zinc-400").trim();return{amber:s.startsWith("#")?s:A,zinc:h.startsWith("#")?h:O}},[]),x=i.useMemo(()=>{if(!d||y.length===0)return null;let e=d.lat,s=d.lat,h=d.lng,S=d.lng;for(const b of y)b.lats&&(s=b.lat),b.lngS&&(S=b.lng);return[[h,e],[S,s]]},[d,y]),Z=i.useCallback(()=>{var s;const e=(s=n.current)==null?void 0:s.getMap();e&&x&&e.fitBounds(x,{padding:{top:40,bottom:44,left:56,right:56},maxZoom:14,duration:0}),v(!0)},[x]);if(!x||!d)return null;const P=[(x[0][0]+x[1][0])/2,(x[0][1]+x[1][1])/2];return a.jsxs("div",{className:V("relative rounded-lg overflow-hidden",f),style:{aspectRatio:"16 / 10"},children:[!t&&a.jsx("div",{className:"absolute inset-0 bg-subtle-fill flex items-center justify-center pointer-events-none z-10",children:a.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})}),a.jsx("div",{className:"h-full w-full transition-opacity duration-200",style:{opacity:t?1:0},children:a.jsxs(te,{ref:n,initialViewState:{longitude:P[0],latitude:P[1],zoom:10},onLoad:Z,style:{height:"100%",width:"100%"},mapStyle:le[r],attributionControl:!1,interactive:!1,children:[_.map((e,s)=>a.jsx(ne,{id:`cecho-${s}`,type:"geojson",data:W[s],lineMetrics:!0,children:a.jsx(se,{id:`cecho-line-${s}`,type:"line",paint:{"line-width":2,"line-gradient":["interpolate",["linear"],["line-progress"],0,H.amber,1,H.zinc]},layout:{"line-cap":"round","line-join":"round"}})},`cecho-${s}`)),a.jsx(R,{longitude:d.lng,latitude:d.lat,anchor:"center",children:a.jsx(U,{prefix:d.prefix,name:d.name,isLocal:!0,color:"amber"})}),y.map((e,s)=>a.jsx(R,{longitude:e.lng,latitude:e.lat,anchor:"center",children:a.jsx(U,{prefix:e.prefix,name:e.name,isLocal:!1,color:"zinc"})},`cecho-node-${e.prefix}-${s}`))]})}),$.length>0&&a.jsx("div",{className:"absolute bottom-1.5 left-1.5 z-10 flex items-center gap-1 flex-wrap max-w-[60%]",children:$.map((e,s)=>a.jsxs(k,{color:"zinc",className:"type-data-xs shadow-sm opacity-70",children:[a.jsx(re,{className:"w-2 h-2 mr-0.5"}),e.prefix,e.name&&a.jsx("span",{className:"ml-0.5 opacity-60",children:e.name})]},`cecho-unmap-${e.prefix}-${s}`))}),a.jsx("div",{className:"absolute bottom-1.5 right-1.5 z-10",children:a.jsxs(k,{color:"green",className:"type-data-xs shadow-sm",children:[j.length," echo",j.length!==1?"es":""]})})]})}export{he as CompanionEchoMap}; +import{r as i,c$ as K,a6 as T,Q as Y,fO as D,au as I,cB as J,g5 as Q,Z as q,O as X,j as a,c as V,V as k,cE as ee}from"./index-CN4vD05c.js";import{M as te,S as ne,L as se,a as R}from"./maplibre-gl-CRRd6W2P.js";import{useSrcHashResolverMap as ae,useDiscoveredNodes as oe}from"./usePipelineStore-BTv04vLL.js";import{M as re}from"./map-pin-off-VHAD8rJE.js";import"./node-types-UozthSpR.js";const le={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},A=X.amber,O=q[400],U=i.memo(function({prefix:c,name:o,isLocal:f,color:n}){const[r,u]=i.useState(!1);return a.jsx("div",{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{pointerEvents:"auto"},children:a.jsxs(k,{color:n,filled:!0,className:V("type-data-xs shadow-lg border border-current/30 transition-all duration-150 cursor-default",r&&"relative z-50"),children:[f&&a.jsx(ee,{className:"w-2.5 h-2.5 mr-0.5"}),c&&a.jsx("span",{className:"font-mono",children:c}),r&&o&&a.jsx("span",{className:c?"ml-0.5 opacity-75":"",children:o})]})})});function N(p,c){return p==null||c==null?!1:p!==0||c!==0}function ie(p,c,o){var u;const f=p.toUpperCase(),n=c.find(l=>l.public_key.toUpperCase().startsWith(f));if(n&&N(n.gps_lat,n.gps_lon))return{name:n.name||null,lat:n.gps_lat,lng:n.gps_lon,hasGps:!0};if(o.neighbors){const l=Object.entries(o.neighbors).find(([t])=>t.toUpperCase().startsWith(f));if(l){const[,t]=l;if(N(t.latitude,t.longitude))return{name:t.node_name||t.name||null,lat:t.latitude,lng:t.longitude,hasGps:!0}}}const r=o.srcHashMap.get(f);if(r){const l=o.discoveredNodes.get(r);if(l&&N(l.latitude,l.longitude))return{name:l.name||null,lat:l.latitude,lng:l.longitude,hasGps:!0};if(o.neighbors){const t=o.neighbors[r];if(t&&N(t.latitude,t.longitude))return{name:t.node_name||t.name||null,lat:t.latitude,lng:t.longitude,hasGps:!0}}}return{name:(n==null?void 0:n.name)||(r?((u=o.discoveredNodes.get(r))==null?void 0:u.name)??null:null),lat:0,lng:0,hasGps:!1}}function ce(p,c,o,f){const n=Math.floor(c/30);for(const r of[n-1,n,n+1])for(const[u,l]of o){const t=l.decoded;if(!(t!=null&&t.decrypted)||t.senderName!==f)continue;const v=t.timestamp??l.timestamp;if(Math.floor(v/30)===r&&t.text===p)return u}return null}function ue(p,c){const o=new Set,f=[];for(const n of c){if(n.packet_hash!==p||n.packet_origin==="tx_local")continue;const r=n.original_path??n.forwarded_path;if(!r||r.length===0)continue;const u=r[r.length-1].toUpperCase();o.has(u)||(o.add(u),f.push({prefix:u,snr:n.snr}))}return f}function he({text:p,timestamp:c,contacts:o,className:f}){const n=i.useRef(null),r=K(),u=T(),l=Y(),[t,v]=i.useState(!1),m=D(),C=I(),z=u==null?void 0:u.neighbors,E=ae(),B=oe(),M=J(),g=Q(),w=(m==null?void 0:m.node_name)??(g==null?void 0:g.node_name)??null,F=i.useMemo(()=>({neighbors:z,srcHashMap:E,discoveredNodes:B}),[z,E,B]),d=i.useMemo(()=>{const e=(m==null?void 0:m.node_name)||(g==null?void 0:g.node_name)||(g==null?void 0:g.companion_name)||"Me";return m&&N(m.latitude,m.longitude)?{prefix:m.public_key.slice(0,2).toUpperCase(),name:e,lat:m.latitude,lng:m.longitude}:M&&N(M.latitude,M.longitude)?{prefix:"",name:e,lat:M.latitude,lng:M.longitude}:null},[m,g,M]),L=i.useMemo(()=>w?ce(p,c,C,w):null,[p,c,C,w]),G=i.useMemo(()=>L?ue(L,l):[],[L,l]),j=i.useMemo(()=>G.map(e=>{const s=ie(e.prefix,o,F);return{prefix:e.prefix,snr:e.snr,...s}}),[G,o,F]),y=i.useMemo(()=>j.filter(e=>e.hasGps),[j]),$=i.useMemo(()=>j.filter(e=>!e.hasGps),[j]),_=i.useMemo(()=>{if(!d||y.length===0)return[];const e=[d.lng,d.lat];return y.map(s=>{const h=[s.lng,s.lat];return{from:e,to:h,midpoint:[(e[0]+h[0])/2,(e[1]+h[1])/2]}})},[d,y]),W=i.useMemo(()=>_.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[_]),H=i.useMemo(()=>{if(typeof document>"u")return{amber:A,zinc:O};const e=getComputedStyle(document.documentElement),s=e.getPropertyValue("--sys-amber").trim(),h=e.getPropertyValue("--zinc-400").trim();return{amber:s.startsWith("#")?s:A,zinc:h.startsWith("#")?h:O}},[]),x=i.useMemo(()=>{if(!d||y.length===0)return null;let e=d.lat,s=d.lat,h=d.lng,S=d.lng;for(const b of y)b.lats&&(s=b.lat),b.lngS&&(S=b.lng);return[[h,e],[S,s]]},[d,y]),Z=i.useCallback(()=>{var s;const e=(s=n.current)==null?void 0:s.getMap();e&&x&&e.fitBounds(x,{padding:{top:40,bottom:44,left:56,right:56},maxZoom:14,duration:0}),v(!0)},[x]);if(!x||!d)return null;const P=[(x[0][0]+x[1][0])/2,(x[0][1]+x[1][1])/2];return a.jsxs("div",{className:V("relative rounded-lg overflow-hidden",f),style:{aspectRatio:"16 / 10"},children:[!t&&a.jsx("div",{className:"absolute inset-0 bg-subtle-fill flex items-center justify-center pointer-events-none z-10",children:a.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})}),a.jsx("div",{className:"h-full w-full transition-opacity duration-200",style:{opacity:t?1:0},children:a.jsxs(te,{ref:n,initialViewState:{longitude:P[0],latitude:P[1],zoom:10},onLoad:Z,style:{height:"100%",width:"100%"},mapStyle:le[r],attributionControl:!1,interactive:!1,children:[_.map((e,s)=>a.jsx(ne,{id:`cecho-${s}`,type:"geojson",data:W[s],lineMetrics:!0,children:a.jsx(se,{id:`cecho-line-${s}`,type:"line",paint:{"line-width":2,"line-gradient":["interpolate",["linear"],["line-progress"],0,H.amber,1,H.zinc]},layout:{"line-cap":"round","line-join":"round"}})},`cecho-${s}`)),a.jsx(R,{longitude:d.lng,latitude:d.lat,anchor:"center",children:a.jsx(U,{prefix:d.prefix,name:d.name,isLocal:!0,color:"amber"})}),y.map((e,s)=>a.jsx(R,{longitude:e.lng,latitude:e.lat,anchor:"center",children:a.jsx(U,{prefix:e.prefix,name:e.name,isLocal:!1,color:"zinc"})},`cecho-node-${e.prefix}-${s}`))]})}),$.length>0&&a.jsx("div",{className:"absolute bottom-1.5 left-1.5 z-10 flex items-center gap-1 flex-wrap max-w-[60%]",children:$.map((e,s)=>a.jsxs(k,{color:"zinc",className:"type-data-xs shadow-sm opacity-70",children:[a.jsx(re,{className:"w-2 h-2 mr-0.5"}),e.prefix,e.name&&a.jsx("span",{className:"ml-0.5 opacity-60",children:e.name})]},`cecho-unmap-${e.prefix}-${s}`))}),a.jsx("div",{className:"absolute bottom-1.5 right-1.5 z-10",children:a.jsxs(k,{color:"green",className:"type-data-xs shadow-sm",children:[j.length," echo",j.length!==1?"es":""]})})]})}export{he as CompanionEchoMap}; diff --git a/frontend/dist/assets/CompanionPathMap-D5FruuYA.js b/frontend/dist/assets/CompanionPathMap-DmNbWPuj.js similarity index 95% rename from frontend/dist/assets/CompanionPathMap-D5FruuYA.js rename to frontend/dist/assets/CompanionPathMap-DmNbWPuj.js index c5b1cc3e..664883f5 100644 --- a/frontend/dist/assets/CompanionPathMap-D5FruuYA.js +++ b/frontend/dist/assets/CompanionPathMap-DmNbWPuj.js @@ -1 +1 @@ -import{r,c$ as X,a6 as I,cB as ee,g5 as te,Z,O as J,j as n,c as K,V as H,cE as ne}from"./index-i0xzpXop.js";import{M as se,S as C,L as U,a as G}from"./maplibre-gl-B20pCOz8.js";import{useSrcHashResolverMap as oe,useDiscoveredNodes as ae}from"./usePipelineStore-BqTRxIqB.js";import{C as le}from"./car-aFMoKQAR.js";import{M as ie}from"./map-pin-off-CPSqCYZk.js";import"./node-types-rVJPSDxd.js";const re={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},ce=Z[500],D=J.orange,T=J.green,ue=r.memo(function({prefix:a,name:o,isLocal:u,color:s}){const[m,b]=r.useState(!1);return n.jsx("div",{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{pointerEvents:"auto"},children:n.jsxs(H,{color:s,filled:!0,className:K("type-data-xs shadow-lg border border-current/30 transition-all duration-150 cursor-default",m&&"relative z-50"),children:[u&&n.jsx(ne,{className:"w-2.5 h-2.5 mr-0.5"}),a&&n.jsx("span",{className:"font-mono",children:a}),m&&o&&n.jsx("span",{className:a?"ml-0.5 opacity-75":"",children:o})]})})});function L(d,a){return d==null||a==null?!1:d!==0||a!==0}function de(d,a,o){var s;const u=[];for(const m of d){const b=m.toUpperCase(),p=a.find(c=>c.public_key.toUpperCase().startsWith(b));if(p&&L(p.gps_lat,p.gps_lon)){u.push({prefix:m,name:p.name||null,lat:p.gps_lat,lng:p.gps_lon,isLocal:!1,hasGps:!0});continue}if(o.neighbors){const c=Object.entries(o.neighbors).find(([i])=>i.toUpperCase().startsWith(b));if(c){const[,i]=c;if(L(i.latitude,i.longitude)){u.push({prefix:m,name:i.node_name||i.name||null,lat:i.latitude,lng:i.longitude,isLocal:!1,hasGps:!0});continue}}}const N=o.srcHashMap.get(b);if(N){const c=o.discoveredNodes.get(N);if(c&&L(c.latitude,c.longitude)){u.push({prefix:m,name:c.name||null,lat:c.latitude,lng:c.longitude,isLocal:!1,hasGps:!0});continue}if(o.neighbors){const i=o.neighbors[N];if(i&&L(i.latitude,i.longitude)){u.push({prefix:m,name:i.node_name||i.name||null,lat:i.latitude,lng:i.longitude,isLocal:!1,hasGps:!0});continue}}}u.push({prefix:m,name:(p==null?void 0:p.name)||(N?((s=o.discoveredNodes.get(N))==null?void 0:s.name)??null:null),lat:0,lng:0,isLocal:!1,hasGps:!1})}return u}function me(d,a,o,u){const s=(a==null?void 0:a.node_name)||u||(o==null?void 0:o.name)||"Me";if(a&&L(a.latitude,a.longitude)){const m=a.public_key.slice(0,2).toUpperCase();return[...d,{prefix:m,name:s,lat:a.latitude,lng:a.longitude,isLocal:!0,hasGps:!0}]}return o&&L(o.latitude,o.longitude)?[...d,{prefix:"",name:s,lat:o.latitude,lng:o.longitude,isLocal:!0,hasGps:!0}]:d}function be({hops:d,contacts:a,selfInfo:o,snr:u,wardriveCoords:s,wardriveSenderName:m,className:b}){const p=r.useRef(null),N=X(),c=I(),[i,Y]=r.useState(!1),w=c==null?void 0:c.neighbors,z=oe(),R=ae(),B=ee(),M=te(),$=r.useMemo(()=>({neighbors:w,srcHashMap:z,discoveredNodes:R}),[w,z,R]),k=(M==null?void 0:M.node_name)??(M==null?void 0:M.companion_name)??null,h=r.useMemo(()=>{const e=de(d,a,$);return me(e,o,B,k)},[d,a,$,o,B,k]),g=r.useMemo(()=>h.filter(e=>e.hasGps),[h]),F=r.useMemo(()=>h.filter(e=>!e.hasGps),[h]),S=r.useMemo(()=>{const e=[];if(g.length<2)return e;const t=[];for(let l=0;lS.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[S]),O=r.useMemo(()=>{if(typeof document>"u")return ce;const e=getComputedStyle(document.documentElement).getPropertyValue("--zinc-400").trim();return e.startsWith("#")?e:Z[400]},[]),v=r.useMemo(()=>{if(!s||g.length===0)return null;const e=[s.lon,s.lat],t=g[0];return{from:e,to:[t.lng,t.lat]}},[s,g]),P=r.useMemo(()=>v?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[v.from,v.to]}}]}:null,[v]),A=r.useMemo(()=>{if(typeof document>"u")return{orange:D,green:T};const e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--sys-orange").trim(),l=e.getPropertyValue("--sys-green").trim();return{orange:t.startsWith("#")?t:D,green:l.startsWith("#")?l:T}},[]),j=r.useMemo(()=>{if(g.length<2&&!s||g.length+(s?1:0)<2)return null;let t=1/0,l=-1/0,x=1/0,y=-1/0;for(const f of g)f.latl&&(l=f.lat),f.lngy&&(y=f.lng);return s&&(s.latl&&(l=s.lat),s.lony&&(y=s.lon)),[[x,t],[y,l]]},[g,s]),Q=r.useCallback(()=>{var t;const e=(t=p.current)==null?void 0:t.getMap();e&&j&&e.fitBounds(j,{padding:{top:40,bottom:44,left:56,right:56},maxZoom:14,duration:0}),Y(!0)},[j]);if(!j)return null;const W=[(j[0][0]+j[1][0])/2,(j[0][1]+j[1][1])/2];return n.jsxs("div",{className:K("relative rounded-lg overflow-hidden",b),style:{aspectRatio:"16 / 10"},children:[!i&&n.jsx("div",{className:"absolute inset-0 bg-subtle-fill flex items-center justify-center pointer-events-none z-10",children:n.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})}),n.jsx("div",{className:"h-full w-full transition-opacity duration-200",style:{opacity:i?1:0},children:n.jsxs(se,{ref:p,initialViewState:{longitude:W[0],latitude:W[1],zoom:10},onLoad:Q,style:{height:"100%",width:"100%"},mapStyle:re[N],attributionControl:!1,interactive:!1,children:[P&&n.jsx(C,{id:"cwd-edge",type:"geojson",data:P,lineMetrics:!0,children:n.jsx(U,{id:"cwd-edge-line",type:"line",paint:{"line-width":2,"line-gradient":["interpolate",["linear"],["line-progress"],0,A.orange,1,A.green]},layout:{"line-cap":"round","line-join":"round"}})}),s&&n.jsx(G,{longitude:s.lon,latitude:s.lat,anchor:"center",children:n.jsx("div",{className:"flex items-center",style:{pointerEvents:"auto"},children:n.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-full bg-sys-orange text-white shadow-lg border-2 border-sys-orange/50",children:n.jsx(le,{className:"w-4 h-4",strokeWidth:2.5})})})}),S.map((e,t)=>n.jsx(C,{id:`cedge-${t}`,type:"geojson",data:q[t],children:n.jsx(U,{id:`cedge-line-${t}`,type:"line",paint:{"line-color":O,"line-width":2,"line-opacity":.85},layout:{"line-cap":"round","line-join":"round"}})},`cedge-${t}`)),S.map((e,t)=>n.jsx(G,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:n.jsx("span",{className:"w-4.5 h-4.5 rounded-full flex items-center justify-center font-mono font-extrabold tabular-nums shadow-md pointer-events-none",style:{backgroundColor:O,color:"#fff",fontSize:"10px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e.hopNumber})},`chop-${t}`)),g.map((e,t)=>{const l=t===0,x=t===g.length-1,y=e.isLocal?"amber":l?"green":x?"amber":"zinc";return n.jsx(G,{longitude:e.lng,latitude:e.lat,anchor:"center",children:n.jsx(ue,{prefix:e.prefix,name:e.name,isLocal:e.isLocal,color:y})},`cnode-${e.prefix}-${t}`)})]})}),F.length>0&&n.jsx("div",{className:"absolute bottom-1.5 left-1.5 z-10 flex items-center gap-1 flex-wrap max-w-[60%]",children:F.map((e,t)=>n.jsxs(H,{color:"zinc",className:"type-data-xs shadow-sm opacity-70",children:[n.jsx(ie,{className:"w-2 h-2 mr-0.5"}),e.prefix,e.name&&n.jsx("span",{className:"ml-0.5 opacity-60",children:e.name})]},`cunmap-${e.prefix}-${t}`))}),u!=null&&n.jsx("div",{className:"absolute bottom-1.5 right-1.5 z-10",children:n.jsxs(H,{color:"zinc",className:"type-data-xs shadow-sm",children:[u>0?"+":"",u.toFixed(1)," dB"]})})]})}export{be as CompanionPathMap}; +import{r,c$ as X,a6 as I,cB as ee,g5 as te,Z,O as J,j as n,c as K,V as H,cE as ne}from"./index-CN4vD05c.js";import{M as se,S as C,L as U,a as G}from"./maplibre-gl-CRRd6W2P.js";import{useSrcHashResolverMap as oe,useDiscoveredNodes as ae}from"./usePipelineStore-BTv04vLL.js";import{C as le}from"./car-CMkH36na.js";import{M as ie}from"./map-pin-off-VHAD8rJE.js";import"./node-types-UozthSpR.js";const re={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},ce=Z[500],D=J.orange,T=J.green,ue=r.memo(function({prefix:a,name:o,isLocal:u,color:s}){const[m,b]=r.useState(!1);return n.jsx("div",{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{pointerEvents:"auto"},children:n.jsxs(H,{color:s,filled:!0,className:K("type-data-xs shadow-lg border border-current/30 transition-all duration-150 cursor-default",m&&"relative z-50"),children:[u&&n.jsx(ne,{className:"w-2.5 h-2.5 mr-0.5"}),a&&n.jsx("span",{className:"font-mono",children:a}),m&&o&&n.jsx("span",{className:a?"ml-0.5 opacity-75":"",children:o})]})})});function L(d,a){return d==null||a==null?!1:d!==0||a!==0}function de(d,a,o){var s;const u=[];for(const m of d){const b=m.toUpperCase(),p=a.find(c=>c.public_key.toUpperCase().startsWith(b));if(p&&L(p.gps_lat,p.gps_lon)){u.push({prefix:m,name:p.name||null,lat:p.gps_lat,lng:p.gps_lon,isLocal:!1,hasGps:!0});continue}if(o.neighbors){const c=Object.entries(o.neighbors).find(([i])=>i.toUpperCase().startsWith(b));if(c){const[,i]=c;if(L(i.latitude,i.longitude)){u.push({prefix:m,name:i.node_name||i.name||null,lat:i.latitude,lng:i.longitude,isLocal:!1,hasGps:!0});continue}}}const N=o.srcHashMap.get(b);if(N){const c=o.discoveredNodes.get(N);if(c&&L(c.latitude,c.longitude)){u.push({prefix:m,name:c.name||null,lat:c.latitude,lng:c.longitude,isLocal:!1,hasGps:!0});continue}if(o.neighbors){const i=o.neighbors[N];if(i&&L(i.latitude,i.longitude)){u.push({prefix:m,name:i.node_name||i.name||null,lat:i.latitude,lng:i.longitude,isLocal:!1,hasGps:!0});continue}}}u.push({prefix:m,name:(p==null?void 0:p.name)||(N?((s=o.discoveredNodes.get(N))==null?void 0:s.name)??null:null),lat:0,lng:0,isLocal:!1,hasGps:!1})}return u}function me(d,a,o,u){const s=(a==null?void 0:a.node_name)||u||(o==null?void 0:o.name)||"Me";if(a&&L(a.latitude,a.longitude)){const m=a.public_key.slice(0,2).toUpperCase();return[...d,{prefix:m,name:s,lat:a.latitude,lng:a.longitude,isLocal:!0,hasGps:!0}]}return o&&L(o.latitude,o.longitude)?[...d,{prefix:"",name:s,lat:o.latitude,lng:o.longitude,isLocal:!0,hasGps:!0}]:d}function be({hops:d,contacts:a,selfInfo:o,snr:u,wardriveCoords:s,wardriveSenderName:m,className:b}){const p=r.useRef(null),N=X(),c=I(),[i,Y]=r.useState(!1),w=c==null?void 0:c.neighbors,z=oe(),R=ae(),B=ee(),M=te(),$=r.useMemo(()=>({neighbors:w,srcHashMap:z,discoveredNodes:R}),[w,z,R]),k=(M==null?void 0:M.node_name)??(M==null?void 0:M.companion_name)??null,h=r.useMemo(()=>{const e=de(d,a,$);return me(e,o,B,k)},[d,a,$,o,B,k]),g=r.useMemo(()=>h.filter(e=>e.hasGps),[h]),F=r.useMemo(()=>h.filter(e=>!e.hasGps),[h]),S=r.useMemo(()=>{const e=[];if(g.length<2)return e;const t=[];for(let l=0;lS.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[S]),O=r.useMemo(()=>{if(typeof document>"u")return ce;const e=getComputedStyle(document.documentElement).getPropertyValue("--zinc-400").trim();return e.startsWith("#")?e:Z[400]},[]),v=r.useMemo(()=>{if(!s||g.length===0)return null;const e=[s.lon,s.lat],t=g[0];return{from:e,to:[t.lng,t.lat]}},[s,g]),P=r.useMemo(()=>v?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[v.from,v.to]}}]}:null,[v]),A=r.useMemo(()=>{if(typeof document>"u")return{orange:D,green:T};const e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--sys-orange").trim(),l=e.getPropertyValue("--sys-green").trim();return{orange:t.startsWith("#")?t:D,green:l.startsWith("#")?l:T}},[]),j=r.useMemo(()=>{if(g.length<2&&!s||g.length+(s?1:0)<2)return null;let t=1/0,l=-1/0,x=1/0,y=-1/0;for(const f of g)f.latl&&(l=f.lat),f.lngy&&(y=f.lng);return s&&(s.latl&&(l=s.lat),s.lony&&(y=s.lon)),[[x,t],[y,l]]},[g,s]),Q=r.useCallback(()=>{var t;const e=(t=p.current)==null?void 0:t.getMap();e&&j&&e.fitBounds(j,{padding:{top:40,bottom:44,left:56,right:56},maxZoom:14,duration:0}),Y(!0)},[j]);if(!j)return null;const W=[(j[0][0]+j[1][0])/2,(j[0][1]+j[1][1])/2];return n.jsxs("div",{className:K("relative rounded-lg overflow-hidden",b),style:{aspectRatio:"16 / 10"},children:[!i&&n.jsx("div",{className:"absolute inset-0 bg-subtle-fill flex items-center justify-center pointer-events-none z-10",children:n.jsx("div",{className:"w-4 h-4 border-2 border-fg-muted/30 border-t-fg-muted rounded-full animate-spin"})}),n.jsx("div",{className:"h-full w-full transition-opacity duration-200",style:{opacity:i?1:0},children:n.jsxs(se,{ref:p,initialViewState:{longitude:W[0],latitude:W[1],zoom:10},onLoad:Q,style:{height:"100%",width:"100%"},mapStyle:re[N],attributionControl:!1,interactive:!1,children:[P&&n.jsx(C,{id:"cwd-edge",type:"geojson",data:P,lineMetrics:!0,children:n.jsx(U,{id:"cwd-edge-line",type:"line",paint:{"line-width":2,"line-gradient":["interpolate",["linear"],["line-progress"],0,A.orange,1,A.green]},layout:{"line-cap":"round","line-join":"round"}})}),s&&n.jsx(G,{longitude:s.lon,latitude:s.lat,anchor:"center",children:n.jsx("div",{className:"flex items-center",style:{pointerEvents:"auto"},children:n.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-full bg-sys-orange text-white shadow-lg border-2 border-sys-orange/50",children:n.jsx(le,{className:"w-4 h-4",strokeWidth:2.5})})})}),S.map((e,t)=>n.jsx(C,{id:`cedge-${t}`,type:"geojson",data:q[t],children:n.jsx(U,{id:`cedge-line-${t}`,type:"line",paint:{"line-color":O,"line-width":2,"line-opacity":.85},layout:{"line-cap":"round","line-join":"round"}})},`cedge-${t}`)),S.map((e,t)=>n.jsx(G,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:n.jsx("span",{className:"w-4.5 h-4.5 rounded-full flex items-center justify-center font-mono font-extrabold tabular-nums shadow-md pointer-events-none",style:{backgroundColor:O,color:"#fff",fontSize:"10px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e.hopNumber})},`chop-${t}`)),g.map((e,t)=>{const l=t===0,x=t===g.length-1,y=e.isLocal?"amber":l?"green":x?"amber":"zinc";return n.jsx(G,{longitude:e.lng,latitude:e.lat,anchor:"center",children:n.jsx(ue,{prefix:e.prefix,name:e.name,isLocal:e.isLocal,color:y})},`cnode-${e.prefix}-${t}`)})]})}),F.length>0&&n.jsx("div",{className:"absolute bottom-1.5 left-1.5 z-10 flex items-center gap-1 flex-wrap max-w-[60%]",children:F.map((e,t)=>n.jsxs(H,{color:"zinc",className:"type-data-xs shadow-sm opacity-70",children:[n.jsx(ie,{className:"w-2 h-2 mr-0.5"}),e.prefix,e.name&&n.jsx("span",{className:"ml-0.5 opacity-60",children:e.name})]},`cunmap-${e.prefix}-${t}`))}),u!=null&&n.jsx("div",{className:"absolute bottom-1.5 right-1.5 z-10",children:n.jsxs(H,{color:"zinc",className:"type-data-xs shadow-sm",children:[u>0?"+":"",u.toFixed(1)," dB"]})})]})}export{be as CompanionPathMap}; diff --git a/frontend/dist/assets/Configuration-C6MYk4Vr.js b/frontend/dist/assets/Configuration-Dg0qrWk7.js similarity index 98% rename from frontend/dist/assets/Configuration-C6MYk4Vr.js rename to frontend/dist/assets/Configuration-Dg0qrWk7.js index 8fb70dbd..ee2a0668 100644 --- a/frontend/dist/assets/Configuration-C6MYk4Vr.js +++ b/frontend/dist/assets/Configuration-Dg0qrWk7.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{e as ke,r as a,j as e,c as m,ev as Is,cT as oe,a2 as U,a0 as J,bM as Z,aE as Ke,ew as ze,ex as os,ey as as,_ as De,a8 as xe,E as jt,S as vt,ez as Nt,a7 as X,cu as cs,eA as wt,B as L,V as ns,eB as Ks,bY as Le,X as Ws,eC as kt,a6 as _t,dK as Os,c3 as St,c7 as ls,dV as Xs,eD as Ct,eE as zs,eF as Tt,eG as Ft,eH as Et,aa as Rt,eI as Je,I as Mt,a1 as Dt,a3 as At}from"./index-i0xzpXop.js";import{g as Pt,a as Lt,c as It,r as Kt,s as Ot,b as zt,u as Vt,d as $t}from"./system-Xia4FpjC.js";import{C as Ht}from"./ConfirmModal-CtS0orbM.js";import{S as qt,A as Bt,a as Gt,N as Ut}from"./AutoConfigureDialog-C9ytM4jL.js";import{W as rs}from"./wand-sparkles-DBzA3PXL.js";import{P as is,F as Vs}from"./pencil-8q_J08l4.js";import{i as Wt,g as Xt,s as Yt,a as Jt,k as Qt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as Zt,a as ea,B as sa}from"./PageLayout-B4RCJ-XT.js";import{T as Ys}from"./trash-2-DCqpUdF7.js";import{R as ta}from"./rotate-ccw-DqV8JyUZ.js";import{S as aa}from"./shield-CxmFjMfw.js";import{R as na}from"./repeat-BSIxXQ81.js";import{G as la}from"./git-branch-DrsZ9sUq.js";import{C as ra}from"./clock-F-4SScS_.js";import{C as Js}from"./chevron-right-DsOuIRi8.js";import{R as se,C as me}from"./Grid-BhoD4aLU.js";import{A as ia}from"./antenna-C7FNplvf.js";import{P as $s}from"./plus-Bb8eT78f.js";import{K as Hs}from"./key-round-BpDWKeL5.js";import"./arrow-right-BZS-u7CW.js";/** +import{e as ke,r as a,j as e,c as m,ev as Is,cT as oe,a2 as U,a0 as J,bM as Z,aE as Ke,ew as ze,ex as os,ey as as,_ as De,a8 as xe,E as jt,S as vt,ez as Nt,a7 as X,cu as cs,eA as wt,B as L,V as ns,eB as Ks,bY as Le,X as Ws,eC as kt,a6 as _t,dK as Os,c3 as St,c7 as ls,dV as Xs,eD as Ct,eE as zs,eF as Tt,eG as Ft,eH as Et,aa as Rt,eI as Je,I as Mt,a1 as Dt,a3 as At}from"./index-CN4vD05c.js";import{g as Pt,a as Lt,c as It,r as Kt,s as Ot,b as zt,u as Vt,d as $t}from"./system-Bx1EMTn3.js";import{C as Ht}from"./ConfirmModal-CH_Er4VJ.js";import{S as qt,A as Bt,a as Gt,N as Ut}from"./AutoConfigureDialog-LhNiSavq.js";import{W as rs}from"./wand-sparkles-Bg4EWlYl.js";import{P as is,F as Vs}from"./pencil-BEPIyoAD.js";import{i as Wt,g as Xt,s as Yt,a as Jt,k as Qt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as Zt,a as ea,B as sa}from"./PageLayout-DJSWC4zL.js";import{T as Ys}from"./trash-2-DqmFYXqQ.js";import{R as ta}from"./rotate-ccw-D-KWB9ub.js";import{S as aa}from"./shield-DH-P-9VP.js";import{R as na}from"./repeat-CTlAf3ox.js";import{G as la}from"./git-branch-DpI9mavY.js";import{C as ra}from"./clock-jH_gnOTU.js";import{C as Js}from"./chevron-right-BCotFXkU.js";import{R as se,C as me}from"./Grid-DeJEUuBo.js";import{A as ia}from"./antenna-CnCmnu-_.js";import{P as $s}from"./plus-3025QRmd.js";import{K as Hs}from"./key-round-CiTX8EjL.js";import"./arrow-right-9ryFJ0vV.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/ConfirmModal-CtS0orbM.js b/frontend/dist/assets/ConfirmModal-CH_Er4VJ.js similarity index 91% rename from frontend/dist/assets/ConfirmModal-CtS0orbM.js rename to frontend/dist/assets/ConfirmModal-CH_Er4VJ.js index 423f6f42..59ea650a 100644 --- a/frontend/dist/assets/ConfirmModal-CtS0orbM.js +++ b/frontend/dist/assets/ConfirmModal-CH_Er4VJ.js @@ -1 +1 @@ -import{r as d,j as s,aC as x,aK as m,bY as g,c as C,aD as f,eJ as j,B as o}from"./index-i0xzpXop.js";const u={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},p={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:a="default",onConfirm:c,onCancel:e}){return s.jsxs(x,{open:n,onClose:e,size:"sm",children:[s.jsx(m,{icon:s.jsx(g,{className:C("w-5 h-5",u[a])}),title:r,onClose:e}),s.jsx(f,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(j,{children:[s.jsx(o,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(o,{color:p[a],onClick:c,className:"flex-1",children:t})]})]})}const y=d.memo(N);export{y as C}; +import{r as d,j as s,aC as x,aK as m,bY as g,c as C,aD as f,eJ as j,B as o}from"./index-CN4vD05c.js";const u={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},p={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:a="default",onConfirm:c,onCancel:e}){return s.jsxs(x,{open:n,onClose:e,size:"sm",children:[s.jsx(m,{icon:s.jsx(g,{className:C("w-5 h-5",u[a])}),title:r,onClose:e}),s.jsx(f,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(j,{children:[s.jsx(o,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(o,{color:p[a],onClick:c,className:"flex-1",children:t})]})]})}const y=d.memo(N);export{y as C}; diff --git a/frontend/dist/assets/Contacts-CkDqsspC.js b/frontend/dist/assets/Contacts-BgYz8bSj.js similarity index 91% rename from frontend/dist/assets/Contacts-CkDqsspC.js rename to frontend/dist/assets/Contacts-BgYz8bSj.js index c29f745f..874ee02c 100644 --- a/frontend/dist/assets/Contacts-CkDqsspC.js +++ b/frontend/dist/assets/Contacts-BgYz8bSj.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-C3aIIydk.js","assets/index-i0xzpXop.js","assets/consumer-registry-5uDLywpC.js","assets/link-scoring-BqsMOwtz.js","assets/ConfirmModal-CtS0orbM.js","assets/variants-Bbq7uzV_.js","assets/git-branch-DrsZ9sUq.js","assets/database-gsjgeKE3.js","assets/useMapViewStore-DZlzQmak.js","assets/index-BCuGA4PV.js","assets/index-CBEGRHd5.js","assets/target-BAeWmUfa.js","assets/funnel-CitfWrkD.js","assets/plus-Bb8eT78f.js","assets/compass-0fhguiKE.js","assets/zap-tuTM-Jsw.js","assets/max-C_kLXH5u.js","assets/trash-2-DCqpUdF7.js","assets/wifi-off-CQ0s_9cO.js","assets/wifi-DYlEDPZY.js","assets/circle-alert-PnLnz8pa.js","assets/clock-F-4SScS_.js","assets/chevron-right-DsOuIRi8.js","assets/LightSparkline-DC33xzFq.js","assets/badge-colors-Dl76Mz8m.js","assets/map-pin-C051lstq.js","assets/node-types-rVJPSDxd.js","assets/BasemapLayer-Bv4kYAcR.js","assets/easing-BdzuOPcT.js","assets/usePipelineStore-BqTRxIqB.js","assets/PageLayout-B4RCJ-XT.js","assets/listbox-C1gGOelh.js","assets/element-movement-BD3SL-GU.js","assets/use-text-value-T4f0bwXS.js","assets/frozen-D4mEoVft.js","assets/MqttModeBadge-Dhi11STL.js","assets/chat-utils-BdAUDg3r.js","assets/SignalIndicator-D8uG_rJC.js","assets/CollisionExplorerModal-DAlBzVhS.js","assets/share-2-B5yQaExh.js","assets/circle-question-mark-CJCLhkb9.js","assets/map-pin-off-CPSqCYZk.js","assets/activity-DQoaymFw.js","assets/search-DsTk_ZsM.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); -import{e as xe,ar as cs,j as e,r as n,_ as is,cp as He,cq as Ie,ao as W,a0 as Ce,cr as ls,cs as me,aa as de,c3 as ds,az as Oe,ct as ye,a2 as ze,cu as ms,ac as xs,cv as us,cw as ps,cx as hs,ab as fs,cy as gs,cz as js,ad as bs,aA as ys,ae as Ne,cA as Ns,cB as vs,cC as ws,cD as Cs,bI as ee,cE as $e,Y as ks,I as Ms,bM as Ss,c as we}from"./index-i0xzpXop.js";import{useDiscoveredNodes as Ps}from"./usePipelineStore-BqTRxIqB.js";import{c as ke}from"./node-types-rVJPSDxd.js";import{P as _s,a as Rs,B as Ls}from"./PageLayout-B4RCJ-XT.js";import{L as Ts,a as le}from"./listbox-C1gGOelh.js";import{T as Fe,M as $s}from"./MqttModeBadge-Dhi11STL.js";import{u as Fs,e as Es,f as Hs,r as Is}from"./consumer-registry-5uDLywpC.js";import{e as Os,g as zs,a as Ds}from"./chat-utils-BdAUDg3r.js";import{b as Bs}from"./SignalIndicator-D8uG_rJC.js";import{C as As}from"./CollisionExplorerModal-DAlBzVhS.js";import{E as qs,T as Vs}from"./target-BAeWmUfa.js";import{S as Us}from"./share-2-B5yQaExh.js";import{C as De}from"./circle-question-mark-CJCLhkb9.js";import{M as Ws}from"./map-pin-off-CPSqCYZk.js";import{A as Be}from"./activity-DQoaymFw.js";import{T as Gs}from"./trash-2-DCqpUdF7.js";import{C as Qs}from"./ConfirmModal-CtS0orbM.js";import{M as Xs}from"./map-pin-C051lstq.js";import{S as Ys}from"./search-DsTk_ZsM.js";import{C as Zs}from"./clock-F-4SScS_.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-DTQ4poRm.js","assets/index-CN4vD05c.js","assets/consumer-registry-ssgJoJPf.js","assets/link-scoring--28z7vGg.js","assets/ConfirmModal-CH_Er4VJ.js","assets/variants-WkuRUM3u.js","assets/git-branch-DpI9mavY.js","assets/database-n5nNHRzj.js","assets/useMapViewStore-D6ulpFc9.js","assets/index-G-dTy9iF.js","assets/index-CnWrze_V.js","assets/target-CftUJhmo.js","assets/funnel-Bd2d2Gy-.js","assets/plus-3025QRmd.js","assets/compass-Ddh177-W.js","assets/zap-Ba3ctUHg.js","assets/max-BbWCrv_A.js","assets/trash-2-DqmFYXqQ.js","assets/wifi-off-Bfc2_ayY.js","assets/wifi-BF-rEj1F.js","assets/circle-alert-NywFrEoZ.js","assets/clock-jH_gnOTU.js","assets/chevron-right-BCotFXkU.js","assets/LightSparkline-Bfgi1R3B.js","assets/badge-colors-Dl76Mz8m.js","assets/map-pin-W8m2dIyd.js","assets/node-types-UozthSpR.js","assets/BasemapLayer-B81nTsqc.js","assets/easing-Cg6LL_7U.js","assets/usePipelineStore-BTv04vLL.js","assets/PageLayout-DJSWC4zL.js","assets/listbox-Cfex3RUz.js","assets/element-movement-22ZdBM88.js","assets/use-text-value-DHtdh4JM.js","assets/frozen-ZI0va0FF.js","assets/MqttModeBadge-BFJmiZy5.js","assets/chat-utils-BLzyljgm.js","assets/SignalIndicator-BpXSkqBv.js","assets/CollisionExplorerModal-CDRCTbR-.js","assets/share-2-FGmu8UDX.js","assets/circle-question-mark-z2YWN8ID.js","assets/map-pin-off-VHAD8rJE.js","assets/activity-ZoAXCcWm.js","assets/search-D1TEdb7u.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); +import{e as xe,ar as cs,j as e,r as n,_ as is,cp as He,cq as Ie,ao as W,a0 as Ce,cr as ls,cs as me,aa as de,c3 as ds,az as Oe,ct as ye,a2 as ze,cu as ms,ac as xs,cv as us,cw as ps,cx as hs,ab as fs,cy as gs,cz as js,ad as bs,aA as ys,ae as Ne,cA as Ns,cB as vs,cC as ws,cD as Cs,bI as ee,cE as $e,Y as ks,I as Ms,bM as Ss,c as we}from"./index-CN4vD05c.js";import{useDiscoveredNodes as Ps}from"./usePipelineStore-BTv04vLL.js";import{c as ke}from"./node-types-UozthSpR.js";import{P as _s,a as Rs,B as Ls}from"./PageLayout-DJSWC4zL.js";import{L as Ts,a as le}from"./listbox-Cfex3RUz.js";import{T as Fe,M as $s}from"./MqttModeBadge-BFJmiZy5.js";import{u as Fs,e as Es,f as Hs,r as Is}from"./consumer-registry-ssgJoJPf.js";import{e as Os,g as zs,a as Ds}from"./chat-utils-BLzyljgm.js";import{b as Bs}from"./SignalIndicator-BpXSkqBv.js";import{C as As}from"./CollisionExplorerModal-CDRCTbR-.js";import{E as qs,T as Vs}from"./target-CftUJhmo.js";import{S as Us}from"./share-2-FGmu8UDX.js";import{C as De}from"./circle-question-mark-z2YWN8ID.js";import{M as Ws}from"./map-pin-off-VHAD8rJE.js";import{A as Be}from"./activity-ZoAXCcWm.js";import{T as Gs}from"./trash-2-DqmFYXqQ.js";import{C as Qs}from"./ConfirmModal-CH_Er4VJ.js";import{M as Xs}from"./map-pin-W8m2dIyd.js";import{S as Ys}from"./search-D1TEdb7u.js";import{C as Zs}from"./clock-jH_gnOTU.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -19,5 +19,5 @@ import{e as xe,ar as cs,j as e,r as n,_ as is,cp as He,cq as Ie,ao as W,a0 as Ce * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nt=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Ae=xe("ruler",nt);class rt extends n.Component{constructor(l){super(l),this.state={hasError:!1}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}render(){var l;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:((l=this.state.error)==null?void 0:l.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 ot=n.lazy(()=>is(()=>import("./ContactsMapMapLibre-C3aIIydk.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,44,45,46]))),Ee=()=>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 ct({neighbors:o,localNode:l,localHash:g,onRemoveNode:u,selectedNodeHash:j,onNodeSelected:N,highlightedEdgeKey:c,highlightedGhost:T}){return cs()===!1?e.jsx(Ee,{}):e.jsx(rt,{children:e.jsx(n.Suspense,{fallback:e.jsx(Ee,{}),children:e.jsx(ot,{neighbors:o,localNode:l,localHash:g,onRemoveNode:u,selectedNodeHash:j,onNodeSelected:N,highlightedEdgeKey:c,highlightedGhost:T})})})}function it({hash:o,className:l="",size:g="sm",collisionInfo:u,isViterbiResolved:j}){const N=He(),c=Ie(),[T,$]=n.useState(!1),w=n.useMemo(()=>W(o),[o]),p=n.useMemo(()=>u!==void 0?u:w?N.find(P=>P.prefix===w)??null:null,[w,N,u]),C=j??(c.totalPaths>0&&c.avgPathConfidence>=.7),D=n.useCallback(P=>{P.preventDefault(),P.stopPropagation(),$(!0)},[]),B=n.useCallback(()=>{$(!1)},[]);if(!p)return null;const A=g==="sm"?"w-3.5 h-3.5":"w-4 h-4",q=C?"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",S=C?`Prefix conflict resolved by Viterbi HMM (${(c.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${w}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:D,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${q} ${l}`,title:S,"aria-label":`View prefix conflict for ${w}${C?" (Viterbi resolved)":""}`,children:C?e.jsxs("span",{className:"relative",children:[e.jsx(qs,{className:A}),e.jsx(Ce,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(st,{className:A})}),T&&e.jsx(As,{isOpen:!0,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:B})]})}const lt=n.memo(it),qe=[{target:"Contacts",fn:"name",minStage:1,when:Es},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Hs}];Is(qe);function dt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function mt({hash:o,contact:l,isHub:g,isNeighbor:u,distance:j,centrality:N,neighborSignal:c,collisionInfo:T,isViterbiResolved:$,pingingHash:w,pingResult:p,pingError:C,isMobile:D,metaSummary:B,metaTooltip:A,onRowClick:q,onPing:S,onRemove:P}){Fs(qe);const _=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0,H=l.node_name||l.name||"Unknown",I=u&&c,se=ke(l),{isRepeater:v,isCompanion:G,isRoomServer:R,isClient:Q,label:b}=se,te=u?`${b} — Direct RF contact (zero-hop neighbor)`:`${b} — Flood routing (multi-hop via mesh)`,ae=n.useCallback(()=>q(o),[q,o]);return e.jsxs("div",{className:`contacts-grid-row ${g?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${_?"cursor-pointer":""}`,onClick:ae,children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[I&&(c==null?void 0:c.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ls(c.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:te,children:(()=>{if(R&&v)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(me,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(Us,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(R)return e.jsx(me,{className:"w-5 h-5 text-sys-pink"});if(v)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(de,{className:"w-3.5 h-3.5 text-sys-blue"})});if((G||Q)&&H!=="Unknown"){const{emoji:F,cleanName:ue}=Os(H);return e.jsx("div",{className:"w-6 h-6 clay-avatar",style:{"--avatar-color":zs(ue)},children:F?e.jsx("span",{className:"text-sm leading-none",children:F}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:Ds(H)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(De,{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}),u&&e.jsx("span",{className:"contact-tag contact-tag--nbr",children:"NBR"}),g&&e.jsx("span",{className:"contact-tag contact-tag--hub",children:"HUB"}),v&&e.jsx("span",{className:"contact-tag contact-tag--rpt",children:"RPT"}),R&&e.jsx("span",{className:"contact-tag contact-tag--room",children:"ROOM"}),G&&e.jsx("span",{className:"contact-tag contact-tag--comp",children:"COMP"}),Q&&e.jsx("span",{className:"contact-tag contact-tag--client",children:"CLIENT"}),D&&e.jsx("span",{className:"contact-tag contact-tag--mobile",children:"MOB"}),!_&&e.jsx(Ws,{className:"w-3 h-3 flex-shrink-0 text-fg-muted/50"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(ds,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(lt,{hash:o,collisionInfo:T,isViterbiResolved:$}),B&&e.jsx("span",{className:"contact-meta",title:A,children:B})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[I&&(c==null?void 0:c.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Bs,{rssi:c.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(c.avgRssi)})]}),I&&(c==null?void 0:c.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[c.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:j!=null&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:dt(j)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:N>0&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(N*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:l.last_seen?Oe(l.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[u&&e.jsx(e.Fragment,{children:p?e.jsxs("div",{className:`flex items-center gap-1 ${ye(p)?"text-sys-green":"text-fg-muted"}`,title:`RTT: ${p.rtt_ms.toFixed(0)}ms${ye(p)?` · SNR: ${p.snr_db.toFixed(1)}dB · RSSI: ${p.rssi}dBm`:""}`,children:[e.jsx(Ce,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs hidden sm:inline",children:ye(p)?`${p.snr_db.toFixed(1)}dB`:`${(p.rtt_ms/1e3).toFixed(1)}s`})]}):C?e.jsxs("span",{className:"text-sys-red text-xs font-medium",title:C,children:[e.jsx("span",{className:"hidden sm:inline",children:C}),e.jsx("span",{className:"sm:hidden",children:"✗"})]}):e.jsx("button",{onClick:F=>S(o,F),disabled:w!==null,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:w===o?e.jsx(ze,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:F=>{F.stopPropagation(),P(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(Gs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const xt=n.memo(mt),ut=6371e3,pt=[{field:"lastHeard",icon:Zs,label:"Recent"},{field:"distance",icon:Ae,label:"Distance"},{field:"centrality",icon:Be,label:"Centrality"}];function ht(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function ft(o){const l=ke(o);return ht(l.type)}function ve(o,l){const{color:g="primary",border:u=!1}=l??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?g==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",u&&(o?g==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function gt(o,l,g,u){const j=(g-o)*Math.PI/180,N=(u-l)*Math.PI/180,c=Math.sin(j/2)*Math.sin(j/2)+Math.cos(o*Math.PI/180)*Math.cos(g*Math.PI/180)*Math.sin(N/2)*Math.sin(N/2),T=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return ut*T}function jt(){var Le,Te;const{stats:o}=ms(),l=xs(),g=us(),u=ps(),j=hs(),N=fs(),c=gs(),T=js(),$=bs(),w=ys(),p=Ne[$],C=He(),D=Ie(),B=Ns(),A=D.totalPaths>0&&D.avgPathConfidence>=.7,q=n.useMemo(()=>{const s=new Map;for(const a of C)s.set(a.prefix,a);return s},[C]),[S,P]=n.useState(null),[_,H]=n.useState("lastHeard"),[I,se]=n.useState("desc"),[v,G]=n.useState(""),[R,Q]=n.useState(!1),[b,te]=n.useState(new Set),[ae,F]=n.useState(!1),[ue,Me]=n.useState(null),[pe,Se]=n.useState(null),[Ve,he]=n.useState(new Map),[Ue,X]=n.useState(new Map),[k,We]=n.useState(25),[V,ne]=n.useState(25),fe=n.useRef(null),Y=n.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),ge=Ps(),re=n.useMemo(()=>{if(ge.size===0)return Y;const s=new Set;for(const t of Object.keys(Y))s.add((t.startsWith("0x")?t.slice(2):t).toLowerCase());let a=null;for(const[t,r]of ge){const i=(t.startsWith("0x")?t.slice(2):t).toLowerCase();s.has(i)||(a||(a={...Y}),a[t]={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 a??Y},[Y,ge]),O=n.useMemo(()=>{const a=Date.now()/1e3-p.minutes*60;return Object.fromEntries(Object.entries(re).filter(([t,r])=>l.has(t)?!1:(r.last_seen??0)>=a))},[re,l,p.minutes]),L=vs(),z=o==null?void 0:o.local_hash,Ge=n.useMemo(()=>{const s=new Map;if(!z||c.size===0)return s;for(const[a,t]of c)if(a.endsWith(`→${z}`)&&t.hops.length>1){const r=a.split("→")[0],i=t.hops[t.hops.length-1];s.set(r,i)}return s},[c,z]),Qe=n.useMemo(()=>{const s=new Map;if(!z||c.size===0)return s;const a=new Map;for(const[t,r]of Object.entries(re)){const i=(t.startsWith("0x")?t.slice(2):t).toLowerCase();a.set(i,r)}for(const[t,r]of c){if(!t.endsWith(`→${z}`)||r.hops.length===0)continue;const i=t.split("→")[0],d=r.hops[0];let h=null;for(const[f,y]of a)if(f.startsWith(d.toLowerCase())){h=y.node_name??y.name??null;break}s.set(i,{prefix:d,name:h,hopCount:r.hopCount})}return s},[c,z,re]),oe=n.useMemo(()=>{const s=new Map;if(!(L!=null&&L.latitude)||!(L!=null&&L.longitude))return s;for(const[a,t]of Object.entries(O))t.latitude&&t.longitude&&t.latitude!==0&&t.longitude!==0?s.set(a,gt(L.latitude,L.longitude,t.latitude,t.longitude)):s.set(a,null);return s},[O,L]),{neighborHashSet:ce,neighborSignalMap:Xe}=n.useMemo(()=>{const s=new Set,a=new Map;for(const t of N)s.add(t.hash),a.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:s,neighborSignalMap:a}},[N]),Pe=n.useMemo(()=>{const s=v.toLowerCase().trim(),a=s==="neighbor"||s==="neighbors",t=R||a,r=b.size>0;return Object.fromEntries(Object.entries(O).filter(([i,d])=>{if(r){const y=ft(d);if(!b.has(y))return!1}if(t&&!ce.has(i))return!1;if(a||!s)return!0;const h=(d.node_name||d.name||"").toLowerCase(),f=W(i).toLowerCase();return h.includes(s)||f.includes(s)||i.toLowerCase().includes(s)}))},[O,v,R,ce,b]),x=n.useMemo(()=>{const s=Object.entries(Pe),a=v.toLowerCase().trim(),t=/^[0-9a-f]{2}(?:[0-9a-f]{2}){0,2}$/i.test(a);return s.sort(([r,i],[d,h])=>{if(t){const y=W(r).toLowerCase(),E=W(d).toLowerCase(),M=y===a,U=E===a;if(M&&!U)return-1;if(U&&!M)return 1}let f=0;switch(_){case"lastHeard":f=(i.last_seen||0)-(h.last_seen||0);break;case"distance":{const y=oe.get(r)??null,E=oe.get(d)??null;y===null&&E===null?f=0:y===null?f=1:E===null?f=-1:f=y-E;break}case"centrality":{const y=j.get(r)||0,E=j.get(d)||0;f=y-E;break}}return I==="desc"?-f:f})},[Pe,_,I,oe,j,v]),m=n.useMemo(()=>{let s=0,a=0,t=0,r=0,i=0;for(const[,d]of x){const h=ke(d),f=d.latitude&&d.longitude&&d.latitude!==0&&d.longitude!==0;switch(h.type){case"room_server":t++;break;case"repeater":a++;break;case"companion":s++;break;case"unknown":i++;break}f&&r++}return{companions:s,repeaters:a,roomServers:t,total:x.length,withLocation:r,unknown:i}},[x]),Ye=n.useMemo(()=>new Set(u),[u]),_e=n.useMemo(()=>k===0?x:x.slice(0,V),[x,V,k]);n.useEffect(()=>{ne(k||x.length)},[_,I,v,R,b,k,x.length]),n.useEffect(()=>{const s=a=>{a.target.closest("[data-dropdown]")||F(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),n.useEffect(()=>{if(k===0)return;const s=new IntersectionObserver(a=>{a[0].isIntersecting&&VMath.min(t+k,x.length))},{threshold:.1,rootMargin:"100px"});return fe.current&&s.observe(fe.current),()=>s.disconnect()},[k,V,x.length]);const Ze=n.useCallback(s=>{We(s),ne(s||x.length)},[x.length]),Je=n.useCallback(s=>{_===s?se(a=>a==="desc"?"asc":"desc"):(H(s),se("desc"))},[_]),Ke=n.useCallback(s=>{const a=O[s];a!=null&&a.latitude&&(a!=null&&a.longitude)&&a.latitude!==0&&a.longitude!==0&&Me(s)},[O]),es=n.useCallback(()=>{Me(null)},[]),ss=n.useCallback((s,a)=>{P({hash:s,name:a})},[]),Re=ws((Te=(Le=o==null?void 0:o.config)==null?void 0:Le.mesh)==null?void 0:Te.path_hash_mode),ts=n.useCallback(async(s,a)=>{if(a.stopPropagation(),!pe){Se(s),he(t=>{const r=new Map(t);return r.delete(s),r}),X(t=>{const r=new Map(t);return r.delete(s),r});try{const r=`0x${W(s,Re)}`,i=await Cs(r,30);i.success&&i.data?(he(d=>new Map(d).set(s,i.data)),setTimeout(()=>{he(d=>{const h=new Map(d);return h.delete(s),h})},1e4)):(X(d=>new Map(d).set(s,i.error||"Ping failed")),setTimeout(()=>{X(d=>{const h=new Map(d);return h.delete(s),h})},5e3))}catch(t){const r=t instanceof Error?t.message:"Ping failed";X(i=>new Map(i).set(s,r)),setTimeout(()=>{X(i=>{const d=new Map(i);return d.delete(s),d})},5e3)}finally{Se(null)}}},[pe,Re]);return e.jsxs(_s,{children:[e.jsx(Rs,{title:"Contacts",icon:e.jsx(ee,{}),subtitle:e.jsx($s,{}),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(ee,{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(de,{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($e,{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(me,{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(Xs,{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(De,{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(ee,{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(de,{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($e,{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(me,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Fe,{ranges:Ne,selectedIndex:$,onSelect:w,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Fe,{ranges:Ne,selectedIndex:$,onSelect:w})})]})}),e.jsxs(Ls,{children:[e.jsx(ct,{neighbors:O,localNode:L??void 0,localHash:z,onRemoveNode:g,selectedNodeHash:ue,onNodeSelected:es}),e.jsxs(ks,{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(ee,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(Ms,{type:"search",size:"sm",value:v,onChange:s=>G(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ys,{className:"w-3.5 h-3.5"}),trailingIcon:v?e.jsx("button",{onClick:()=>{G(""),(v.toLowerCase().trim()==="neighbor"||v.toLowerCase().trim()==="neighbors")&&Q(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(Ss,{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:()=>F(!ae),className:ve(b.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(at,{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})]}),ae&&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:a})=>e.jsxs("button",{onClick:()=>{te(t=>{const r=new Set(t);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(Ce,{className:"w-3 h-3"})}),e.jsx("span",{className:b.has(s)?"text-fg-primary":"text-fg-secondary",children:a})]},s)),b.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>te(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"})]})]})]}),ce.size>0&&e.jsxs("button",{onClick:()=>Q(!R),className:ve(R,{color:"success",border:!0}),title:R?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(de,{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:[pt.map(({field:s,icon:a,label:t})=>e.jsxs("button",{onClick:()=>Je(s),className:ve(_===s),title:`Sort by ${t.toLowerCase()}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:t}),_===s&&e.jsx(Ks,{className:we("w-3 h-3",I==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Ts,{value:k,onChange:Ze,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(le,{value:25,children:"25"}),e.jsx(le,{value:50,children:"50"}),e.jsx(le,{value:100,children:"100"}),e.jsx(le,{value:0,children:"All"})]})]})]}),x.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",style:{contain:"layout paint"},children:_e.map(([s,a])=>{const t=W(s),r=Ye.has(s),i=ce.has(s),d=oe.get(s)??null,h=j.get(s)||0,f=i?Xe.get(s):void 0,y=t?q.get(t)??null:null,E=T.has(s),M=i?null:Qe.get(s)??null,U=Ge.get(s)??null,je=B.get(s);let Z=null;if(je&&je.length>0){const ie=je.reduce((rs,os)=>rs+os.count,0);ie>0&&(Z=ie/24)}const be=a.first_seen?Oe(a.first_seen).replace(/ ago$/i,""):null,J=[],K=[];if(M){const ie=M.name??M.prefix;J.push(`→${ie} +${M.hopCount}`),K.push(`Gateway: ${M.name??M.prefix} (${M.hopCount} hop${M.hopCount!==1?"s":""})`)}U&&(J.push(`↙${U}`),K.push(`Last forwarder: ${U}`)),Z!==null&&(J.push(`${Z<1?"<1":Math.round(Z)}/hr`),K.push(`Packet rate: ${Z.toFixed(1)}/hr`)),be&&(J.push(be),K.push(`First seen: ${be} ago`));const as=J.join(" · "),ns=K.join(` + */const nt=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Ae=xe("ruler",nt);class rt extends n.Component{constructor(l){super(l),this.state={hasError:!1}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}render(){var l;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:((l=this.state.error)==null?void 0:l.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 ot=n.lazy(()=>is(()=>import("./ContactsMapMapLibre-DTQ4poRm.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,44,45,46]))),Ee=()=>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 ct({neighbors:o,localNode:l,localHash:g,onRemoveNode:u,selectedNodeHash:j,onNodeSelected:N,highlightedEdgeKey:c,highlightedGhost:T}){return cs()===!1?e.jsx(Ee,{}):e.jsx(rt,{children:e.jsx(n.Suspense,{fallback:e.jsx(Ee,{}),children:e.jsx(ot,{neighbors:o,localNode:l,localHash:g,onRemoveNode:u,selectedNodeHash:j,onNodeSelected:N,highlightedEdgeKey:c,highlightedGhost:T})})})}function it({hash:o,className:l="",size:g="sm",collisionInfo:u,isViterbiResolved:j}){const N=He(),c=Ie(),[T,$]=n.useState(!1),w=n.useMemo(()=>W(o),[o]),p=n.useMemo(()=>u!==void 0?u:w?N.find(P=>P.prefix===w)??null:null,[w,N,u]),C=j??(c.totalPaths>0&&c.avgPathConfidence>=.7),D=n.useCallback(P=>{P.preventDefault(),P.stopPropagation(),$(!0)},[]),B=n.useCallback(()=>{$(!1)},[]);if(!p)return null;const A=g==="sm"?"w-3.5 h-3.5":"w-4 h-4",q=C?"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",S=C?`Prefix conflict resolved by Viterbi HMM (${(c.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${w}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:D,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${q} ${l}`,title:S,"aria-label":`View prefix conflict for ${w}${C?" (Viterbi resolved)":""}`,children:C?e.jsxs("span",{className:"relative",children:[e.jsx(qs,{className:A}),e.jsx(Ce,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(st,{className:A})}),T&&e.jsx(As,{isOpen:!0,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:B})]})}const lt=n.memo(it),qe=[{target:"Contacts",fn:"name",minStage:1,when:Es},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Hs}];Is(qe);function dt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function mt({hash:o,contact:l,isHub:g,isNeighbor:u,distance:j,centrality:N,neighborSignal:c,collisionInfo:T,isViterbiResolved:$,pingingHash:w,pingResult:p,pingError:C,isMobile:D,metaSummary:B,metaTooltip:A,onRowClick:q,onPing:S,onRemove:P}){Fs(qe);const _=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0,H=l.node_name||l.name||"Unknown",I=u&&c,se=ke(l),{isRepeater:v,isCompanion:G,isRoomServer:R,isClient:Q,label:b}=se,te=u?`${b} — Direct RF contact (zero-hop neighbor)`:`${b} — Flood routing (multi-hop via mesh)`,ae=n.useCallback(()=>q(o),[q,o]);return e.jsxs("div",{className:`contacts-grid-row ${g?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${_?"cursor-pointer":""}`,onClick:ae,children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[I&&(c==null?void 0:c.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ls(c.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:te,children:(()=>{if(R&&v)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(me,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(Us,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(R)return e.jsx(me,{className:"w-5 h-5 text-sys-pink"});if(v)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(de,{className:"w-3.5 h-3.5 text-sys-blue"})});if((G||Q)&&H!=="Unknown"){const{emoji:F,cleanName:ue}=Os(H);return e.jsx("div",{className:"w-6 h-6 clay-avatar",style:{"--avatar-color":zs(ue)},children:F?e.jsx("span",{className:"text-sm leading-none",children:F}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:Ds(H)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(De,{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}),u&&e.jsx("span",{className:"contact-tag contact-tag--nbr",children:"NBR"}),g&&e.jsx("span",{className:"contact-tag contact-tag--hub",children:"HUB"}),v&&e.jsx("span",{className:"contact-tag contact-tag--rpt",children:"RPT"}),R&&e.jsx("span",{className:"contact-tag contact-tag--room",children:"ROOM"}),G&&e.jsx("span",{className:"contact-tag contact-tag--comp",children:"COMP"}),Q&&e.jsx("span",{className:"contact-tag contact-tag--client",children:"CLIENT"}),D&&e.jsx("span",{className:"contact-tag contact-tag--mobile",children:"MOB"}),!_&&e.jsx(Ws,{className:"w-3 h-3 flex-shrink-0 text-fg-muted/50"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(ds,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(lt,{hash:o,collisionInfo:T,isViterbiResolved:$}),B&&e.jsx("span",{className:"contact-meta",title:A,children:B})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[I&&(c==null?void 0:c.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Bs,{rssi:c.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(c.avgRssi)})]}),I&&(c==null?void 0:c.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[c.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:j!=null&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:dt(j)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:N>0&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(N*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:l.last_seen?Oe(l.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[u&&e.jsx(e.Fragment,{children:p?e.jsxs("div",{className:`flex items-center gap-1 ${ye(p)?"text-sys-green":"text-fg-muted"}`,title:`RTT: ${p.rtt_ms.toFixed(0)}ms${ye(p)?` · SNR: ${p.snr_db.toFixed(1)}dB · RSSI: ${p.rssi}dBm`:""}`,children:[e.jsx(Ce,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs hidden sm:inline",children:ye(p)?`${p.snr_db.toFixed(1)}dB`:`${(p.rtt_ms/1e3).toFixed(1)}s`})]}):C?e.jsxs("span",{className:"text-sys-red text-xs font-medium",title:C,children:[e.jsx("span",{className:"hidden sm:inline",children:C}),e.jsx("span",{className:"sm:hidden",children:"✗"})]}):e.jsx("button",{onClick:F=>S(o,F),disabled:w!==null,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:w===o?e.jsx(ze,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:F=>{F.stopPropagation(),P(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(Gs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const xt=n.memo(mt),ut=6371e3,pt=[{field:"lastHeard",icon:Zs,label:"Recent"},{field:"distance",icon:Ae,label:"Distance"},{field:"centrality",icon:Be,label:"Centrality"}];function ht(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function ft(o){const l=ke(o);return ht(l.type)}function ve(o,l){const{color:g="primary",border:u=!1}=l??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?g==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",u&&(o?g==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function gt(o,l,g,u){const j=(g-o)*Math.PI/180,N=(u-l)*Math.PI/180,c=Math.sin(j/2)*Math.sin(j/2)+Math.cos(o*Math.PI/180)*Math.cos(g*Math.PI/180)*Math.sin(N/2)*Math.sin(N/2),T=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return ut*T}function jt(){var Le,Te;const{stats:o}=ms(),l=xs(),g=us(),u=ps(),j=hs(),N=fs(),c=gs(),T=js(),$=bs(),w=ys(),p=Ne[$],C=He(),D=Ie(),B=Ns(),A=D.totalPaths>0&&D.avgPathConfidence>=.7,q=n.useMemo(()=>{const s=new Map;for(const a of C)s.set(a.prefix,a);return s},[C]),[S,P]=n.useState(null),[_,H]=n.useState("lastHeard"),[I,se]=n.useState("desc"),[v,G]=n.useState(""),[R,Q]=n.useState(!1),[b,te]=n.useState(new Set),[ae,F]=n.useState(!1),[ue,Me]=n.useState(null),[pe,Se]=n.useState(null),[Ve,he]=n.useState(new Map),[Ue,X]=n.useState(new Map),[k,We]=n.useState(25),[V,ne]=n.useState(25),fe=n.useRef(null),Y=n.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),ge=Ps(),re=n.useMemo(()=>{if(ge.size===0)return Y;const s=new Set;for(const t of Object.keys(Y))s.add((t.startsWith("0x")?t.slice(2):t).toLowerCase());let a=null;for(const[t,r]of ge){const i=(t.startsWith("0x")?t.slice(2):t).toLowerCase();s.has(i)||(a||(a={...Y}),a[t]={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 a??Y},[Y,ge]),O=n.useMemo(()=>{const a=Date.now()/1e3-p.minutes*60;return Object.fromEntries(Object.entries(re).filter(([t,r])=>l.has(t)?!1:(r.last_seen??0)>=a))},[re,l,p.minutes]),L=vs(),z=o==null?void 0:o.local_hash,Ge=n.useMemo(()=>{const s=new Map;if(!z||c.size===0)return s;for(const[a,t]of c)if(a.endsWith(`→${z}`)&&t.hops.length>1){const r=a.split("→")[0],i=t.hops[t.hops.length-1];s.set(r,i)}return s},[c,z]),Qe=n.useMemo(()=>{const s=new Map;if(!z||c.size===0)return s;const a=new Map;for(const[t,r]of Object.entries(re)){const i=(t.startsWith("0x")?t.slice(2):t).toLowerCase();a.set(i,r)}for(const[t,r]of c){if(!t.endsWith(`→${z}`)||r.hops.length===0)continue;const i=t.split("→")[0],d=r.hops[0];let h=null;for(const[f,y]of a)if(f.startsWith(d.toLowerCase())){h=y.node_name??y.name??null;break}s.set(i,{prefix:d,name:h,hopCount:r.hopCount})}return s},[c,z,re]),oe=n.useMemo(()=>{const s=new Map;if(!(L!=null&&L.latitude)||!(L!=null&&L.longitude))return s;for(const[a,t]of Object.entries(O))t.latitude&&t.longitude&&t.latitude!==0&&t.longitude!==0?s.set(a,gt(L.latitude,L.longitude,t.latitude,t.longitude)):s.set(a,null);return s},[O,L]),{neighborHashSet:ce,neighborSignalMap:Xe}=n.useMemo(()=>{const s=new Set,a=new Map;for(const t of N)s.add(t.hash),a.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:s,neighborSignalMap:a}},[N]),Pe=n.useMemo(()=>{const s=v.toLowerCase().trim(),a=s==="neighbor"||s==="neighbors",t=R||a,r=b.size>0;return Object.fromEntries(Object.entries(O).filter(([i,d])=>{if(r){const y=ft(d);if(!b.has(y))return!1}if(t&&!ce.has(i))return!1;if(a||!s)return!0;const h=(d.node_name||d.name||"").toLowerCase(),f=W(i).toLowerCase();return h.includes(s)||f.includes(s)||i.toLowerCase().includes(s)}))},[O,v,R,ce,b]),x=n.useMemo(()=>{const s=Object.entries(Pe),a=v.toLowerCase().trim(),t=/^[0-9a-f]{2}(?:[0-9a-f]{2}){0,2}$/i.test(a);return s.sort(([r,i],[d,h])=>{if(t){const y=W(r).toLowerCase(),E=W(d).toLowerCase(),M=y===a,U=E===a;if(M&&!U)return-1;if(U&&!M)return 1}let f=0;switch(_){case"lastHeard":f=(i.last_seen||0)-(h.last_seen||0);break;case"distance":{const y=oe.get(r)??null,E=oe.get(d)??null;y===null&&E===null?f=0:y===null?f=1:E===null?f=-1:f=y-E;break}case"centrality":{const y=j.get(r)||0,E=j.get(d)||0;f=y-E;break}}return I==="desc"?-f:f})},[Pe,_,I,oe,j,v]),m=n.useMemo(()=>{let s=0,a=0,t=0,r=0,i=0;for(const[,d]of x){const h=ke(d),f=d.latitude&&d.longitude&&d.latitude!==0&&d.longitude!==0;switch(h.type){case"room_server":t++;break;case"repeater":a++;break;case"companion":s++;break;case"unknown":i++;break}f&&r++}return{companions:s,repeaters:a,roomServers:t,total:x.length,withLocation:r,unknown:i}},[x]),Ye=n.useMemo(()=>new Set(u),[u]),_e=n.useMemo(()=>k===0?x:x.slice(0,V),[x,V,k]);n.useEffect(()=>{ne(k||x.length)},[_,I,v,R,b,k,x.length]),n.useEffect(()=>{const s=a=>{a.target.closest("[data-dropdown]")||F(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),n.useEffect(()=>{if(k===0)return;const s=new IntersectionObserver(a=>{a[0].isIntersecting&&VMath.min(t+k,x.length))},{threshold:.1,rootMargin:"100px"});return fe.current&&s.observe(fe.current),()=>s.disconnect()},[k,V,x.length]);const Ze=n.useCallback(s=>{We(s),ne(s||x.length)},[x.length]),Je=n.useCallback(s=>{_===s?se(a=>a==="desc"?"asc":"desc"):(H(s),se("desc"))},[_]),Ke=n.useCallback(s=>{const a=O[s];a!=null&&a.latitude&&(a!=null&&a.longitude)&&a.latitude!==0&&a.longitude!==0&&Me(s)},[O]),es=n.useCallback(()=>{Me(null)},[]),ss=n.useCallback((s,a)=>{P({hash:s,name:a})},[]),Re=ws((Te=(Le=o==null?void 0:o.config)==null?void 0:Le.mesh)==null?void 0:Te.path_hash_mode),ts=n.useCallback(async(s,a)=>{if(a.stopPropagation(),!pe){Se(s),he(t=>{const r=new Map(t);return r.delete(s),r}),X(t=>{const r=new Map(t);return r.delete(s),r});try{const r=`0x${W(s,Re)}`,i=await Cs(r,30);i.success&&i.data?(he(d=>new Map(d).set(s,i.data)),setTimeout(()=>{he(d=>{const h=new Map(d);return h.delete(s),h})},1e4)):(X(d=>new Map(d).set(s,i.error||"Ping failed")),setTimeout(()=>{X(d=>{const h=new Map(d);return h.delete(s),h})},5e3))}catch(t){const r=t instanceof Error?t.message:"Ping failed";X(i=>new Map(i).set(s,r)),setTimeout(()=>{X(i=>{const d=new Map(i);return d.delete(s),d})},5e3)}finally{Se(null)}}},[pe,Re]);return e.jsxs(_s,{children:[e.jsx(Rs,{title:"Contacts",icon:e.jsx(ee,{}),subtitle:e.jsx($s,{}),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(ee,{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(de,{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($e,{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(me,{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(Xs,{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(De,{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(ee,{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(de,{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($e,{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(me,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Fe,{ranges:Ne,selectedIndex:$,onSelect:w,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Fe,{ranges:Ne,selectedIndex:$,onSelect:w})})]})}),e.jsxs(Ls,{children:[e.jsx(ct,{neighbors:O,localNode:L??void 0,localHash:z,onRemoveNode:g,selectedNodeHash:ue,onNodeSelected:es}),e.jsxs(ks,{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(ee,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(Ms,{type:"search",size:"sm",value:v,onChange:s=>G(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ys,{className:"w-3.5 h-3.5"}),trailingIcon:v?e.jsx("button",{onClick:()=>{G(""),(v.toLowerCase().trim()==="neighbor"||v.toLowerCase().trim()==="neighbors")&&Q(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(Ss,{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:()=>F(!ae),className:ve(b.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(at,{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})]}),ae&&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:a})=>e.jsxs("button",{onClick:()=>{te(t=>{const r=new Set(t);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(Ce,{className:"w-3 h-3"})}),e.jsx("span",{className:b.has(s)?"text-fg-primary":"text-fg-secondary",children:a})]},s)),b.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>te(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"})]})]})]}),ce.size>0&&e.jsxs("button",{onClick:()=>Q(!R),className:ve(R,{color:"success",border:!0}),title:R?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(de,{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:[pt.map(({field:s,icon:a,label:t})=>e.jsxs("button",{onClick:()=>Je(s),className:ve(_===s),title:`Sort by ${t.toLowerCase()}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:t}),_===s&&e.jsx(Ks,{className:we("w-3 h-3",I==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Ts,{value:k,onChange:Ze,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(le,{value:25,children:"25"}),e.jsx(le,{value:50,children:"50"}),e.jsx(le,{value:100,children:"100"}),e.jsx(le,{value:0,children:"All"})]})]})]}),x.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",style:{contain:"layout paint"},children:_e.map(([s,a])=>{const t=W(s),r=Ye.has(s),i=ce.has(s),d=oe.get(s)??null,h=j.get(s)||0,f=i?Xe.get(s):void 0,y=t?q.get(t)??null:null,E=T.has(s),M=i?null:Qe.get(s)??null,U=Ge.get(s)??null,je=B.get(s);let Z=null;if(je&&je.length>0){const ie=je.reduce((rs,os)=>rs+os.count,0);ie>0&&(Z=ie/24)}const be=a.first_seen?Oe(a.first_seen).replace(/ ago$/i,""):null,J=[],K=[];if(M){const ie=M.name??M.prefix;J.push(`→${ie} +${M.hopCount}`),K.push(`Gateway: ${M.name??M.prefix} (${M.hopCount} hop${M.hopCount!==1?"s":""})`)}U&&(J.push(`↙${U}`),K.push(`Last forwarder: ${U}`)),Z!==null&&(J.push(`${Z<1?"<1":Math.round(Z)}/hr`),K.push(`Packet rate: ${Z.toFixed(1)}/hr`)),be&&(J.push(be),K.push(`First seen: ${be} ago`));const as=J.join(" · "),ns=K.join(` `);return e.jsx(xt,{hash:s,contact:a,isHub:r,isNeighbor:i,distance:d,centrality:h,neighborSignal:f,collisionInfo:y,isViterbiResolved:A,pingingHash:pe,pingResult:Ve.get(s),pingError:Ue.get(s),isMobile:E,metaSummary:as,metaTooltip:ns,onRowClick:Ke,onPing:ts,onRemove:ss},s)})}),k>0&&V0&&Vne(s=>Math.min(s+k,x.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(ee,{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:!!S,title:"Remove Contact",message:`Remove ${(S==null?void 0:S.name)||"this contact"} from the contacts list? The node will reappear if it advertises again.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{S&&g(S.hash),P(null)},onCancel:()=>P(null)})]})}const zt=Object.freeze(Object.defineProperty({__proto__:null,default:jt},Symbol.toStringTag,{value:"Module"}));export{zt as C,lt as P,Ae as R}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-C3aIIydk.js b/frontend/dist/assets/ContactsMapMapLibre-DTQ4poRm.js similarity index 99% rename from frontend/dist/assets/ContactsMapMapLibre-C3aIIydk.js rename to frontend/dist/assets/ContactsMapMapLibre-DTQ4poRm.js index 7e710a4f..bbd140c5 100644 --- a/frontend/dist/assets/ContactsMapMapLibre-C3aIIydk.js +++ b/frontend/dist/assets/ContactsMapMapLibre-DTQ4poRm.js @@ -1,4 +1,4 @@ -import{e as N0,an as na,r as j,gA as ia,cu as sa,dp as oa,dq as la,j as m,aC as co,dr as aa,aD as fo,m as qt,a0 as Hr,dK as ho,c as zr,a2 as Gn,O as i0,Z as dr,gB as Un,gC as mo,gD as ua,cj as ca,cq as fa,cs as ha,dV as go,ap as po,aE as yo,d as v0,b as pr,B as Lt,dG as da,cl as li,E as Li,S as Ni,dx as xo,t as wo,c$ as vo,aa as bo,bM as Gr,bI as as,gE as ko,Q as ma,a6 as ga,dF as pa,gF as ya,az as Co,bT as us,bV as xa,a1 as Vn,a3 as Wn,cn as wa,b9 as va,f1 as Eo,gG as ba,gH as ka,gI as Ca,gJ as Ea,aR as So,V as mt,gK as Sa,gL as Mo,gM as Ma,ao as b0,bP as Bo,dw as Ba,gN as Do,gO as _o,cb as Da,gy as _a,ce as Ta,du as To,dy as ja,ab as Ra,gP as Ia,fd as La,gQ as ai,gR as Na}from"./index-i0xzpXop.js";import{u as J0,S as L0,L as $t,M as Fa,b as Pa}from"./maplibre-gl-B20pCOz8.js";import{u as jo,r as Ro,e as cs,f as fs,g as Qa}from"./consumer-registry-5uDLywpC.js";import{L as Fn,c as Oa}from"./link-scoring-BqsMOwtz.js";import{C as za}from"./ConfirmModal-CtS0orbM.js";import{s as Ha,a as Ga,M as Ua}from"./variants-Bbq7uzV_.js";import{G as xi}from"./git-branch-DrsZ9sUq.js";import{D as Va}from"./database-gsjgeKE3.js";import{H as Wa,A as un,D as hs,p as Ya,c as Ka,u as lr}from"./useMapViewStore-DZlzQmak.js";import{E as Io}from"./target-BAeWmUfa.js";import{F as Za}from"./funnel-CitfWrkD.js";import{P as $a}from"./plus-Bb8eT78f.js";import{C as qa}from"./compass-0fhguiKE.js";import{Z as Ja}from"./zap-tuTM-Jsw.js";import{b as Xa,e as Au,a as Lo,m as ds,E as eu,u as tu,G as ru,g as nu,d as iu,f as su}from"./max-C_kLXH5u.js";import{T as ou}from"./trash-2-DCqpUdF7.js";import{W as lu}from"./wifi-off-CQ0s_9cO.js";import{W as au}from"./wifi-DYlEDPZY.js";import{C as uu}from"./circle-alert-PnLnz8pa.js";import{C as No}from"./clock-F-4SScS_.js";import{C as cu}from"./chevron-right-DsOuIRi8.js";import{L as fu}from"./LightSparkline-DC33xzFq.js";import{P as Fo,R as hu}from"./Contacts-CkDqsspC.js";import{H as On,C as s0,N as du,a as mu}from"./badge-colors-Dl76Mz8m.js";import{M as gu}from"./map-pin-C051lstq.js";import{c as ms}from"./node-types-rVJPSDxd.js";import{B as pu}from"./BasemapLayer-Bv4kYAcR.js";import{a as Po,b as wi,c as yu}from"./easing-BdzuOPcT.js";import"./index-BCuGA4PV.js";import"./index-CBEGRHd5.js";import"./usePipelineStore-BqTRxIqB.js";import"./PageLayout-B4RCJ-XT.js";import"./listbox-C1gGOelh.js";import"./element-movement-BD3SL-GU.js";import"./use-text-value-T4f0bwXS.js";import"./frozen-D4mEoVft.js";import"./MqttModeBadge-Dhi11STL.js";import"./chat-utils-BdAUDg3r.js";import"./SignalIndicator-D8uG_rJC.js";import"./CollisionExplorerModal-DAlBzVhS.js";import"./share-2-B5yQaExh.js";import"./circle-question-mark-CJCLhkb9.js";import"./map-pin-off-CPSqCYZk.js";import"./activity-DQoaymFw.js";import"./search-DsTk_ZsM.js";/** +import{e as N0,an as na,r as j,gA as ia,cu as sa,dp as oa,dq as la,j as m,aC as co,dr as aa,aD as fo,m as qt,a0 as Hr,dK as ho,c as zr,a2 as Gn,O as i0,Z as dr,gB as Un,gC as mo,gD as ua,cj as ca,cq as fa,cs as ha,dV as go,ap as po,aE as yo,d as v0,b as pr,B as Lt,dG as da,cl as li,E as Li,S as Ni,dx as xo,t as wo,c$ as vo,aa as bo,bM as Gr,bI as as,gE as ko,Q as ma,a6 as ga,dF as pa,gF as ya,az as Co,bT as us,bV as xa,a1 as Vn,a3 as Wn,cn as wa,b9 as va,f1 as Eo,gG as ba,gH as ka,gI as Ca,gJ as Ea,aR as So,V as mt,gK as Sa,gL as Mo,gM as Ma,ao as b0,bP as Bo,dw as Ba,gN as Do,gO as _o,cb as Da,gy as _a,ce as Ta,du as To,dy as ja,ab as Ra,gP as Ia,fd as La,gQ as ai,gR as Na}from"./index-CN4vD05c.js";import{u as J0,S as L0,L as $t,M as Fa,b as Pa}from"./maplibre-gl-CRRd6W2P.js";import{u as jo,r as Ro,e as cs,f as fs,g as Qa}from"./consumer-registry-ssgJoJPf.js";import{L as Fn,c as Oa}from"./link-scoring--28z7vGg.js";import{C as za}from"./ConfirmModal-CH_Er4VJ.js";import{s as Ha,a as Ga,M as Ua}from"./variants-WkuRUM3u.js";import{G as xi}from"./git-branch-DpI9mavY.js";import{D as Va}from"./database-n5nNHRzj.js";import{H as Wa,A as un,D as hs,p as Ya,c as Ka,u as lr}from"./useMapViewStore-D6ulpFc9.js";import{E as Io}from"./target-CftUJhmo.js";import{F as Za}from"./funnel-Bd2d2Gy-.js";import{P as $a}from"./plus-3025QRmd.js";import{C as qa}from"./compass-Ddh177-W.js";import{Z as Ja}from"./zap-Ba3ctUHg.js";import{b as Xa,e as Au,a as Lo,m as ds,E as eu,u as tu,G as ru,g as nu,d as iu,f as su}from"./max-BbWCrv_A.js";import{T as ou}from"./trash-2-DqmFYXqQ.js";import{W as lu}from"./wifi-off-Bfc2_ayY.js";import{W as au}from"./wifi-BF-rEj1F.js";import{C as uu}from"./circle-alert-NywFrEoZ.js";import{C as No}from"./clock-jH_gnOTU.js";import{C as cu}from"./chevron-right-BCotFXkU.js";import{L as fu}from"./LightSparkline-Bfgi1R3B.js";import{P as Fo,R as hu}from"./Contacts-BgYz8bSj.js";import{H as On,C as s0,N as du,a as mu}from"./badge-colors-Dl76Mz8m.js";import{M as gu}from"./map-pin-W8m2dIyd.js";import{c as ms}from"./node-types-UozthSpR.js";import{B as pu}from"./BasemapLayer-B81nTsqc.js";import{a as Po,b as wi,c as yu}from"./easing-Cg6LL_7U.js";import"./index-G-dTy9iF.js";import"./index-CnWrze_V.js";import"./usePipelineStore-BTv04vLL.js";import"./PageLayout-DJSWC4zL.js";import"./listbox-Cfex3RUz.js";import"./element-movement-22ZdBM88.js";import"./use-text-value-DHtdh4JM.js";import"./frozen-ZI0va0FF.js";import"./MqttModeBadge-BFJmiZy5.js";import"./chat-utils-BLzyljgm.js";import"./SignalIndicator-BpXSkqBv.js";import"./CollisionExplorerModal-CDRCTbR-.js";import"./share-2-FGmu8UDX.js";import"./circle-question-mark-z2YWN8ID.js";import"./map-pin-off-VHAD8rJE.js";import"./activity-ZoAXCcWm.js";import"./search-D1TEdb7u.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Dashboard-CDloj9Ii.js b/frontend/dist/assets/Dashboard-B_DHVbWG.js similarity index 97% rename from frontend/dist/assets/Dashboard-CDloj9Ii.js rename to frontend/dist/assets/Dashboard-B_DHVbWG.js index 29b766e6..e650dc6d 100644 --- a/frontend/dist/assets/Dashboard-CDloj9Ii.js +++ b/frontend/dist/assets/Dashboard-B_DHVbWG.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-i0xzpXop.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); -import{e as Z,f as bs,h as Dt,k as Rt,J as js,n as ws,o as Ns,p as Ee,q as vs,r as f,M as ks,t as Ms,_ as st,v as nt,w as At,x as Pt,y as Cs,z as te,D as Ts,j as t,d as Ke,m as ge,S as Lt,E as $t,U as Ss,F as _s,G as Pe,P as Bs,H as Ds,K as Q,L as Rs,N as As,O as Y,Q as we,R as Ft,T as Et,V as ne,W as Ps,X as Ls,Y as je,$ as $s,a0 as at,a1 as Fs,a2 as Le,a3 as Es,a4 as Is,a5 as Hs,a6 as ie,a7 as It,a8 as Ht,a9 as zs,B as $e,aa as zt,ab as Ot,ac as Os,ad as Ne,ae as ee,af as Gt,ag as Wt,ah as Gs,ai as Ws,aj as qs,ak as Xs,al as Us,am as Ie,u as qt,an as Vs,ao as ot,ap as me,aq as Me,ar as Xt,as as Ys,at as Ce,au as Js,av as Zs,aw as Ks,ax as rt,ay as Qs,c as J,az as en,aA as Ut,aB as it,aC as Vt,aD as Yt,aE as tn,aF as ve,aG as sn,aH as nn,aI as an,aJ as Qe,aK as on,aL as Jt,aM as Zt,aN as rn,aO as ln,Z as lt,aP as cn,aQ as dn,aR as un,aS as ct}from"./index-i0xzpXop.js";import{C as dt,P as mn,a as fn,B as pn}from"./PageLayout-B4RCJ-XT.js";import{u as fe,r as pe,h as hn,a as xn,b as gn,i as yn}from"./consumer-registry-5uDLywpC.js";import{A as re,D as Ye}from"./DataValue-Cj0a0QCM.js";import{c as bn}from"./node-types-rVJPSDxd.js";import{b as Kt,c as ye,a as jn,d as wn,F as Te}from"./meshcore-tx-constants-DgpFTAmf.js";import{S as Nn,u as Je,P as vn,T as kn,C as Qt}from"./PacketList-CbchJDnI.js";import{useGetDecodedContent as Mn,useResolveSource as Cn}from"./usePipelineStore-BqTRxIqB.js";import{A as ut}from"./arrow-right-BZS-u7CW.js";import{T as es,M as Tn}from"./MqttModeBadge-Dhi11STL.js";import{L as ts}from"./LightSparkline-DC33xzFq.js";import{c as Sn}from"./link-scoring-BqsMOwtz.js";import{Z as _n}from"./zap-tuTM-Jsw.js";import{A as Bn,N as Dn}from"./AutoConfigureDialog-C9ytM4jL.js";import{g as Rn,e as He,a as An,f as Pn}from"./chat-utils-BdAUDg3r.js";import{C as Ln}from"./ChatBubble-DL8lfbnv.js";import{M as ss}from"./message-square-text-CIgRIHv3.js";import{C as mt}from"./chevron-right-DsOuIRi8.js";import{H as $n}from"./hash-CyK-Kad6.js";import{M as Fn}from"./message-square-BzLgyIjH.js";import{S as En}from"./shield-check-DlsLo8Eo.js";import{W as In}from"./wand-sparkles-DBzA3PXL.js";import{u as ue}from"./index-BCuGA4PV.js";import{H as Hn}from"./useMapViewStore-DZlzQmak.js";import{R as ft}from"./Grid-BhoD4aLU.js";import"./chevron-up-BVzq549_.js";import"./primitives-QKpQyH4U.js";import"./badge-colors-Dl76Mz8m.js";import"./SignalIndicator-D8uG_rJC.js";import"./arrow-up-D_sZeyuo.js";import"./arrow-down-SlBTV0Nc.js";import"./payload-detail-Bh2WvEK0.js";import"./map-pin-C051lstq.js";import"./circle-question-mark-CJCLhkb9.js";import"./layers-LQ5jNXOV.js";import"./clock-F-4SScS_.js";import"./route-Df1YhBTq.js";import"./activity-DQoaymFw.js";import"./database-gsjgeKE3.js";import"./shield-CxmFjMfw.js";import"./index-CBEGRHd5.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CN4vD05c.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); +import{e as Z,f as bs,h as Dt,k as Rt,J as js,n as ws,o as Ns,p as Ee,q as vs,r as f,M as ks,t as Ms,_ as st,v as nt,w as At,x as Pt,y as Cs,z as te,D as Ts,j as t,d as Ke,m as ge,S as Lt,E as $t,U as Ss,F as _s,G as Pe,P as Bs,H as Ds,K as Q,L as Rs,N as As,O as Y,Q as we,R as Ft,T as Et,V as ne,W as Ps,X as Ls,Y as je,$ as $s,a0 as at,a1 as Fs,a2 as Le,a3 as Es,a4 as Is,a5 as Hs,a6 as ie,a7 as It,a8 as Ht,a9 as zs,B as $e,aa as zt,ab as Ot,ac as Os,ad as Ne,ae as ee,af as Gt,ag as Wt,ah as Gs,ai as Ws,aj as qs,ak as Xs,al as Us,am as Ie,u as qt,an as Vs,ao as ot,ap as me,aq as Me,ar as Xt,as as Ys,at as Ce,au as Js,av as Zs,aw as Ks,ax as rt,ay as Qs,c as J,az as en,aA as Ut,aB as it,aC as Vt,aD as Yt,aE as tn,aF as ve,aG as sn,aH as nn,aI as an,aJ as Qe,aK as on,aL as Jt,aM as Zt,aN as rn,aO as ln,Z as lt,aP as cn,aQ as dn,aR as un,aS as ct}from"./index-CN4vD05c.js";import{C as dt,P as mn,a as fn,B as pn}from"./PageLayout-DJSWC4zL.js";import{u as fe,r as pe,h as hn,a as xn,b as gn,i as yn}from"./consumer-registry-ssgJoJPf.js";import{A as re,D as Ye}from"./DataValue-CdynXJno.js";import{c as bn}from"./node-types-UozthSpR.js";import{b as Kt,c as ye,a as jn,d as wn,F as Te}from"./meshcore-tx-constants-DgpFTAmf.js";import{S as Nn,u as Je,P as vn,T as kn,C as Qt}from"./PacketList-Dq4ygXCy.js";import{useGetDecodedContent as Mn,useResolveSource as Cn}from"./usePipelineStore-BTv04vLL.js";import{A as ut}from"./arrow-right-9ryFJ0vV.js";import{T as es,M as Tn}from"./MqttModeBadge-BFJmiZy5.js";import{L as ts}from"./LightSparkline-Bfgi1R3B.js";import{c as Sn}from"./link-scoring--28z7vGg.js";import{Z as _n}from"./zap-Ba3ctUHg.js";import{A as Bn,N as Dn}from"./AutoConfigureDialog-LhNiSavq.js";import{g as Rn,e as He,a as An,f as Pn}from"./chat-utils-BLzyljgm.js";import{C as Ln}from"./ChatBubble-CFCWQdGy.js";import{M as ss}from"./message-square-text-CjTpe3p8.js";import{C as mt}from"./chevron-right-BCotFXkU.js";import{H as $n}from"./hash-vaiKl847.js";import{M as Fn}from"./message-square-EOpOlt3H.js";import{S as En}from"./shield-check-WAIr0NHG.js";import{W as In}from"./wand-sparkles-Bg4EWlYl.js";import{u as ue}from"./index-G-dTy9iF.js";import{H as Hn}from"./useMapViewStore-D6ulpFc9.js";import{R as ft}from"./Grid-DeJEUuBo.js";import"./chevron-up-Tfuf4unO.js";import"./primitives-DS3PJRi6.js";import"./badge-colors-Dl76Mz8m.js";import"./SignalIndicator-BpXSkqBv.js";import"./arrow-up-Cd56Jeq2.js";import"./arrow-down-BuVueZSW.js";import"./payload-detail-DXAypO28.js";import"./map-pin-W8m2dIyd.js";import"./circle-question-mark-z2YWN8ID.js";import"./layers-DwnLNHzI.js";import"./clock-jH_gnOTU.js";import"./route-4Pe810jq.js";import"./activity-ZoAXCcWm.js";import"./database-n5nNHRzj.js";import"./shield-DH-P-9VP.js";import"./index-CnWrze_V.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -59,7 +59,7 @@ import{e as Z,f as bs,h as Dt,k as Rt,J as js,n as ws,o as Ns,p as Ee,q as vs,r * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aa=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],oa=Z("timer",aa);function ra(...e){const n=!Array.isArray(e[0]),o=n?0:-1,s=e[0+o],r=e[1+o],a=e[2+o],c=e[3+o],i=bs(r,a,c);return n?i(s):i}function ia(e,n,o={}){const s=e.get();let r=null,a=s,c;const i=typeof s=="string"?s.replace(/[\d.-]/g,""):void 0,d=()=>{r&&(r.stop(),r=null)},u=()=>{d();const m=gt(e.get()),j=gt(a);m!==j&&(r=new js({keyframes:[m,j],velocity:e.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...o,onUpdate:c}))};if(e.attach((m,j)=>{a=m,c=l=>j(xt(l,i)),Dt.postRender(()=>{var l;u(),(l=e.events.animationStart)==null||l.notify(),r==null||r.then(()=>{var x;(x=e.events.animationComplete)==null||x.notify()})})},d),Rt(n)){const m=n.on("change",l=>e.set(xt(l,i))),j=e.on("destroy",m);return()=>{m(),j()}}return d}function xt(e,n){return n?e+n:e}function gt(e){return typeof e=="number"?e:parseFloat(e)}function rs(e,n){const o=ue(n()),s=()=>o.set(n());return s(),ws(()=>{const r=()=>Dt.preRender(s,!1,!0),a=e.map(c=>c.on("change",r));return()=>{a.forEach(c=>c()),Ns(s)}}),o}function la(e){Ee.current=[],e();const n=rs(Ee.current,e);return Ee.current=void 0,n}function ca(e,n,o,s){if(typeof e=="function")return la(e);const a=ra(n,o,s);return Array.isArray(e)?yt(e,a):yt([e],([c])=>a(c))}function yt(e,n){const o=vs(()=>[]);return rs(e,()=>{o.length=0;const s=e.length;for(let r=0;rRt(e)?e.get():e;if(o)return ca(s);const r=ue(s());return f.useInsertionEffect(()=>ia(r,e,n),[r,JSON.stringify(n)]),r}function Se(e,n={}){return da(e,{type:"spring",...n})}const oe=Ms(()=>({result:null,isComputing:!1})),ua=500,ma=300;let ce=null,_e=null;function fa(e){var o;const n=(o=e==null?void 0:e.config)==null?void 0:o.radio;return`${(n==null?void 0:n.spreading_factor)??7}:${(n==null?void 0:n.bandwidth)??125e3}:${(n==null?void 0:n.coding_rate)??5}:${(n==null?void 0:n.preamble_length)??8}`}function pa(){if(ce)return ce;if(typeof window>"u")return null;try{ce=new Worker(new URL("/assets/dashboard-bucketing.worker-BwrZMAuc.js",import.meta.url),{type:"module"}),ce.onmessage=e=>{if(e.data.type==="error"){console.error("[DashboardBucketing] Worker error:",e.data.error),oe.setState({isComputing:!1});return}oe.setState({result:e.data.payload,isComputing:!1})},ce.onerror=e=>{console.error("[DashboardBucketing] Worker error:",e),oe.setState({isComputing:!1})}}catch(e){console.error("[DashboardBucketing] Failed to init worker:",e)}return ce}function ha(e,n,o,s){const r=pa();if(!r)return;const a=e.length,c=new Float64Array(a),i=new Float64Array(a),d=new Uint16Array(a),u=new Uint8Array(a),m=new Uint8Array(a),j=new Uint8Array(a),l=new Uint8Array(a),x=new Float32Array(a),N=new Float32Array(a),h=new Uint32Array(a),y=new Map;let C=0;for(let B=0;BparseInt(n,10)).filter(n=>e[n]>0).sort((n,o)=>e[o]-e[n])}function xa(e,n,o){const s={...e,received:[...e.received],unique_received:[...e.unique_received],transmitted:[...e.transmitted],forwarded:[...e.forwarded],dropped:[...e.dropped],receivedBytesBuckets:e.receivedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),forwardedBytesBuckets:e.forwardedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),droppedBytesBuckets:e.droppedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),receivedTotalByType:{...e.receivedTotalByType},receivedCountByType:{...e.receivedCountByType},forwardedTotalByType:{...e.forwardedTotalByType},droppedTotalByType:{...e.droppedTotalByType}},{start_time:r,end_time:a,bucket_duration_seconds:c,bucket_count:i}=e,d=new Set;for(const m of n){const j=m.timestamp??0;if(ja)continue;const l=Math.floor((j-r)/c);if(l<0||l>=i)continue;d.has(l)||(d.add(l),s.received[l]={...s.received[l]},s.unique_received[l]={...s.unique_received[l]},s.transmitted[l]={...s.transmitted[l]},s.forwarded[l]={...s.forwarded[l]},s.dropped[l]={...s.dropped[l]});const x=At(m,o),N=m.length??m.payload_length??0,h=m.type??m.payload_type??0,y=m.packet_origin;y==="tx_local"?(s.transmitted[l].count++,s.transmitted[l].airtime_ms+=x):y==="tx_forward"||m.transmitted?(s.forwarded[l].count++,s.forwarded[l].airtime_ms+=x,s.forwardedBytesBuckets[l].bytesByType[h]=(s.forwardedBytesBuckets[l].bytesByType[h]??0)+N,s.forwardedBytesBuckets[l].totalBytes+=N,s.forwardedBytesBuckets[l].countByType[h]=(s.forwardedBytesBuckets[l].countByType[h]??0)+1,s.forwardedBytesBuckets[l].totalCount++,s.forwardedTotalByType[h]=(s.forwardedTotalByType[h]??0)+N,s.totalForwardedCount++):m.drop_reason&&(s.dropped[l].count++,s.dropped[l].airtime_ms+=x,s.droppedBytesBuckets[l].bytesByType[h]=(s.droppedBytesBuckets[l].bytesByType[h]??0)+N,s.droppedBytesBuckets[l].totalBytes+=N,s.droppedBytesBuckets[l].countByType[h]=(s.droppedBytesBuckets[l].countByType[h]??0)+1,s.droppedBytesBuckets[l].totalCount++,s.droppedTotalByType[h]=(s.droppedTotalByType[h]??0)+N,s.totalDroppedCount++),y!=="tx_local"&&(s.received[l].count++,s.received[l].airtime_ms+=x,s.unique_received[l].count++,s.unique_received[l].airtime_ms+=x,s.receivedBytesBuckets[l].bytesByType[h]=(s.receivedBytesBuckets[l].bytesByType[h]??0)+N,s.receivedBytesBuckets[l].totalBytes+=N,s.receivedBytesBuckets[l].countByType[h]=(s.receivedBytesBuckets[l].countByType[h]??0)+1,s.receivedBytesBuckets[l].totalCount++,s.receivedTotalByType[h]=(s.receivedTotalByType[h]??0)+N,s.receivedCountByType[h]=(s.receivedCountByType[h]??0)+1,s.totalReceivedBytes+=N)}const u=s.time_range_minutes/60;return s.kbPerHour=u>0?Math.round(s.totalReceivedBytes/1024/u):0,s.forwardedRatePerHour=u>0?Math.round(s.totalForwardedCount/u):0,s.droppedRatePerHour=u>0?Math.round(s.totalDroppedCount/u):0,s.receivedActiveTypes=ze(s.receivedTotalByType),s.forwardedActiveTypes=ze(s.forwardedTotalByType),s.droppedActiveTypes=ze(s.droppedTotalByType),s}typeof window<"u"&&Promise.all([st(()=>import("./index-i0xzpXop.js").then(e=>e.hm),__vite__mapDeps([0,1])),st(()=>import("./index-i0xzpXop.js").then(e=>e.hl),__vite__mapDeps([0,1]))]).then(([e,n])=>{const{DASHBOARD_TIME_RANGES:o}=n;let s=0,r=-1,a="";e.useStore.subscribe(c=>{const i=c.packets.length,d=c.globalTimeRangeIndex,u=fa(c.stats);if(i===s&&d===r&&u===a)return;const m=s,j=r,l=a;if(s=i,r=d,a=u,i===0)return;const x=o[d]??o[4],N=x.minutes,h=x.buckets,y=c.stats,C=nt(y),T=i-m,B=d!==j,v=u!==l,w=oe.getState().result;if(!B&&!v&&T>0&&T{_e=null;const p=e.useStore.getState();if(p.packets.length===0||!p.stats)return;const _=o[p.globalTimeRangeIndex]??o[4],k=nt(p.stats);ha(p.packets,_.minutes,_.buckets,k)},ma)})});const ga=()=>oe(e=>e.result),is=[{target:"ReceivedChart",fn:"type",minStage:1},{target:"ReceivedChart",fn:"airtime",minStage:1,when:hn}];pe(is);function ya(e){const o=new Date(e*1e3).getHours();return o>=6&&o<18}function bt(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const he=32,Oe=20,ba=[.25,.5,.75,1];function ja({buckets:e,activeTypes:n,totalByType:o,mode:s="bytes"}){fe(is);const r=Pt(),[a,c]=f.useState(null),[i,d]=f.useState(null),[u,m]=f.useState(null),j=f.useCallback((v,w,b)=>{c(w),d(b)},[]),l=e.length>0&&n.length>0,x=a?ya(a.start):null,N=a?bt(a.start):"",h=u!==null&&x!==null&&u!==x;x!==u&&m(x);const y=f.useMemo(()=>Cs(e),[e]),C=s==="count"?te:Ts,T=f.useMemo(()=>y===0?[]:ba.map(v=>({pct:v,label:C(Math.round(y*v)),pos:(1-v)*100})),[y,C]),B=f.useMemo(()=>{if(e.length===0)return[];const v=e.length,w=Math.max(1,Math.floor(v/6)),b=[];for(let p=0;pt.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${b}%`,transform:v===1?"none":"translateY(-50%)",right:0},children:w},v))}),t.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:he,right:0,top:0,bottom:Oe},children:l&&t.jsx(Ss,{buckets:e,activeTypes:n,gridColor:r.grid,axisTickColor:r.axisTick,onHover:j,yAxisFormat:s,externalAxes:!0})}),t.jsx("div",{className:"absolute left-0 right-0 bottom-0 pointer-events-none",style:{left:he,height:Oe},"aria-hidden":"true",children:B.map((v,w)=>t.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${v.pos}%`,transform:w===0?"none":w===B.length-1?"translateX(-100%)":"translateX(-50%)"},children:v.label},w))})]}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:l&&t.jsx(_s,{activeTypes:n,totalByType:o,formatMode:s})})]})}const jt={top:8,right:8,bottom:28,left:48},wt={top:0,right:0,bottom:0,left:0};let Be=null,Nt=0;const wa=1e3;function Na(){const e=performance.now();return Be&&e-Nth&&(h=D),P>y&&(y=P)}h===0&&y===0?(h=1,y=1):h===0?h=1:y===0&&(y=1);const C=h*1.05,T=y*1.05,B=C+T;let v=C/B;v=Math.max(Fe,Math.min(1-Fe,v));const w=i-m,b=v*w,p=(1-v)*w,_=a+b,k=a+b+m,A=a+b+m/2;for(let g=0;g0)for(const F of s){const M=R[F]??0;if(M===0)continue;const $=M/C*b,E=P-$;e.fillStyle=Pe(F),e.fillRect(D,E,l,$),P=E}let L=k;const S=o[g].countByType;if(N[g]>0){const F=S[Q]??0;if(F>0){const M=F/T*p;e.fillStyle=Pe(Q),e.fillRect(D,L,l,M),L+=M}for(const M of s){if(M===Q)continue;const $=S[M]??0;if($===0)continue;const E=$/T*p;e.fillStyle=Pe(M),e.fillRect(D,L,l,E),L+=E}}}return{baselineY:A,fwdHalf:b,drpHalf:p,fwdCeil:C,drpCeil:T,gapPx:m}}function ka(e,n,o,s,r,a,c,i,d,u,m=!1){if(n.length===0)return;const{baselineY:j,fwdHalf:l,drpHalf:x,fwdCeil:N,drpCeil:h,gapPx:y}=d,C=Na(),T=j-Math.ceil(y/2),B=j+Math.floor(y/2);e.save(),e.strokeStyle=c,e.lineWidth=1*u,e.setLineDash([]);const v=[.5,1];for(const w of v){const b=Math.round(T-w*l)+.5;e.beginPath(),e.moveTo(o,b),e.lineTo(o+r,b),e.stroke();const p=Math.round(B+w*x)+.5;e.beginPath(),e.moveTo(o,p),e.lineTo(o+r,p),e.stroke()}if(e.restore(),e.clearRect(o,j-Math.ceil(y/2),r,y),!m){e.save(),e.font=`bold ${10*u}px ${C}`,e.textAlign="left";const w=4*u,b=2*u;for(const p of v){const _=Math.round(N*p),k=Math.round(h*p),A=p===1,g=T-p*l,D=B+p*x;_>0&&(e.fillStyle=Y.green,e.globalAlpha=.7,A?(e.textBaseline="top",e.fillText(te(_),w,g+b)):(e.textBaseline="middle",e.fillText(te(_),w,g))),k>0&&(e.fillStyle=Y.red,e.globalAlpha=.7,A?(e.textBaseline="bottom",e.fillText(te(k),w,D-b)):(e.textBaseline="middle",e.fillText(te(k),w,D)))}e.globalAlpha=1,e.restore()}if(!m){e.save(),e.font=`${12*u}px ${C}`,e.fillStyle=i,e.textBaseline="top",e.textAlign="center";const w=8*u,b=n.length,p=Math.max(1,Math.floor(b/6)),_=r/b;for(let k=0;k{const r=n[s]??0,a=o[s]??0;if(r===0&&a===0)return null;const c=s===Q?"CRC":Bs[s]??`TYPE_${s}`;return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:Pe(s)}}),t.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:c}),t.jsxs("span",{className:"tabular-nums",children:[t.jsxs("span",{className:"text-sys-green",children:["▲",te(r)]})," ",t.jsxs("span",{className:"text-sys-red",children:["▼",te(a)]})]})]},s)})})}function Ca(e,n,o){const s=e.length;let r=0,a=0;for(let m=0;mr&&(r=j),l>a&&(a=l)}r===0&&a===0?(r=1,a=1):r===0?r=1:a===0&&(a=1);const c=r*1.05,i=a*1.05,d=c+i;let u=c/d;return u=Math.max(Fe,Math.min(1-Fe,u)),{fwdMax:Math.round(c),drpMax:Math.round(i),fwdFrac:u}}function Ta({forwardedBuckets:e,droppedBuckets:n,allTypes:o,onHover:s,gridColor:r,axisTickColor:a,externalAxes:c=!1}){const i=f.useRef(null),d=f.useRef(null),u=f.useRef(e),m=f.useRef(n),j=f.useRef(o),l=f.useRef(c);u.current=e,m.current=n,j.current=o,l.current=c;const x=c?wt:jt,N=typeof document<"u"&&document.documentElement.dataset.mode!=="light",h=r||(N?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"),y=a||(N?"rgba(255,255,255,0.6)":"rgba(0,0,0,0.6)"),C=f.useRef({gridColor:h,axisTickColor:y});C.current={gridColor:h,axisTickColor:y};const T=e.length,B=f.useMemo(()=>{const b=e.map(_=>_.start),p=e.map(()=>1);return[b,p]},[T]),v=f.useCallback(b=>{if(!i.current||e.length===0)return;const p=i.current.getBoundingClientRect(),_=b.clientX-p.left,k=c?wt:jt,A=k.left,g=p.width-k.left-k.right,P=(_-A)/g;if(P<0||P>1){s==null||s(null,null,null);return}const R=Math.min(e.length-1,Math.max(0,Math.floor(P*e.length)));s==null||s(R,e[R],P)},[e,s]),w=f.useCallback(()=>{s==null||s(null,null,null)},[s]);return f.useEffect(()=>{if(!i.current||T===0)return;const b=i.current;let p=null;const _=Ds(()=>{const k=b.getBoundingClientRect(),A=Math.floor(k.width)||400,g=Math.floor(k.height)||200,D={width:A,height:g,padding:[x.top,x.right,x.bottom,x.left],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[R=>{const L=R.ctx,{left:S,top:F,width:M,height:$}=R.bbox,E=window.devicePixelRatio||1,W=C.current,I=u.current;I.length>=2&&As(L,I[0].start,I[I.length-1].end,S,F,M,$);const O=va(L,u.current,m.current,j.current,S,F,M,$);ka(L,u.current,S,F,M,$,W.gridColor,W.axisTickColor,O,E,l.current)}]}},P=new Rs(D,B,b);d.current=P,p=new ResizeObserver(()=>{const R=b.getBoundingClientRect();R.width>0&&R.height>0&&d.current&&d.current.setSize({width:Math.floor(R.width),height:Math.floor(R.height)})}),p.observe(b)});return()=>{var k;_(),p==null||p.disconnect(),(k=d.current)==null||k.destroy(),d.current=null}},[T]),f.useEffect(()=>{d.current&&d.current.redraw()},[e,n,o]),e.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):t.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:v,onMouseLeave:w})}const Sa=f.memo(Ta),ls=[{target:"RepeaterAnalyticsCard",fn:"type",minStage:1}];pe(ls);function _a(e){const o=new Date(e*1e3).getHours();return o>=6&&o<18}function vt(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const xe=32,Ge=20,Ba=[.5,1];function Da({forwardedBuckets:e,droppedBuckets:n,forwardedActiveTypes:o,droppedActiveTypes:s,forwardedCount:r,droppedCount:a,crcCount:c,crcHistory:i,receivedCount:d,forwardedTotalByType:u,droppedTotalByType:m,startTime:j,bucketDurationSeconds:l,bucketCount:x,timeRangeMinutes:N}){fe(ls);const h=Pt(),y=we(),[C,T]=f.useState(null),[B,v]=f.useState(null),[w,b]=f.useState(null),p=f.useCallback((G,H,U)=>{T(H),v(U)},[]),_=Math.max(1,N/60),k=f.useMemo(()=>Ft(y,_),[y,_]),A=f.useMemo(()=>k?Et(k):0,[k]),g=Math.round(A*10)/10,D=Math.round((k==null?void 0:k.avgBackoffMs)??0),{fwdMirror:P,drpMirror:R,allTypes:L,fwdTotals:S,drpTotals:F}=f.useMemo(()=>{const G=e.map(X=>({start:X.start,end:X.end,countByType:{...X.countByType}})),H=new Array(x).fill(0);for(const X of i){let K=Math.floor((X.timestamp-j)/l);K<0&&(K=0),!(K>=x)&&H[K]++}const U=n.map((X,K)=>({start:X.start,end:X.end,countByType:{...X.countByType,...H[K]>0?{[Q]:H[K]}:{}}})),V=new Set([...o,...s]);c>0&&V.add(Q);const se={...u},ae={...m};c>0&&(ae[Q]=c);const ke=[...V].sort((X,K)=>{const ys=(se[X]??0)+(ae[X]??0);return(se[K]??0)+(ae[K]??0)-ys});return{fwdMirror:G,drpMirror:U,allTypes:ke,fwdTotals:se,drpTotals:ae}},[e,n,o,s,i,c,j,l,x,u,m]),M=L.length>0&&P.length>0,$=C?_a(C.start):null,E=C?vt(C.start):"",W=w!==null&&$!==null&&w!==$;$!==w&&b($);const I=f.useMemo(()=>M?Ca(P,R,L):null,[M,P,R,L]),O=f.useMemo(()=>{if(!I)return[];const{fwdMax:G,drpMax:H,fwdFrac:U}=I,V=[];for(const se of Ba){const ae=Math.round(G*se);if(ae>0){const X=(1-se)*U*100;V.push({label:te(ae),pos:X,color:"green"})}const ke=Math.round(H*se);if(ke>0){const X=(U+se*(1-U))*100;V.push({label:te(ke),pos:X,color:"red"})}}return V},[I]),z=f.useMemo(()=>{if(P.length===0)return[];const G=P.length,H=Math.max(1,Math.floor(G/6)),U=[];for(let V=0;Vt.jsx("span",{className:`type-data-xs text-right pr-1.5 ${U==="green"?"text-sys-green/70":"text-sys-red/70"}`,style:{position:"absolute",top:`${H}%`,transform:H<=1?"none":H>=99?"translateY(-100%)":"translateY(-50%)",right:0},children:G},V))}),t.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:xe,right:0,top:0,bottom:Ge},children:[M&&I&&t.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none",style:{height:`${I.fwdFrac*100}%`,background:"var(--sys-blue)",opacity:.1}}),M&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"data-box data-box-compact flex items-center gap-1 absolute z-10 pointer-events-none",style:{top:8,left:8,background:"var(--surface)",borderColor:"var(--edge-subtle)"},children:[t.jsx(ht,{className:"w-3 h-3 text-sys-green"}),t.jsx("span",{children:"FWD"})]}),t.jsxs("span",{className:"data-box data-box-compact flex items-center gap-1 absolute z-10 pointer-events-none",style:{bottom:8,left:8,background:"var(--surface)",borderColor:"var(--edge-subtle)"},children:[t.jsx(pt,{className:"w-3 h-3 text-sys-red"}),t.jsx("span",{children:"DROP"})]})]}),t.jsx("div",{className:`absolute inset-0 flex items-center transition-opacity duration-300 ${M?"opacity-0 pointer-events-none":"opacity-100"}`,"aria-hidden":M,children:t.jsx("div",{className:"w-full flex items-center gap-1",children:t.jsx("div",{className:"flex-1 flex items-end gap-1 h-1/2",children:[45,72,33,58,80,42,65,28,55,75,38,62].map((G,H)=>t.jsx("div",{className:"flex-1 bg-subtle-fill rounded-sm animate-pulse",style:{height:`${G}%`}},`u${H}`))})})}),t.jsx("div",{className:`h-full transition-opacity duration-300 ${M?"opacity-100":"opacity-0"}`,children:M&&t.jsx(Sa,{forwardedBuckets:P,droppedBuckets:R,allTypes:L,gridColor:h.grid,axisTickColor:h.axisTick,onHover:p,externalAxes:!0})}),M&&I&&t.jsx("div",{className:"absolute inset-x-0 bottom-0 pointer-events-none",style:{top:`${I.fwdFrac*100}%`,background:"var(--sys-red)",opacity:.1}})]}),t.jsx("div",{className:"absolute left-0 right-0 bottom-0 pointer-events-none",style:{left:xe,height:Ge},"aria-hidden":"true",children:z.map((G,H)=>t.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${G.pos}%`,transform:H===0?"none":H===z.length-1?"translateX(-100%)":"translateX(-50%)"},children:G.label},H))})]}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:M&&t.jsx(Ma,{allTypes:L,forwardedTotalByType:S,droppedTotalByType:F})})]})}const Ra=2,Aa=1;function Pa(e,n,o){const s=d=>(d==null?void 0:d.reduce((u,m)=>u+m.count,0))??0,r=s(n),a=s(o),c=r||(e==null?void 0:e.rx_count)||1,i=a||(e==null?void 0:e.dropped_count)||0;return c>0?i/(c+i)*100:0}function La(e,n,o){const s=r=>(r==null?void 0:r.reduce((a,c)=>a+c.count,0))??0;if(n!=null&&n.length&&o){const a=s(n)*100,c=n.length*o*1e3;return a/c*100}if(e){const r=(e.uptime_seconds||1)*1e3;return(e.total_airtime_ms||e.airtime_used_ms||0)/r*100}return 0}function kt(e,n,o){return jn(Math.max(n,Math.min(o,e)))}function $a(e,n,o,s,r){let a=Kt(e);n>20?a+=Te*2:n>12&&(a+=Te),o>8&&(a+=Te);const c=kt(a,0,Ra);let i=wn(e);o>8&&(i+=Te);const d=kt(i,0,Aa),u=ye(c),m=ye(d),j=s!==null?ye(s):null;let l="stable";return j!==null&&(u>j?l="increase":u{if(u!=="applying"){m("applying");try{const H=await Ls({tx_delay_factor:z,direct_tx_delay_factor:G});H!=null&&H.success?(m("success"),setTimeout(()=>m("idle"),2e3)):(m("error"),setTimeout(()=>m("idle"),2500))}catch{m("error"),setTimeout(()=>m("idle"),2500)}}},[u]);if(!c)return t.jsx(je,{children:t.jsx($s,{})});const x=10080*60,h=Math.floor(Date.now()/1e3)-x,y=Object.values((e==null?void 0:e.neighbors)??{}).filter(z=>z.zero_hop&&z.last_seen>=h&&bn(z).isRepeater).length,C=j.filter(z=>z.status==="active"||z.lastSeen>=h).length,T=Math.max(y,C),B=Pa(e,n,o),v=La(e,s,r),w=((W=(E=e==null?void 0:e.config)==null?void 0:E.delays)==null?void 0:W.tx_delay_factor)??null,b=((O=(I=e==null?void 0:e.config)==null?void 0:I.delays)==null?void 0:O.direct_tx_delay_factor)??null,p=$a(T,B,v,w),_=T!==1,k=Kt(T),A=[`${T} repeater${_?"s":""} heard in the last 7 days (base ×${k.toFixed(1)}).`];p.floodFactor===k&&B<=12&&v<=8?A.push("No modifiers applied — network looks healthy."):(B>20?A.push(`High duplicate rate (${B.toFixed(1)}%) suggests frequent collisions — window widened.`):B>12&&A.push(`Elevated duplicate rate (${B.toFixed(1)}%) — window widened one step.`),v>8&&A.push(`Channel is busy (${v.toFixed(1)}% TX util) — extra spacing added.`));const g=[`Direct uses one forwarder — ×${p.directFactor.toFixed(1)} backoff for channel contention.`];v>8&&g.push("Busy channel — small extra backoff.");const D=[`Flood ×${p.floodFactor.toFixed(1)} (${p.floodSlots} slot${p.floodSlots!==1?"s":""})`,...A,"",`Direct ×${p.directFactor.toFixed(1)}`,...g,"","Click to copy CLI commands"].join(` + */const aa=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],oa=Z("timer",aa);function ra(...e){const n=!Array.isArray(e[0]),o=n?0:-1,s=e[0+o],r=e[1+o],a=e[2+o],c=e[3+o],i=bs(r,a,c);return n?i(s):i}function ia(e,n,o={}){const s=e.get();let r=null,a=s,c;const i=typeof s=="string"?s.replace(/[\d.-]/g,""):void 0,d=()=>{r&&(r.stop(),r=null)},u=()=>{d();const m=gt(e.get()),j=gt(a);m!==j&&(r=new js({keyframes:[m,j],velocity:e.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...o,onUpdate:c}))};if(e.attach((m,j)=>{a=m,c=l=>j(xt(l,i)),Dt.postRender(()=>{var l;u(),(l=e.events.animationStart)==null||l.notify(),r==null||r.then(()=>{var x;(x=e.events.animationComplete)==null||x.notify()})})},d),Rt(n)){const m=n.on("change",l=>e.set(xt(l,i))),j=e.on("destroy",m);return()=>{m(),j()}}return d}function xt(e,n){return n?e+n:e}function gt(e){return typeof e=="number"?e:parseFloat(e)}function rs(e,n){const o=ue(n()),s=()=>o.set(n());return s(),ws(()=>{const r=()=>Dt.preRender(s,!1,!0),a=e.map(c=>c.on("change",r));return()=>{a.forEach(c=>c()),Ns(s)}}),o}function la(e){Ee.current=[],e();const n=rs(Ee.current,e);return Ee.current=void 0,n}function ca(e,n,o,s){if(typeof e=="function")return la(e);const a=ra(n,o,s);return Array.isArray(e)?yt(e,a):yt([e],([c])=>a(c))}function yt(e,n){const o=vs(()=>[]);return rs(e,()=>{o.length=0;const s=e.length;for(let r=0;rRt(e)?e.get():e;if(o)return ca(s);const r=ue(s());return f.useInsertionEffect(()=>ia(r,e,n),[r,JSON.stringify(n)]),r}function Se(e,n={}){return da(e,{type:"spring",...n})}const oe=Ms(()=>({result:null,isComputing:!1})),ua=500,ma=300;let ce=null,_e=null;function fa(e){var o;const n=(o=e==null?void 0:e.config)==null?void 0:o.radio;return`${(n==null?void 0:n.spreading_factor)??7}:${(n==null?void 0:n.bandwidth)??125e3}:${(n==null?void 0:n.coding_rate)??5}:${(n==null?void 0:n.preamble_length)??8}`}function pa(){if(ce)return ce;if(typeof window>"u")return null;try{ce=new Worker(new URL("/assets/dashboard-bucketing.worker-BwrZMAuc.js",import.meta.url),{type:"module"}),ce.onmessage=e=>{if(e.data.type==="error"){console.error("[DashboardBucketing] Worker error:",e.data.error),oe.setState({isComputing:!1});return}oe.setState({result:e.data.payload,isComputing:!1})},ce.onerror=e=>{console.error("[DashboardBucketing] Worker error:",e),oe.setState({isComputing:!1})}}catch(e){console.error("[DashboardBucketing] Failed to init worker:",e)}return ce}function ha(e,n,o,s){const r=pa();if(!r)return;const a=e.length,c=new Float64Array(a),i=new Float64Array(a),d=new Uint16Array(a),u=new Uint8Array(a),m=new Uint8Array(a),j=new Uint8Array(a),l=new Uint8Array(a),x=new Float32Array(a),N=new Float32Array(a),h=new Uint32Array(a),y=new Map;let C=0;for(let B=0;BparseInt(n,10)).filter(n=>e[n]>0).sort((n,o)=>e[o]-e[n])}function xa(e,n,o){const s={...e,received:[...e.received],unique_received:[...e.unique_received],transmitted:[...e.transmitted],forwarded:[...e.forwarded],dropped:[...e.dropped],receivedBytesBuckets:e.receivedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),forwardedBytesBuckets:e.forwardedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),droppedBytesBuckets:e.droppedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType},countByType:{...m.countByType}})),receivedTotalByType:{...e.receivedTotalByType},receivedCountByType:{...e.receivedCountByType},forwardedTotalByType:{...e.forwardedTotalByType},droppedTotalByType:{...e.droppedTotalByType}},{start_time:r,end_time:a,bucket_duration_seconds:c,bucket_count:i}=e,d=new Set;for(const m of n){const j=m.timestamp??0;if(ja)continue;const l=Math.floor((j-r)/c);if(l<0||l>=i)continue;d.has(l)||(d.add(l),s.received[l]={...s.received[l]},s.unique_received[l]={...s.unique_received[l]},s.transmitted[l]={...s.transmitted[l]},s.forwarded[l]={...s.forwarded[l]},s.dropped[l]={...s.dropped[l]});const x=At(m,o),N=m.length??m.payload_length??0,h=m.type??m.payload_type??0,y=m.packet_origin;y==="tx_local"?(s.transmitted[l].count++,s.transmitted[l].airtime_ms+=x):y==="tx_forward"||m.transmitted?(s.forwarded[l].count++,s.forwarded[l].airtime_ms+=x,s.forwardedBytesBuckets[l].bytesByType[h]=(s.forwardedBytesBuckets[l].bytesByType[h]??0)+N,s.forwardedBytesBuckets[l].totalBytes+=N,s.forwardedBytesBuckets[l].countByType[h]=(s.forwardedBytesBuckets[l].countByType[h]??0)+1,s.forwardedBytesBuckets[l].totalCount++,s.forwardedTotalByType[h]=(s.forwardedTotalByType[h]??0)+N,s.totalForwardedCount++):m.drop_reason&&(s.dropped[l].count++,s.dropped[l].airtime_ms+=x,s.droppedBytesBuckets[l].bytesByType[h]=(s.droppedBytesBuckets[l].bytesByType[h]??0)+N,s.droppedBytesBuckets[l].totalBytes+=N,s.droppedBytesBuckets[l].countByType[h]=(s.droppedBytesBuckets[l].countByType[h]??0)+1,s.droppedBytesBuckets[l].totalCount++,s.droppedTotalByType[h]=(s.droppedTotalByType[h]??0)+N,s.totalDroppedCount++),y!=="tx_local"&&(s.received[l].count++,s.received[l].airtime_ms+=x,s.unique_received[l].count++,s.unique_received[l].airtime_ms+=x,s.receivedBytesBuckets[l].bytesByType[h]=(s.receivedBytesBuckets[l].bytesByType[h]??0)+N,s.receivedBytesBuckets[l].totalBytes+=N,s.receivedBytesBuckets[l].countByType[h]=(s.receivedBytesBuckets[l].countByType[h]??0)+1,s.receivedBytesBuckets[l].totalCount++,s.receivedTotalByType[h]=(s.receivedTotalByType[h]??0)+N,s.receivedCountByType[h]=(s.receivedCountByType[h]??0)+1,s.totalReceivedBytes+=N)}const u=s.time_range_minutes/60;return s.kbPerHour=u>0?Math.round(s.totalReceivedBytes/1024/u):0,s.forwardedRatePerHour=u>0?Math.round(s.totalForwardedCount/u):0,s.droppedRatePerHour=u>0?Math.round(s.totalDroppedCount/u):0,s.receivedActiveTypes=ze(s.receivedTotalByType),s.forwardedActiveTypes=ze(s.forwardedTotalByType),s.droppedActiveTypes=ze(s.droppedTotalByType),s}typeof window<"u"&&Promise.all([st(()=>import("./index-CN4vD05c.js").then(e=>e.hm),__vite__mapDeps([0,1])),st(()=>import("./index-CN4vD05c.js").then(e=>e.hl),__vite__mapDeps([0,1]))]).then(([e,n])=>{const{DASHBOARD_TIME_RANGES:o}=n;let s=0,r=-1,a="";e.useStore.subscribe(c=>{const i=c.packets.length,d=c.globalTimeRangeIndex,u=fa(c.stats);if(i===s&&d===r&&u===a)return;const m=s,j=r,l=a;if(s=i,r=d,a=u,i===0)return;const x=o[d]??o[4],N=x.minutes,h=x.buckets,y=c.stats,C=nt(y),T=i-m,B=d!==j,v=u!==l,w=oe.getState().result;if(!B&&!v&&T>0&&T{_e=null;const p=e.useStore.getState();if(p.packets.length===0||!p.stats)return;const _=o[p.globalTimeRangeIndex]??o[4],k=nt(p.stats);ha(p.packets,_.minutes,_.buckets,k)},ma)})});const ga=()=>oe(e=>e.result),is=[{target:"ReceivedChart",fn:"type",minStage:1},{target:"ReceivedChart",fn:"airtime",minStage:1,when:hn}];pe(is);function ya(e){const o=new Date(e*1e3).getHours();return o>=6&&o<18}function bt(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const he=32,Oe=20,ba=[.25,.5,.75,1];function ja({buckets:e,activeTypes:n,totalByType:o,mode:s="bytes"}){fe(is);const r=Pt(),[a,c]=f.useState(null),[i,d]=f.useState(null),[u,m]=f.useState(null),j=f.useCallback((v,w,b)=>{c(w),d(b)},[]),l=e.length>0&&n.length>0,x=a?ya(a.start):null,N=a?bt(a.start):"",h=u!==null&&x!==null&&u!==x;x!==u&&m(x);const y=f.useMemo(()=>Cs(e),[e]),C=s==="count"?te:Ts,T=f.useMemo(()=>y===0?[]:ba.map(v=>({pct:v,label:C(Math.round(y*v)),pos:(1-v)*100})),[y,C]),B=f.useMemo(()=>{if(e.length===0)return[];const v=e.length,w=Math.max(1,Math.floor(v/6)),b=[];for(let p=0;pt.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${b}%`,transform:v===1?"none":"translateY(-50%)",right:0},children:w},v))}),t.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:he,right:0,top:0,bottom:Oe},children:l&&t.jsx(Ss,{buckets:e,activeTypes:n,gridColor:r.grid,axisTickColor:r.axisTick,onHover:j,yAxisFormat:s,externalAxes:!0})}),t.jsx("div",{className:"absolute left-0 right-0 bottom-0 pointer-events-none",style:{left:he,height:Oe},"aria-hidden":"true",children:B.map((v,w)=>t.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${v.pos}%`,transform:w===0?"none":w===B.length-1?"translateX(-100%)":"translateX(-50%)"},children:v.label},w))})]}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:l&&t.jsx(_s,{activeTypes:n,totalByType:o,formatMode:s})})]})}const jt={top:8,right:8,bottom:28,left:48},wt={top:0,right:0,bottom:0,left:0};let Be=null,Nt=0;const wa=1e3;function Na(){const e=performance.now();return Be&&e-Nth&&(h=D),P>y&&(y=P)}h===0&&y===0?(h=1,y=1):h===0?h=1:y===0&&(y=1);const C=h*1.05,T=y*1.05,B=C+T;let v=C/B;v=Math.max(Fe,Math.min(1-Fe,v));const w=i-m,b=v*w,p=(1-v)*w,_=a+b,k=a+b+m,A=a+b+m/2;for(let g=0;g0)for(const F of s){const M=R[F]??0;if(M===0)continue;const $=M/C*b,E=P-$;e.fillStyle=Pe(F),e.fillRect(D,E,l,$),P=E}let L=k;const S=o[g].countByType;if(N[g]>0){const F=S[Q]??0;if(F>0){const M=F/T*p;e.fillStyle=Pe(Q),e.fillRect(D,L,l,M),L+=M}for(const M of s){if(M===Q)continue;const $=S[M]??0;if($===0)continue;const E=$/T*p;e.fillStyle=Pe(M),e.fillRect(D,L,l,E),L+=E}}}return{baselineY:A,fwdHalf:b,drpHalf:p,fwdCeil:C,drpCeil:T,gapPx:m}}function ka(e,n,o,s,r,a,c,i,d,u,m=!1){if(n.length===0)return;const{baselineY:j,fwdHalf:l,drpHalf:x,fwdCeil:N,drpCeil:h,gapPx:y}=d,C=Na(),T=j-Math.ceil(y/2),B=j+Math.floor(y/2);e.save(),e.strokeStyle=c,e.lineWidth=1*u,e.setLineDash([]);const v=[.5,1];for(const w of v){const b=Math.round(T-w*l)+.5;e.beginPath(),e.moveTo(o,b),e.lineTo(o+r,b),e.stroke();const p=Math.round(B+w*x)+.5;e.beginPath(),e.moveTo(o,p),e.lineTo(o+r,p),e.stroke()}if(e.restore(),e.clearRect(o,j-Math.ceil(y/2),r,y),!m){e.save(),e.font=`bold ${10*u}px ${C}`,e.textAlign="left";const w=4*u,b=2*u;for(const p of v){const _=Math.round(N*p),k=Math.round(h*p),A=p===1,g=T-p*l,D=B+p*x;_>0&&(e.fillStyle=Y.green,e.globalAlpha=.7,A?(e.textBaseline="top",e.fillText(te(_),w,g+b)):(e.textBaseline="middle",e.fillText(te(_),w,g))),k>0&&(e.fillStyle=Y.red,e.globalAlpha=.7,A?(e.textBaseline="bottom",e.fillText(te(k),w,D-b)):(e.textBaseline="middle",e.fillText(te(k),w,D)))}e.globalAlpha=1,e.restore()}if(!m){e.save(),e.font=`${12*u}px ${C}`,e.fillStyle=i,e.textBaseline="top",e.textAlign="center";const w=8*u,b=n.length,p=Math.max(1,Math.floor(b/6)),_=r/b;for(let k=0;k{const r=n[s]??0,a=o[s]??0;if(r===0&&a===0)return null;const c=s===Q?"CRC":Bs[s]??`TYPE_${s}`;return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:Pe(s)}}),t.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:c}),t.jsxs("span",{className:"tabular-nums",children:[t.jsxs("span",{className:"text-sys-green",children:["▲",te(r)]})," ",t.jsxs("span",{className:"text-sys-red",children:["▼",te(a)]})]})]},s)})})}function Ca(e,n,o){const s=e.length;let r=0,a=0;for(let m=0;mr&&(r=j),l>a&&(a=l)}r===0&&a===0?(r=1,a=1):r===0?r=1:a===0&&(a=1);const c=r*1.05,i=a*1.05,d=c+i;let u=c/d;return u=Math.max(Fe,Math.min(1-Fe,u)),{fwdMax:Math.round(c),drpMax:Math.round(i),fwdFrac:u}}function Ta({forwardedBuckets:e,droppedBuckets:n,allTypes:o,onHover:s,gridColor:r,axisTickColor:a,externalAxes:c=!1}){const i=f.useRef(null),d=f.useRef(null),u=f.useRef(e),m=f.useRef(n),j=f.useRef(o),l=f.useRef(c);u.current=e,m.current=n,j.current=o,l.current=c;const x=c?wt:jt,N=typeof document<"u"&&document.documentElement.dataset.mode!=="light",h=r||(N?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"),y=a||(N?"rgba(255,255,255,0.6)":"rgba(0,0,0,0.6)"),C=f.useRef({gridColor:h,axisTickColor:y});C.current={gridColor:h,axisTickColor:y};const T=e.length,B=f.useMemo(()=>{const b=e.map(_=>_.start),p=e.map(()=>1);return[b,p]},[T]),v=f.useCallback(b=>{if(!i.current||e.length===0)return;const p=i.current.getBoundingClientRect(),_=b.clientX-p.left,k=c?wt:jt,A=k.left,g=p.width-k.left-k.right,P=(_-A)/g;if(P<0||P>1){s==null||s(null,null,null);return}const R=Math.min(e.length-1,Math.max(0,Math.floor(P*e.length)));s==null||s(R,e[R],P)},[e,s]),w=f.useCallback(()=>{s==null||s(null,null,null)},[s]);return f.useEffect(()=>{if(!i.current||T===0)return;const b=i.current;let p=null;const _=Ds(()=>{const k=b.getBoundingClientRect(),A=Math.floor(k.width)||400,g=Math.floor(k.height)||200,D={width:A,height:g,padding:[x.top,x.right,x.bottom,x.left],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[R=>{const L=R.ctx,{left:S,top:F,width:M,height:$}=R.bbox,E=window.devicePixelRatio||1,W=C.current,I=u.current;I.length>=2&&As(L,I[0].start,I[I.length-1].end,S,F,M,$);const O=va(L,u.current,m.current,j.current,S,F,M,$);ka(L,u.current,S,F,M,$,W.gridColor,W.axisTickColor,O,E,l.current)}]}},P=new Rs(D,B,b);d.current=P,p=new ResizeObserver(()=>{const R=b.getBoundingClientRect();R.width>0&&R.height>0&&d.current&&d.current.setSize({width:Math.floor(R.width),height:Math.floor(R.height)})}),p.observe(b)});return()=>{var k;_(),p==null||p.disconnect(),(k=d.current)==null||k.destroy(),d.current=null}},[T]),f.useEffect(()=>{d.current&&d.current.redraw()},[e,n,o]),e.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):t.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:v,onMouseLeave:w})}const Sa=f.memo(Ta),ls=[{target:"RepeaterAnalyticsCard",fn:"type",minStage:1}];pe(ls);function _a(e){const o=new Date(e*1e3).getHours();return o>=6&&o<18}function vt(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const xe=32,Ge=20,Ba=[.5,1];function Da({forwardedBuckets:e,droppedBuckets:n,forwardedActiveTypes:o,droppedActiveTypes:s,forwardedCount:r,droppedCount:a,crcCount:c,crcHistory:i,receivedCount:d,forwardedTotalByType:u,droppedTotalByType:m,startTime:j,bucketDurationSeconds:l,bucketCount:x,timeRangeMinutes:N}){fe(ls);const h=Pt(),y=we(),[C,T]=f.useState(null),[B,v]=f.useState(null),[w,b]=f.useState(null),p=f.useCallback((G,H,U)=>{T(H),v(U)},[]),_=Math.max(1,N/60),k=f.useMemo(()=>Ft(y,_),[y,_]),A=f.useMemo(()=>k?Et(k):0,[k]),g=Math.round(A*10)/10,D=Math.round((k==null?void 0:k.avgBackoffMs)??0),{fwdMirror:P,drpMirror:R,allTypes:L,fwdTotals:S,drpTotals:F}=f.useMemo(()=>{const G=e.map(X=>({start:X.start,end:X.end,countByType:{...X.countByType}})),H=new Array(x).fill(0);for(const X of i){let K=Math.floor((X.timestamp-j)/l);K<0&&(K=0),!(K>=x)&&H[K]++}const U=n.map((X,K)=>({start:X.start,end:X.end,countByType:{...X.countByType,...H[K]>0?{[Q]:H[K]}:{}}})),V=new Set([...o,...s]);c>0&&V.add(Q);const se={...u},ae={...m};c>0&&(ae[Q]=c);const ke=[...V].sort((X,K)=>{const ys=(se[X]??0)+(ae[X]??0);return(se[K]??0)+(ae[K]??0)-ys});return{fwdMirror:G,drpMirror:U,allTypes:ke,fwdTotals:se,drpTotals:ae}},[e,n,o,s,i,c,j,l,x,u,m]),M=L.length>0&&P.length>0,$=C?_a(C.start):null,E=C?vt(C.start):"",W=w!==null&&$!==null&&w!==$;$!==w&&b($);const I=f.useMemo(()=>M?Ca(P,R,L):null,[M,P,R,L]),O=f.useMemo(()=>{if(!I)return[];const{fwdMax:G,drpMax:H,fwdFrac:U}=I,V=[];for(const se of Ba){const ae=Math.round(G*se);if(ae>0){const X=(1-se)*U*100;V.push({label:te(ae),pos:X,color:"green"})}const ke=Math.round(H*se);if(ke>0){const X=(U+se*(1-U))*100;V.push({label:te(ke),pos:X,color:"red"})}}return V},[I]),z=f.useMemo(()=>{if(P.length===0)return[];const G=P.length,H=Math.max(1,Math.floor(G/6)),U=[];for(let V=0;Vt.jsx("span",{className:`type-data-xs text-right pr-1.5 ${U==="green"?"text-sys-green/70":"text-sys-red/70"}`,style:{position:"absolute",top:`${H}%`,transform:H<=1?"none":H>=99?"translateY(-100%)":"translateY(-50%)",right:0},children:G},V))}),t.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:xe,right:0,top:0,bottom:Ge},children:[M&&I&&t.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none",style:{height:`${I.fwdFrac*100}%`,background:"var(--sys-blue)",opacity:.1}}),M&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"data-box data-box-compact flex items-center gap-1 absolute z-10 pointer-events-none",style:{top:8,left:8,background:"var(--surface)",borderColor:"var(--edge-subtle)"},children:[t.jsx(ht,{className:"w-3 h-3 text-sys-green"}),t.jsx("span",{children:"FWD"})]}),t.jsxs("span",{className:"data-box data-box-compact flex items-center gap-1 absolute z-10 pointer-events-none",style:{bottom:8,left:8,background:"var(--surface)",borderColor:"var(--edge-subtle)"},children:[t.jsx(pt,{className:"w-3 h-3 text-sys-red"}),t.jsx("span",{children:"DROP"})]})]}),t.jsx("div",{className:`absolute inset-0 flex items-center transition-opacity duration-300 ${M?"opacity-0 pointer-events-none":"opacity-100"}`,"aria-hidden":M,children:t.jsx("div",{className:"w-full flex items-center gap-1",children:t.jsx("div",{className:"flex-1 flex items-end gap-1 h-1/2",children:[45,72,33,58,80,42,65,28,55,75,38,62].map((G,H)=>t.jsx("div",{className:"flex-1 bg-subtle-fill rounded-sm animate-pulse",style:{height:`${G}%`}},`u${H}`))})})}),t.jsx("div",{className:`h-full transition-opacity duration-300 ${M?"opacity-100":"opacity-0"}`,children:M&&t.jsx(Sa,{forwardedBuckets:P,droppedBuckets:R,allTypes:L,gridColor:h.grid,axisTickColor:h.axisTick,onHover:p,externalAxes:!0})}),M&&I&&t.jsx("div",{className:"absolute inset-x-0 bottom-0 pointer-events-none",style:{top:`${I.fwdFrac*100}%`,background:"var(--sys-red)",opacity:.1}})]}),t.jsx("div",{className:"absolute left-0 right-0 bottom-0 pointer-events-none",style:{left:xe,height:Ge},"aria-hidden":"true",children:z.map((G,H)=>t.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${G.pos}%`,transform:H===0?"none":H===z.length-1?"translateX(-100%)":"translateX(-50%)"},children:G.label},H))})]}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:M&&t.jsx(Ma,{allTypes:L,forwardedTotalByType:S,droppedTotalByType:F})})]})}const Ra=2,Aa=1;function Pa(e,n,o){const s=d=>(d==null?void 0:d.reduce((u,m)=>u+m.count,0))??0,r=s(n),a=s(o),c=r||(e==null?void 0:e.rx_count)||1,i=a||(e==null?void 0:e.dropped_count)||0;return c>0?i/(c+i)*100:0}function La(e,n,o){const s=r=>(r==null?void 0:r.reduce((a,c)=>a+c.count,0))??0;if(n!=null&&n.length&&o){const a=s(n)*100,c=n.length*o*1e3;return a/c*100}if(e){const r=(e.uptime_seconds||1)*1e3;return(e.total_airtime_ms||e.airtime_used_ms||0)/r*100}return 0}function kt(e,n,o){return jn(Math.max(n,Math.min(o,e)))}function $a(e,n,o,s,r){let a=Kt(e);n>20?a+=Te*2:n>12&&(a+=Te),o>8&&(a+=Te);const c=kt(a,0,Ra);let i=wn(e);o>8&&(i+=Te);const d=kt(i,0,Aa),u=ye(c),m=ye(d),j=s!==null?ye(s):null;let l="stable";return j!==null&&(u>j?l="increase":u{if(u!=="applying"){m("applying");try{const H=await Ls({tx_delay_factor:z,direct_tx_delay_factor:G});H!=null&&H.success?(m("success"),setTimeout(()=>m("idle"),2e3)):(m("error"),setTimeout(()=>m("idle"),2500))}catch{m("error"),setTimeout(()=>m("idle"),2500)}}},[u]);if(!c)return t.jsx(je,{children:t.jsx($s,{})});const x=10080*60,h=Math.floor(Date.now()/1e3)-x,y=Object.values((e==null?void 0:e.neighbors)??{}).filter(z=>z.zero_hop&&z.last_seen>=h&&bn(z).isRepeater).length,C=j.filter(z=>z.status==="active"||z.lastSeen>=h).length,T=Math.max(y,C),B=Pa(e,n,o),v=La(e,s,r),w=((W=(E=e==null?void 0:e.config)==null?void 0:E.delays)==null?void 0:W.tx_delay_factor)??null,b=((O=(I=e==null?void 0:e.config)==null?void 0:I.delays)==null?void 0:O.direct_tx_delay_factor)??null,p=$a(T,B,v,w),_=T!==1,k=Kt(T),A=[`${T} repeater${_?"s":""} heard in the last 7 days (base ×${k.toFixed(1)}).`];p.floodFactor===k&&B<=12&&v<=8?A.push("No modifiers applied — network looks healthy."):(B>20?A.push(`High duplicate rate (${B.toFixed(1)}%) suggests frequent collisions — window widened.`):B>12&&A.push(`Elevated duplicate rate (${B.toFixed(1)}%) — window widened one step.`),v>8&&A.push(`Channel is busy (${v.toFixed(1)}% TX util) — extra spacing added.`));const g=[`Direct uses one forwarder — ×${p.directFactor.toFixed(1)} backoff for channel contention.`];v>8&&g.push("Busy channel — small extra backoff.");const D=[`Flood ×${p.floodFactor.toFixed(1)} (${p.floodSlots} slot${p.floodSlots!==1?"s":""})`,...A,"",`Direct ×${p.directFactor.toFixed(1)}`,...g,"","Click to copy CLI commands"].join(` `),P=w!==null?ye(w):null,R=b!==null?ye(b):null,L=P!==null&&p.floodSlots!==P,S=R!==null&&p.directSlots!==R,F=L||S,M=async()=>{const z=`set txdelay ${p.floodFactor.toFixed(1)} set direct.txdelay ${p.directFactor.toFixed(1)}`;await Es(z),d(!0),setTimeout(()=>d(!1),1500)},$=()=>l(p.floodFactor,p.directFactor);return t.jsxs(je,{children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3 flex-wrap",children:[t.jsx(Nn,{className:"w-4 h-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"DELAY DOCTOR"}),a&&t.jsx(ne,{color:"zinc",className:"hidden sm:inline-flex",children:a})]}),t.jsxs("button",{onClick:M,className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-subtle-fill radius-inner transition-base p-1 -m-1 group",title:D,children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-fg-primary",children:t.jsxs(Ye,{children:["×",p.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Flood"})]}),t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-sys-blue",children:t.jsxs(Ye,{children:["×",p.directFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Direct"})]}),t.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:i?t.jsx(at,{className:"w-4 h-4 text-sys-green"}):t.jsx(Fs,{className:"w-4 h-4 text-fg-muted"})})]}),t.jsx("div",{className:"flex-1 py-2",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"Dupe"}),t.jsxs("div",{className:`data-box data-box-fill data-box-left ${p.duplicateRate>8?"text-status-warning":""}`,children:[p.duplicateRate.toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"TX Util"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p.txUtilization.toFixed(2),"%"]})]})]})}),t.jsx("div",{className:"pt-2 mt-auto",children:t.jsxs("div",{className:"flex items-end justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:w!==null?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:["×",w.toFixed(2)]})}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"data-box data-box-fill data-box-left",style:{color:"var(--sys-blue)"},children:["×",(b==null?void 0:b.toFixed(2))??"—"]})})]}):t.jsx("span",{className:"text-sm text-fg-muted",children:"No config"})})]}),F&&t.jsxs("button",{onClick:$,disabled:u==="applying"||u==="success",className:`flex items-center gap-1.5 px-2.5 py-1.5 radius-inner type-micro font-medium transition-base ${u==="success"?"bg-sys-green/15 text-sys-green":u==="error"?"bg-sys-red/15 text-sys-red":u==="applying"?"bg-subtle-fill text-fg-muted":"bg-sys-blue/10 text-sys-blue hover:bg-sys-blue/20"}`,title:`Apply ×${p.floodFactor.toFixed(1)} flood, ×${p.directFactor.toFixed(1)} direct`,children:[u==="success"?"Rx'd":u==="error"?"Failed":"Apply",u==="applying"?t.jsx(Le,{className:"w-3.5 h-3.5 animate-spin"}):u==="success"?t.jsx(at,{className:"w-3.5 h-3.5"}):t.jsxs("span",{className:"relative inline-flex items-end w-6 h-3.5",children:[t.jsx(Kn,{className:"w-3.5 h-3.5 absolute left-0 bottom-0"}),t.jsx(na,{className:"w-3 h-3 absolute right-0 bottom-0"})]})]})]})})]})}const cs=[{target:"RecentPackets",fn:"rssi",minStage:1},{target:"RecentPackets",fn:"snr",minStage:1}];pe(cs);const Ea=25;function Ia(){fe(cs);const e=we(),n=Is(),o=Hs(),s=ie(),r=Mn(),a=Je(x=>x.requestChannel),[c,i]=f.useState(!0),d=f.useCallback(x=>i(x),[]),u=f.useMemo(()=>[...e.length<=100?e:e.slice(-100)].sort((N,h)=>(h.timestamp??0)-(N.timestamp??0)),[e]),m=s==null?void 0:s.local_hash,j=s==null?void 0:s.neighbors,l=Cn();return t.jsxs(je,{noPadding:!0,className:"!overflow-visible",children:[t.jsx(It,{listHeader:!0,icon:t.jsx(zt,{}),title:"Recent Packets",actions:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ht,{enabled:c,onChange:d,label:"Hide Dupes",size:"sm"}),o&&t.jsx(zs,{showLabel:!0}),t.jsxs($e,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ut,{"data-slot":"icon"})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(vn,{packets:u,allPackets:e,localHash:m,neighbors:j,resolveSource:l,getDecodedContent:r,onChannelClick:a,loading:n,maxPackets:Ea,showPagination:!1,flashNewest:!0,hideDupes:c,emptyMessage:"No packets received",footerAction:t.jsxs($e,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ut,{"data-slot":"icon"})]})})})]})}const Ha={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function za({trend:e}){return t.jsx("span",{className:`mini-widget-trend ${e}`,children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:Ha[e]})})})}function Oa(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function Ga({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function le({title:e,icon:n,value:o,unit:s,valueSize:r="md",status:a,subtitle:c,subtitleValue:i,trend:d,headerRight:u,children:m,isLoading:j=!1,error:l,className:x="",onClick:N,isLoaded:h}){const y=["mini-widget-value",r==="lg"&&"mini-widget-value-lg",r==="sm"&&"mini-widget-value-sm"].filter(Boolean).join(" "),C=["mini-widget",x].filter(Boolean).join(" ");return t.jsxs(je,{noPadding:!0,className:C,onClick:N,isLoaded:h,children:[t.jsxs("div",{className:"mini-widget-header",children:[n,t.jsx("span",{className:"mini-widget-title",children:e}),a&&a!=="unknown"&&t.jsx("div",{className:`mini-widget-status-dot ${a}`}),d&&t.jsx(za,{trend:d}),u&&t.jsx("span",{className:"ml-auto flex items-center",children:u})]}),j?t.jsx(Oa,{}):l?t.jsx(Ga,{message:l}):t.jsxs("div",{className:"mini-widget-content",children:[(o!==void 0||c||i)&&t.jsxs("div",{className:"mini-widget-value-row",children:[o!==void 0&&t.jsxs("div",{className:y,children:[typeof o=="number"?t.jsx(re,{value:o,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(o)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx(Ye,{children:o}),s&&t.jsx("span",{className:"mini-widget-unit",children:s})]}),(c||i)&&t.jsxs("span",{className:"mini-widget-badge-group",children:[c&&!i&&t.jsx("span",{className:"data-box mini-widget-subtitle-box",children:c}),c&&i&&t.jsx("span",{className:"mini-widget-subtitle truncate",children:c}),i&&t.jsx("span",{className:"data-box mini-widget-subtitle-box",children:i})]})]}),m]})]})}const Wa={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},ds={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function Ze(e,n){if(e.length===0)return null;const o=[...e].sort((c,i)=>c-i),s=n/100*(o.length-1),r=Math.floor(s),a=Math.ceil(s);return r===a?o[r]:o[r]+(o[a]-o[r])*(s-r)}function Mt(e){return Ze(e,50)}function qa(e){if(e.length<2)return 0;const n=e.reduce((r,a)=>r+a,0)/e.length,s=e.map(r=>Math.pow(r-n,2)).reduce((r,a)=>r+a,0)/e.length;return Math.sqrt(s)}function Xa(e){if(e.length<2)return 0;const n=e.length;let o=0,s=0,r=0,a=0;const c=e[0].timestamp;for(const d of e){const u=(d.timestamp-c)/3600,m=d.value;o+=u,s+=m,r+=u*m,a+=u*u}const i=n*a-o*o;return Math.abs(i)<1e-4?0:(n*r-o*s)/i}function Ua(e,n,o){const s=Wa;return e>=s.DELTA_CRITICAL?[2,`Noise floor ${e.toFixed(1)} dB above baseline`]:n>=s.SLOPE_CRITICAL?[2,`Noise floor rising ${n.toFixed(1)} dB/hour`]:o>=s.JITTER_CRITICAL?[2,`Noise floor unstable (±${o.toFixed(1)} dB)`]:e>=s.DELTA_WARNING?[1,`Noise floor ${e.toFixed(1)} dB above baseline`]:n>=s.SLOPE_WARNING?[1,`Noise floor rising ${n.toFixed(1)} dB/hour`]:o>=s.JITTER_WARNING?[1,`Noise floor variable (±${o.toFixed(1)} dB)`]:[0,null]}function Va(e){if(e.length===0)return{...ds,computedAt:Math.floor(Date.now()/1e3)};const n=Math.floor(Date.now()/1e3),o=e.filter(y=>Number.isFinite(y)),s=e.length>0?[e[e.length-1]]:[],r=e.slice(-4).filter(y=>Number.isFinite(y)),a=Mt(o),c=Ze(o,10),i=Ze(o,90),d=Mt(s),u=d!==null&&c!==null?d-c:0,m=r.map((y,C)=>({timestamp:n-(r.length-1-C)*3600,value:y})),j=Xa(m),l=qa(r),x=o.length>=12,[N,h]=x?Ua(u,j,l):[0,null];return{baselineMedian:a,baselineP10:c,baselineP90:i,currentMedian:d,currentSampleCount:s.length,delta:u,slope:j,jitter:l,penalty:N,penaltyReason:h,computedAt:n,isReliable:x}}const Ya={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],noiseFloorWindowHistory:[],linkQuality:null,channelHealth:null,nfTrend:ds,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},us=f.createContext(Ya);function Ja({children:e}){var R;const n=ie(),o=we(),s=Ot(),r=Os(),a=Ne(),c=ee[a],i=Math.max(1,c.minutes/60),d=n===null,[u,m]=f.useState(null),j=f.useCallback(async()=>{try{const L=await Gt(Math.ceil(i));if(L.success&&L.data){m(L.data.history);return}const S=await Wt(Math.ceil(i));S.success&&S.data&&S.data.count>0&&m(null)}catch{}},[i]);f.useEffect(()=>{j();const L=setInterval(j,6e4);return()=>clearInterval(L)},[j]);const l=f.useMemo(()=>Ft(o,i,u),[o,i,u]),x=(n==null?void 0:n.noise_floor_dbm)??null,N=f.useMemo(()=>Gs(x)?x:null,[x]),h=f.useMemo(()=>{var S;const L=(S=n==null?void 0:n.config)==null?void 0:S.radio;return L?{sf:L.spreading_factor??7,bwHz:L.bandwidth??125e3}:null},[(R=n==null?void 0:n.config)==null?void 0:R.radio]),y=Ws(i),C=qs(i),T=n==null?void 0:n.neighbors,B=f.useMemo(()=>Object.fromEntries(Object.entries(T??{}).filter(([S])=>!r.has(S))),[T,r]),v=f.useMemo(()=>s.filter(L=>!r.has(L.hash)),[s,r]),w=f.useMemo(()=>Va(y),[y]),b=f.useMemo(()=>Xs(v,B,h),[v,B,h]),p=f.useMemo(()=>Us(l,N,b),[l,N,b]),[_,k]=f.useState({noiseFloor:null,networkScore:null,channelHealth:null}),A=f.useRef(0);f.useEffect(()=>{const L=()=>{const F=Date.now();F-A.current>3e4&&(A.current=F,k({noiseFloor:N,networkScore:(b==null?void 0:b.networkScore)??null,channelHealth:(p==null?void 0:p.score)??null}))};L();const S=setInterval(L,5e3);return()=>clearInterval(S)},[N,b==null?void 0:b.networkScore,p==null?void 0:p.score]);const g=f.useMemo(()=>({noiseFloor:{current:N,previous:_.noiseFloor,trend:N!==null?Ie(N,_.noiseFloor,2,!0):"stable"},networkScore:{current:(b==null?void 0:b.networkScore)??0,previous:_.networkScore,trend:Ie((b==null?void 0:b.networkScore)??0,_.networkScore,3,!1)},channelHealth:{current:(p==null?void 0:p.score)??0,previous:_.channelHealth,trend:Ie((p==null?void 0:p.score)??0,_.channelHealth,3,!1)}}),[N,b==null?void 0:b.networkScore,p==null?void 0:p.score,_]),P={lbtStats:l,noiseFloor:N,sparklineNoiseFloor:y,noiseFloorWindowHistory:C,linkQuality:b,channelHealth:p,nfTrend:w,radioConfig:h,trends:g,stats:n,recentPackets:o,quickNeighbors:s,isLoading:d,error:null,refresh:async()=>{}};return t.jsx(us.Provider,{value:P,children:e})}function et(){const e=f.useContext(us);if(e===void 0)throw new Error("useLBTData must be used within an LBTDataProvider");return e}function Za(e){return e<100?"excellent":e<250?"good":e<500?"fair":e<1e3?"congested":"critical"}function Ka(e){return e===0?"No backoffs":"Retries"}function Qa(e,n){return e===0?void 0:`${n.toFixed(0)}%`}function eo(){const{lbtStats:e,isLoading:n,error:o}=et(),s=qt(),r=(e==null?void 0:e.avgBackoffMs)??0,a=(e==null?void 0:e.retryRate)??0,c=e?Za(r):"unknown",i=e==null?void 0:e.sparklineBackoff,d=f.useMemo(()=>!i||i.length<2?[]:i.map((u,m)=>({timestamp:Date.now()-(i.length-1-m)*36e5,count:u})),[i]);return t.jsx(le,{title:"LBT Backoff",icon:t.jsx(oa,{className:"mini-widget-icon"}),value:Math.round(r),unit:"ms",status:c,subtitle:e?Ka(r):void 0,subtitleValue:e?Qa(r,a):void 0,isLoading:n,error:o,onClick:()=>s("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(ts,{data:d,width:9999,height:24,invertScale:!0,isLoading:n,className:"w-full"})})})}const ms=[{target:"LinkLeaders",fn:"path",minStage:1,when:xn},{target:"LinkLeaders",fn:"src_hash",minStage:1,when:gn}];pe(ms);function to(){fe(ms);const e=qt(),n=Ot(),o=we(),s=ie(),r=Ne(),c=ee[r].minutes*60,i=Vs(),d=f.useMemo(()=>{if(i===0)return o;const p=i-c;return o.filter(_=>_.timestamp>=p)},[o,c,i]),u=s===null,m=s!=null&&s.local_hash?ot(s.local_hash):"",j=(s==null?void 0:s.neighbors)??{},{neighborHashes:l,neighborNames:x}=f.useMemo(()=>{const p=new Set,_=new Map;for(const k of n){p.add(k.hash);const A=j[k.hash],g=(A==null?void 0:A.name)||(A==null?void 0:A.node_name)||k.prefix;_.set(k.hash,g)}return{neighborHashes:p,neighborNames:_}},[n,j]),N=f.useMemo(()=>{if(l.size===0||d.length===0||!m)return{champion:null,listener:null,loudest:null};const{scores:p}=Sn(d,l,m),_=[];for(const[D,P]of p)P.blendedScore!==0&&_.push({...P,name:x.get(D)??ot(D)});let k=null,A=null,g=null;for(const D of _)(!k||D.blendedScore>k.blendedScore)&&(k=D),(!A||D.listenerScore>A.listenerScore)&&(A=D),(!g||D.loudScore>g.loudScore)&&(g=D);return{champion:k,listener:A,loudest:g}},[d,l,m,x]),h=p=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",p.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Blended Score: ",p.blendedScore,t.jsx("span",{className:"text-fg-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",p.listenerScore,"/100 (",p.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",p.loudScore,"/100 (",p.loudCount," packets relayed)"]})]})]}),y=p=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",p.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",p.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[p.listenerCount," packets where they heard your transmissions"]})})]}),C=p=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",p.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",p.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[p.loudCount," packets they relayed directly to you"]})})]}),{champion:T,listener:B,loudest:v}=N,b=T||B||v?t.jsxs("div",{className:"flex flex-col gap-0 sm:gap-0.5",children:[T&&t.jsx(me,{content:h(T),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(kn,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-map-neighbor-color flex-shrink-0"}),t.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:T.name}),t.jsx("span",{className:"text-map-neighbor-color pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:T.blendedScore})]})}),B&&t.jsx(me,{content:y(B),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(as,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:B.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:B.listenerScore})]})}),v&&t.jsx(me,{content:C(v),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(Jn,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:v.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:v.loudScore})]})})]}):n.length===0?t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No routing data yet"});return t.jsx(le,{title:"Link Leaders",icon:t.jsx(ea,{className:"mini-widget-icon"}),isLoading:u,onClick:()=>e("/contacts"),children:b})}function so(e){return e<15?"excellent":e<30?"good":e<45?"fair":e<60?"congested":"critical"}function no(e){return e<15?"Clear channel":e<30?"Light traffic":e<45?"Moderate traffic":e<60?"Heavy traffic":e<75?"Congested":"Severe congestion"}function ao(){const{lbtStats:e,isLoading:n,error:o}=et(),s=e?Et(e):0,r=e?so(s):"unknown",a=(e==null?void 0:e.maxBackoffMs)??0,c=e?a>200?"Peak":no(s):void 0,i=e&&a>200?`${Math.round(a)}ms`:void 0,d=e==null?void 0:e.sparklineCollisionRisk,u=f.useMemo(()=>!d||d.length<2?[]:d.map((j,l)=>({timestamp:Date.now()-(d.length-1-l)*36e5,count:j})),[d]),m=Math.round(s*10)/10;return t.jsx(le,{title:"Collision Risk",icon:t.jsx(_n,{className:"mini-widget-icon"}),value:m,unit:"%",status:r,subtitle:c,subtitleValue:i,isLoading:n,error:o,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(ts,{data:u,width:9999,height:24,invertScale:!0,isLoading:n,className:"w-full"})})})}function oo(e){return e<30?"excellent":e<50?"good":e<70?"fair":e<90?"congested":"critical"}function ro(e){return e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function io(){var h,y;const[e,n]=f.useState(!1),[o]=f.useState(0),{stats:s,lbtStats:r,isLoading:a}=et(),c=((y=(h=s==null?void 0:s.config)==null?void 0:h.duty_cycle)==null?void 0:y.enforcement_enabled)??!1,i=f.useMemo(()=>{if(!s)return null;if(!c){const w=s.airtime_used_ms??0,b=s.max_airtime_ms??1,p=b>0?w/b*100:0;return{usedMs:w,maxMs:b,remainingMs:Math.max(0,b-w),utilizationPercent:p}}const C=s.airtime_used_ms??0,T=s.max_airtime_ms??1,B=s.airtime_remaining_ms??0,v=s.utilization_percent??(T>0?C/T*100:0);return{usedMs:C,maxMs:T,remainingMs:B,utilizationPercent:v}},[s,c]),d=f.useMemo(()=>{if(!r||r.totalPacketsWithLBT===0)return 100;const C=r.totalPacketsWithLBT-r.packetsWithRetries,T=r.totalPacketsWithLBT;return C/T*100},[r]),u=(i==null?void 0:i.utilizationPercent)??0,m=oo(u),j=(i==null?void 0:i.remainingMs)??0,l=d<95?"1st Try":"Remaining",x=d<95?`${d.toFixed(0)}%`:ro(j),N=i?t.jsx("div",{className:"mini-widget-progress mt-auto",children:t.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(u,100)}%`}})}):null;return t.jsx(le,{title:"Duty Cycle",icon:t.jsx(zt,{className:"mini-widget-icon"}),value:u.toFixed(1),unit:"%",status:m,subtitle:l,subtitleValue:x,isLoading:a,children:N})}function lo(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(Me,{className:"w-4 h-4"}),t.jsx(Me,{className:"h-3 w-16"})]}),t.jsx(Me,{className:"h-7 w-12 mt-2"}),t.jsx(Me,{className:"h-3 w-20 mt-2"})]})}function co(){return t.jsx("div",{className:"widget-row",children:Array.from({length:5}).map((e,n)=>t.jsx(lo,{},n))})}const fs=[{target:"MeshHealth",fn:"type",minStage:1}];pe(fs);function uo({className:e="",isLoaded:n,leading:o}){fe(fs);const s=Xt(),r=n??s??!0;return t.jsxs("div",{className:`mesh-health-container relative ${e}`,children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(Ys,{className:"w-4 h-4 text-sys-blue"}),t.jsx("span",{className:"type-label text-fg-muted",children:"MESH HEALTH"})]}),r?t.jsx(Ja,{children:t.jsxs("div",{className:"widget-row",children:[o&&t.jsx("div",{className:"widget-leading",children:o}),t.jsx(eo,{}),t.jsx(ao,{}),t.jsx(io,{}),t.jsx(to,{})]})}):t.jsx(co,{})]})}const ps=[{target:"PublicChannel",fn:"decrypt",minStage:2,when:yn}];pe(ps);let hs="",xs="",Ct="";function mo(){const e=new Date,n=e.toDateString();if(n!==Ct){Ct=n,hs=n;const o=new Date(e);o.setDate(o.getDate()-1),xs=o.toDateString()}}function fo(e){mo();const n=new Date(e*1e3).toDateString();return n===hs?"Today":n===xs?"Yesterday":new Date(e*1e3).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function po(e,n,o){return`${e||""}|${n}|${o}`}function ho(e,n){const o=e.message,s=n.message;return o.timestamp===s.timestamp&&o.text===s.text&&o.senderName===s.senderName&&o.channelHash===s.channelHash&&o.channelName===s.channelName&&e.isChannelSelected===n.isChannelSelected&&e.onChannelClick===n.onChannelClick}const xo=f.memo(function({message:n,onChannelClick:o,isChannelSelected:s}){const r=n.channelName||n.channelHash.slice(0,6);return t.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:t.jsx(Ln,{senderName:n.senderName||"Unknown",text:n.text,timestamp:n.timestamp,bubbleVariant:"subtle",nameAccessory:t.jsx(Qt,{channelName:r,active:s,onClick:()=>o==null?void 0:o(n.channelHash)})})})},ho);function go({open:e,onClose:n,messages:o,onLoadMore:s,hasMoreToLoad:r,isDecoding:a,initialChannel:c}){const i=f.useRef(null),d=f.useRef(!0),u=Ne(),m=Ut(),j=f.useRef(!1);f.useEffect(()=>{e?(j.current=!0,it.resume()):j.current&&it.pause()},[e]);const l=f.useMemo(()=>{const g=Date.now()/1e3,D=ee[u].minutes,P=g-D*60;return[...o].filter(R=>R.timestamp>=P).sort((R,L)=>R.timestamp-L.timestamp)},[o,u]),x=f.useCallback(()=>{const g=i.current;g&&(d.current=g.scrollTop>=-50)},[]),N=f.useMemo(()=>{const g=new Map;for(const D of l){const P=D.channelHash,R=g.get(P);R?R.count++:g.set(P,{name:D.channelName||D.channelHash.slice(0,6),hash:D.channelHash,count:1})}return Array.from(g.values()).sort((D,P)=>P.count-D.count)},[l]),h=N.length,[y,C]=f.useState(null),[T,B]=f.useState(!1);f.useEffect(()=>{e&&c&&C(c)},[e,c]);const v=f.useCallback(()=>{s(y,N)},[s,y,N]),w=f.useMemo(()=>y?l.filter(g=>g.channelHash===y):l,[l,y]),b=f.useMemo(()=>{const g=[];let D="";for(const P of w){const R=fo(P.timestamp);R!==D&&(g.push({type:"date",date:R}),D=R),g.push({type:"message",message:P})}return g},[w]);f.useLayoutEffect(()=>{const g=i.current;g&&d.current&&(g.scrollTop=0)},[w.length]);const p=19,_=N.slice(0,p),k=N.slice(p),A=k.length>0;return t.jsx(Vt,{open:e,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:t.jsxs(Yt,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[t.jsx("div",{className:"flex-shrink-0 px-4 sm:px-5 py-3 sm:py-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ss,{className:"size-5 text-icon-card-title flex-shrink-0"}),t.jsx("h2",{className:"type-micro",children:"Public Channels"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(es,{ranges:ee,selectedIndex:u,onSelect:m,size:"sm"}),t.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),t.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),t.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:h>0?void 0:0},children:h>0&&t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsxs("button",{onClick:()=>C(null),className:J("px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",y===null?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["All ",h]}),_.map(g=>t.jsx("button",{onClick:()=>C(g.hash),className:J("flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",y===g.hash?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:t.jsx("span",{className:"truncate max-w-[80px]",children:g.name})},g.hash)),A&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>B(!T),className:J("flex items-center gap-0.5 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",T||k.some(g=>g.hash===y)?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["+",k.length,t.jsx(tn,{className:J("size-3 transition-transform",T&&"rotate-180")})]}),T&&t.jsx("div",{className:J("absolute top-full left-0 mt-1 z-50","min-w-[140px] max-h-[200px] overflow-y-auto","p-1 rounded-lg","bg-elevated backdrop-blur-xl","ring-1 ring-edge-subtle shadow-xl"),children:k.map(g=>t.jsxs("button",{onClick:()=>{C(g.hash),B(!1)},className:J("w-full flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-all text-left",y===g.hash?"bg-sys-blue/20 text-sys-blue":"text-fg-secondary hover:bg-subtle-fill-strong"),children:[t.jsx($n,{className:"size-2.5 opacity-60 flex-shrink-0"}),t.jsx("span",{className:"truncate",children:g.name}),t.jsxs("span",{className:"opacity-60 ml-auto",children:["(",g.count,")"]})]},g.hash))})]})]})}),t.jsx("div",{ref:i,onScroll:x,className:J("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 radius-inner depth-stroke-inset","flex flex-col-reverse"),children:a&&w.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(Le,{className:"size-12 mb-4 text-sys-indigo animate-spin"}),t.jsx("p",{className:"text-lg font-medium",children:"Loading messages..."})]}):w.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(Fn,{className:"size-16 mb-4 opacity-20"}),t.jsx("p",{className:"text-lg font-medium",children:"No messages yet"}),t.jsx("p",{className:"text-sm mt-1 opacity-70",children:y?"No messages in this channel":"Public channel messages will appear here"})]}):t.jsxs("div",{className:"px-4 py-4",children:[r&&t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("button",{onClick:v,disabled:a,className:J("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",a?"bg-subtle-fill text-fg-muted ring-edge-subtle cursor-wait":"bg-sys-blue/10 text-sys-blue ring-sys-blue/20 hover:bg-sys-blue/20 hover:ring-sys-blue/30"),children:a?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(Le,{className:"size-3 animate-spin"}),"Loading..."]}):"Load older messages"})}),b.map((g,D)=>{if(g.type==="date")return t.jsx("div",{className:"flex justify-center my-4",children:t.jsx("span",{className:J("px-3.5 py-1.5 rounded-full","bg-subtle-fill backdrop-blur-sm","text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:g.date})},`date-${g.date}-${D}`);const P=`msg-${g.message.timestamp}-${g.message.senderName||"anon"}-${g.message.channelHash}`;return t.jsx("div",{children:t.jsx(xo,{message:g.message,onChannelClick:C,isChannelSelected:y===g.message.channelHash})},P)})]})}),t.jsx("div",{className:"flex-shrink-0 px-5 py-2 text-center",children:t.jsxs("p",{className:"text-[11px] text-fg-muted",children:[w.length," messages · ",h," ",h===1?"channel":"channels",a&&t.jsxs("span",{className:"ml-2 text-sys-indigo",children:[t.jsx(Le,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})})}function yo(e){const n=[],o=new Set;for(const s of e.values()){const r=s.decoded;if(!r||!r.decrypted||r.macCorrupted||!r.text)continue;const a=po(r.senderName,r.channelHash,r.text);o.has(a)||(o.add(a),n.push({timestamp:s.timestamp,channelName:r.channelName,channelHash:r.channelHash,senderName:r.senderName,text:r.text,rssi:s.rssi,snr:s.snr}))}return n}function bo({isLoaded:e}){const n=Xt(),o=e??n??!0;fe(ps);const s=we(),[r,a]=f.useState(!1),[c,i]=f.useState(null),d=Ne(),u=f.useCallback(()=>{i(null),a(!0),Ce.getState().queueDecryption(s)},[s]),m=Je(_=>_.requestedHash),j=Je(_=>_.clearRequest);f.useEffect(()=>{m&&(i(m),a(!0),Ce.getState().queueDecryption(s),j())},[m,j,s]);const l=Js(),x=Zs(),N=Ks(),h=f.useMemo(()=>yo(l),[l]),y=f.useMemo(()=>{const _=Date.now()/1e3,k=ee[d].minutes,A=_-k*60;return h.filter(g=>g.timestamp>=A)},[h,d]),C=f.useMemo(()=>y.length===0?null:y.reduce((_,k)=>k.timestamp>_.timestamp?k:_),[y]),T=x.isDecoding,v=f.useMemo(()=>{const _=Date.now()/1e3,k=ee[d].minutes,A=_-k*60,g=new Set;let D=0;for(const P of s)(P.type??P.payload_type)===rt.GRP_TXT&&((P.timestamp??0){const _=Date.now()/1e3,k=ee[d].minutes,A=_-k*60;for(const g of s)if((g.type??g.payload_type)===rt.GRP_TXT&&!((g.timestamp??0){if(!T){if(_){const A=k.find(g=>g.hash===_);if(A){Ce.getState().queueChannelDecryption(s,A.name);return}}Ce.getState().queueDecryption(s)}},[s,T]);return o?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:u,className:J("group cursor-pointer rounded-2xl transition-all duration-150","bg-surface/80 backdrop-blur-lg depth-raised","hover:bg-subtle-fill","px-3 py-2.5 sm:px-4 sm:py-3"),children:t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[t.jsx(ss,{className:"size-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),v>0&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary",children:v}),t.jsx(mt,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors ml-auto sm:hidden"})]}),t.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5 min-w-0 overflow-hidden",children:[t.jsx(Ke,{mode:"wait",initial:!1,children:C?t.jsxs(ge.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.2,ease:[.4,0,.2,1]},className:"flex items-center gap-2 sm:gap-1.5 min-w-0",children:[C.channelName&&t.jsx("span",{className:"hidden sm:inline-flex",children:t.jsx(Qt,{channelName:C.channelName})}),t.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] clay-avatar",style:{"--avatar-color":Rn(He(C.senderName||"").cleanName)},children:He(C.senderName||"").emoji?t.jsx("span",{className:"text-base",children:He(C.senderName||"").emoji}):t.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:An(C.senderName||"")})}),t.jsx("div",{className:"inline-flex items-center px-3 py-1.5 rounded-2xl rounded-tr-md bg-[#007AFF] shadow-sm min-w-0 flex-1 sm:flex-initial sm:max-w-xs sm:-ml-px",children:t.jsx("span",{className:"text-sm text-white truncate tracking-wide",children:Pn(C.text,{isOutgoing:!0})})}),t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary flex-shrink-0",children:en(C.timestamp)})]},`msg-${C.timestamp}-${C.senderName}-${C.channelHash}`):N?t.jsx(ge.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-fg-muted italic",children:"No messages yet"},"empty"):t.jsxs(ge.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:-16},transition:{duration:.15},className:"flex items-center gap-2 sm:gap-1.5",children:[t.jsx("div",{className:"hidden sm:block w-8 h-4 rounded bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"hidden sm:block w-[30px] h-[30px] rounded-full bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"h-8 w-32 sm:w-48 rounded-2xl bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"w-12 h-6 rounded-md bg-subtle-fill-strong animate-pulse"})]},"skeleton")}),t.jsx(mt,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),t.jsx(go,{open:r,onClose:()=>a(!1),messages:h,onLoadMore:p,hasMoreToLoad:b,isDecoding:T,initialChannel:c})]}):t.jsx("div",{className:"h-14 rounded-xl bg-elevated/50 animate-pulse"})}const q=2,jo=2,De=5,Re=4,be=20,We=Qe(Y.cyan),qe=Qe(Y.amber),Xe=Qe(Y.red);function tt(e,n,o){const s=o.length;if(s===0)return null;let r=0,a=0;for(let w=0;wr&&(r=b);const p=o[w].newlyGuarded.length;p>a&&(a=p)}if(r===0&&a===0)return null;const c=Math.max(1,De-a),i=r>0?Math.max(1,Math.ceil(r/c)):1,d=e-Re*2,u=n-Re*2,m=(d-q*(be-1))/be,j=(u-q*(De-1))/De,l=Math.max(3,Math.min(m,j)),x=l+q,N=s,h=0,y=be*x-q,C=Re+(d-y)/2,T=De*x-q,B=Re+(u-T),v=Math.min(jo,l/3);return{quantum:i,tileSize:l,colStep:x,visibleCols:N,startIdx:h,offsetX:C,offsetY:B,gridH:T,r:v}}function wo(e,n,o,s,r){e.clearRect(0,0,o*(window.devicePixelRatio||1),s*(window.devicePixelRatio||1));const a=tt(o,s,n);if(a)for(let c=0;c0?(h=a.offsetY+a.gridH-d*a.colStep+q,y=d*a.colStep-q):N==="dropped"&&u>0?(h=a.offsetY+a.gridH-(d+u)*a.colStep+q,y=u*a.colStep-q):N==="guarded"&&m>0&&(h=a.offsetY+a.gridH-j*a.colStep+q,y=m*a.colStep-q),y>0&&(e.beginPath(),e.roundRect(l-1,h-1,a.tileSize+2,y+2,a.r+1),e.stroke()),e.restore()}}}function No(e,n,o,s,r){const a=tt(o,s,r);if(!a)return null;const c=Math.floor((e-a.offsetX+q/2)/a.colStep);if(c<0||c>=a.visibleCols)return null;const i=r[a.startIdx+c],d=Math.ceil(i.allowedDelta/a.quantum),u=Math.ceil(i.droppedDelta/a.quantum),m=i.newlyGuarded.length,j=d+u+m;if(j===0)return null;const l=a.offsetX+c*a.colStep;if(el+a.tileSize)return null;const x=a.offsetY+a.gridH,N=x-d*a.colStep+q,h=x-(d+u)*a.colStep+q,y=x-j*a.colStep+q;return m>0&&n>=y&&n0&&n>=h&&n0&&n>=N&&n<=x?{col:c,segment:"allowed"}:null}function Ue(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}const de=5;function vo(e){if(e<60)return`${Math.round(e)}s`;if(e<3600)return`${Math.floor(e/60)}m`;const n=Math.floor(e/3600),o=Math.floor(e%3600/60);return o>0?`${n}h ${o}m`:`${n}h`}function ko(e,n,o,s){const r=e.allowedDelta+e.droppedDelta;if(n==="allowed")return t.jsxs("div",{className:"min-w-[120px] space-y-1",children:[t.jsx("div",{className:"text-[10px] text-fg-muted tabular-nums",children:Ue(e.ts)}),t.jsxs("div",{className:"text-xs tabular-nums",children:[t.jsx("span",{className:"text-sys-cyan font-medium",children:e.allowedDelta}),t.jsx("span",{className:"text-fg-muted",children:" adverts allowed"})]}),e.trackedCount>0&&t.jsxs("div",{className:"text-[10px] text-fg-muted tabular-nums",children:[e.trackedCount," sources tracked"]}),r>0&&t.jsxs("div",{className:"text-[10px] text-fg-muted tabular-nums",children:[Math.round(e.allowedDelta/r*100),"% of traffic"]})]});if(n==="dropped"){const a=r>0?Math.round(e.droppedDelta/r*100):0,c=a-o;return t.jsxs("div",{className:"min-w-[140px] max-w-[240px] space-y-1",children:[t.jsx("div",{className:"text-[10px] text-fg-muted tabular-nums",children:Ue(e.ts)}),t.jsxs("div",{className:"text-xs tabular-nums",children:[t.jsx("span",{className:"text-sys-amber font-medium",children:e.droppedDelta}),t.jsx("span",{className:"text-fg-muted",children:" adverts dropped"})]}),r>0&&t.jsxs("div",{className:"text-[10px] tabular-nums",children:[t.jsxs("span",{className:a>50?"text-sys-amber":"text-fg-muted",children:[a,"% drop rate"]}),Math.abs(c)>=5&&t.jsxs("span",{className:c>0?"text-sys-amber":"text-sys-cyan",children:[" ","(",c>0?"+":"",c,"% vs avg)"]})]}),e.drops.length>0&&t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:[e.drops.slice(0,de).map((i,d)=>t.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[t.jsx("span",{className:"font-mono truncate",children:i.name||i.pubkey.slice(0,8)}),t.jsx("span",{className:"text-fg-muted text-[10px] truncate flex-shrink-0 max-w-[100px]",children:i.reason})]},`${i.pubkey}-${d}`)),e.drops.length>de&&t.jsxs("div",{className:"text-[10px] text-fg-muted",children:["+",e.drops.length-de," more"]})]})]})}return t.jsxs("div",{className:"min-w-[140px] max-w-[220px] space-y-1",children:[t.jsx("div",{className:"text-[10px] text-fg-muted tabular-nums",children:Ue(e.ts)}),t.jsxs("div",{className:"text-xs text-sys-red font-medium",children:[e.newlyGuarded.length," newly guarded"]}),e.newlyGuarded.length>0&&t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:[e.newlyGuarded.slice(0,de).map(a=>t.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[t.jsx("span",{className:"font-mono truncate",children:s(a.pubkey)}),t.jsx("span",{className:"text-fg-muted tabular-nums flex-shrink-0",children:vo(a.remaining)})]},a.pubkey)),e.newlyGuarded.length>de&&t.jsxs("div",{className:"text-[10px] text-fg-muted",children:["+",e.newlyGuarded.length-de," more"]})]})]})}function Mo(e){if(e.length<=be)return e;const n=Math.ceil(e.length/be),o=[];for(let s=0;sMo(n),[n]),s=f.useRef(null),r=f.useRef(null),{show:a,hide:c,updatePosition:i}=nn(),d=f.useRef(!1),u=f.useRef(null),m=ie(),j=an(),[l,x]=f.useState(!1),N=(g=(A=m==null?void 0:m.config)==null?void 0:A.repeater)==null?void 0:g.advert_rate_limit,h=(P=(D=m==null?void 0:m.config)==null?void 0:D.repeater)==null?void 0:P.advert_penalty_box,y=(L=(R=m==null?void 0:m.config)==null?void 0:R.repeater)==null?void 0:L.advert_adaptive,C=(e==null?void 0:e.stats.adverts_allowed)??0,T=(e==null?void 0:e.stats.adverts_dropped)??0,B=f.useMemo(()=>{const S=new Set;for(const F of o)for(const M of F.newlyGuarded)S.add(M.pubkey);return S.size},[o]),v=f.useMemo(()=>{const S=new Map;for(const M of(e==null?void 0:e.recent_drops)??[])M.name&&S.set(M.pubkey,M.name);const F=(m==null?void 0:m.neighbors)??{};for(const[M,$]of Object.entries(F))if(!S.has(M)){const E=$.name||$.node_name;E&&S.set(M,E)}return M=>S.get(M)||M.slice(0,8)},[e==null?void 0:e.recent_drops,m==null?void 0:m.neighbors]),w=f.useMemo(()=>{let S=0,F=0;for(const $ of o)S+=$.allowedDelta,F+=$.droppedDelta;const M=S+F;return M>0?Math.round(F/M*100):0},[o]),b="10m",p=f.useCallback(()=>{const S=s.current,F=r.current;if(!S||!F)return;const M=F.getBoundingClientRect(),$=window.devicePixelRatio||1,E=Math.floor(M.width),W=Math.floor(M.height);if(E===0||W===0)return;S.width=E*$,S.height=W*$,S.style.width=`${E}px`,S.style.height=`${W}px`;const I=S.getContext("2d");I&&(I.scale($,$),wo(I,o,E,W,u.current))},[o]);f.useEffect(()=>{p();const S=new ResizeObserver(()=>p());return r.current&&S.observe(r.current),()=>S.disconnect()},[p]);const _=f.useCallback(S=>{const F=r.current;if(!F||o.length===0)return;const M=F.getBoundingClientRect(),$=Math.floor(M.width),E=Math.floor(M.height),W=S.clientX-M.left,I=S.clientY-M.top,O=No(W,I,$,E,o);if(!O){u.current&&(u.current=null,p()),d.current&&(d.current=!1,c());return}const z=u.current;(!z||z.col!==O.col||z.segment!==O.segment)&&(u.current=O,p());const G=tt($,E,o);if(!G)return;const H=o[G.startIdx+O.col],U=ko(H,O.segment,w,v);d.current?i(S.clientX,S.clientY):d.current=!0,a(U,S.clientX,S.clientY)},[o,w,v,a,c,i,p]),k=f.useCallback(()=>{u.current&&(u.current=null,p()),d.current&&(d.current=!1,c())},[c,p]);return t.jsxs(je,{noPadding:!0,isLoaded:!0,className:"mini-widget overflow-hidden flex flex-col",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(En,{className:"mini-widget-icon"}),t.jsx("span",{className:"mini-widget-title",children:"Advert Decisions"}),t.jsx(ne,{color:"zinc",children:b})]}),t.jsx("div",{ref:r,className:"h-28 mx-2 overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",onMouseMove:_,onMouseLeave:k,children:o.length>0?t.jsx("canvas",{ref:s,className:"block w-full h-full"}):t.jsx("div",{className:"flex items-center justify-center w-full h-full text-xs text-fg-muted",children:"Waiting for data…"})}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-3 sm:gap-x-4 gap-y-1 px-3 py-2.5 type-data-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"shrink-0 w-3 h-3 rounded-xs bg-sys-cyan"}),t.jsx("span",{className:"text-fg-secondary uppercase tracking-wide whitespace-nowrap",children:"Allow"}),t.jsx("span",{className:"tabular-nums text-fg-muted shrink-0",children:t.jsx(re,{value:C,priority:"low"})})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"shrink-0 w-3 h-3 rounded-xs bg-sys-amber"}),t.jsx("span",{className:"text-fg-secondary uppercase tracking-wide whitespace-nowrap",children:"Drop"}),t.jsx("span",{className:"tabular-nums text-fg-muted shrink-0",children:t.jsx(re,{value:T,priority:"low"})})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"shrink-0 w-3 h-3 rounded-xs bg-sys-red"}),t.jsx("span",{className:"text-fg-secondary uppercase tracking-wide whitespace-nowrap",children:"In Jail"}),t.jsx("span",{className:"tabular-nums text-fg-muted shrink-0",children:B})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"shrink-0 w-3 h-3 rounded-xs bg-zinc-500/30"}),t.jsx("span",{className:"text-fg-secondary uppercase tracking-wide whitespace-nowrap",children:"Tracked"}),t.jsx("span",{className:"tabular-nums text-fg-muted shrink-0",children:(e==null?void 0:e.tracked_pubkeys)??0})]})]}),t.jsx("div",{className:"mt-auto px-2 pb-2",children:t.jsxs($e,{color:"primary",outline:!0,className:"w-full justify-center",onClick:()=>x(!0),children:[t.jsx(In,{"data-slot":"icon"}),"Adapt"]})}),t.jsx(Bn,{open:l,onClose:()=>x(!1),currentConfig:{tokenBucket:N,penaltyBox:h,adaptive:y},onApplied:async()=>{await j({force:!0}).catch(()=>{})}})]})}const To=f.memo(Co);function So(e){if(e<60)return`${Math.round(e)}s`;if(e<3600)return`${Math.floor(e/60)}m`;const n=Math.floor(e/3600),o=Math.floor(e%3600/60);return o>0?`${n}h ${o}m`:`${n}h`}function _o(){const e=ve(),n=ie();return{all:f.useMemo(()=>{if(!(e!=null&&e.active_penalties))return[];const s=new Map;for(const i of e.recent_drops??[])i.name&&s.set(i.pubkey,i.name);const r=(n==null?void 0:n.neighbors)??{};for(const[i,d]of Object.entries(r))if(!s.has(i)){const u=d.name||d.node_name;u&&s.set(i,u)}const a=new Map,c=new Map;for(const i of e.recent_drops??[])a.has(i.pubkey)||a.set(i.pubkey,i.reason),c.set(i.pubkey,(c.get(i.pubkey)??0)+1);return Object.entries(e.active_penalties).sort(([,i],[,d])=>d-i).map(([i,d])=>({pubkey:i,name:s.get(i)||i.slice(0,8),remaining:d,reason:a.get(i),dropCount:c.get(i)??0}))},[e,n==null?void 0:n.neighbors]),isLoading:!e,penaltyCount:e?Object.keys(e.active_penalties??{}).length:0}}function gs({offender:e,rank:n}){const o=n===0;return t.jsx(me,{content:t.jsxs("div",{className:"max-w-[260px]",children:[t.jsx("div",{className:"font-semibold mb-1",children:e.name}),t.jsx("div",{className:"text-fg-muted text-xs font-mono mb-1",children:e.pubkey}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5 text-xs",children:[t.jsxs("div",{children:["Penalty: ",So(e.remaining)," remaining"]}),e.reason&&t.jsxs("div",{children:["Reason: ",e.reason]}),t.jsxs("div",{children:["Recent drops: ",e.dropCount]})]})]}),children:t.jsx("div",{className:"text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:t.jsx("span",{className:`font-mono truncate ${o?"font-semibold text-sys-red":"text-fg-muted"}`,children:e.name})})})}function Bo({open:e,onClose:n,offenders:o}){return t.jsxs(Vt,{open:e,onClose:n,size:"sm",children:[t.jsx(on,{icon:t.jsx(os,{size:20}),title:`Jail (${o.length})`,onClose:n}),t.jsx(Yt,{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:o.length===0?t.jsx("div",{className:"text-center text-sm text-fg-muted py-4",children:"No active penalties"}):o.map(s=>t.jsx(gs,{offender:s},s.pubkey))})]})}function Do(){const{all:e,isLoading:n,penaltyCount:o}=_o(),s=ve(),[r,a]=f.useState(!1),c=f.useCallback(()=>a(!0),[]),i=f.useCallback(()=>a(!1),[]),d=e.slice(0,3),u=(s==null?void 0:s.recent_drops)??[],m=o===0&&u.length>0&&!n,j=u.slice(0,3);return t.jsxs(t.Fragment,{children:[t.jsxs(le,{title:"Most Wanted",icon:t.jsx(os,{className:"mini-widget-icon"}),isLoading:n,isLoaded:!0,children:[d.length>0?t.jsx("div",{className:"flex flex-col gap-0 sm:gap-0.5",children:d.map((l,x)=>t.jsx(gs,{offender:l,rank:x},l.pubkey))}):m?t.jsx("div",{className:"flex flex-col gap-0 sm:gap-0.5",children:j.map((l,x)=>t.jsx(me,{content:t.jsxs("div",{className:"max-w-[260px]",children:[t.jsx("div",{className:"font-semibold mb-1",children:l.name||l.pubkey}),t.jsx("div",{className:"text-fg-muted text-xs font-mono mb-1",children:l.pubkey}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 text-xs",children:[t.jsxs("div",{children:["Reason: ",l.reason]}),t.jsxs("div",{children:[Math.round(l.seconds_ago),"s ago"]})]})]}),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx("span",{className:`font-mono truncate flex-1 min-w-0 ${x===0?"font-semibold text-sys-amber":"text-fg-muted"}`,children:l.name||l.pubkey.slice(0,8)}),t.jsx("span",{className:`pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right truncate ${x===0?"text-sys-amber":"text-fg-muted"}`,children:l.reason.replace(/^Token bucket: /,"").replace(/^Penalty: /,"")})]})},l.pubkey))}):o===0&&!n?t.jsx("div",{className:"flex items-center justify-center text-xs text-fg-muted mt-auto",children:"No active penalties"}):null,o>0?t.jsxs("div",{className:"flex items-center mt-auto pt-0.5",children:[t.jsxs("span",{className:"text-[10px] text-fg-muted tabular-nums",children:[o," in jail"]}),o>3&&t.jsx($e,{plain:!0,className:"ml-auto text-[10px] text-sys-blue hover:underline",onClick:c,children:"Show All"})]}):m?t.jsx("div",{className:"flex items-center mt-auto pt-0.5",children:t.jsxs("span",{className:"text-[10px] text-sys-amber tabular-nums",children:[u.length," recent drop",u.length!==1?"s":""]})}):null]}),t.jsx(Bo,{open:r,onClose:i,offenders:e})]})}const Tt=[{key:"quiet",color:Y.green,label:"Quiet"},{key:"normal",color:Y.blue,label:"Normal"},{key:"busy",color:Y.amber,label:"Busy"},{key:"congested",color:Y.red,label:"Congested"}],St={quiet:"text-sys-green",normal:"text-sys-blue",busy:"text-sys-amber",congested:"text-sys-red"},_t=2,Ro=4;function Ao(e,n,o,s){const{quietMax:r,normalMax:a,busyMax:c,ewmaValue:i}=n;e.clearRect(0,0,o,s);const d=Math.max(c*2,i*1.3,c+.5),u=_t*3,m=o-u,j=[{start:0,end:r,color:Y.green},{start:r,end:a,color:Y.blue},{start:a,end:c,color:Y.amber},{start:c,end:d,color:Y.red}],l=[];let x=0;for(const k of j){const A=(k.end-k.start)/d*m;l.push({...k,px:x,pw:A}),x+=A+_t}const N=8,h=N,y=s-N-2;for(const k of l)e.fillStyle=k.color,e.globalAlpha=1,e.beginPath(),e.roundRect(k.px,h,k.pw,y,Ro),e.fill();function C(k){const A=Math.max(0,Math.min(k,d));for(const D of l)if(A<=D.end){const P=D.end>D.start?(A-D.start)/(D.end-D.start):0;return D.px+P*D.pw}const g=l[l.length-1];return g.px+g.pw}const T=C(i),B=4,v=4,w=h-1,b=h+y+1,p=lt[900],_=lt[200];e.fillStyle=p,e.beginPath(),e.moveTo(T-v,w-B),e.lineTo(T+v,w-B),e.lineTo(T,w),e.closePath(),e.fill(),e.fillStyle=_,e.beginPath(),e.moveTo(T-(v-1),w-B+.5),e.lineTo(T+(v-1),w-B+.5),e.lineTo(T,w-.5),e.closePath(),e.fill();for(const[k,A]of[[p,-1],[_,0],[p,1]])e.strokeStyle=k,e.lineWidth=1,e.beginPath(),e.moveTo(T+A,w),e.lineTo(T+A,b),e.stroke()}const Ae={stiffness:120,damping:20,mass:.8};function Po(){var g,D,P,R,L,S,F;const e=ve(),n=Jt(),o=Zt(),s=rn(),r=ie(),a=f.useRef(null),c=f.useRef(null),i=(D=(g=r==null?void 0:r.config)==null?void 0:g.repeater)==null?void 0:D.advert_adaptive,d=(e==null?void 0:e.adaptive.current_tier)??"normal",u=e==null?void 0:e.adaptive.pending_tier,m=!!u&&u!==d,j=((P=i==null?void 0:i.thresholds)==null?void 0:P.quiet_max)??.05,l=((R=i==null?void 0:i.thresholds)==null?void 0:R.normal_max)??.2,x=((L=i==null?void 0:i.thresholds)==null?void 0:L.busy_max)??.5,N=ue(s),h=Se(N,Ae),y=ue(j),C=ue(l),T=ue(x),B=Se(y,Ae),v=Se(C,Ae),w=Se(T,Ae);f.useEffect(()=>{N.set(s)},[s,N]),f.useEffect(()=>{y.set(j)},[j,y]),f.useEffect(()=>{C.set(l)},[l,C]),f.useEffect(()=>{T.set(x)},[x,T]);const b=f.useCallback(()=>{const M=a.current,$=c.current;if(!M||!$)return;const E=$.getBoundingClientRect(),W=window.devicePixelRatio||1,I=Math.floor(E.width),O=Math.floor(E.height);if(I===0||O===0)return;M.width=I*W,M.height=O*W,M.style.width=`${I}px`,M.style.height=`${O}px`;const z=M.getContext("2d");z&&(z.scale(W,W),Ao(z,{quietMax:B.get(),normalMax:v.get(),busyMax:w.get(),ewmaValue:h.get()},I,O))},[B,v,w,h]);f.useEffect(()=>{const M=[h.on("change",()=>b()),B.on("change",()=>b()),v.on("change",()=>b()),w.on("change",()=>b())];return()=>M.forEach($=>$())},[h,B,v,w,b]),f.useEffect(()=>{b();const M=new ResizeObserver(()=>b());return c.current&&M.observe(c.current),()=>M.disconnect()},[b]);const p=((S=Tt.find(M=>M.key===d))==null?void 0:S.label)??d,_=St[d]??"text-fg-muted",k=!e&&!o,A=o&&!n;return t.jsxs(le,{title:"Adaptive Tier",icon:t.jsx(ln,{className:"mini-widget-icon"}),isLoading:k,isLoaded:!0,error:A?"Adaptive tier data unavailable":null,headerRight:t.jsxs("span",{className:"text-[10px] text-fg-muted tabular-nums",children:[t.jsx("span",{className:"data-box data-box-compact",children:s.toFixed(2)}),t.jsx("span",{className:"ml-0.5 text-fg-muted/60",children:"adv/min"})]}),children:[t.jsx("div",{ref:c,className:"w-full h-8 sm:h-10 md:h-12",children:t.jsx("canvas",{ref:a,className:"block w-full h-full"})}),t.jsxs("div",{className:J("data-box data-box-fill text-center font-semibold uppercase tracking-wide mt-1",_),children:[p,m&&t.jsxs("span",{className:J("ml-1.5 text-[10px] font-normal animate-pulse",St[u]??"text-fg-muted"),children:["→ ",((F=Tt.find(M=>M.key===u))==null?void 0:F.label)??u]})]})]})}const Lo=f.memo(Po);function Bt(e){if(e<60)return`${e}s`;if(e<3600){const s=Math.floor(e/60),r=e%60;return r>0?`${s}m ${r}s`:`${s}m`}const n=Math.floor(e/3600),o=Math.floor(e%3600/60);return o>0?`${n}h ${o}m`:`${n}h`}function $o(){var l;const e=ve(),n=((e==null?void 0:e.stats.drop_rate)??0)*100,o=(e==null?void 0:e.stats.adverts_allowed)??0,s=(e==null?void 0:e.stats.adverts_dropped)??0,r=(e==null?void 0:e.tracked_pubkeys)??0,a=(e==null?void 0:e.effective_limits)??null,c=((l=e==null?void 0:e.metrics)==null?void 0:l.duplicate_ratio_ewma)??0,i=(e==null?void 0:e.stats.adverts_duplicate_reheard)??0,d=o+s,u=d>0?o/d*100:100,m=!e,j=d>0?s/d*100:0;return t.jsx(le,{title:"Drop Rate",icon:t.jsx(ns,{className:"mini-widget-icon"}),value:Math.round(n),unit:"%",isLoading:m,isLoaded:!0,headerRight:t.jsxs("span",{className:"text-[10px] text-fg-muted tabular-nums",children:["Tracked ",t.jsx("span",{className:"data-box data-box-compact ml-0.5",children:r})]}),children:d>0&&t.jsx(me,{content:t.jsxs("div",{className:"min-w-[140px] space-y-1",children:[t.jsx("div",{className:"text-xs text-fg-secondary font-medium",children:"Effective Limits"}),a?t.jsxs("div",{className:"space-y-0.5 text-[10px] tabular-nums",children:[t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsx("span",{className:"text-fg-muted",children:"Bucket"}),t.jsxs("span",{children:[a.bucket_capacity," tokens"]})]}),t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsx("span",{className:"text-fg-muted",children:"Refill"}),t.jsxs("span",{children:[a.refill_tokens," / ",Bt(a.refill_interval_seconds)]})]}),a.min_interval_seconds>0&&t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsx("span",{className:"text-fg-muted",children:"Min interval"}),t.jsx("span",{children:Bt(a.min_interval_seconds)})]})]}):t.jsx("div",{className:"text-[10px] text-fg-muted",children:"Limits not available"}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5 text-[10px] tabular-nums",children:[t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsx("span",{className:"text-fg-muted",children:"Tracked"}),t.jsxs("span",{children:[r," pubkey",r!==1?"s":""]})]}),i>0&&t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsx("span",{className:"text-fg-muted",children:"Deduped"}),t.jsxs("span",{children:[i.toLocaleString()," (",Math.round(c*100),"%)"]})]})]})]}),children:t.jsxs("div",{className:"w-full mt-auto cursor-default",children:[t.jsxs("div",{className:"flex h-1.5 gap-0.5",children:[t.jsx("div",{className:"h-full rounded-full bg-sys-cyan transition-all duration-500",style:{width:`${u}%`}}),t.jsx("div",{className:"h-full rounded-full bg-sys-red transition-all duration-500",style:{width:`${j}%`}})]}),t.jsxs("div",{className:"flex justify-between mt-0.5",children:[t.jsx("span",{className:"type-data-xs text-sys-cyan/70 tabular-nums",children:o.toLocaleString()}),t.jsx("span",{className:"type-data-xs text-sys-red/70 tabular-nums",children:s.toLocaleString()})]})]})})})}const Fo="/assets/spam-can-JZXwgFOy.svg",Eo=1376,Ve=768,Io=[{x:0,w:280,stretch:!1},{x:280,w:4,stretch:!0},{x:284,w:808,stretch:!1},{x:1092,w:4,stretch:!0},{x:1096,w:280,stretch:!1}];function Ho(){return t.jsx("div",{className:"relative h-full w-full overflow-hidden rounded-[var(--radius-card)]",children:t.jsx("div",{className:"absolute inset-0 flex","data-spam-can":!0,children:Io.map(({x:e,w:n,stretch:o})=>t.jsx("svg",{viewBox:`${e} 0 ${n} ${Ve}`,preserveAspectRatio:"none",style:o?{height:"100%",flex:"1 1 0",minWidth:0}:{height:"100%",aspectRatio:`${n} / ${Ve}`,flexShrink:0},children:t.jsx("image",{href:Fo,width:Eo,height:Ve})},e))})})}const zo=f.memo(Ho);function Oo(){const e=Jt();return!Zt()||!e?null:t.jsxs("div",{className:"mesh-health-container relative",children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(Un,{className:"w-4 h-4 text-sys-blue"}),t.jsx("span",{className:"type-label text-fg-muted",children:"SPAMGUARD"})]}),t.jsxs("div",{className:"widget-row",children:[t.jsx("div",{className:"widget-leading",children:t.jsx(To,{})}),t.jsx(Lo,{}),t.jsx($o,{}),t.jsx(Do,{}),t.jsx(zo,{})]})]})}function Dr(){var g,D,P;const e=ie(),n=cn(),o=dn(),s=ga(),r=f.useRef(!1);o&&!r.current&&(r.current=!0);const a=r.current,c=Ne(),i=Ut(),d=un(),u=ee[c]??ee[4],m=d.isBackgroundLoading&&c>=5,[j,l]=f.useState([]),[x,N]=f.useState(0),[h,y]=f.useState(()=>localStorage.getItem("rx-crc-overlay")==="true"),C=f.useCallback(()=>{y(R=>{const L=!R;return localStorage.setItem("rx-crc-overlay",String(L)),L})},[]),[T,B]=f.useState(()=>localStorage.getItem("rx-analytics-view")==="true"),v=f.useCallback(R=>{B(R),localStorage.setItem("rx-analytics-view",String(R))},[]);f.useEffect(()=>{const R=u.minutes/60;Promise.all([Wt(R),Gt(R,5e4)]).then(([L,S])=>{var F,M;N((L.success&&((F=L.data)==null?void 0:F.count)!=null?L.data.count:S.success&&((M=S.data)==null?void 0:M.count)!=null?S.data.count:0)??0),l(S.success&&S.data?S.data.history:[])})},[u.minutes]);const w=f.useMemo(()=>{const R=O=>(O==null?void 0:O.reduce((z,G)=>z+G.count,0))??0,L=R(s==null?void 0:s.received),S=R(s==null?void 0:s.unique_received),F=R(s==null?void 0:s.forwarded),M=R(s==null?void 0:s.dropped),$=R(s==null?void 0:s.transmitted),E=((s==null?void 0:s.time_range_minutes)??u.minutes)/60,W=E>0?Math.round(L/E):0,I=E>0?Math.round(F/E):0;return{received:L,uniqueReceived:S,forwarded:F,dropped:M,transmitted:$,rxPerHour:W,fwdPerHour:I}},[s,u.minutes]),b=f.useMemo(()=>s?{totalBytes:s.totalReceivedBytes,kbPerHour:s.kbPerHour}:{totalBytes:0,kbPerHour:0},[s]),p=f.useMemo(()=>{if(!s)return[];const{receivedBytesBuckets:R,start_time:L,bucket_duration_seconds:S,bucket_count:F}=s,M=new Array(F).fill(0);for(const $ of j){let E=Math.floor(($.timestamp-L)/S);E<0&&(E=0),!(E>=F)&&M[E]++}return R.map(($,E)=>({start:$.start,end:$.end,bytesByType:{...$.countByType,...h&&M[E]>0?{[Q]:M[E]}:{}},totalBytes:$.totalCount}))},[s,j,h]),_=f.useMemo(()=>{if(!s)return[];const{receivedCountByType:R}=s,L=Object.keys(R).map(S=>parseInt(S,10)).filter(S=>(R[S]??0)>0).sort((S,F)=>(R[F]??0)-(R[S]??0));return h&&x>0&&L.unshift(Q),L},[s,x,h]),k=f.useMemo(()=>{if(!s)return{};const R={...s.receivedCountByType??{}};return h&&x>0&&(R[Q]=x),R},[s,x,h]),A=(e==null?void 0:e.node_name)??((g=e==null?void 0:e.config)==null?void 0:g.node_name)??"Unknown Node";return f.useEffect(()=>{A&&A!=="Unknown Node"&&(document.title=`pyMC: ${A}`)},[A]),n?t.jsxs(dt,{neomorphic:!0,className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-fg-muted",children:n}),t.jsx("p",{className:"type-data-sm text-fg-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(mn,{children:[t.jsx(fn,{title:A,icon:t.jsx(Hn,{}),subtitle:t.jsx(Tn,{}),controls:t.jsx(es,{ranges:ee,selectedIndex:c,onSelect:i,isPending:m})}),t.jsxs(pn,{ready:a,children:[t.jsx(bo,{}),t.jsx(ft,{template:"hero-auto",children:t.jsxs(dt,{neomorphic:!0,children:[t.jsx(It,{icon:t.jsx(ns,{}),title:"PACKETS RECEIVED",badge:u.label,badgeColor:"zinc",titleExtra:t.jsx(Ht,{enabled:T,onChange:v,size:"sm",label:t.jsx("span",{className:"font-mono text-xs text-fg-muted uppercase tracking-wide",children:"Advanced"})}),actions:a?t.jsx("div",{className:"flex items-center gap-1.5",children:T?t.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"CRC errors — packets corrupted during radio transmission",children:[t.jsx(ct,{className:"w-3.5 h-3.5 text-sys-red"}),t.jsxs("span",{children:["CRC ",x.toLocaleString()]})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:C,className:"p-1 rounded hover:bg-zinc-500/20 active:bg-zinc-500/30 transition-colors touch-manipulation",title:h?"Hide CRC Errors":"Show CRC Errors","aria-label":h?"Hide CRC error overlay":"Show CRC error overlay","aria-pressed":h,children:t.jsx(ct,{className:`w-3.5 h-3.5 transition-colors ${h?"text-sys-red":"text-fg-muted"}`})}),t.jsxs("div",{className:"data-box",children:[b.kbPerHour," KB/hr"]})]})}):void 0}),t.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:T?t.jsx(Da,{forwardedBuckets:(s==null?void 0:s.forwardedBytesBuckets)??[],droppedBuckets:(s==null?void 0:s.droppedBytesBuckets)??[],forwardedActiveTypes:(s==null?void 0:s.forwardedActiveTypes)??[],droppedActiveTypes:(s==null?void 0:s.droppedActiveTypes)??[],forwardedCount:w.forwarded,droppedCount:w.dropped,crcCount:x,crcHistory:j,receivedCount:w.received,forwardedTotalByType:(s==null?void 0:s.forwardedTotalByType)??{},droppedTotalByType:(s==null?void 0:s.droppedTotalByType)??{},startTime:(s==null?void 0:s.start_time)??0,bucketDurationSeconds:(s==null?void 0:s.bucket_duration_seconds)??1,bucketCount:(s==null?void 0:s.bucket_count)??0,timeRangeMinutes:u.minutes}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:a?t.jsx(re,{value:w.received,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(ne,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Total Rx"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:a?t.jsx(re,{value:w.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(ne,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),t.jsx("div",{className:"mt-2 flex-1 min-h-0",children:t.jsx(ja,{buckets:p,activeTypes:_,totalByType:k,mode:"count"})})]})})]})}),t.jsx(uo,{leading:t.jsx(Fa,{stats:e,localHash:e==null?void 0:e.local_hash,receivedBuckets:s==null?void 0:s.received,droppedBuckets:s==null?void 0:s.dropped,forwardedBuckets:s==null?void 0:s.forwarded,bucketDurationSeconds:s==null?void 0:s.bucket_duration_seconds,timeRangeLabel:u.label})}),t.jsx(Oo,{}),t.jsx(Ia,{}),e&&t.jsx(ft,{template:"auto",children:t.jsx(Dn,{nodeName:A,publicKey:e.public_key,pathHashMode:(P=(D=e.config)==null?void 0:D.mesh)==null?void 0:P.path_hash_mode})})]})]})}export{Dr as default}; diff --git a/frontend/dist/assets/DataValue-Cj0a0QCM.js b/frontend/dist/assets/DataValue-CdynXJno.js similarity index 87% rename from frontend/dist/assets/DataValue-Cj0a0QCM.js rename to frontend/dist/assets/DataValue-CdynXJno.js index dd955ff8..24680327 100644 --- a/frontend/dist/assets/DataValue-Cj0a0QCM.js +++ b/frontend/dist/assets/DataValue-CdynXJno.js @@ -1 +1 @@ -import{r as a,cY as d,j as o,cZ as N}from"./index-i0xzpXop.js";import{A as g}from"./index-BCuGA4PV.js";const I=a.memo(function({value:t,format:e,prefix:r,suffix:s,className:n,priority:m="medium"}){const[u,p]=a.useState(!1),[f,l]=a.useState(t);a.useEffect(()=>d(()=>{p(!0),l(0)},m),[m]),a.useEffect(()=>{u&&l(t)},[u,t]);const A=`${r??""}${t.toLocaleString(void 0,e)}${s??""}`;return u?o.jsx(g,{className:`${n??""} overflow-hidden`,format:e,prefix:r,suffix:s,transition:N.numberTicker,children:f}):o.jsx("span",{className:n,children:A})}),x={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},c=/([,\.:\/])/g;function j(i){return i.split(c).map((e,r)=>{const s=x[e];return s?o.jsx("span",{className:s,children:e},r):e})}const S=a.memo(function({children:t,className:e="",as:r="span"}){const s=a.useMemo(()=>{let n;return typeof t=="number"?n=t.toLocaleString():Array.isArray(t)?n=t.join(""):n=String(t??""),c.test(n)?(c.lastIndex=0,j(n)):n},[t]);return o.jsx(r,{className:`data-tight ${e}`.trim(),children:s})});export{I as A,S as D}; +import{r as a,cY as d,j as o,cZ as N}from"./index-CN4vD05c.js";import{A as g}from"./index-G-dTy9iF.js";const I=a.memo(function({value:t,format:e,prefix:r,suffix:s,className:n,priority:m="medium"}){const[u,p]=a.useState(!1),[f,l]=a.useState(t);a.useEffect(()=>d(()=>{p(!0),l(0)},m),[m]),a.useEffect(()=>{u&&l(t)},[u,t]);const A=`${r??""}${t.toLocaleString(void 0,e)}${s??""}`;return u?o.jsx(g,{className:`${n??""} overflow-hidden`,format:e,prefix:r,suffix:s,transition:N.numberTicker,children:f}):o.jsx("span",{className:n,children:A})}),x={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},c=/([,\.:\/])/g;function j(i){return i.split(c).map((e,r)=>{const s=x[e];return s?o.jsx("span",{className:s,children:e},r):e})}const S=a.memo(function({children:t,className:e="",as:r="span"}){const s=a.useMemo(()=>{let n;return typeof t=="number"?n=t.toLocaleString():Array.isArray(t)?n=t.join(""):n=String(t??""),c.test(n)?(c.lastIndex=0,j(n)):n},[t]);return o.jsx(r,{className:`data-tight ${e}`.trim(),children:s})});export{I as A,S as D}; diff --git a/frontend/dist/assets/Grid-BhoD4aLU.js b/frontend/dist/assets/Grid-DeJEUuBo.js similarity index 95% rename from frontend/dist/assets/Grid-BhoD4aLU.js rename to frontend/dist/assets/Grid-DeJEUuBo.js index 107f145d..b5a962bd 100644 --- a/frontend/dist/assets/Grid-BhoD4aLU.js +++ b/frontend/dist/assets/Grid-DeJEUuBo.js @@ -1 +1 @@ -import{r as b,j as c,c as d}from"./index-i0xzpXop.js";const g={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},p={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function w({template:o,children:r,className:e,gap:n}){const t=g[o],m=p[o],a=n==="none"?"gap-0":n==="sm"?"bento-gap-sm":n==="lg"?"bento-gap-lg":"bento-gap",i=b.Children.map(r,l=>!b.isValidElement(l)||l.type===u?l:c.jsx(u,{span:t.mobile,sm:t.sm,md:t.md,lg:t.lg,xl:t.xl,children:l}));return c.jsx("div",{className:d("bento-row",m,a,e),children:i})}function s(o,r=""){const e=r?`${r}:`:"";return o==="full"?`${e}col-span-full`:o==="auto"?`${e}col-auto`:o===1.5?`${e}bento-col-1-5`:`${e}bento-col-${o}`}function u({children:o,span:r,sm:e,md:n,lg:t,xl:m,ratio:a,className:i}){const l=d("bento-cell",s(r),e&&s(e,"sm"),n&&s(n,"md"),t&&s(t,"lg"),m&&s(m,"xl"),i);return c.jsx("div",{className:l,"data-ratio":a??void 0,style:a?{"--cell-ratio":a}:void 0,children:o})}export{u as C,w as R}; +import{r as b,j as c,c as d}from"./index-CN4vD05c.js";const g={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},p={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function w({template:o,children:r,className:e,gap:n}){const t=g[o],m=p[o],a=n==="none"?"gap-0":n==="sm"?"bento-gap-sm":n==="lg"?"bento-gap-lg":"bento-gap",i=b.Children.map(r,l=>!b.isValidElement(l)||l.type===u?l:c.jsx(u,{span:t.mobile,sm:t.sm,md:t.md,lg:t.lg,xl:t.xl,children:l}));return c.jsx("div",{className:d("bento-row",m,a,e),children:i})}function s(o,r=""){const e=r?`${r}:`:"";return o==="full"?`${e}col-span-full`:o==="auto"?`${e}col-auto`:o===1.5?`${e}bento-col-1-5`:`${e}bento-col-${o}`}function u({children:o,span:r,sm:e,md:n,lg:t,xl:m,ratio:a,className:i}){const l=d("bento-cell",s(r),e&&s(e,"sm"),n&&s(n,"md"),t&&s(t,"lg"),m&&s(m,"xl"),i);return c.jsx("div",{className:l,"data-ratio":a??void 0,style:a?{"--cell-ratio":a}:void 0,children:o})}export{u as C,w as R}; diff --git a/frontend/dist/assets/KeycapButton-BjL5Ht30.js b/frontend/dist/assets/KeycapButton-DFXxSuaV.js similarity index 98% rename from frontend/dist/assets/KeycapButton-BjL5Ht30.js rename to frontend/dist/assets/KeycapButton-DFXxSuaV.js index eeb02d30..723f4b5e 100644 --- a/frontend/dist/assets/KeycapButton-BjL5Ht30.js +++ b/frontend/dist/assets/KeycapButton-DFXxSuaV.js @@ -1 +1 @@ -import{r as l,j as t,Z as O}from"./index-i0xzpXop.js";import{b as F,c as x}from"./keycap-sfx-ByZp-njj.js";const R={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},w=Object.keys(R),N={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"},C=6,D=56,L=2;function B(){return w.filter(()=>Math.random()>.45).join("")}function $(r,i){const n=Array.from(r).map(a=>N[a.toUpperCase()]??N[a]??""),d=Math.max(0,(i??0)-r.length);for(let a=0;a{if(a)return;const e=$(r,d),o=e.length,g=C+(o-1)*L;let y=0,b,E=!1;const k=()=>{if(!E){if(y++,y>=g){f(null);return}f(e.map((j,_)=>{const v=C+_*L;return y>=v?j:B()})),b=setTimeout(k,D)}};return k(),()=>{E=!0,clearTimeout(b)}},[r,d,a]);const c=(e,o)=>t.jsx("svg",{viewBox:"0 0 100 182",width:h,height:n,className:"seven-seg__char","aria-hidden":"true",children:w.map(g=>t.jsx("polygon",{points:R[g],fill:i,stroke:i,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(g)?1:M},g))},o),s=$(r,d),u=T??s;return t.jsxs("span",{className:`seven-seg${S?` ${S}`:""}`,children:[u.map((e,o)=>c(e,`${o}-${e}`)),t.jsx("span",{className:"sr-only",children:r})]})}const G={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},I=O[900],P="#FFDEB0";function Z({icon:r,variant:i="grey",onClick:n,onPress:d,sentDuration:a=2e3,title:S,disabled:h=!1,className:m,iconColor:M=I,iconActiveColor:T=P,indicators:f}){const c=!!d,[s,u]=l.useState("idle"),[e,o]=l.useState(!1),g=l.useRef(),y=c?s==="held":e,b=c&&(s==="sending"||s==="sent"),E=c?s==="held"||s==="sending":e;l.useEffect(()=>()=>clearTimeout(g.current),[]);const k=l.useCallback(()=>{h||b||(F(),c?u("held"):o(!0))},[h,b,c]),j=l.useCallback(async()=>{if(c){if(s!=="held")return;x(),u("sending");const p=await d();u(p?"sent":"idle"),p&&(g.current=setTimeout(()=>u("idle"),a))}else{if(!e)return;o(!1),x(),n==null||n()}},[c,s,d,a,e,n]),_=l.useCallback(()=>{c?s==="held"&&(x(),u("idle")):(e&&x(),o(!1))},[c,s,e]),v=t.jsx("button",{onMouseDown:k,onMouseUp:j,onMouseLeave:_,onTouchStart:k,onTouchEnd:j,onTouchCancel:_,disabled:h||b,className:`keycap-btn${i==="red"?" keycap-btn--red-cap":""}${E?" keycap-btn--pressed":""}${m&&!f?` ${m}`:""}`,title:S,children:t.jsxs("div",{className:"keycap-wrap",children:[t.jsx("img",{src:G[i],alt:"",className:"keycap-btn__img",draggable:!1}),t.jsx("span",{className:"keycap-icon-overlay",style:{color:y||s==="sending"?T:M},children:r})]})});return f!=null&&f.length?t.jsxs("div",{className:`keycap-group${m?` ${m}`:""}`,children:[v,t.jsx("div",{className:"indicator-key-pair",children:f.map(p=>{const A=p.trackPress?s:p.active?"active":"idle";return t.jsxs("div",{className:`indicator-key${A!=="idle"?` indicator-key--${A}`:""}`,children:[t.jsx("span",{className:"indicator-key__label",children:p.label}),t.jsx("span",{className:"indicator-key__led"})]},p.label)})})]}):v}export{Z as K,Y as S}; +import{r as l,j as t,Z as O}from"./index-CN4vD05c.js";import{b as F,c as x}from"./keycap-sfx-ByZp-njj.js";const R={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},w=Object.keys(R),N={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"},C=6,D=56,L=2;function B(){return w.filter(()=>Math.random()>.45).join("")}function $(r,i){const n=Array.from(r).map(a=>N[a.toUpperCase()]??N[a]??""),d=Math.max(0,(i??0)-r.length);for(let a=0;a{if(a)return;const e=$(r,d),o=e.length,g=C+(o-1)*L;let y=0,b,E=!1;const k=()=>{if(!E){if(y++,y>=g){f(null);return}f(e.map((j,_)=>{const v=C+_*L;return y>=v?j:B()})),b=setTimeout(k,D)}};return k(),()=>{E=!0,clearTimeout(b)}},[r,d,a]);const c=(e,o)=>t.jsx("svg",{viewBox:"0 0 100 182",width:h,height:n,className:"seven-seg__char","aria-hidden":"true",children:w.map(g=>t.jsx("polygon",{points:R[g],fill:i,stroke:i,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(g)?1:M},g))},o),s=$(r,d),u=T??s;return t.jsxs("span",{className:`seven-seg${S?` ${S}`:""}`,children:[u.map((e,o)=>c(e,`${o}-${e}`)),t.jsx("span",{className:"sr-only",children:r})]})}const G={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},I=O[900],P="#FFDEB0";function Z({icon:r,variant:i="grey",onClick:n,onPress:d,sentDuration:a=2e3,title:S,disabled:h=!1,className:m,iconColor:M=I,iconActiveColor:T=P,indicators:f}){const c=!!d,[s,u]=l.useState("idle"),[e,o]=l.useState(!1),g=l.useRef(),y=c?s==="held":e,b=c&&(s==="sending"||s==="sent"),E=c?s==="held"||s==="sending":e;l.useEffect(()=>()=>clearTimeout(g.current),[]);const k=l.useCallback(()=>{h||b||(F(),c?u("held"):o(!0))},[h,b,c]),j=l.useCallback(async()=>{if(c){if(s!=="held")return;x(),u("sending");const p=await d();u(p?"sent":"idle"),p&&(g.current=setTimeout(()=>u("idle"),a))}else{if(!e)return;o(!1),x(),n==null||n()}},[c,s,d,a,e,n]),_=l.useCallback(()=>{c?s==="held"&&(x(),u("idle")):(e&&x(),o(!1))},[c,s,e]),v=t.jsx("button",{onMouseDown:k,onMouseUp:j,onMouseLeave:_,onTouchStart:k,onTouchEnd:j,onTouchCancel:_,disabled:h||b,className:`keycap-btn${i==="red"?" keycap-btn--red-cap":""}${E?" keycap-btn--pressed":""}${m&&!f?` ${m}`:""}`,title:S,children:t.jsxs("div",{className:"keycap-wrap",children:[t.jsx("img",{src:G[i],alt:"",className:"keycap-btn__img",draggable:!1}),t.jsx("span",{className:"keycap-icon-overlay",style:{color:y||s==="sending"?T:M},children:r})]})});return f!=null&&f.length?t.jsxs("div",{className:`keycap-group${m?` ${m}`:""}`,children:[v,t.jsx("div",{className:"indicator-key-pair",children:f.map(p=>{const A=p.trackPress?s:p.active?"active":"idle";return t.jsxs("div",{className:`indicator-key${A!=="idle"?` indicator-key--${A}`:""}`,children:[t.jsx("span",{className:"indicator-key__label",children:p.label}),t.jsx("span",{className:"indicator-key__led"})]},p.label)})})]}):v}export{Z as K,Y as S}; diff --git a/frontend/dist/assets/LightSparkline-DC33xzFq.js b/frontend/dist/assets/LightSparkline-Bfgi1R3B.js similarity index 96% rename from frontend/dist/assets/LightSparkline-DC33xzFq.js rename to frontend/dist/assets/LightSparkline-Bfgi1R3B.js index 6d3c8b80..2e97111c 100644 --- a/frontend/dist/assets/LightSparkline-DC33xzFq.js +++ b/frontend/dist/assets/LightSparkline-Bfgi1R3B.js @@ -1 +1 @@ -import{r as y,j as t}from"./index-i0xzpXop.js";const m="var(--sys-cyan)",k="var(--sys-blue)",v="var(--sys-indigo)",I="var(--sparkline-critical)",g="var(--fg-muted)";function C(d,o,e,s=2){if(d.length<2)return"";const r=d.map(n=>n.count),u=Math.max(...r,1),p=Math.min(...r),l=u-p||1,j=o-s*2,a=e-s*2,i=r.map((n,c)=>({x:s+c/(r.length-1)*j,y:s+a-(n-p)/l*a}));let x=`M ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)}`;for(let n=1;nC(o,e,s),[o,e,s]),x=!r&&o.length>=2,n=r??(x?`url(#${a})`:g),c=l.includes("w-");return p&&o.length<2?t.jsx("div",{className:`flex items-center justify-center ${l}`,style:c?{height:s}:{width:e,height:s},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:c?{width:"100%",height:s-6}:{width:e-8,height:s-6}})}):o.length<2?t.jsx("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,className:l,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:s/2,x2:e-4,y2:s/2,stroke:I,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsxs("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,preserveAspectRatio:"none",className:l,"aria-hidden":"true",style:{maxWidth:"100%"},children:[x&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:a,gradientUnits:"userSpaceOnUse",x1:0,y1:2,x2:0,y2:s-2,children:[t.jsx("stop",{offset:"0%",stopColor:u?v:m}),t.jsx("stop",{offset:"50%",stopColor:k}),t.jsx("stop",{offset:"100%",stopColor:u?m:v})]})}),t.jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})});export{L}; +import{r as y,j as t}from"./index-CN4vD05c.js";const m="var(--sys-cyan)",k="var(--sys-blue)",v="var(--sys-indigo)",I="var(--sparkline-critical)",g="var(--fg-muted)";function C(d,o,e,s=2){if(d.length<2)return"";const r=d.map(n=>n.count),u=Math.max(...r,1),p=Math.min(...r),l=u-p||1,j=o-s*2,a=e-s*2,i=r.map((n,c)=>({x:s+c/(r.length-1)*j,y:s+a-(n-p)/l*a}));let x=`M ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)}`;for(let n=1;nC(o,e,s),[o,e,s]),x=!r&&o.length>=2,n=r??(x?`url(#${a})`:g),c=l.includes("w-");return p&&o.length<2?t.jsx("div",{className:`flex items-center justify-center ${l}`,style:c?{height:s}:{width:e,height:s},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:c?{width:"100%",height:s-6}:{width:e-8,height:s-6}})}):o.length<2?t.jsx("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,className:l,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:s/2,x2:e-4,y2:s/2,stroke:I,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsxs("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,preserveAspectRatio:"none",className:l,"aria-hidden":"true",style:{maxWidth:"100%"},children:[x&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:a,gradientUnits:"userSpaceOnUse",x1:0,y1:2,x2:0,y2:s-2,children:[t.jsx("stop",{offset:"0%",stopColor:u?v:m}),t.jsx("stop",{offset:"50%",stopColor:k}),t.jsx("stop",{offset:"100%",stopColor:u?m:v})]})}),t.jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})});export{L}; diff --git a/frontend/dist/assets/Login-CzKupPAb.js b/frontend/dist/assets/Login-3t0ZYqhq.js similarity index 99% rename from frontend/dist/assets/Login-CzKupPAb.js rename to frontend/dist/assets/Login-3t0ZYqhq.js index dd5557d1..ef85ed09 100644 --- a/frontend/dist/assets/Login-CzKupPAb.js +++ b/frontend/dist/assets/Login-3t0ZYqhq.js @@ -1 +1 @@ -import{r as s,j as e,u as _,g as Z,i as B,s as E,l as I,m as r,a as T,b as u,A,c as f,I as j,C as W,d as z,B as F,Z as D}from"./index-i0xzpXop.js";function U({width:i,height:n,className:d="",fill:a="currentColor"}){return e.jsxs("svg",{viewBox:"0 0 134 15",width:i,height:n,className:d,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[e.jsx("path",{fill:a,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),e.jsx("path",{fill:a,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),e.jsx("path",{fill:a,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),e.jsx("path",{fill:a,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),e.jsx("path",{fill:a,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),e.jsx("path",{fill:a,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),e.jsx("path",{fill:a,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),e.jsx("path",{fill:a,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}const q=s.memo(U),H="/assets/WCM_Waves-RN-_ocPH.gif",K="/assets/pyMC-logo-CaIkLXHc.svg",l={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:T.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:u.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...u.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:u.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},b=f("block type-badge text-fg-secondary"),X=s.memo(function({className:n}){return e.jsxs("svg",{className:f("animate-spin",n),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),p=s.memo(function({href:n,children:d}){return e.jsx(r.a,{href:n,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:d})}),v=()=>e.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),Y=s.memo(function(){return e.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:D[950]},"aria-hidden":"true"})}),O=s.memo(function(){return e.jsxs(r.footer,{variants:l.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[e.jsx("p",{className:"text-center type-badge text-white/40 mb-3",children:"Powered By"}),e.jsx("div",{className:"mx-auto max-w-xs",children:e.jsxs("div",{className:"flex items-center justify-center gap-4",children:[e.jsx(p,{href:"https://github.com/rightup/pyMC_Repeater",children:e.jsx("img",{src:K,alt:"pyMC",className:"h-14"})}),e.jsx(v,{}),e.jsx(p,{href:"https://meshcore.co.uk",children:e.jsx(q,{height:12,className:"text-white"})}),e.jsx(v,{}),e.jsxs(p,{href:"https://wcmesh.com",children:[e.jsx("div",{className:"size-14 overflow-hidden radius-badge border border-white/10 -translate-y-1",children:e.jsx("img",{src:H,alt:"",className:"size-full object-cover"})}),e.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})}),V={session_expired:"Your session has expired. Please sign in again.",no_token:"Authentication required. Please sign in.",token_expired_away:"Your session expired while you were away."};function J(){const i=_(),[n,d]=s.useState("admin"),[a,N]=s.useState(""),[C,w]=s.useState(Z),[L,g]=s.useState(!1),[o,h]=s.useState(null),[y]=s.useState(()=>{try{const t=sessionStorage.getItem("auth_redirect_reason");return sessionStorage.removeItem("auth_redirect_reason"),t?V[t]??null:null}catch{return null}}),c=n.length>0&&a.length>0&&!L;s.useEffect(()=>{B()&&i("/",{replace:!0})},[i]);const m=s.useCallback(()=>h(null),[]),M=s.useCallback(t=>{d(t.target.value),o&&m()},[o,m]),k=s.useCallback(t=>{N(t.target.value),o&&m()},[o,m]),S=s.useCallback(t=>{w(t),E(t)},[]),R=s.useCallback(async t=>{if(t.preventDefault(),!c)return;g(!0),h(null);const x=await I(n,a,C);g(!1),x.success?window.location.href="/":h(x.error??"Login failed")},[c,n,a,C]),P=s.useCallback(t=>{t.key==="Enter"&&c&&t.target.tagName==="INPUT"&&(t.preventDefault(),t.currentTarget.requestSubmit())},[c]);return e.jsxs(e.Fragment,{children:[e.jsx(Y,{}),e.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-6 sm:px-6 lg:px-8 -mt-6",children:e.jsxs(r.div,{variants:l.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[e.jsx(r.div,{variants:l.item,className:"flex justify-center",children:e.jsx(A,{})}),y&&!o&&e.jsx(r.div,{variants:l.item,className:"rounded-md bg-sys-amber/10 px-3 py-2.5 text-center",children:e.jsx("p",{className:"text-sm text-sys-amber",children:y})}),e.jsxs(r.form,{variants:l.item,onSubmit:R,onKeyDown:P,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:b,children:"Username"}),e.jsx("div",{className:"mt-2",children:e.jsx(j,{id:"username",name:"username",type:"text",value:n,onChange:M,required:!0,autoComplete:"username",className:"font-mono text-sm font-semibold"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:b,children:"Password"}),e.jsx("div",{className:"mt-2",children:e.jsx(j,{id:"password",name:"password",type:"password",value:a,onChange:k,required:!0,autoComplete:"current-password",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),e.jsx("div",{className:"-mt-2",children:e.jsx(W,{checked:C,onChange:S,label:e.jsx("span",{className:"type-badge text-fg-secondary",children:"Remember me"}),size:"sm"})}),e.jsx(z,{mode:"wait",children:o&&e.jsx(r.div,{variants:l.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-sys-red/10 p-3 overflow-hidden",children:e.jsx("p",{className:"text-sm text-sys-red text-center",children:o})},"error")}),e.jsx(r.div,{whileTap:c?{scale:.98}:void 0,children:e.jsx(F,{type:"submit",disabled:!c,className:"w-full py-3 radius-pill font-mono text-sm font-semibold uppercase tracking-wide text-white bg-sys-indigo hover:bg-sys-blue shadow-sm transition-colors",children:L?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),e.jsxs(r.p,{variants:l.item,className:"text-center text-sm/6 text-fg-muted",children:["A ",e.jsx("span",{className:"text-sys-blue",children:"@RightUp"})," X"," ",e.jsx("span",{className:"text-sys-blue",children:"@Treehouse⚡"})," Collab"]})]})}),e.jsx(O,{})]})}export{J as default}; +import{r as s,j as e,u as _,g as Z,i as B,s as E,l as I,m as r,a as T,b as u,A,c as f,I as j,C as W,d as z,B as F,Z as D}from"./index-CN4vD05c.js";function U({width:i,height:n,className:d="",fill:a="currentColor"}){return e.jsxs("svg",{viewBox:"0 0 134 15",width:i,height:n,className:d,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[e.jsx("path",{fill:a,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),e.jsx("path",{fill:a,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),e.jsx("path",{fill:a,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),e.jsx("path",{fill:a,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),e.jsx("path",{fill:a,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),e.jsx("path",{fill:a,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),e.jsx("path",{fill:a,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),e.jsx("path",{fill:a,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}const q=s.memo(U),H="/assets/WCM_Waves-RN-_ocPH.gif",K="/assets/pyMC-logo-CaIkLXHc.svg",l={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:T.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:u.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...u.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:u.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},b=f("block type-badge text-fg-secondary"),X=s.memo(function({className:n}){return e.jsxs("svg",{className:f("animate-spin",n),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),p=s.memo(function({href:n,children:d}){return e.jsx(r.a,{href:n,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:d})}),v=()=>e.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),Y=s.memo(function(){return e.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:D[950]},"aria-hidden":"true"})}),O=s.memo(function(){return e.jsxs(r.footer,{variants:l.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[e.jsx("p",{className:"text-center type-badge text-white/40 mb-3",children:"Powered By"}),e.jsx("div",{className:"mx-auto max-w-xs",children:e.jsxs("div",{className:"flex items-center justify-center gap-4",children:[e.jsx(p,{href:"https://github.com/rightup/pyMC_Repeater",children:e.jsx("img",{src:K,alt:"pyMC",className:"h-14"})}),e.jsx(v,{}),e.jsx(p,{href:"https://meshcore.co.uk",children:e.jsx(q,{height:12,className:"text-white"})}),e.jsx(v,{}),e.jsxs(p,{href:"https://wcmesh.com",children:[e.jsx("div",{className:"size-14 overflow-hidden radius-badge border border-white/10 -translate-y-1",children:e.jsx("img",{src:H,alt:"",className:"size-full object-cover"})}),e.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})}),V={session_expired:"Your session has expired. Please sign in again.",no_token:"Authentication required. Please sign in.",token_expired_away:"Your session expired while you were away."};function J(){const i=_(),[n,d]=s.useState("admin"),[a,N]=s.useState(""),[C,w]=s.useState(Z),[L,g]=s.useState(!1),[o,h]=s.useState(null),[y]=s.useState(()=>{try{const t=sessionStorage.getItem("auth_redirect_reason");return sessionStorage.removeItem("auth_redirect_reason"),t?V[t]??null:null}catch{return null}}),c=n.length>0&&a.length>0&&!L;s.useEffect(()=>{B()&&i("/",{replace:!0})},[i]);const m=s.useCallback(()=>h(null),[]),M=s.useCallback(t=>{d(t.target.value),o&&m()},[o,m]),k=s.useCallback(t=>{N(t.target.value),o&&m()},[o,m]),S=s.useCallback(t=>{w(t),E(t)},[]),R=s.useCallback(async t=>{if(t.preventDefault(),!c)return;g(!0),h(null);const x=await I(n,a,C);g(!1),x.success?window.location.href="/":h(x.error??"Login failed")},[c,n,a,C]),P=s.useCallback(t=>{t.key==="Enter"&&c&&t.target.tagName==="INPUT"&&(t.preventDefault(),t.currentTarget.requestSubmit())},[c]);return e.jsxs(e.Fragment,{children:[e.jsx(Y,{}),e.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-6 sm:px-6 lg:px-8 -mt-6",children:e.jsxs(r.div,{variants:l.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[e.jsx(r.div,{variants:l.item,className:"flex justify-center",children:e.jsx(A,{})}),y&&!o&&e.jsx(r.div,{variants:l.item,className:"rounded-md bg-sys-amber/10 px-3 py-2.5 text-center",children:e.jsx("p",{className:"text-sm text-sys-amber",children:y})}),e.jsxs(r.form,{variants:l.item,onSubmit:R,onKeyDown:P,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:b,children:"Username"}),e.jsx("div",{className:"mt-2",children:e.jsx(j,{id:"username",name:"username",type:"text",value:n,onChange:M,required:!0,autoComplete:"username",className:"font-mono text-sm font-semibold"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:b,children:"Password"}),e.jsx("div",{className:"mt-2",children:e.jsx(j,{id:"password",name:"password",type:"password",value:a,onChange:k,required:!0,autoComplete:"current-password",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),e.jsx("div",{className:"-mt-2",children:e.jsx(W,{checked:C,onChange:S,label:e.jsx("span",{className:"type-badge text-fg-secondary",children:"Remember me"}),size:"sm"})}),e.jsx(z,{mode:"wait",children:o&&e.jsx(r.div,{variants:l.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-sys-red/10 p-3 overflow-hidden",children:e.jsx("p",{className:"text-sm text-sys-red text-center",children:o})},"error")}),e.jsx(r.div,{whileTap:c?{scale:.98}:void 0,children:e.jsx(F,{type:"submit",disabled:!c,className:"w-full py-3 radius-pill font-mono text-sm font-semibold uppercase tracking-wide text-white bg-sys-indigo hover:bg-sys-blue shadow-sm transition-colors",children:L?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),e.jsxs(r.p,{variants:l.item,className:"text-center text-sm/6 text-fg-muted",children:["A ",e.jsx("span",{className:"text-sys-blue",children:"@RightUp"})," X"," ",e.jsx("span",{className:"text-sys-blue",children:"@Treehouse⚡"})," Collab"]})]})}),e.jsx(O,{})]})}export{J as default}; diff --git a/frontend/dist/assets/Logs-DxRQJIYV.js b/frontend/dist/assets/Logs-BOXDno8q.js similarity index 92% rename from frontend/dist/assets/Logs-DxRQJIYV.js rename to frontend/dist/assets/Logs-BOXDno8q.js index 5dfd3eb7..a1b921c7 100644 --- a/frontend/dist/assets/Logs-DxRQJIYV.js +++ b/frontend/dist/assets/Logs-BOXDno8q.js @@ -1 +1 @@ -import{dY as h,dZ as f,a5 as j,d_ as L,d$ as v,r as l,e0 as N,j as e,e1 as m,a7 as y,B as w,c as i,e2 as b,dN as C,m as S,e3 as E}from"./index-i0xzpXop.js";import{P,a as R,B as k,C as B}from"./PageLayout-B4RCJ-XT.js";import{C as I,a as T}from"./circle-stop--JH-Omkf.js";const D=l.memo(function({log:a}){return e.jsx(S.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:"easeOut"},className:"p-3 bg-subtle-fill/80 radius-inner depth-stroke-raised hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:i("type-data-sm w-14 shrink-0",E(a.level)),children:a.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:a.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(a.timestamp).toLocaleString()})]})]})})});function M({showDebug:s,onToggle:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:i("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(C,{enabled:s,onChange:a,size:"sm"})]})}function O(){const s=h(),a=f(),o=j(),r=L(),g=v(),[c,x]=l.useState(!1),u=l.useCallback(()=>{x(t=>!t)},[]),d=c?s:s.filter(t=>t.level!=="DEBUG"),n=l.useRef(r);return n.current=r,l.useEffect(()=>{if(!o)return;n.current();const t=setInterval(()=>n.current(),N.logs);return()=>clearInterval(t)},[o]),e.jsxs(P,{children:[e.jsx(R,{title:"System Logs",icon:e.jsx(m,{}),controls:e.jsx(M,{showDebug:c,onToggle:u})}),e.jsx(k,{ready:!0,children:e.jsxs(B,{neomorphic:!0,noPadding:!0,children:[e.jsx(y,{listHeader:!0,icon:e.jsx(m,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(w,{plain:!0,color:o?"danger":"primary",onClick:()=>g(!o),title:o?"Pause":"Resume",className:i(!o&&"animate-pulse-slow"),children:o?e.jsx(I,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(T,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:a&&s.length===0?e.jsx(b,{count:10}):d.length===0?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:s.length===0?"No logs available":"No logs match selected filters"}):d.map((t,p)=>e.jsx(D,{log:t},`${t.timestamp}-${p}`))})]})})]})}export{O as default}; +import{dY as h,dZ as f,a5 as j,d_ as L,d$ as v,r as l,e0 as N,j as e,e1 as m,a7 as y,B as w,c as i,e2 as b,dN as C,m as S,e3 as E}from"./index-CN4vD05c.js";import{P,a as R,B as k,C as B}from"./PageLayout-DJSWC4zL.js";import{C as I,a as T}from"./circle-stop-DyVWFFOh.js";const D=l.memo(function({log:a}){return e.jsx(S.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:"easeOut"},className:"p-3 bg-subtle-fill/80 radius-inner depth-stroke-raised hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:i("type-data-sm w-14 shrink-0",E(a.level)),children:a.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:a.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(a.timestamp).toLocaleString()})]})]})})});function M({showDebug:s,onToggle:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:i("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(C,{enabled:s,onChange:a,size:"sm"})]})}function O(){const s=h(),a=f(),o=j(),r=L(),g=v(),[c,x]=l.useState(!1),u=l.useCallback(()=>{x(t=>!t)},[]),d=c?s:s.filter(t=>t.level!=="DEBUG"),n=l.useRef(r);return n.current=r,l.useEffect(()=>{if(!o)return;n.current();const t=setInterval(()=>n.current(),N.logs);return()=>clearInterval(t)},[o]),e.jsxs(P,{children:[e.jsx(R,{title:"System Logs",icon:e.jsx(m,{}),controls:e.jsx(M,{showDebug:c,onToggle:u})}),e.jsx(k,{ready:!0,children:e.jsxs(B,{neomorphic:!0,noPadding:!0,children:[e.jsx(y,{listHeader:!0,icon:e.jsx(m,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(w,{plain:!0,color:o?"danger":"primary",onClick:()=>g(!o),title:o?"Pause":"Resume",className:i(!o&&"animate-pulse-slow"),children:o?e.jsx(I,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(T,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:a&&s.length===0?e.jsx(b,{count:10}):d.length===0?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:s.length===0?"No logs available":"No logs match selected filters"}):d.map((t,p)=>e.jsx(D,{log:t},`${t.timestamp}-${p}`))})]})})]})}export{O as default}; diff --git a/frontend/dist/assets/MeshGraph-DWjajU3T.js b/frontend/dist/assets/MeshGraph-P8jwne_q.js similarity index 99% rename from frontend/dist/assets/MeshGraph-DWjajU3T.js rename to frontend/dist/assets/MeshGraph-P8jwne_q.js index 0b50d321..4ff166f7 100644 --- a/frontend/dist/assets/MeshGraph-DWjajU3T.js +++ b/frontend/dist/assets/MeshGraph-P8jwne_q.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webgl-device-QoBMYpnS-D6oZ9mRP.js","assets/index-i0xzpXop.js","assets/max-C_kLXH5u.js","assets/consumer-registry-5uDLywpC.js","assets/variants-Bbq7uzV_.js","assets/git-branch-DrsZ9sUq.js","assets/clock-F-4SScS_.js","assets/database-gsjgeKE3.js","assets/badge-colors-Dl76Mz8m.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/target-BAeWmUfa.js","assets/layers-LQ5jNXOV.js","assets/search-DsTk_ZsM.js","assets/settings-2-B0xGzDNd.js","assets/rotate-ccw-DqV8JyUZ.js","assets/chevron-right-DsOuIRi8.js","assets/network-CeKhSsIh.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); -var lL=Object.defineProperty;var cL=(i,e,t)=>e in i?lL(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var b=(i,e,t)=>cL(i,typeof e!="symbol"?e+"":e,t);import{e as rp,r as z,_ as m0,bu as cn,cu as mg,dp as uL,dq as dL,j as f,aC as hL,aD as g0,bM as Gl,c as oh,bY as fL,dr as pL,m as ga,a0 as ey,a2 as gg,ds as PS,dt as jh,du as NS,ao as hd,dv as mL,dw as gL,d as Jc,dx as _L,aQ as yL,dy as bL,dz as vL,dA as xL,dB as wL,dC as SL,dD as EL,dE as CL,a6 as TL,cP as kL,dF as AL,O as Ge,Z as qt,dG as _0,V as Di,ap as be,dH as IL,dI as LL,aa as _g,dJ as fd,dK as y0,dL as RL,aE as Pc,dM as PL,b2 as NL,dN as DL,dO as ML,B as ty,c3 as OL,a1 as BL,a3 as FL,dP as zL}from"./index-i0xzpXop.js";import{m as b0,t as yg,a as UL,b as $L,e as Rn,u as jL,G as HL,c as VL,E as GL}from"./max-C_kLXH5u.js";import{u as WL,r as YL,f as v0,g as qL,e as XL}from"./consumer-registry-5uDLywpC.js";import{s as KL,M as DS,a as x0,b as iy}from"./variants-Bbq7uzV_.js";import{G as Wp}from"./git-branch-DrsZ9sUq.js";import{C as ZL}from"./clock-F-4SScS_.js";import{D as QL}from"./database-gsjgeKE3.js";import{N as JL,a as eR}from"./badge-colors-Dl76Mz8m.js";import{e as tR,f as w0,g as iR}from"./meshcore-tx-constants-DgpFTAmf.js";import{E as nR,T as sR}from"./target-BAeWmUfa.js";import{L as S0}from"./layers-LQ5jNXOV.js";import{S as E0}from"./search-DsTk_ZsM.js";import{S as C0}from"./settings-2-B0xGzDNd.js";import{R as T0}from"./rotate-ccw-DqV8JyUZ.js";import{C as Yp}from"./chevron-right-DsOuIRi8.js";import{N as rR}from"./network-CeKhSsIh.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webgl-device-QoBMYpnS-B_qdW-Dv.js","assets/index-CN4vD05c.js","assets/max-BbWCrv_A.js","assets/consumer-registry-ssgJoJPf.js","assets/variants-WkuRUM3u.js","assets/git-branch-DpI9mavY.js","assets/clock-jH_gnOTU.js","assets/database-n5nNHRzj.js","assets/badge-colors-Dl76Mz8m.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/target-CftUJhmo.js","assets/layers-DwnLNHzI.js","assets/search-D1TEdb7u.js","assets/settings-2-CUT2ngOp.js","assets/rotate-ccw-D-KWB9ub.js","assets/chevron-right-BCotFXkU.js","assets/network-DgftOg20.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); +var lL=Object.defineProperty;var cL=(i,e,t)=>e in i?lL(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var b=(i,e,t)=>cL(i,typeof e!="symbol"?e+"":e,t);import{e as rp,r as z,_ as m0,bu as cn,cu as mg,dp as uL,dq as dL,j as f,aC as hL,aD as g0,bM as Gl,c as oh,bY as fL,dr as pL,m as ga,a0 as ey,a2 as gg,ds as PS,dt as jh,du as NS,ao as hd,dv as mL,dw as gL,d as Jc,dx as _L,aQ as yL,dy as bL,dz as vL,dA as xL,dB as wL,dC as SL,dD as EL,dE as CL,a6 as TL,cP as kL,dF as AL,O as Ge,Z as qt,dG as _0,V as Di,ap as be,dH as IL,dI as LL,aa as _g,dJ as fd,dK as y0,dL as RL,aE as Pc,dM as PL,b2 as NL,dN as DL,dO as ML,B as ty,c3 as OL,a1 as BL,a3 as FL,dP as zL}from"./index-CN4vD05c.js";import{m as b0,t as yg,a as UL,b as $L,e as Rn,u as jL,G as HL,c as VL,E as GL}from"./max-BbWCrv_A.js";import{u as WL,r as YL,f as v0,g as qL,e as XL}from"./consumer-registry-ssgJoJPf.js";import{s as KL,M as DS,a as x0,b as iy}from"./variants-WkuRUM3u.js";import{G as Wp}from"./git-branch-DpI9mavY.js";import{C as ZL}from"./clock-jH_gnOTU.js";import{D as QL}from"./database-n5nNHRzj.js";import{N as JL,a as eR}from"./badge-colors-Dl76Mz8m.js";import{e as tR,f as w0,g as iR}from"./meshcore-tx-constants-DgpFTAmf.js";import{E as nR,T as sR}from"./target-CftUJhmo.js";import{L as S0}from"./layers-DwnLNHzI.js";import{S as E0}from"./search-D1TEdb7u.js";import{S as C0}from"./settings-2-CUT2ngOp.js";import{R as T0}from"./rotate-ccw-D-KWB9ub.js";import{C as Yp}from"./chevron-right-BCotFXkU.js";import{N as rR}from"./network-DgftOg20.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -29,7 +29,7 @@ ${r}${o}${i.type.toUpperCase()}: ${i.message}

Compilation error in ${r}



 ${o}
-
`,l.style.top="10px",l.style.left="10px",l.style.position="absolute",l.style.zIndex="9999",l.style.width="100%",l.style.textAlign="left",document.body.appendChild(l),(n=document.getElementsByClassName("luma-compiler-log-error")[0])==null||n.scrollIntoView(),l.onclick=()=>{const c=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(c)}}};$(x2,"defaultProps",{..._n.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let MN=x2;function ON(i){return BN(i.source)||i.id||fy(`unnamed ${i.stage}-shader`)}function BN(i,e="unnamed"){const t=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(i);return t?t[1]:e}const S2=class E2 extends _n{constructor(e,t){super(e,t,E2.defaultProps),$(this,"shaderLayout"),$(this,"bufferLayout"),$(this,"linkStatus","pending"),$(this,"hash",""),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}get[Symbol.toStringTag](){return"RenderPipeline"}};$(S2,"defaultProps",{..._n.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});let Zh=S2;const C2=class T2 extends _n{constructor(e,t){super(e,t,T2.defaultProps),$(this,"hash",""),$(this,"shaderLayout"),this.shaderLayout=t.shaderLayout}get[Symbol.toStringTag](){return"ComputePipeline"}};$(C2,"defaultProps",{..._n.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});let Q0=C2;function FN(i){return jN[i]}function zN(i){const[e,t]=$N[i],n=e==="i32"||e==="u32",s=e!=="u32",r=UN[e]*t;return{primitiveType:e,components:t,byteLength:r,integer:n,signed:s}}const UN={f32:4,f16:2,i32:4,u32:4},$N={f32:["f32",1],"vec2":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},jN={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"f16",components:2},"vec3":{type:"f16",components:3},"vec4":{type:"f16",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16},"mat2x2":{type:"f16",components:4},"mat2x3":{type:"f16",components:6},"mat2x4":{type:"f16",components:8},"mat3x2":{type:"f16",components:6},"mat3x3":{type:"f16",components:9},"mat3x4":{type:"f16",components:12},"mat4x2":{type:"f16",components:8},"mat4x3":{type:"f16",components:12},"mat4x4":{type:"f16",components:16},"mat2x2":{type:"i32",components:4},"mat2x3":{type:"i32",components:6},"mat2x4":{type:"i32",components:8},"mat3x2":{type:"i32",components:6},"mat3x3":{type:"i32",components:9},"mat3x4":{type:"i32",components:12},"mat4x2":{type:"i32",components:8},"mat4x3":{type:"i32",components:12},"mat4x4":{type:"i32",components:16},"mat2x2":{type:"u32",components:4},"mat2x3":{type:"u32",components:6},"mat2x4":{type:"u32",components:8},"mat3x2":{type:"u32",components:6},"mat3x3":{type:"u32",components:9},"mat3x4":{type:"u32",components:12},"mat4x2":{type:"u32",components:8},"mat4x3":{type:"u32",components:12},"mat4x4":{type:"u32",components:16}};function k2(i,e){const t={};for(const n of i.attributes){const s=HN(i,e,n.name);s&&(t[n.name]=s)}return t}function Nte(i,e,t=16){const n=k2(i,e),s=new Array(t).fill(null);for(const r of Object.values(n))s[r.location]=r;return s}function HN(i,e,t){const n=VN(i,t),s=GN(e,t);if(!n)return null;const r=zN(n.type),o=cN(r),a=(s==null?void 0:s.vertexFormat)||o,l=my(a);return{attributeName:(s==null?void 0:s.attributeName)||n.name,bufferName:(s==null?void 0:s.bufferName)||n.name,location:n.location,shaderType:n.type,primitiveType:r.primitiveType,shaderComponents:r.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:r.integer,stepMode:(s==null?void 0:s.stepMode)||n.stepMode||"vertex",byteOffset:(s==null?void 0:s.byteOffset)||0,byteStride:(s==null?void 0:s.byteStride)||0}}function VN(i,e){const t=i.attributes.find(n=>n.name===e);return t||le.warn(`shader layout attribute "${e}" not present in shader`),t||null}function GN(i,e){WN(i);let t=YN(i,e);return t||(t=qN(i,e),t)?t:(le.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function WN(i){for(const e of i)(e.attributes&&e.format||!e.attributes&&!e.format)&&le.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function YN(i,e){for(const t of i)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function qN(i,e){var t;for(const n of i){let s=n.byteStride;if(typeof n.byteStride!="number")for(const o of n.attributes||[]){const a=my(o.format);s+=a.byteLength}const r=(t=n.attributes)==null?void 0:t.find(o=>o.attribute===e);if(r)return{attributeName:r.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:r.format,byteOffset:r.byteOffset,byteStride:s}}return null}let wd;function A2(i){return(!wd||wd.byteLengthr.type==="uniform"&&r.name===(e==null?void 0:e.name));if(!n)throw new Error(e==null?void 0:e.name);const s=n;for(const r of s.uniforms||[])this.bindingLayout[r.name]=r}}setUniforms(e){for(const[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){QN(this.uniforms[e],t)||(this.uniforms[e]=JN(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}let ri=class{constructor(e){$(this,"uniformBlocks",new Map),$(this,"uniformBufferLayouts",new Map),$(this,"uniformBuffers",new Map);for(const[t,n]of Object.entries(e)){const s=t,r=new ZN(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,r);const o=new eD({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var t;for(const[n,s]of Object.entries(e))(t=this.uniformBlocks.get(n))==null||t.setUniforms(s);this.updateUniformBuffers()}getUniformBufferByteLength(e){var t;return((t=this.uniformBufferLayouts.get(e))==null?void 0:t.byteLength)||0}getUniformBufferData(e){var t,n;const s=((t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms())||{};return(n=this.uniformBufferLayouts.get(e))==null?void 0:n.getData(s)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);const s=this.getUniformBufferByteLength(t),r=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return r.write(o),r}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){const n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(const t of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(t);e||(e=n)}return e&&le.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var t;const n=this.uniformBlocks.get(e);let s=this.uniformBuffers.get(e),r=!1;if(s&&n!=null&&n.needsRedraw){r||(r=n.needsRedraw);const o=this.getUniformBufferData(e);s=this.uniformBuffers.get(e),s==null||s.write(o);const a=(t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms();le.log(4,`Writing to uniform buffer ${String(e)}`,o,a)()}return r}};var Do;(function(i){i[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.GEQUAL=518]="GEQUAL",i[i.ALWAYS=519]="ALWAYS",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.R16_EXT=33322]="R16_EXT",i[i.RG16_EXT=33324]="RG16_EXT",i[i.RGB16_EXT=32852]="RGB16_EXT",i[i.RGBA16_EXT=32859]="RGBA16_EXT",i[i.R16_SNORM_EXT=36760]="R16_SNORM_EXT",i[i.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",i[i.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",i[i.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",i[i.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",i[i.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",i[i.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",i[i.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",i[i.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",i[i.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",i[i.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",i[i.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",i[i.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",i[i.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",i[i.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",i[i.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",i[i.LINE_WEBGL=6913]="LINE_WEBGL",i[i.FILL_WEBGL=6914]="FILL_WEBGL",i[i.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",i[i.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",i[i.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",i[i.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",i[i.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",i[i.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",i[i.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",i[i.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",i[i.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",i[i.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",i[i.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",i[i.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",i[i.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",i[i.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",i[i.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",i[i.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",i[i.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",i[i.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",i[i.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",i[i.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",i[i.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",i[i.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",i[i.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",i[i.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Do||(Do={}));const tD={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},iD=i=>({drawBuffersWEBGL(e){return i.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),nD=i=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return i.createVertexArray()},deleteVertexArrayOES(e){return i.deleteVertexArray(e)},isVertexArrayOES(e){return i.isVertexArray(e)},bindVertexArrayOES(e){return i.bindVertexArray(e)}}),sD=i=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return i.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return i.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return i.vertexAttribDivisor(...e)}});function rD(i=!0){const e=HTMLCanvasElement.prototype;if(!i&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){const s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&oD(s),s}return this.originalGetContext(t,n)}}function oD(i){i.getExtension("EXT_color_buffer_float");const e={...tD,WEBGL_disjoint_timer_query:i.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:iD(i),OES_vertex_array_object:nD(i),ANGLE_instanced_arrays:sD(i)},t=i.getExtension;i.getExtension=function(s){return t.call(i,s)||(s in e?e[s]:null)};const n=i.getSupportedExtensions;i.getSupportedExtensions=function(){const s=n.apply(i)||[];return s==null?void 0:s.concat(Object.keys(e))}}async function I2(i,e){const t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",i),new Promise((s,r)=>{n.onload=s,n.onerror=o=>r(new Error(`Unable to load script '${i}': ${o}`)),t.appendChild(n)})}const aD=1;let hi=null,J0=!1;const _y={debugSpectorJS:le.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function lD(i){if(!globalThis.SPECTOR)try{await I2(i.debugSpectorJSUrl||_y.debugSpectorJSUrl)}catch(e){le.warn(String(e))}}function Ote(i){var e;if(i={..._y,...i},!i.debugSpectorJS)return null;if(!hi&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){le.probe(aD,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:t}=globalThis.SPECTOR;hi=new t,globalThis.luma&&(globalThis.luma.spector=hi)}if(!hi)return null;if(J0||(J0=!0,hi.spyCanvases(),hi==null||hi.onCaptureStarted.add(t=>le.info("Spector capture started:",t)()),hi==null||hi.onCapture.add(t=>{le.info("Spector capture complete:",t)(),hi==null||hi.getResultUI(),hi==null||hi.resultView.display(),hi==null||hi.resultView.addCapture(t)})),i.gl){const t=i.gl,n=t.device;hi==null||hi.startCapture(i.gl,500),t.device=n,new Promise(s=>setTimeout(s,2e3)).then(s=>{le.info("Spector capture stopped after 2 seconds")(),hi==null||hi.stopCapture()})}return hi}const cD="https://unpkg.com/webgl-debug@2.0.1/index.js";function L2(i){return i.luma=i.luma||{},i.luma}async function uD(){Vu()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await I2(cD))}function Bte(i,e={}){return e.debugWebGL||e.traceWebGL?hD(i,e):dD(i)}function dD(i){const e=L2(i);return e.realContext?e.realContext:i}function hD(i,e){if(!globalThis.WebGLDebugUtils)return le.warn("webgl-debug not loaded")(),i;const t=L2(i);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Do,...i});const n=globalThis.WebGLDebugUtils.makeDebugContext(i,fD.bind(null,e),pD.bind(null,e));for(const o in Do)!(o in n)&&typeof Do[o]=="number"&&(n[o]=Do[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.setPrototypeOf(s,n);const r=Object.create(s);return t.realContext=i,t.debugContext=r,r.debug=!0,r}function ex(i,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${i}(${t})`}function fD(i,e,t,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);const s=globalThis.WebGLDebugUtils.glEnumToString(e),r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${s} in gl.${t}(${r})`;le.error(o)();debugger}function pD(i,e,t){let n="";le.level>=1&&(n=ex(e,t),i.traceWebGL&&le.log(1,n)());for(const s of t)if(s===void 0){n=n||ex(e,t);debugger}}const Sd=1;class mD extends CN{constructor(){super(),$(this,"type","webgl"),Cg.defaultProps={...Cg.defaultProps,..._y}}enforceWebGL2(e){rD(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&le.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){const{WebGLDevice:n}=await m0(async()=>{const{WebGLDevice:r}=await import("./webgl-device-QoBMYpnS-D6oZ9mRP.js");return{WebGLDevice:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));if(e instanceof n)return e;if((e==null?void 0:e.device)instanceof n)return e.device;if(!gD(e))throw new Error("Invalid WebGL2RenderingContext");const s=t.createCanvasContext===!0?{}:t.createCanvasContext;return new n({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...s}})}async create(e={}){const{WebGLDevice:t}=await m0(async()=>{const{WebGLDevice:n}=await import("./webgl-device-QoBMYpnS-D6oZ9mRP.js");return{WebGLDevice:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));le.groupCollapsed(Sd,"WebGLDevice created")();try{const n=[];(e.debugWebGL||e.debug)&&n.push(uD()),e.debugSpectorJS&&n.push(lD(e));const s=await Promise.allSettled(n);for(const a of s)a.status==="rejected"&&le.error(`Failed to initialize debug libraries ${a.reason}`)();const r=new t(e),o=`${r._reused?"Reusing":"Created"} device with WebGL2 ${r.props.debug?"debug ":""}context: ${r.info.vendor}, ${r.info.renderer} for canvas: ${r.canvasContext.id}`;return le.probe(Sd,o)(),le.table(Sd,r.info)(),r}finally{le.groupEnd(Sd)()}}}function gD(i){return typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext?!0:!!(i&&Number.isFinite(i._version))}const _D=new mD,yD="#b3b3b3",bD=void 0,Ag=void 0,vD=1,xD=4,wD="#666666",SD=.1,ED=1,CD=1,R2="#222222",fe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},TD=.7,kD=.95,AD=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:P2,setPrototypeOf:tx,isFrozen:ID,getPrototypeOf:LD,getOwnPropertyDescriptor:RD}=Object;let{freeze:hn,seal:_s,create:N2}=Object,{apply:Ig,construct:Lg}=typeof Reflect<"u"&&Reflect;hn||(hn=function(i){return i});_s||(_s=function(i){return i});Ig||(Ig=function(i,e,t){return i.apply(e,t)});Lg||(Lg=function(i,e){return new i(...e)});const Ed=fn(Array.prototype.forEach),PD=fn(Array.prototype.lastIndexOf),ix=fn(Array.prototype.pop),lc=fn(Array.prototype.push),ND=fn(Array.prototype.splice),hh=fn(String.prototype.toLowerCase),nm=fn(String.prototype.toString),nx=fn(String.prototype.match),cc=fn(String.prototype.replace),DD=fn(String.prototype.indexOf),MD=fn(String.prototype.trim),Ms=fn(Object.prototype.hasOwnProperty),sn=fn(RegExp.prototype.test),uc=OD(TypeError);function fn(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:hh;tx&&tx(i,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const r=t(s);r!==s&&(ID(e)||(e[n]=r),s=r)}i[s]=!0}return i}function BD(i){for(let e=0;e/gm),jD=_s(/\$\{[\w\W]*/gm),HD=_s(/^data-[\-\w.\u00B7-\uFFFF]+$/),VD=_s(/^aria-[\-\w]+$/),D2=_s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),GD=_s(/^(?:\w+script|data):/i),WD=_s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),M2=_s(/^html$/i),YD=_s(/^[a-z][.\w]*(-[.\w]+)+$/i);var lx=Object.freeze({__proto__:null,ARIA_ATTR:VD,ATTR_WHITESPACE:WD,CUSTOM_ELEMENT:YD,DATA_ATTR:HD,DOCTYPE_NAME:M2,ERB_EXPR:$D,IS_ALLOWED_URI:D2,IS_SCRIPT_OR_DATA:GD,MUSTACHE_EXPR:UD,TMPLIT_EXPR:jD});const hc={element:1,text:3,progressingInstruction:7,comment:8,document:9},qD=function(){return typeof window>"u"?null:window},XD=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(t=e.getAttribute(n));const s="dompurify"+(t?"#"+t:"");try{return i.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},cx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function O2(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qD();const e=I=>O2(I);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==hc.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const n=t,s=n.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:p}=i,m=l.prototype,_=dc(m,"cloneNode"),g=dc(m,"remove"),y=dc(m,"nextSibling"),S=dc(m,"childNodes"),C=dc(m,"parentNode");if(typeof o=="function"){const I=t.createElement("template");I.content&&I.content.ownerDocument&&(t=I.content.ownerDocument)}let x,A="";const{implementation:L,createNodeIterator:P,createDocumentFragment:H,getElementsByTagName:Q}=t,{importNode:te}=n;let O=cx();e.isSupported=typeof P2=="function"&&typeof C=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:he,ERB_EXPR:se,TMPLIT_EXPR:R,DATA_ATTR:J,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:ee}=lx;let{IS_ALLOWED_URI:ae}=lx,Z=null;const Se=ot({},[...sx,...sm,...rm,...om,...rx]);let xe=null;const Je=ot({},[...ox,...am,...ax,...Cd]);let de=Object.seal(N2(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bt=null,Xe=null,ht=!0,re=!0,Te=!1,Pe=!0,q=!1,We=!0,He=!1,it=!1,Vt=!1,pe=!1,nt=!1,ui=!1,_i=!0,Zn=!1;const Qo="user-content-";let Zs=!0,Li=!1,en={},Ri=null;const ai=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let vo=null;const Es=ot({},["audio","video","img","source","image","track"]);let Qn=null;const Jn=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cs="http://www.w3.org/1998/Math/MathML",zi="http://www.w3.org/2000/svg",Ei="http://www.w3.org/1999/xhtml";let ii=Ei,bn=!1,vn=null;const Ts=ot({},[Cs,zi,Ei],nm);let On=ot({},["mi","mo","mn","ms","mtext"]),es=ot({},["annotation-xml"]);const Dr=ot({},["title","style","font","a","script"]);let xn=null;const Qs=["application/xhtml+xml","text/html"],Jo="text/html";let Zt=null,Ot=null;const ks=t.createElement("form"),xo=function(I){return I instanceof RegExp||I instanceof Function},Js=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===I)){if((!I||typeof I!="object")&&(I={}),I=Hr(I),xn=Qs.indexOf(I.PARSER_MEDIA_TYPE)===-1?Jo:I.PARSER_MEDIA_TYPE,Zt=xn==="application/xhtml+xml"?nm:hh,Z=Ms(I,"ALLOWED_TAGS")?ot({},I.ALLOWED_TAGS,Zt):Se,xe=Ms(I,"ALLOWED_ATTR")?ot({},I.ALLOWED_ATTR,Zt):Je,vn=Ms(I,"ALLOWED_NAMESPACES")?ot({},I.ALLOWED_NAMESPACES,nm):Ts,Qn=Ms(I,"ADD_URI_SAFE_ATTR")?ot(Hr(Jn),I.ADD_URI_SAFE_ATTR,Zt):Jn,vo=Ms(I,"ADD_DATA_URI_TAGS")?ot(Hr(Es),I.ADD_DATA_URI_TAGS,Zt):Es,Ri=Ms(I,"FORBID_CONTENTS")?ot({},I.FORBID_CONTENTS,Zt):ai,bt=Ms(I,"FORBID_TAGS")?ot({},I.FORBID_TAGS,Zt):Hr({}),Xe=Ms(I,"FORBID_ATTR")?ot({},I.FORBID_ATTR,Zt):Hr({}),en=Ms(I,"USE_PROFILES")?I.USE_PROFILES:!1,ht=I.ALLOW_ARIA_ATTR!==!1,re=I.ALLOW_DATA_ATTR!==!1,Te=I.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=I.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=I.SAFE_FOR_TEMPLATES||!1,We=I.SAFE_FOR_XML!==!1,He=I.WHOLE_DOCUMENT||!1,pe=I.RETURN_DOM||!1,nt=I.RETURN_DOM_FRAGMENT||!1,ui=I.RETURN_TRUSTED_TYPE||!1,Vt=I.FORCE_BODY||!1,_i=I.SANITIZE_DOM!==!1,Zn=I.SANITIZE_NAMED_PROPS||!1,Zs=I.KEEP_CONTENT!==!1,Li=I.IN_PLACE||!1,ae=I.ALLOWED_URI_REGEXP||D2,ii=I.NAMESPACE||Ei,On=I.MATHML_TEXT_INTEGRATION_POINTS||On,es=I.HTML_INTEGRATION_POINTS||es,de=I.CUSTOM_ELEMENT_HANDLING||{},I.CUSTOM_ELEMENT_HANDLING&&xo(I.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(de.tagNameCheck=I.CUSTOM_ELEMENT_HANDLING.tagNameCheck),I.CUSTOM_ELEMENT_HANDLING&&xo(I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(de.attributeNameCheck=I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),I.CUSTOM_ELEMENT_HANDLING&&typeof I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(re=!1),nt&&(pe=!0),en&&(Z=ot({},rx),xe=[],en.html===!0&&(ot(Z,sx),ot(xe,ox)),en.svg===!0&&(ot(Z,sm),ot(xe,am),ot(xe,Cd)),en.svgFilters===!0&&(ot(Z,rm),ot(xe,am),ot(xe,Cd)),en.mathMl===!0&&(ot(Z,om),ot(xe,ax),ot(xe,Cd))),I.ADD_TAGS&&(Z===Se&&(Z=Hr(Z)),ot(Z,I.ADD_TAGS,Zt)),I.ADD_ATTR&&(xe===Je&&(xe=Hr(xe)),ot(xe,I.ADD_ATTR,Zt)),I.ADD_URI_SAFE_ATTR&&ot(Qn,I.ADD_URI_SAFE_ATTR,Zt),I.FORBID_CONTENTS&&(Ri===ai&&(Ri=Hr(Ri)),ot(Ri,I.FORBID_CONTENTS,Zt)),Zs&&(Z["#text"]=!0),He&&ot(Z,["html","head","body"]),Z.table&&(ot(Z,["tbody"]),delete bt.tbody),I.TRUSTED_TYPES_POLICY){if(typeof I.TRUSTED_TYPES_POLICY.createHTML!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof I.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=I.TRUSTED_TYPES_POLICY,A=x.createHTML("")}else x===void 0&&(x=XD(p,s)),x!==null&&typeof A=="string"&&(A=x.createHTML(""));hn&&hn(I),Ot=I}},Rt=ot({},[...sm,...rm,...FD]),Mr=ot({},[...om,...zD]),ea=function(I){let V=C(I);(!V||!V.tagName)&&(V={namespaceURI:ii,tagName:"template"});const E=hh(I.tagName),G=hh(V.tagName);return vn[I.namespaceURI]?I.namespaceURI===zi?V.namespaceURI===Ei?E==="svg":V.namespaceURI===Cs?E==="svg"&&(G==="annotation-xml"||On[G]):!!Rt[E]:I.namespaceURI===Cs?V.namespaceURI===Ei?E==="math":V.namespaceURI===zi?E==="math"&&es[G]:!!Mr[E]:I.namespaceURI===Ei?V.namespaceURI===zi&&!es[G]||V.namespaceURI===Cs&&!On[G]?!1:!Mr[E]&&(Dr[E]||!Rt[E]):!!(xn==="application/xhtml+xml"&&vn[I.namespaceURI]):!1},ts=function(I){lc(e.removed,{element:I});try{C(I).removeChild(I)}catch{g(I)}},di=function(I,V){try{lc(e.removed,{attribute:V.getAttributeNode(I),from:V})}catch{lc(e.removed,{attribute:null,from:V})}if(V.removeAttribute(I),I==="is")if(pe||nt)try{ts(V)}catch{}else try{V.setAttribute(I,"")}catch{}},Bn=function(I){let V=null,E=null;if(Vt)I=""+I;else{const Ce=nx(I,/^[\r\n\t ]+/);E=Ce&&Ce[0]}xn==="application/xhtml+xml"&&ii===Ei&&(I=''+I+"");const G=x?x.createHTML(I):I;if(ii===Ei)try{V=new h().parseFromString(G,xn)}catch{}if(!V||!V.documentElement){V=L.createDocument(ii,"template",null);try{V.documentElement.innerHTML=bn?A:G}catch{}}const ne=V.body||V.documentElement;return I&&E&&ne.insertBefore(t.createTextNode(E),ne.childNodes[0]||null),ii===Ei?Q.call(V,He?"html":"body")[0]:He?V.documentElement:ne},wo=function(I){return P.call(I.ownerDocument||I,I,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ut=function(I){return I instanceof d&&(typeof I.nodeName!="string"||typeof I.textContent!="string"||typeof I.removeChild!="function"||!(I.attributes instanceof u)||typeof I.removeAttribute!="function"||typeof I.setAttribute!="function"||typeof I.namespaceURI!="string"||typeof I.insertBefore!="function"||typeof I.hasChildNodes!="function")},Or=function(I){return typeof a=="function"&&I instanceof a};function st(I,V,E){Ed(I,G=>{G.call(e,V,E,Ot)})}const wn=function(I){let V=null;if(st(O.beforeSanitizeElements,I,null),ut(I))return ts(I),!0;const E=Zt(I.nodeName);if(st(O.uponSanitizeElement,I,{tagName:E,allowedTags:Z}),We&&I.hasChildNodes()&&!Or(I.firstElementChild)&&sn(/<[/\w!]/g,I.innerHTML)&&sn(/<[/\w!]/g,I.textContent)||I.nodeType===hc.progressingInstruction||We&&I.nodeType===hc.comment&&sn(/<[/\w]/g,I.data))return ts(I),!0;if(!Z[E]||bt[E]){if(!bt[E]&&er(E)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E)))return!1;if(Zs&&!Ri[E]){const G=C(I)||I.parentNode,ne=S(I)||I.childNodes;if(ne&&G){const Ce=ne.length;for(let At=Ce-1;At>=0;--At){const rt=_(ne[At],!0);rt.__removalCount=(I.__removalCount||0)+1,G.insertBefore(rt,y(I))}}}return ts(I),!0}return I instanceof l&&!ea(I)||(E==="noscript"||E==="noembed"||E==="noframes")&&sn(/<\/no(script|embed|frames)/i,I.innerHTML)?(ts(I),!0):(q&&I.nodeType===hc.text&&(V=I.textContent,Ed([he,se,R],G=>{V=cc(V,G," ")}),I.textContent!==V&&(lc(e.removed,{element:I.cloneNode()}),I.textContent=V)),st(O.afterSanitizeElements,I,null),!1)},Br=function(I,V,E){if(_i&&(V==="id"||V==="name")&&(E in t||E in ks))return!1;if(!(re&&!Xe[V]&&sn(J,V))&&!(ht&&sn(F,V))){if(!xe[V]||Xe[V]){if(!(er(I)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,I)||de.tagNameCheck instanceof Function&&de.tagNameCheck(I))&&(de.attributeNameCheck instanceof RegExp&&sn(de.attributeNameCheck,V)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(V))||V==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E))))return!1}else if(!Qn[V]&&!sn(ae,cc(E,ie,""))&&!((V==="src"||V==="xlink:href"||V==="href")&&I!=="script"&&DD(E,"data:")===0&&vo[I])&&!(Te&&!sn(X,cc(E,ie,"")))&&E)return!1}return!0},er=function(I){return I!=="annotation-xml"&&nx(I,ee)},Fn=function(I){st(O.beforeSanitizeAttributes,I,null);const{attributes:V}=I;if(!V||ut(I))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let G=V.length;for(;G--;){const ne=V[G],{name:Ce,namespaceURI:At,value:rt}=ne,et=Zt(Ce),yi=rt;let ft=Ce==="value"?yi:MD(yi);if(E.attrName=et,E.attrValue=ft,E.keepAttr=!0,E.forceKeepAttr=void 0,st(O.uponSanitizeAttribute,I,E),ft=E.attrValue,Zn&&(et==="id"||et==="name")&&(di(Ce,I),ft=Qo+ft),We&&sn(/((--!?|])>)|<\/(style|title)/i,ft)){di(Ce,I);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){di(Ce,I);continue}if(!Pe&&sn(/\/>/i,ft)){di(Ce,I);continue}q&&Ed([he,se,R],Bt=>{ft=cc(ft,Bt," ")});const tr=Zt(I.nodeName);if(!Br(tr,et,ft)){di(Ce,I);continue}if(x&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!At)switch(p.getAttributeType(tr,et)){case"TrustedHTML":{ft=x.createHTML(ft);break}case"TrustedScriptURL":{ft=x.createScriptURL(ft);break}}if(ft!==yi)try{At?I.setAttributeNS(At,Ce,ft):I.setAttribute(Ce,ft),ut(I)?ts(I):ix(e.removed)}catch{di(Ce,I)}}st(O.afterSanitizeAttributes,I,null)},tn=function I(V){let E=null;const G=wo(V);for(st(O.beforeSanitizeShadowDOM,V,null);E=G.nextNode();)st(O.uponSanitizeShadowNode,E,null),wn(E),Fn(E),E.content instanceof r&&I(E.content);st(O.afterSanitizeShadowDOM,V,null)};return e.sanitize=function(I){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,G=null,ne=null,Ce=null;if(bn=!I,bn&&(I=""),typeof I!="string"&&!Or(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw uc("dirty is not a string, aborting")}else throw uc("toString is not a function");if(!e.isSupported)return I;if(it||Js(V),e.removed=[],typeof I=="string"&&(Li=!1),Li){if(I.nodeName){const et=Zt(I.nodeName);if(!Z[et]||bt[et])throw uc("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=Bn(""),G=E.ownerDocument.importNode(I,!0),G.nodeType===hc.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?E=G:E.appendChild(G);else{if(!pe&&!q&&!He&&I.indexOf("<")===-1)return x&&ui?x.createHTML(I):I;if(E=Bn(I),!E)return pe?null:ui?A:""}E&&Vt&&ts(E.firstChild);const At=wo(Li?I:E);for(;ne=At.nextNode();)wn(ne),Fn(ne),ne.content instanceof r&&tn(ne.content);if(Li)return I;if(pe){if(nt)for(Ce=H.call(E.ownerDocument);E.firstChild;)Ce.appendChild(E.firstChild);else Ce=E;return(xe.shadowroot||xe.shadowrootmode)&&(Ce=te.call(n,Ce,!0)),Ce}let rt=He?E.outerHTML:E.innerHTML;return He&&Z["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&sn(M2,E.ownerDocument.doctype.name)&&(rt=" +`,l.style.top="10px",l.style.left="10px",l.style.position="absolute",l.style.zIndex="9999",l.style.width="100%",l.style.textAlign="left",document.body.appendChild(l),(n=document.getElementsByClassName("luma-compiler-log-error")[0])==null||n.scrollIntoView(),l.onclick=()=>{const c=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(c)}}};$(x2,"defaultProps",{..._n.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let MN=x2;function ON(i){return BN(i.source)||i.id||fy(`unnamed ${i.stage}-shader`)}function BN(i,e="unnamed"){const t=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(i);return t?t[1]:e}const S2=class E2 extends _n{constructor(e,t){super(e,t,E2.defaultProps),$(this,"shaderLayout"),$(this,"bufferLayout"),$(this,"linkStatus","pending"),$(this,"hash",""),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}get[Symbol.toStringTag](){return"RenderPipeline"}};$(S2,"defaultProps",{..._n.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});let Zh=S2;const C2=class T2 extends _n{constructor(e,t){super(e,t,T2.defaultProps),$(this,"hash",""),$(this,"shaderLayout"),this.shaderLayout=t.shaderLayout}get[Symbol.toStringTag](){return"ComputePipeline"}};$(C2,"defaultProps",{..._n.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});let Q0=C2;function FN(i){return jN[i]}function zN(i){const[e,t]=$N[i],n=e==="i32"||e==="u32",s=e!=="u32",r=UN[e]*t;return{primitiveType:e,components:t,byteLength:r,integer:n,signed:s}}const UN={f32:4,f16:2,i32:4,u32:4},$N={f32:["f32",1],"vec2":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},jN={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"f16",components:2},"vec3":{type:"f16",components:3},"vec4":{type:"f16",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16},"mat2x2":{type:"f16",components:4},"mat2x3":{type:"f16",components:6},"mat2x4":{type:"f16",components:8},"mat3x2":{type:"f16",components:6},"mat3x3":{type:"f16",components:9},"mat3x4":{type:"f16",components:12},"mat4x2":{type:"f16",components:8},"mat4x3":{type:"f16",components:12},"mat4x4":{type:"f16",components:16},"mat2x2":{type:"i32",components:4},"mat2x3":{type:"i32",components:6},"mat2x4":{type:"i32",components:8},"mat3x2":{type:"i32",components:6},"mat3x3":{type:"i32",components:9},"mat3x4":{type:"i32",components:12},"mat4x2":{type:"i32",components:8},"mat4x3":{type:"i32",components:12},"mat4x4":{type:"i32",components:16},"mat2x2":{type:"u32",components:4},"mat2x3":{type:"u32",components:6},"mat2x4":{type:"u32",components:8},"mat3x2":{type:"u32",components:6},"mat3x3":{type:"u32",components:9},"mat3x4":{type:"u32",components:12},"mat4x2":{type:"u32",components:8},"mat4x3":{type:"u32",components:12},"mat4x4":{type:"u32",components:16}};function k2(i,e){const t={};for(const n of i.attributes){const s=HN(i,e,n.name);s&&(t[n.name]=s)}return t}function Nte(i,e,t=16){const n=k2(i,e),s=new Array(t).fill(null);for(const r of Object.values(n))s[r.location]=r;return s}function HN(i,e,t){const n=VN(i,t),s=GN(e,t);if(!n)return null;const r=zN(n.type),o=cN(r),a=(s==null?void 0:s.vertexFormat)||o,l=my(a);return{attributeName:(s==null?void 0:s.attributeName)||n.name,bufferName:(s==null?void 0:s.bufferName)||n.name,location:n.location,shaderType:n.type,primitiveType:r.primitiveType,shaderComponents:r.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:r.integer,stepMode:(s==null?void 0:s.stepMode)||n.stepMode||"vertex",byteOffset:(s==null?void 0:s.byteOffset)||0,byteStride:(s==null?void 0:s.byteStride)||0}}function VN(i,e){const t=i.attributes.find(n=>n.name===e);return t||le.warn(`shader layout attribute "${e}" not present in shader`),t||null}function GN(i,e){WN(i);let t=YN(i,e);return t||(t=qN(i,e),t)?t:(le.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function WN(i){for(const e of i)(e.attributes&&e.format||!e.attributes&&!e.format)&&le.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function YN(i,e){for(const t of i)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function qN(i,e){var t;for(const n of i){let s=n.byteStride;if(typeof n.byteStride!="number")for(const o of n.attributes||[]){const a=my(o.format);s+=a.byteLength}const r=(t=n.attributes)==null?void 0:t.find(o=>o.attribute===e);if(r)return{attributeName:r.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:r.format,byteOffset:r.byteOffset,byteStride:s}}return null}let wd;function A2(i){return(!wd||wd.byteLengthr.type==="uniform"&&r.name===(e==null?void 0:e.name));if(!n)throw new Error(e==null?void 0:e.name);const s=n;for(const r of s.uniforms||[])this.bindingLayout[r.name]=r}}setUniforms(e){for(const[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){QN(this.uniforms[e],t)||(this.uniforms[e]=JN(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}let ri=class{constructor(e){$(this,"uniformBlocks",new Map),$(this,"uniformBufferLayouts",new Map),$(this,"uniformBuffers",new Map);for(const[t,n]of Object.entries(e)){const s=t,r=new ZN(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,r);const o=new eD({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var t;for(const[n,s]of Object.entries(e))(t=this.uniformBlocks.get(n))==null||t.setUniforms(s);this.updateUniformBuffers()}getUniformBufferByteLength(e){var t;return((t=this.uniformBufferLayouts.get(e))==null?void 0:t.byteLength)||0}getUniformBufferData(e){var t,n;const s=((t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms())||{};return(n=this.uniformBufferLayouts.get(e))==null?void 0:n.getData(s)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);const s=this.getUniformBufferByteLength(t),r=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return r.write(o),r}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){const n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(const t of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(t);e||(e=n)}return e&&le.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var t;const n=this.uniformBlocks.get(e);let s=this.uniformBuffers.get(e),r=!1;if(s&&n!=null&&n.needsRedraw){r||(r=n.needsRedraw);const o=this.getUniformBufferData(e);s=this.uniformBuffers.get(e),s==null||s.write(o);const a=(t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms();le.log(4,`Writing to uniform buffer ${String(e)}`,o,a)()}return r}};var Do;(function(i){i[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.GEQUAL=518]="GEQUAL",i[i.ALWAYS=519]="ALWAYS",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.R16_EXT=33322]="R16_EXT",i[i.RG16_EXT=33324]="RG16_EXT",i[i.RGB16_EXT=32852]="RGB16_EXT",i[i.RGBA16_EXT=32859]="RGBA16_EXT",i[i.R16_SNORM_EXT=36760]="R16_SNORM_EXT",i[i.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",i[i.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",i[i.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",i[i.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",i[i.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",i[i.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",i[i.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",i[i.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",i[i.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",i[i.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",i[i.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",i[i.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",i[i.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",i[i.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",i[i.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",i[i.LINE_WEBGL=6913]="LINE_WEBGL",i[i.FILL_WEBGL=6914]="FILL_WEBGL",i[i.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",i[i.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",i[i.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",i[i.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",i[i.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",i[i.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",i[i.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",i[i.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",i[i.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",i[i.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",i[i.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",i[i.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",i[i.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",i[i.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",i[i.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",i[i.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",i[i.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",i[i.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",i[i.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",i[i.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",i[i.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",i[i.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",i[i.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",i[i.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Do||(Do={}));const tD={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},iD=i=>({drawBuffersWEBGL(e){return i.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),nD=i=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return i.createVertexArray()},deleteVertexArrayOES(e){return i.deleteVertexArray(e)},isVertexArrayOES(e){return i.isVertexArray(e)},bindVertexArrayOES(e){return i.bindVertexArray(e)}}),sD=i=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return i.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return i.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return i.vertexAttribDivisor(...e)}});function rD(i=!0){const e=HTMLCanvasElement.prototype;if(!i&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){const s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&oD(s),s}return this.originalGetContext(t,n)}}function oD(i){i.getExtension("EXT_color_buffer_float");const e={...tD,WEBGL_disjoint_timer_query:i.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:iD(i),OES_vertex_array_object:nD(i),ANGLE_instanced_arrays:sD(i)},t=i.getExtension;i.getExtension=function(s){return t.call(i,s)||(s in e?e[s]:null)};const n=i.getSupportedExtensions;i.getSupportedExtensions=function(){const s=n.apply(i)||[];return s==null?void 0:s.concat(Object.keys(e))}}async function I2(i,e){const t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",i),new Promise((s,r)=>{n.onload=s,n.onerror=o=>r(new Error(`Unable to load script '${i}': ${o}`)),t.appendChild(n)})}const aD=1;let hi=null,J0=!1;const _y={debugSpectorJS:le.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function lD(i){if(!globalThis.SPECTOR)try{await I2(i.debugSpectorJSUrl||_y.debugSpectorJSUrl)}catch(e){le.warn(String(e))}}function Ote(i){var e;if(i={..._y,...i},!i.debugSpectorJS)return null;if(!hi&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){le.probe(aD,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:t}=globalThis.SPECTOR;hi=new t,globalThis.luma&&(globalThis.luma.spector=hi)}if(!hi)return null;if(J0||(J0=!0,hi.spyCanvases(),hi==null||hi.onCaptureStarted.add(t=>le.info("Spector capture started:",t)()),hi==null||hi.onCapture.add(t=>{le.info("Spector capture complete:",t)(),hi==null||hi.getResultUI(),hi==null||hi.resultView.display(),hi==null||hi.resultView.addCapture(t)})),i.gl){const t=i.gl,n=t.device;hi==null||hi.startCapture(i.gl,500),t.device=n,new Promise(s=>setTimeout(s,2e3)).then(s=>{le.info("Spector capture stopped after 2 seconds")(),hi==null||hi.stopCapture()})}return hi}const cD="https://unpkg.com/webgl-debug@2.0.1/index.js";function L2(i){return i.luma=i.luma||{},i.luma}async function uD(){Vu()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await I2(cD))}function Bte(i,e={}){return e.debugWebGL||e.traceWebGL?hD(i,e):dD(i)}function dD(i){const e=L2(i);return e.realContext?e.realContext:i}function hD(i,e){if(!globalThis.WebGLDebugUtils)return le.warn("webgl-debug not loaded")(),i;const t=L2(i);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Do,...i});const n=globalThis.WebGLDebugUtils.makeDebugContext(i,fD.bind(null,e),pD.bind(null,e));for(const o in Do)!(o in n)&&typeof Do[o]=="number"&&(n[o]=Do[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.setPrototypeOf(s,n);const r=Object.create(s);return t.realContext=i,t.debugContext=r,r.debug=!0,r}function ex(i,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${i}(${t})`}function fD(i,e,t,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);const s=globalThis.WebGLDebugUtils.glEnumToString(e),r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${s} in gl.${t}(${r})`;le.error(o)();debugger}function pD(i,e,t){let n="";le.level>=1&&(n=ex(e,t),i.traceWebGL&&le.log(1,n)());for(const s of t)if(s===void 0){n=n||ex(e,t);debugger}}const Sd=1;class mD extends CN{constructor(){super(),$(this,"type","webgl"),Cg.defaultProps={...Cg.defaultProps,..._y}}enforceWebGL2(e){rD(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&le.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){const{WebGLDevice:n}=await m0(async()=>{const{WebGLDevice:r}=await import("./webgl-device-QoBMYpnS-B_qdW-Dv.js");return{WebGLDevice:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));if(e instanceof n)return e;if((e==null?void 0:e.device)instanceof n)return e.device;if(!gD(e))throw new Error("Invalid WebGL2RenderingContext");const s=t.createCanvasContext===!0?{}:t.createCanvasContext;return new n({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...s}})}async create(e={}){const{WebGLDevice:t}=await m0(async()=>{const{WebGLDevice:n}=await import("./webgl-device-QoBMYpnS-B_qdW-Dv.js");return{WebGLDevice:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));le.groupCollapsed(Sd,"WebGLDevice created")();try{const n=[];(e.debugWebGL||e.debug)&&n.push(uD()),e.debugSpectorJS&&n.push(lD(e));const s=await Promise.allSettled(n);for(const a of s)a.status==="rejected"&&le.error(`Failed to initialize debug libraries ${a.reason}`)();const r=new t(e),o=`${r._reused?"Reusing":"Created"} device with WebGL2 ${r.props.debug?"debug ":""}context: ${r.info.vendor}, ${r.info.renderer} for canvas: ${r.canvasContext.id}`;return le.probe(Sd,o)(),le.table(Sd,r.info)(),r}finally{le.groupEnd(Sd)()}}}function gD(i){return typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext?!0:!!(i&&Number.isFinite(i._version))}const _D=new mD,yD="#b3b3b3",bD=void 0,Ag=void 0,vD=1,xD=4,wD="#666666",SD=.1,ED=1,CD=1,R2="#222222",fe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},TD=.7,kD=.95,AD=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:P2,setPrototypeOf:tx,isFrozen:ID,getPrototypeOf:LD,getOwnPropertyDescriptor:RD}=Object;let{freeze:hn,seal:_s,create:N2}=Object,{apply:Ig,construct:Lg}=typeof Reflect<"u"&&Reflect;hn||(hn=function(i){return i});_s||(_s=function(i){return i});Ig||(Ig=function(i,e,t){return i.apply(e,t)});Lg||(Lg=function(i,e){return new i(...e)});const Ed=fn(Array.prototype.forEach),PD=fn(Array.prototype.lastIndexOf),ix=fn(Array.prototype.pop),lc=fn(Array.prototype.push),ND=fn(Array.prototype.splice),hh=fn(String.prototype.toLowerCase),nm=fn(String.prototype.toString),nx=fn(String.prototype.match),cc=fn(String.prototype.replace),DD=fn(String.prototype.indexOf),MD=fn(String.prototype.trim),Ms=fn(Object.prototype.hasOwnProperty),sn=fn(RegExp.prototype.test),uc=OD(TypeError);function fn(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:hh;tx&&tx(i,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const r=t(s);r!==s&&(ID(e)||(e[n]=r),s=r)}i[s]=!0}return i}function BD(i){for(let e=0;e/gm),jD=_s(/\$\{[\w\W]*/gm),HD=_s(/^data-[\-\w.\u00B7-\uFFFF]+$/),VD=_s(/^aria-[\-\w]+$/),D2=_s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),GD=_s(/^(?:\w+script|data):/i),WD=_s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),M2=_s(/^html$/i),YD=_s(/^[a-z][.\w]*(-[.\w]+)+$/i);var lx=Object.freeze({__proto__:null,ARIA_ATTR:VD,ATTR_WHITESPACE:WD,CUSTOM_ELEMENT:YD,DATA_ATTR:HD,DOCTYPE_NAME:M2,ERB_EXPR:$D,IS_ALLOWED_URI:D2,IS_SCRIPT_OR_DATA:GD,MUSTACHE_EXPR:UD,TMPLIT_EXPR:jD});const hc={element:1,text:3,progressingInstruction:7,comment:8,document:9},qD=function(){return typeof window>"u"?null:window},XD=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(t=e.getAttribute(n));const s="dompurify"+(t?"#"+t:"");try{return i.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},cx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function O2(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qD();const e=I=>O2(I);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==hc.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const n=t,s=n.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:p}=i,m=l.prototype,_=dc(m,"cloneNode"),g=dc(m,"remove"),y=dc(m,"nextSibling"),S=dc(m,"childNodes"),C=dc(m,"parentNode");if(typeof o=="function"){const I=t.createElement("template");I.content&&I.content.ownerDocument&&(t=I.content.ownerDocument)}let x,A="";const{implementation:L,createNodeIterator:P,createDocumentFragment:H,getElementsByTagName:Q}=t,{importNode:te}=n;let O=cx();e.isSupported=typeof P2=="function"&&typeof C=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:he,ERB_EXPR:se,TMPLIT_EXPR:R,DATA_ATTR:J,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:ee}=lx;let{IS_ALLOWED_URI:ae}=lx,Z=null;const Se=ot({},[...sx,...sm,...rm,...om,...rx]);let xe=null;const Je=ot({},[...ox,...am,...ax,...Cd]);let de=Object.seal(N2(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bt=null,Xe=null,ht=!0,re=!0,Te=!1,Pe=!0,q=!1,We=!0,He=!1,it=!1,Vt=!1,pe=!1,nt=!1,ui=!1,_i=!0,Zn=!1;const Qo="user-content-";let Zs=!0,Li=!1,en={},Ri=null;const ai=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let vo=null;const Es=ot({},["audio","video","img","source","image","track"]);let Qn=null;const Jn=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cs="http://www.w3.org/1998/Math/MathML",zi="http://www.w3.org/2000/svg",Ei="http://www.w3.org/1999/xhtml";let ii=Ei,bn=!1,vn=null;const Ts=ot({},[Cs,zi,Ei],nm);let On=ot({},["mi","mo","mn","ms","mtext"]),es=ot({},["annotation-xml"]);const Dr=ot({},["title","style","font","a","script"]);let xn=null;const Qs=["application/xhtml+xml","text/html"],Jo="text/html";let Zt=null,Ot=null;const ks=t.createElement("form"),xo=function(I){return I instanceof RegExp||I instanceof Function},Js=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===I)){if((!I||typeof I!="object")&&(I={}),I=Hr(I),xn=Qs.indexOf(I.PARSER_MEDIA_TYPE)===-1?Jo:I.PARSER_MEDIA_TYPE,Zt=xn==="application/xhtml+xml"?nm:hh,Z=Ms(I,"ALLOWED_TAGS")?ot({},I.ALLOWED_TAGS,Zt):Se,xe=Ms(I,"ALLOWED_ATTR")?ot({},I.ALLOWED_ATTR,Zt):Je,vn=Ms(I,"ALLOWED_NAMESPACES")?ot({},I.ALLOWED_NAMESPACES,nm):Ts,Qn=Ms(I,"ADD_URI_SAFE_ATTR")?ot(Hr(Jn),I.ADD_URI_SAFE_ATTR,Zt):Jn,vo=Ms(I,"ADD_DATA_URI_TAGS")?ot(Hr(Es),I.ADD_DATA_URI_TAGS,Zt):Es,Ri=Ms(I,"FORBID_CONTENTS")?ot({},I.FORBID_CONTENTS,Zt):ai,bt=Ms(I,"FORBID_TAGS")?ot({},I.FORBID_TAGS,Zt):Hr({}),Xe=Ms(I,"FORBID_ATTR")?ot({},I.FORBID_ATTR,Zt):Hr({}),en=Ms(I,"USE_PROFILES")?I.USE_PROFILES:!1,ht=I.ALLOW_ARIA_ATTR!==!1,re=I.ALLOW_DATA_ATTR!==!1,Te=I.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=I.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=I.SAFE_FOR_TEMPLATES||!1,We=I.SAFE_FOR_XML!==!1,He=I.WHOLE_DOCUMENT||!1,pe=I.RETURN_DOM||!1,nt=I.RETURN_DOM_FRAGMENT||!1,ui=I.RETURN_TRUSTED_TYPE||!1,Vt=I.FORCE_BODY||!1,_i=I.SANITIZE_DOM!==!1,Zn=I.SANITIZE_NAMED_PROPS||!1,Zs=I.KEEP_CONTENT!==!1,Li=I.IN_PLACE||!1,ae=I.ALLOWED_URI_REGEXP||D2,ii=I.NAMESPACE||Ei,On=I.MATHML_TEXT_INTEGRATION_POINTS||On,es=I.HTML_INTEGRATION_POINTS||es,de=I.CUSTOM_ELEMENT_HANDLING||{},I.CUSTOM_ELEMENT_HANDLING&&xo(I.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(de.tagNameCheck=I.CUSTOM_ELEMENT_HANDLING.tagNameCheck),I.CUSTOM_ELEMENT_HANDLING&&xo(I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(de.attributeNameCheck=I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),I.CUSTOM_ELEMENT_HANDLING&&typeof I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(re=!1),nt&&(pe=!0),en&&(Z=ot({},rx),xe=[],en.html===!0&&(ot(Z,sx),ot(xe,ox)),en.svg===!0&&(ot(Z,sm),ot(xe,am),ot(xe,Cd)),en.svgFilters===!0&&(ot(Z,rm),ot(xe,am),ot(xe,Cd)),en.mathMl===!0&&(ot(Z,om),ot(xe,ax),ot(xe,Cd))),I.ADD_TAGS&&(Z===Se&&(Z=Hr(Z)),ot(Z,I.ADD_TAGS,Zt)),I.ADD_ATTR&&(xe===Je&&(xe=Hr(xe)),ot(xe,I.ADD_ATTR,Zt)),I.ADD_URI_SAFE_ATTR&&ot(Qn,I.ADD_URI_SAFE_ATTR,Zt),I.FORBID_CONTENTS&&(Ri===ai&&(Ri=Hr(Ri)),ot(Ri,I.FORBID_CONTENTS,Zt)),Zs&&(Z["#text"]=!0),He&&ot(Z,["html","head","body"]),Z.table&&(ot(Z,["tbody"]),delete bt.tbody),I.TRUSTED_TYPES_POLICY){if(typeof I.TRUSTED_TYPES_POLICY.createHTML!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof I.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=I.TRUSTED_TYPES_POLICY,A=x.createHTML("")}else x===void 0&&(x=XD(p,s)),x!==null&&typeof A=="string"&&(A=x.createHTML(""));hn&&hn(I),Ot=I}},Rt=ot({},[...sm,...rm,...FD]),Mr=ot({},[...om,...zD]),ea=function(I){let V=C(I);(!V||!V.tagName)&&(V={namespaceURI:ii,tagName:"template"});const E=hh(I.tagName),G=hh(V.tagName);return vn[I.namespaceURI]?I.namespaceURI===zi?V.namespaceURI===Ei?E==="svg":V.namespaceURI===Cs?E==="svg"&&(G==="annotation-xml"||On[G]):!!Rt[E]:I.namespaceURI===Cs?V.namespaceURI===Ei?E==="math":V.namespaceURI===zi?E==="math"&&es[G]:!!Mr[E]:I.namespaceURI===Ei?V.namespaceURI===zi&&!es[G]||V.namespaceURI===Cs&&!On[G]?!1:!Mr[E]&&(Dr[E]||!Rt[E]):!!(xn==="application/xhtml+xml"&&vn[I.namespaceURI]):!1},ts=function(I){lc(e.removed,{element:I});try{C(I).removeChild(I)}catch{g(I)}},di=function(I,V){try{lc(e.removed,{attribute:V.getAttributeNode(I),from:V})}catch{lc(e.removed,{attribute:null,from:V})}if(V.removeAttribute(I),I==="is")if(pe||nt)try{ts(V)}catch{}else try{V.setAttribute(I,"")}catch{}},Bn=function(I){let V=null,E=null;if(Vt)I=""+I;else{const Ce=nx(I,/^[\r\n\t ]+/);E=Ce&&Ce[0]}xn==="application/xhtml+xml"&&ii===Ei&&(I=''+I+"");const G=x?x.createHTML(I):I;if(ii===Ei)try{V=new h().parseFromString(G,xn)}catch{}if(!V||!V.documentElement){V=L.createDocument(ii,"template",null);try{V.documentElement.innerHTML=bn?A:G}catch{}}const ne=V.body||V.documentElement;return I&&E&&ne.insertBefore(t.createTextNode(E),ne.childNodes[0]||null),ii===Ei?Q.call(V,He?"html":"body")[0]:He?V.documentElement:ne},wo=function(I){return P.call(I.ownerDocument||I,I,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ut=function(I){return I instanceof d&&(typeof I.nodeName!="string"||typeof I.textContent!="string"||typeof I.removeChild!="function"||!(I.attributes instanceof u)||typeof I.removeAttribute!="function"||typeof I.setAttribute!="function"||typeof I.namespaceURI!="string"||typeof I.insertBefore!="function"||typeof I.hasChildNodes!="function")},Or=function(I){return typeof a=="function"&&I instanceof a};function st(I,V,E){Ed(I,G=>{G.call(e,V,E,Ot)})}const wn=function(I){let V=null;if(st(O.beforeSanitizeElements,I,null),ut(I))return ts(I),!0;const E=Zt(I.nodeName);if(st(O.uponSanitizeElement,I,{tagName:E,allowedTags:Z}),We&&I.hasChildNodes()&&!Or(I.firstElementChild)&&sn(/<[/\w!]/g,I.innerHTML)&&sn(/<[/\w!]/g,I.textContent)||I.nodeType===hc.progressingInstruction||We&&I.nodeType===hc.comment&&sn(/<[/\w]/g,I.data))return ts(I),!0;if(!Z[E]||bt[E]){if(!bt[E]&&er(E)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E)))return!1;if(Zs&&!Ri[E]){const G=C(I)||I.parentNode,ne=S(I)||I.childNodes;if(ne&&G){const Ce=ne.length;for(let At=Ce-1;At>=0;--At){const rt=_(ne[At],!0);rt.__removalCount=(I.__removalCount||0)+1,G.insertBefore(rt,y(I))}}}return ts(I),!0}return I instanceof l&&!ea(I)||(E==="noscript"||E==="noembed"||E==="noframes")&&sn(/<\/no(script|embed|frames)/i,I.innerHTML)?(ts(I),!0):(q&&I.nodeType===hc.text&&(V=I.textContent,Ed([he,se,R],G=>{V=cc(V,G," ")}),I.textContent!==V&&(lc(e.removed,{element:I.cloneNode()}),I.textContent=V)),st(O.afterSanitizeElements,I,null),!1)},Br=function(I,V,E){if(_i&&(V==="id"||V==="name")&&(E in t||E in ks))return!1;if(!(re&&!Xe[V]&&sn(J,V))&&!(ht&&sn(F,V))){if(!xe[V]||Xe[V]){if(!(er(I)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,I)||de.tagNameCheck instanceof Function&&de.tagNameCheck(I))&&(de.attributeNameCheck instanceof RegExp&&sn(de.attributeNameCheck,V)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(V))||V==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E))))return!1}else if(!Qn[V]&&!sn(ae,cc(E,ie,""))&&!((V==="src"||V==="xlink:href"||V==="href")&&I!=="script"&&DD(E,"data:")===0&&vo[I])&&!(Te&&!sn(X,cc(E,ie,"")))&&E)return!1}return!0},er=function(I){return I!=="annotation-xml"&&nx(I,ee)},Fn=function(I){st(O.beforeSanitizeAttributes,I,null);const{attributes:V}=I;if(!V||ut(I))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let G=V.length;for(;G--;){const ne=V[G],{name:Ce,namespaceURI:At,value:rt}=ne,et=Zt(Ce),yi=rt;let ft=Ce==="value"?yi:MD(yi);if(E.attrName=et,E.attrValue=ft,E.keepAttr=!0,E.forceKeepAttr=void 0,st(O.uponSanitizeAttribute,I,E),ft=E.attrValue,Zn&&(et==="id"||et==="name")&&(di(Ce,I),ft=Qo+ft),We&&sn(/((--!?|])>)|<\/(style|title)/i,ft)){di(Ce,I);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){di(Ce,I);continue}if(!Pe&&sn(/\/>/i,ft)){di(Ce,I);continue}q&&Ed([he,se,R],Bt=>{ft=cc(ft,Bt," ")});const tr=Zt(I.nodeName);if(!Br(tr,et,ft)){di(Ce,I);continue}if(x&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!At)switch(p.getAttributeType(tr,et)){case"TrustedHTML":{ft=x.createHTML(ft);break}case"TrustedScriptURL":{ft=x.createScriptURL(ft);break}}if(ft!==yi)try{At?I.setAttributeNS(At,Ce,ft):I.setAttribute(Ce,ft),ut(I)?ts(I):ix(e.removed)}catch{di(Ce,I)}}st(O.afterSanitizeAttributes,I,null)},tn=function I(V){let E=null;const G=wo(V);for(st(O.beforeSanitizeShadowDOM,V,null);E=G.nextNode();)st(O.uponSanitizeShadowNode,E,null),wn(E),Fn(E),E.content instanceof r&&I(E.content);st(O.afterSanitizeShadowDOM,V,null)};return e.sanitize=function(I){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,G=null,ne=null,Ce=null;if(bn=!I,bn&&(I=""),typeof I!="string"&&!Or(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw uc("dirty is not a string, aborting")}else throw uc("toString is not a function");if(!e.isSupported)return I;if(it||Js(V),e.removed=[],typeof I=="string"&&(Li=!1),Li){if(I.nodeName){const et=Zt(I.nodeName);if(!Z[et]||bt[et])throw uc("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=Bn(""),G=E.ownerDocument.importNode(I,!0),G.nodeType===hc.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?E=G:E.appendChild(G);else{if(!pe&&!q&&!He&&I.indexOf("<")===-1)return x&&ui?x.createHTML(I):I;if(E=Bn(I),!E)return pe?null:ui?A:""}E&&Vt&&ts(E.firstChild);const At=wo(Li?I:E);for(;ne=At.nextNode();)wn(ne),Fn(ne),ne.content instanceof r&&tn(ne.content);if(Li)return I;if(pe){if(nt)for(Ce=H.call(E.ownerDocument);E.firstChild;)Ce.appendChild(E.firstChild);else Ce=E;return(xe.shadowroot||xe.shadowrootmode)&&(Ce=te.call(n,Ce,!0)),Ce}let rt=He?E.outerHTML:E.innerHTML;return He&&Z["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&sn(M2,E.ownerDocument.doctype.name)&&(rt=" `+rt),q&&Ed([he,se,R],et=>{rt=cc(rt,et," ")}),x&&ui?x.createHTML(rt):rt},e.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Js(I),it=!0},e.clearConfig=function(){Ot=null,it=!1},e.isValidAttribute=function(I,V,E){Ot||Js({});const G=Zt(I),ne=Zt(V);return Br(G,ne,E)},e.addHook=function(I,V){typeof V=="function"&&lc(O[I],V)},e.removeHook=function(I,V){if(V!==void 0){const E=PD(O[I],V);return E===-1?void 0:ND(O[I],E,1)[0]}return ix(O[I])},e.removeHooks=function(I){O[I]=[]},e.removeAllHooks=function(){O=cx()},e}var KD=O2();const ZD=i=>typeof i=="function",B2=i=>Array.isArray(i),QD=i=>i instanceof Object,JD=i=>i instanceof Object?i.constructor.name!=="Function"&&i.constructor.name!=="Object":!1,ux=i=>QD(i)&&!B2(i)&&!ZD(i)&&!JD(i);function Mo(i){let e;if(B2(i))e=i;else{const t=Uo(i),n=t==null?void 0:t.rgb();e=[(n==null?void 0:n.r)||0,(n==null?void 0:n.g)||0,(n==null?void 0:n.b)||0,(t==null?void 0:t.opacity)??1]}return[e[0]/255,e[1]/255,e[2]/255,e[3]]}function eM(i,e,t){return .2126*i+.7152*e+.0722*t}function jn(i,e,t=0,n=0,s,r){return i.readPixelsToArrayWebGL(e,{sourceX:t,sourceY:n,sourceWidth:s,sourceHeight:r})}function tM(i,e,t){return Math.min(Math.max(i,e),t)}function rs(i){return i!=null&&!Number.isNaN(i)}function iM(i,e){return KD.sanitize(i,{ALLOWED_TAGS:["a","b","i","em","strong","span","div","p","br"],ALLOWED_ATTR:["href","target","class","id","style"],ALLOW_DATA_ATTR:!1,...e})}class nM{constructor(){this.enableSimulation=fe.enableSimulation,this.backgroundColor=R2,this.spaceSize=fe.spaceSize,this.pointColor=yD,this.pointDefaultColor=void 0,this.pointGreyoutOpacity=bD,this.pointGreyoutColor=Ag,this.pointSize=xD,this.pointDefaultSize=void 0,this.pointOpacity=vD,this.pointSizeScale=fe.pointSizeScale,this.hoveredPointCursor=fe.hoveredPointCursor,this.hoveredLinkCursor=fe.hoveredLinkCursor,this.renderHoveredPointRing=fe.renderHoveredPointRing,this.hoveredPointRingColor=fe.hoveredPointRingColor,this.focusedPointRingColor=fe.focusedPointRingColor,this.focusedPointIndex=fe.focusedPointIndex,this.linkColor=wD,this.linkDefaultColor=void 0,this.linkOpacity=ED,this.linkGreyoutOpacity=SD,this.linkWidth=CD,this.linkDefaultWidth=void 0,this.linkWidthScale=fe.linkWidthScale,this.hoveredLinkColor=fe.hoveredLinkColor,this.hoveredLinkWidthIncrease=fe.hoveredLinkWidthIncrease,this.renderLinks=fe.renderLinks,this.curvedLinks=fe.curvedLinks,this.curvedLinkSegments=fe.curvedLinkSegments,this.curvedLinkWeight=fe.curvedLinkWeight,this.curvedLinkControlPointDistance=fe.curvedLinkControlPointDistance,this.linkArrows=fe.linkArrows,this.linkDefaultArrows=void 0,this.linkArrowsSizeScale=fe.linkArrowsSizeScale,this.scaleLinksOnZoom=fe.scaleLinksOnZoom,this.linkVisibilityDistanceRange=fe.linkVisibilityDistanceRange,this.linkVisibilityMinTransparency=fe.linkVisibilityMinTransparency,this.simulationDecay=fe.simulation.decay,this.simulationGravity=fe.simulation.gravity,this.simulationCenter=fe.simulation.center,this.simulationRepulsion=fe.simulation.repulsion,this.simulationRepulsionTheta=fe.simulation.repulsionTheta,this.simulationLinkSpring=fe.simulation.linkSpring,this.simulationLinkDistance=fe.simulation.linkDistance,this.simulationLinkDistRandomVariationRange=fe.simulation.linkDistRandomVariationRange,this.simulationRepulsionFromMouse=fe.simulation.repulsionFromMouse,this.enableRightClickRepulsion=fe.enableRightClickRepulsion,this.simulationFriction=fe.simulation.friction,this.simulationCluster=fe.simulation.cluster,this.onSimulationStart=void 0,this.onSimulationTick=void 0,this.onSimulationEnd=void 0,this.onSimulationPause=void 0,this.onSimulationRestart=void 0,this.onSimulationUnpause=void 0,this.onClick=void 0,this.onPointClick=void 0,this.onLinkClick=void 0,this.onBackgroundClick=void 0,this.onMouseMove=void 0,this.onPointMouseOver=void 0,this.onPointMouseOut=void 0,this.onLinkMouseOver=void 0,this.onLinkMouseOut=void 0,this.onZoomStart=void 0,this.onZoom=void 0,this.onZoomEnd=void 0,this.onDragStart=void 0,this.onDrag=void 0,this.onDragEnd=void 0,this.showFPSMonitor=fe.showFPSMonitor,this.pixelRatio=fe.pixelRatio,this.scalePointsOnZoom=fe.scalePointsOnZoom,this.initialZoomLevel=void 0,this.enableZoom=fe.enableZoom,this.enableSimulationDuringZoom=fe.enableSimulationDuringZoom,this.enableDrag=fe.enableDrag,this.fitViewOnInit=fe.fitViewOnInit,this.fitViewDelay=fe.fitViewDelay,this.fitViewPadding=fe.fitViewPadding,this.fitViewDuration=fe.fitViewDuration,this.fitViewByPointsInRect=void 0,this.fitViewByPointIndices=void 0,this.randomSeed=void 0,this.pointSamplingDistance=fe.pointSamplingDistance,this.attribution=fe.attribution,this.rescalePositions=fe.rescalePositions}init(e){Object.keys(e).forEach(t=>{this.deepMergeConfig(this.getConfig(),e,t)})}deepMergeConfig(e,t,n){ux(e[n])&&ux(t[n])?Object.keys(t[n]).forEach(s=>{this.deepMergeConfig(e[n],t[n],s)}):e[n]=t[n]}getConfig(){return this}}function yy(i,e){if(!i)throw new Error(e||"shadertools: assertion failed.")}const lm={number:{type:"number",validate(i,e){return Number.isFinite(i)&&typeof e=="object"&&(e.max===void 0||i<=e.max)&&(e.min===void 0||i>=e.min)}},array:{type:"array",validate(i,e){return Array.isArray(i)||ArrayBuffer.isView(i)}}};function sM(i){const e={};for(const[t,n]of Object.entries(i))e[t]=rM(n);return e}function rM(i){let e=dx(i);if(e!=="object")return{value:i,...lm[e],type:e};if(typeof i=="object")return i?i.type!==void 0?{...i,...lm[i.type],type:i.type}:i.value===void 0?{type:"object",value:i}:(e=dx(i.value),{...i,...lm[e],type:e}):{type:"object",value:null};throw new Error("props")}function dx(i){return Array.isArray(i)||ArrayBuffer.isView(i)?"array":typeof i}const oM=`#ifdef MODULE_LOGDEPTH logdepth_adjustPosition(gl_Position); #endif diff --git a/frontend/dist/assets/Mqtt-DoM7Zof1.js b/frontend/dist/assets/Mqtt-DR3VniFT.js similarity index 98% rename from frontend/dist/assets/Mqtt-DoM7Zof1.js rename to frontend/dist/assets/Mqtt-DR3VniFT.js index dfb849c5..8ef8f571 100644 --- a/frontend/dist/assets/Mqtt-DoM7Zof1.js +++ b/frontend/dist/assets/Mqtt-DR3VniFT.js @@ -1,4 +1,4 @@ -import{e as Se,fm as N,fn as Ke,r as d,j as e,I as K,B as te,c as C,f2 as Fe,f3 as ze,aE as be,f4 as Ve,a8 as pe,V as I,a0 as ne,bM as xe,fo as ye,dn as Ce,fp as Le,fq as me,bH as We,fr as $e,aa as le,a7 as Pe,fs as O,ft as Ye,fu as Ze,fv as Me,fw as Je,fx as Xe,fy as _e,a2 as je,fz as qe,cK as ke,fA as Qe,bY as et}from"./index-i0xzpXop.js";import{C as Q,P as tt,a as st,B as at}from"./PageLayout-B4RCJ-XT.js";import{L as Re,a as fe}from"./listbox-C1gGOelh.js";import{S as nt}from"./settings-2-B0xGzDNd.js";import{P as re}from"./plus-Bb8eT78f.js";import{M as rt}from"./map-pin-C051lstq.js";import{C as lt}from"./check-check-AfNqagLY.js";import{Z as se}from"./zap-tuTM-Jsw.js";import{S as Te}from"./search-DsTk_ZsM.js";import{C as de}from"./chevron-right-DsOuIRi8.js";import{H as ot}from"./hash-CyK-Kad6.js";import{u as it,C as ct}from"./chevron-up-BVzq549_.js";import{F as dt}from"./funnel-CitfWrkD.js";import{a as ut,C as mt}from"./circle-stop--JH-Omkf.js";import{T as ht}from"./trash-2-DCqpUdF7.js";import{M as pt}from"./message-square-BzLgyIjH.js";import{C as xt}from"./cpu-BxgsQ0OY.js";import{R as ue,C as ge}from"./Grid-BhoD4aLU.js";import{W as ft}from"./wifi-DYlEDPZY.js";import{W as gt}from"./wifi-off-CQ0s_9cO.js";import{D as Ne}from"./database-gsjgeKE3.js";import{C as Nt}from"./clock-F-4SScS_.js";import"./element-movement-BD3SL-GU.js";import"./use-text-value-T4f0bwXS.js";import"./frozen-D4mEoVft.js";/** +import{e as Se,fm as N,fn as Ke,r as d,j as e,I as K,B as te,c as C,f2 as Fe,f3 as ze,aE as be,f4 as Ve,a8 as pe,V as I,a0 as ne,bM as xe,fo as ye,dn as Ce,fp as Le,fq as me,bH as We,fr as $e,aa as le,a7 as Pe,fs as O,ft as Ye,fu as Ze,fv as Me,fw as Je,fx as Xe,fy as _e,a2 as je,fz as qe,cK as ke,fA as Qe,bY as et}from"./index-CN4vD05c.js";import{C as Q,P as tt,a as st,B as at}from"./PageLayout-DJSWC4zL.js";import{L as Re,a as fe}from"./listbox-Cfex3RUz.js";import{S as nt}from"./settings-2-CUT2ngOp.js";import{P as re}from"./plus-3025QRmd.js";import{M as rt}from"./map-pin-W8m2dIyd.js";import{C as lt}from"./check-check-CL5EVU8z.js";import{Z as se}from"./zap-Ba3ctUHg.js";import{S as Te}from"./search-D1TEdb7u.js";import{C as de}from"./chevron-right-BCotFXkU.js";import{H as ot}from"./hash-vaiKl847.js";import{u as it,C as ct}from"./chevron-up-Tfuf4unO.js";import{F as dt}from"./funnel-Bd2d2Gy-.js";import{a as ut,C as mt}from"./circle-stop-DyVWFFOh.js";import{T as ht}from"./trash-2-DqmFYXqQ.js";import{M as pt}from"./message-square-EOpOlt3H.js";import{C as xt}from"./cpu-6yAZtSYM.js";import{R as ue,C as ge}from"./Grid-DeJEUuBo.js";import{W as ft}from"./wifi-BF-rEj1F.js";import{W as gt}from"./wifi-off-Bfc2_ayY.js";import{D as Ne}from"./database-n5nNHRzj.js";import{C as Nt}from"./clock-jH_gnOTU.js";import"./element-movement-22ZdBM88.js";import"./use-text-value-DHtdh4JM.js";import"./frozen-ZI0va0FF.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/MqttModeBadge-Dhi11STL.js b/frontend/dist/assets/MqttModeBadge-BFJmiZy5.js similarity index 98% rename from frontend/dist/assets/MqttModeBadge-Dhi11STL.js rename to frontend/dist/assets/MqttModeBadge-BFJmiZy5.js index 72f2d35f..d57ee21e 100644 --- a/frontend/dist/assets/MqttModeBadge-Dhi11STL.js +++ b/frontend/dist/assets/MqttModeBadge-BFJmiZy5.js @@ -1,4 +1,4 @@ -import{aX as Le,bi as ve,d0 as qe,d1 as xe,aZ as Qe,aY as Z,r as l,b0 as Ve,b1 as ee,b5 as U,b4 as z,aT as I,b8 as Q,d2 as se,d3 as _e,bd as Ye,be as He,bj as Ke,bf as re,bk as We,bg as me,d4 as je,d5 as V,d6 as A,d7 as G,d8 as he,d9 as Pe,bh as le,bu as C,da as ye,db as ge,bl as we,bs as Xe,bm as Te,bn as Ee,bo as J,bp as Ze,bq as Ue,bt as Fe,dc as ze,dd as Oe,bv as Je,de as et,df as tt,bw as ke,dg as nt,dh as at,di as ot,aU as st,dj as rt,bC as lt,dk as ut,dl as it,dm as Ne,bE as ct,bG as ce,e as dt,j as x,c as M,d as pt,m as ft,cZ as bt,dn as vt,u as mt,V as ht,aa as Ie}from"./index-i0xzpXop.js";import{C as yt}from"./chevron-right-DsOuIRi8.js";import{F as gt,y as xt,R as Pt,T as $t,w as St,A as Ct}from"./map-pin-C051lstq.js";var wt=Object.defineProperty,kt=(e,n,t)=>n in e?wt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Be=(e,n,t)=>(kt(e,typeof n!="symbol"?n+"":n,t),t),P=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(P||{}),It=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(It||{});let Bt={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,n){return e.button===n.button?e:{...e,button:n.button}},3(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},4(e,n){return e.panel===n.panel?e:{...e,panel:n.panel}},5(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}}};class $e extends Le{constructor(n){super(n),Be(this,"actions",{close:()=>this.send({type:1}),refocusableClose:t=>{this.actions.close();let f=t?ve(t)?t:"current"in t&&ve(t.current)?t.current:this.state.button:this.state.button;f==null||f.focus()},open:()=>this.send({type:0}),setButtonId:t=>this.send({type:3,buttonId:t}),setButton:t=>this.send({type:2,button:t}),setPanelId:t=>this.send({type:5,panelId:t}),setPanel:t=>this.send({type:4,panel:t})}),Be(this,"selectors",{isPortalled:t=>{var f;if(!t.button||!t.panel)return!1;let m=(f=qe(t.button))!=null?f:document;for(let $ of m.querySelectorAll("body > *"))if(Number($==null?void 0:$.contains(t.button))^Number($==null?void 0:$.contains(t.panel)))return!0;let i=xe(m),r=i.indexOf(t.button),a=(r+i.length-1)%i.length,S=(r+1)%i.length,y=i[a],s=i[S];return!t.panel.contains(y)&&!t.panel.contains(s)}});{let t=this.state.id,f=Qe.get(null);this.on(0,()=>f.actions.push(t)),this.on(1,()=>f.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new $e({id:n,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(n,t){return Z(t.type,Bt,n,t)}}const Me=l.createContext(null);function de(e){let n=l.useContext(Me);if(n===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return n}function _t({id:e,__demoMode:n=!1}){let t=l.useMemo(()=>$e.new({id:e,__demoMode:n}),[]);return Ve(()=>t.dispose()),t}let Se=l.createContext(null);Se.displayName="PopoverGroupContext";function De(){return l.useContext(Se)}let pe=l.createContext(null);pe.displayName="PopoverPanelContext";function jt(){return l.useContext(pe)}let Tt="div";function Et(e,n){var t;let f=l.useId(),{__demoMode:m=!1,...i}=e,r=_t({id:f,__demoMode:m}),a=l.useRef(null),S=z(n,et(u=>{a.current=u})),[y,s,$,w,B]=U(r,l.useCallback(u=>[u.popoverState,u.button,u.panel,u.buttonId,u.panelId],[])),k=tt((t=a.current)!=null?t:s),b=ke(w),p=ke(B),v=l.useMemo(()=>({buttonId:b,panelId:p,close:r.actions.close}),[b,p,r]),g=De(),c=g==null?void 0:g.registerPopover,_=I(()=>{var u,j;let E=se((u=a.current)!=null?u:s);return(j=g==null?void 0:g.isFocusWithinPopoverGroup())!=null?j:E&&((s==null?void 0:s.contains(E))||($==null?void 0:$.contains(E)))});l.useEffect(()=>c==null?void 0:c(v),[c,v]);let[te,ne]=nt(),L=at(s),D=ot({mainTreeNode:L,portals:te,defaultContainers:[{get current(){return r.state.button}},{get current(){return r.state.panel}}]});st(k,"focus",u=>{var j,E,O,W,N,X;u.target!==window&&rt(u.target)&&r.state.popoverState===P.Open&&(_()||r.state.button&&r.state.panel&&(D.contains(u.target)||(E=(j=r.state.beforePanelSentinel.current)==null?void 0:j.contains)!=null&&E.call(j,u.target)||(W=(O=r.state.afterPanelSentinel.current)==null?void 0:O.contains)!=null&&W.call(O,u.target)||(X=(N=r.state.afterButtonSentinel.current)==null?void 0:N.contains)!=null&&X.call(N,u.target)||r.actions.close()))},!0);let Y=y===P.Open;lt(Y,D.resolveContainers,(u,j)=>{r.actions.close(),ut(j,it.Loose)||(u.preventDefault(),s==null||s.focus())});let ae=re({open:y===P.Open,close:r.actions.refocusableClose}),oe=U(r,l.useCallback(u=>Z(u.popoverState,{[P.Open]:J.Open,[P.Closed]:J.Closed}),[])),H={ref:S},K=le();return C.createElement(Ne,{node:L},C.createElement(Ct,null,C.createElement(pe.Provider,{value:null},C.createElement(Me.Provider,{value:r},C.createElement(Oe,{value:r.actions.refocusableClose},C.createElement(ct,{value:oe},C.createElement(ne,null,K({ourProps:H,theirProps:i,slot:ae,defaultTag:Tt,name:"Popover"}))))))))}let Ft="button";function Ot(e,n){let t=l.useId(),{id:f=`headlessui-popover-button-${t}`,disabled:m=!1,autoFocus:i=!1,...r}=e,a=de("Popover.Button"),[S,y,s,$,w,B,k]=U(a,l.useCallback(o=>[o.popoverState,a.selectors.isPortalled(o),o.button,o.buttonId,o.panel,o.panelId,o.afterButtonSentinel],[])),b=l.useRef(null),p=`headlessui-focus-sentinel-${l.useId()}`,v=De(),g=v==null?void 0:v.closeOthers,c=jt()!==null;l.useEffect(()=>{if(!c)return a.actions.setButtonId(f),()=>a.actions.setButtonId(null)},[c,f,a]);let[_]=l.useState(()=>Symbol()),te=z(b,n,gt(),I(o=>{if(!c){if(o)a.state.buttons.current.push(_);else{let d=a.state.buttons.current.indexOf(_);d!==-1&&a.state.buttons.current.splice(d,1)}a.state.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),o&&a.actions.setButton(o)}})),ne=z(b,n),L=I(o=>{var d,T,F;if(c){if(a.state.popoverState===P.Closed)return;switch(o.key){case Q.Space:case Q.Enter:o.preventDefault(),(T=(d=o.target).click)==null||T.call(d),a.actions.close(),(F=a.state.button)==null||F.focus();break}}else switch(o.key){case Q.Space:case Q.Enter:o.preventDefault(),o.stopPropagation(),a.state.popoverState===P.Closed?(g==null||g(a.state.buttonId),a.actions.open()):a.actions.close();break;case Q.Escape:if(a.state.popoverState!==P.Open)return g==null?void 0:g(a.state.buttonId);if(!b.current)return;let R=se(b.current);if(R&&!b.current.contains(R))return;o.preventDefault(),o.stopPropagation(),a.actions.close();break}}),D=I(o=>{c||o.key===Q.Space&&o.preventDefault()}),Y=I(o=>{var d,T;_e(o.currentTarget)||m||(c?(a.actions.close(),(d=a.state.button)==null||d.focus()):(o.preventDefault(),o.stopPropagation(),a.state.popoverState===P.Closed?(g==null||g(a.state.buttonId),a.actions.open()):a.actions.close(),(T=a.state.button)==null||T.focus()))}),ae=I(o=>{o.preventDefault(),o.stopPropagation()}),{isFocusVisible:oe,focusProps:H}=Ye({autoFocus:i}),{isHovered:K,hoverProps:u}=He({isDisabled:m}),{pressed:j,pressProps:E}=Ke({disabled:m}),O=S===P.Open,W=re({open:O,active:j||O,disabled:m,hover:K,focus:oe,autofocus:i}),N=We(e,s),X=c?me({ref:ne,type:N,onKeyDown:L,onClick:Y,disabled:m||void 0,autoFocus:i},H,u,E):me({ref:te,id:$,type:N,"aria-expanded":S===P.Open,"aria-controls":w?B:void 0,disabled:m||void 0,autoFocus:i,onKeyDown:L,onKeyUp:D,onClick:Y,onMouseDown:ae},H,u,E),ue=je(),fe=I(()=>{if(!ve(a.state.panel))return;let o=a.state.panel;function d(){Z(ue.current,{[A.Forwards]:()=>V(o,G.First),[A.Backwards]:()=>V(o,G.Last)})===he.Error&&V(xe(Pe(a.state.button)).filter(T=>T.dataset.headlessuiFocusGuard!=="true"),Z(ue.current,{[A.Forwards]:G.Next,[A.Backwards]:G.Previous}),{relativeTo:a.state.button})}d()}),h=le();return C.createElement(C.Fragment,null,h({ourProps:X,theirProps:r,slot:W,defaultTag:Ft,name:"Popover.Button"}),O&&!c&&y&&C.createElement(ye,{id:p,ref:k,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:fe}))}let Nt="div",Mt=ce.RenderStrategy|ce.Static;function Re(e,n){let t=l.useId(),{id:f=`headlessui-popover-backdrop-${t}`,transition:m=!1,...i}=e,r=de("Popover.Backdrop"),a=U(r,l.useCallback(v=>v.popoverState,[])),[S,y]=l.useState(null),s=z(n,y),$=Te(),[w,B]=Ee(m,S,$!==null?($&J.Open)===J.Open:a===P.Open),k=I(v=>{if(_e(v.currentTarget))return v.preventDefault();r.actions.close()}),b=re({open:a===P.Open}),p={ref:s,id:f,"aria-hidden":!0,onClick:k,...Fe(B)};return le()({ourProps:p,theirProps:i,slot:b,defaultTag:Nt,features:Mt,visible:w,name:"Popover.Backdrop"})}let Dt="div",Rt=ce.RenderStrategy|ce.Static;function At(e,n){let t=l.useId(),{id:f=`headlessui-popover-panel-${t}`,focus:m=!1,anchor:i,portal:r=!1,modal:a=!1,transition:S=!1,...y}=e,s=de("Popover.Panel"),$=U(s,s.selectors.isPortalled),[w,B,k,b,p]=U(s,l.useCallback(h=>[h.popoverState,h.button,h.__demoMode,h.beforePanelSentinel,h.afterPanelSentinel],[])),v=`headlessui-focus-sentinel-before-${t}`,g=`headlessui-focus-sentinel-after-${t}`,c=l.useRef(null),_=xt(i),[te,ne]=Pt(_),L=$t();_&&(r=!0);let[D,Y]=l.useState(null),ae=z(c,n,_?te:null,s.actions.setPanel,Y),oe=we(B),H=we(c.current);Xe(()=>(s.actions.setPanelId(f),()=>s.actions.setPanelId(null)),[f,s]);let K=Te(),[u,j]=Ee(S,D,K!==null?(K&J.Open)===J.Open:w===P.Open);Ze(u,B,s.actions.close),Ue(k?!1:a&&u,H);let E=I(h=>{var o;switch(h.key){case Q.Escape:if(s.state.popoverState!==P.Open||!c.current)return;let d=se(c.current);if(d&&!c.current.contains(d))return;h.preventDefault(),h.stopPropagation(),s.actions.close(),(o=s.state.button)==null||o.focus();break}});l.useEffect(()=>{var h;e.static||w===P.Closed&&((h=e.unmount)==null||h)&&s.actions.setPanel(null)},[w,e.unmount,e.static,s]),l.useEffect(()=>{if(k||!m||w!==P.Open||!c.current)return;let h=se(c.current);c.current.contains(h)||V(c.current,G.First)},[k,m,c.current,w]);let O=re({open:w===P.Open,close:s.actions.refocusableClose}),W=me(_?L():{},{ref:ae,id:f,onKeyDown:E,onBlur:m&&w===P.Open?h=>{var o,d,T,F,R;let q=h.relatedTarget;q&&c.current&&((o=c.current)!=null&&o.contains(q)||(s.actions.close(),((T=(d=b.current)==null?void 0:d.contains)!=null&&T.call(d,q)||(R=(F=p.current)==null?void 0:F.contains)!=null&&R.call(F,q))&&q.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...y.style,...ne,"--button-width":St(u,B,!0).width},...Fe(j)}),N=je(),X=I(()=>{let h=c.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;V(h,G.First)===he.Error&&((d=s.state.afterPanelSentinel.current)==null||d.focus())},[A.Backwards]:()=>{var d;(d=s.state.button)==null||d.focus({preventScroll:!0})}})}o()}),ue=I(()=>{let h=c.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;if(!s.state.button)return;let T=(d=Pe(s.state.button))!=null?d:document.body,F=xe(T),R=F.indexOf(s.state.button),q=F.slice(0,R+1),ie=[...F.slice(R+1),...q];for(let be of ie.slice())if(be.dataset.headlessuiFocusGuard==="true"||D!=null&&D.contains(be)){let Ce=ie.indexOf(be);Ce!==-1&&ie.splice(Ce,1)}V(ie,G.First,{sorted:!1})},[A.Backwards]:()=>{var d;V(h,G.Previous)===he.Error&&((d=s.state.button)==null||d.focus())}})}o()}),fe=le();return C.createElement(ze,null,C.createElement(pe.Provider,{value:f},C.createElement(Oe,{value:s.actions.refocusableClose},C.createElement(Je,{enabled:r?e.static||u:!1,ownerDocument:oe},u&&$&&C.createElement(ye,{id:v,ref:b,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}),fe({ourProps:W,theirProps:y,slot:O,defaultTag:Dt,features:Rt,visible:u,name:"Popover.Panel"}),u&&$&&C.createElement(ye,{id:g,ref:p,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:ue})))))}let Gt="div";function Lt(e,n){let t=l.useRef(null),f=z(t,n),[m,i]=l.useState([]),r=I(b=>{i(p=>{let v=p.indexOf(b);if(v!==-1){let g=p.slice();return g.splice(v,1),g}return p})}),a=I(b=>(i(p=>[...p,b]),()=>r(b))),S=I(()=>{var b;let p=Pe(t.current);if(!p)return!1;let v=se(t.current);return(b=t.current)!=null&&b.contains(v)?!0:m.some(g=>{var c,_;return((c=p.getElementById(g.buttonId.current))==null?void 0:c.contains(v))||((_=p.getElementById(g.panelId.current))==null?void 0:_.contains(v))})}),y=I(b=>{for(let p of m)p.buttonId.current!==b&&p.close()}),s=l.useMemo(()=>({registerPopover:a,unregisterPopover:r,isFocusWithinPopoverGroup:S,closeOthers:y}),[a,r,S,y]),$=re({}),w=e,B={ref:f},k=le();return C.createElement(Ne,null,C.createElement(Se.Provider,{value:s},k({ourProps:B,theirProps:w,slot:$,defaultTag:Gt,name:"Popover.Group"})))}let qt=ee(Et),Ae=ee(Ot),Qt=ee(Re),Vt=ee(Re),Ge=ee(At),Yt=ee(Lt),Ht=Object.assign(qt,{Button:Ae,Backdrop:Vt,Overlay:Qt,Panel:Ge,Group:Yt});/** +import{aX as Le,bi as ve,d0 as qe,d1 as xe,aZ as Qe,aY as Z,r as l,b0 as Ve,b1 as ee,b5 as U,b4 as z,aT as I,b8 as Q,d2 as se,d3 as _e,bd as Ye,be as He,bj as Ke,bf as re,bk as We,bg as me,d4 as je,d5 as V,d6 as A,d7 as G,d8 as he,d9 as Pe,bh as le,bu as C,da as ye,db as ge,bl as we,bs as Xe,bm as Te,bn as Ee,bo as J,bp as Ze,bq as Ue,bt as Fe,dc as ze,dd as Oe,bv as Je,de as et,df as tt,bw as ke,dg as nt,dh as at,di as ot,aU as st,dj as rt,bC as lt,dk as ut,dl as it,dm as Ne,bE as ct,bG as ce,e as dt,j as x,c as M,d as pt,m as ft,cZ as bt,dn as vt,u as mt,V as ht,aa as Ie}from"./index-CN4vD05c.js";import{C as yt}from"./chevron-right-BCotFXkU.js";import{F as gt,y as xt,R as Pt,T as $t,w as St,A as Ct}from"./map-pin-W8m2dIyd.js";var wt=Object.defineProperty,kt=(e,n,t)=>n in e?wt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Be=(e,n,t)=>(kt(e,typeof n!="symbol"?n+"":n,t),t),P=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(P||{}),It=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(It||{});let Bt={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,n){return e.button===n.button?e:{...e,button:n.button}},3(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},4(e,n){return e.panel===n.panel?e:{...e,panel:n.panel}},5(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}}};class $e extends Le{constructor(n){super(n),Be(this,"actions",{close:()=>this.send({type:1}),refocusableClose:t=>{this.actions.close();let f=t?ve(t)?t:"current"in t&&ve(t.current)?t.current:this.state.button:this.state.button;f==null||f.focus()},open:()=>this.send({type:0}),setButtonId:t=>this.send({type:3,buttonId:t}),setButton:t=>this.send({type:2,button:t}),setPanelId:t=>this.send({type:5,panelId:t}),setPanel:t=>this.send({type:4,panel:t})}),Be(this,"selectors",{isPortalled:t=>{var f;if(!t.button||!t.panel)return!1;let m=(f=qe(t.button))!=null?f:document;for(let $ of m.querySelectorAll("body > *"))if(Number($==null?void 0:$.contains(t.button))^Number($==null?void 0:$.contains(t.panel)))return!0;let i=xe(m),r=i.indexOf(t.button),a=(r+i.length-1)%i.length,S=(r+1)%i.length,y=i[a],s=i[S];return!t.panel.contains(y)&&!t.panel.contains(s)}});{let t=this.state.id,f=Qe.get(null);this.on(0,()=>f.actions.push(t)),this.on(1,()=>f.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new $e({id:n,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(n,t){return Z(t.type,Bt,n,t)}}const Me=l.createContext(null);function de(e){let n=l.useContext(Me);if(n===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return n}function _t({id:e,__demoMode:n=!1}){let t=l.useMemo(()=>$e.new({id:e,__demoMode:n}),[]);return Ve(()=>t.dispose()),t}let Se=l.createContext(null);Se.displayName="PopoverGroupContext";function De(){return l.useContext(Se)}let pe=l.createContext(null);pe.displayName="PopoverPanelContext";function jt(){return l.useContext(pe)}let Tt="div";function Et(e,n){var t;let f=l.useId(),{__demoMode:m=!1,...i}=e,r=_t({id:f,__demoMode:m}),a=l.useRef(null),S=z(n,et(u=>{a.current=u})),[y,s,$,w,B]=U(r,l.useCallback(u=>[u.popoverState,u.button,u.panel,u.buttonId,u.panelId],[])),k=tt((t=a.current)!=null?t:s),b=ke(w),p=ke(B),v=l.useMemo(()=>({buttonId:b,panelId:p,close:r.actions.close}),[b,p,r]),g=De(),c=g==null?void 0:g.registerPopover,_=I(()=>{var u,j;let E=se((u=a.current)!=null?u:s);return(j=g==null?void 0:g.isFocusWithinPopoverGroup())!=null?j:E&&((s==null?void 0:s.contains(E))||($==null?void 0:$.contains(E)))});l.useEffect(()=>c==null?void 0:c(v),[c,v]);let[te,ne]=nt(),L=at(s),D=ot({mainTreeNode:L,portals:te,defaultContainers:[{get current(){return r.state.button}},{get current(){return r.state.panel}}]});st(k,"focus",u=>{var j,E,O,W,N,X;u.target!==window&&rt(u.target)&&r.state.popoverState===P.Open&&(_()||r.state.button&&r.state.panel&&(D.contains(u.target)||(E=(j=r.state.beforePanelSentinel.current)==null?void 0:j.contains)!=null&&E.call(j,u.target)||(W=(O=r.state.afterPanelSentinel.current)==null?void 0:O.contains)!=null&&W.call(O,u.target)||(X=(N=r.state.afterButtonSentinel.current)==null?void 0:N.contains)!=null&&X.call(N,u.target)||r.actions.close()))},!0);let Y=y===P.Open;lt(Y,D.resolveContainers,(u,j)=>{r.actions.close(),ut(j,it.Loose)||(u.preventDefault(),s==null||s.focus())});let ae=re({open:y===P.Open,close:r.actions.refocusableClose}),oe=U(r,l.useCallback(u=>Z(u.popoverState,{[P.Open]:J.Open,[P.Closed]:J.Closed}),[])),H={ref:S},K=le();return C.createElement(Ne,{node:L},C.createElement(Ct,null,C.createElement(pe.Provider,{value:null},C.createElement(Me.Provider,{value:r},C.createElement(Oe,{value:r.actions.refocusableClose},C.createElement(ct,{value:oe},C.createElement(ne,null,K({ourProps:H,theirProps:i,slot:ae,defaultTag:Tt,name:"Popover"}))))))))}let Ft="button";function Ot(e,n){let t=l.useId(),{id:f=`headlessui-popover-button-${t}`,disabled:m=!1,autoFocus:i=!1,...r}=e,a=de("Popover.Button"),[S,y,s,$,w,B,k]=U(a,l.useCallback(o=>[o.popoverState,a.selectors.isPortalled(o),o.button,o.buttonId,o.panel,o.panelId,o.afterButtonSentinel],[])),b=l.useRef(null),p=`headlessui-focus-sentinel-${l.useId()}`,v=De(),g=v==null?void 0:v.closeOthers,c=jt()!==null;l.useEffect(()=>{if(!c)return a.actions.setButtonId(f),()=>a.actions.setButtonId(null)},[c,f,a]);let[_]=l.useState(()=>Symbol()),te=z(b,n,gt(),I(o=>{if(!c){if(o)a.state.buttons.current.push(_);else{let d=a.state.buttons.current.indexOf(_);d!==-1&&a.state.buttons.current.splice(d,1)}a.state.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),o&&a.actions.setButton(o)}})),ne=z(b,n),L=I(o=>{var d,T,F;if(c){if(a.state.popoverState===P.Closed)return;switch(o.key){case Q.Space:case Q.Enter:o.preventDefault(),(T=(d=o.target).click)==null||T.call(d),a.actions.close(),(F=a.state.button)==null||F.focus();break}}else switch(o.key){case Q.Space:case Q.Enter:o.preventDefault(),o.stopPropagation(),a.state.popoverState===P.Closed?(g==null||g(a.state.buttonId),a.actions.open()):a.actions.close();break;case Q.Escape:if(a.state.popoverState!==P.Open)return g==null?void 0:g(a.state.buttonId);if(!b.current)return;let R=se(b.current);if(R&&!b.current.contains(R))return;o.preventDefault(),o.stopPropagation(),a.actions.close();break}}),D=I(o=>{c||o.key===Q.Space&&o.preventDefault()}),Y=I(o=>{var d,T;_e(o.currentTarget)||m||(c?(a.actions.close(),(d=a.state.button)==null||d.focus()):(o.preventDefault(),o.stopPropagation(),a.state.popoverState===P.Closed?(g==null||g(a.state.buttonId),a.actions.open()):a.actions.close(),(T=a.state.button)==null||T.focus()))}),ae=I(o=>{o.preventDefault(),o.stopPropagation()}),{isFocusVisible:oe,focusProps:H}=Ye({autoFocus:i}),{isHovered:K,hoverProps:u}=He({isDisabled:m}),{pressed:j,pressProps:E}=Ke({disabled:m}),O=S===P.Open,W=re({open:O,active:j||O,disabled:m,hover:K,focus:oe,autofocus:i}),N=We(e,s),X=c?me({ref:ne,type:N,onKeyDown:L,onClick:Y,disabled:m||void 0,autoFocus:i},H,u,E):me({ref:te,id:$,type:N,"aria-expanded":S===P.Open,"aria-controls":w?B:void 0,disabled:m||void 0,autoFocus:i,onKeyDown:L,onKeyUp:D,onClick:Y,onMouseDown:ae},H,u,E),ue=je(),fe=I(()=>{if(!ve(a.state.panel))return;let o=a.state.panel;function d(){Z(ue.current,{[A.Forwards]:()=>V(o,G.First),[A.Backwards]:()=>V(o,G.Last)})===he.Error&&V(xe(Pe(a.state.button)).filter(T=>T.dataset.headlessuiFocusGuard!=="true"),Z(ue.current,{[A.Forwards]:G.Next,[A.Backwards]:G.Previous}),{relativeTo:a.state.button})}d()}),h=le();return C.createElement(C.Fragment,null,h({ourProps:X,theirProps:r,slot:W,defaultTag:Ft,name:"Popover.Button"}),O&&!c&&y&&C.createElement(ye,{id:p,ref:k,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:fe}))}let Nt="div",Mt=ce.RenderStrategy|ce.Static;function Re(e,n){let t=l.useId(),{id:f=`headlessui-popover-backdrop-${t}`,transition:m=!1,...i}=e,r=de("Popover.Backdrop"),a=U(r,l.useCallback(v=>v.popoverState,[])),[S,y]=l.useState(null),s=z(n,y),$=Te(),[w,B]=Ee(m,S,$!==null?($&J.Open)===J.Open:a===P.Open),k=I(v=>{if(_e(v.currentTarget))return v.preventDefault();r.actions.close()}),b=re({open:a===P.Open}),p={ref:s,id:f,"aria-hidden":!0,onClick:k,...Fe(B)};return le()({ourProps:p,theirProps:i,slot:b,defaultTag:Nt,features:Mt,visible:w,name:"Popover.Backdrop"})}let Dt="div",Rt=ce.RenderStrategy|ce.Static;function At(e,n){let t=l.useId(),{id:f=`headlessui-popover-panel-${t}`,focus:m=!1,anchor:i,portal:r=!1,modal:a=!1,transition:S=!1,...y}=e,s=de("Popover.Panel"),$=U(s,s.selectors.isPortalled),[w,B,k,b,p]=U(s,l.useCallback(h=>[h.popoverState,h.button,h.__demoMode,h.beforePanelSentinel,h.afterPanelSentinel],[])),v=`headlessui-focus-sentinel-before-${t}`,g=`headlessui-focus-sentinel-after-${t}`,c=l.useRef(null),_=xt(i),[te,ne]=Pt(_),L=$t();_&&(r=!0);let[D,Y]=l.useState(null),ae=z(c,n,_?te:null,s.actions.setPanel,Y),oe=we(B),H=we(c.current);Xe(()=>(s.actions.setPanelId(f),()=>s.actions.setPanelId(null)),[f,s]);let K=Te(),[u,j]=Ee(S,D,K!==null?(K&J.Open)===J.Open:w===P.Open);Ze(u,B,s.actions.close),Ue(k?!1:a&&u,H);let E=I(h=>{var o;switch(h.key){case Q.Escape:if(s.state.popoverState!==P.Open||!c.current)return;let d=se(c.current);if(d&&!c.current.contains(d))return;h.preventDefault(),h.stopPropagation(),s.actions.close(),(o=s.state.button)==null||o.focus();break}});l.useEffect(()=>{var h;e.static||w===P.Closed&&((h=e.unmount)==null||h)&&s.actions.setPanel(null)},[w,e.unmount,e.static,s]),l.useEffect(()=>{if(k||!m||w!==P.Open||!c.current)return;let h=se(c.current);c.current.contains(h)||V(c.current,G.First)},[k,m,c.current,w]);let O=re({open:w===P.Open,close:s.actions.refocusableClose}),W=me(_?L():{},{ref:ae,id:f,onKeyDown:E,onBlur:m&&w===P.Open?h=>{var o,d,T,F,R;let q=h.relatedTarget;q&&c.current&&((o=c.current)!=null&&o.contains(q)||(s.actions.close(),((T=(d=b.current)==null?void 0:d.contains)!=null&&T.call(d,q)||(R=(F=p.current)==null?void 0:F.contains)!=null&&R.call(F,q))&&q.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...y.style,...ne,"--button-width":St(u,B,!0).width},...Fe(j)}),N=je(),X=I(()=>{let h=c.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;V(h,G.First)===he.Error&&((d=s.state.afterPanelSentinel.current)==null||d.focus())},[A.Backwards]:()=>{var d;(d=s.state.button)==null||d.focus({preventScroll:!0})}})}o()}),ue=I(()=>{let h=c.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;if(!s.state.button)return;let T=(d=Pe(s.state.button))!=null?d:document.body,F=xe(T),R=F.indexOf(s.state.button),q=F.slice(0,R+1),ie=[...F.slice(R+1),...q];for(let be of ie.slice())if(be.dataset.headlessuiFocusGuard==="true"||D!=null&&D.contains(be)){let Ce=ie.indexOf(be);Ce!==-1&&ie.splice(Ce,1)}V(ie,G.First,{sorted:!1})},[A.Backwards]:()=>{var d;V(h,G.Previous)===he.Error&&((d=s.state.button)==null||d.focus())}})}o()}),fe=le();return C.createElement(ze,null,C.createElement(pe.Provider,{value:f},C.createElement(Oe,{value:s.actions.refocusableClose},C.createElement(Je,{enabled:r?e.static||u:!1,ownerDocument:oe},u&&$&&C.createElement(ye,{id:v,ref:b,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}),fe({ourProps:W,theirProps:y,slot:O,defaultTag:Dt,features:Rt,visible:u,name:"Popover.Panel"}),u&&$&&C.createElement(ye,{id:g,ref:p,features:ge.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:ue})))))}let Gt="div";function Lt(e,n){let t=l.useRef(null),f=z(t,n),[m,i]=l.useState([]),r=I(b=>{i(p=>{let v=p.indexOf(b);if(v!==-1){let g=p.slice();return g.splice(v,1),g}return p})}),a=I(b=>(i(p=>[...p,b]),()=>r(b))),S=I(()=>{var b;let p=Pe(t.current);if(!p)return!1;let v=se(t.current);return(b=t.current)!=null&&b.contains(v)?!0:m.some(g=>{var c,_;return((c=p.getElementById(g.buttonId.current))==null?void 0:c.contains(v))||((_=p.getElementById(g.panelId.current))==null?void 0:_.contains(v))})}),y=I(b=>{for(let p of m)p.buttonId.current!==b&&p.close()}),s=l.useMemo(()=>({registerPopover:a,unregisterPopover:r,isFocusWithinPopoverGroup:S,closeOthers:y}),[a,r,S,y]),$=re({}),w=e,B={ref:f},k=le();return C.createElement(Ne,null,C.createElement(Se.Provider,{value:s},k({ourProps:B,theirProps:w,slot:$,defaultTag:Gt,name:"Popover.Group"})))}let qt=ee(Et),Ae=ee(Ot),Qt=ee(Re),Vt=ee(Re),Ge=ee(At),Yt=ee(Lt),Ht=Object.assign(qt,{Button:Ae,Backdrop:Vt,Overlay:Qt,Panel:Ge,Group:Yt});/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/PacketList-CbchJDnI.js b/frontend/dist/assets/PacketList-Dq4ygXCy.js similarity index 98% rename from frontend/dist/assets/PacketList-CbchJDnI.js rename to frontend/dist/assets/PacketList-Dq4ygXCy.js index 20347ede..7576a9c9 100644 --- a/frontend/dist/assets/PacketList-CbchJDnI.js +++ b/frontend/dist/assets/PacketList-Dq4ygXCy.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-BsgVWepx.js","assets/index-i0xzpXop.js","assets/BasemapLayer-Bv4kYAcR.js","assets/car-aFMoKQAR.js","assets/useMapViewStore-DZlzQmak.js","assets/index-BCuGA4PV.js","assets/index-CBEGRHd5.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css"])))=>i.map(i=>d[i]); -import{e as Pe,bN as ns,bO as Pt,q as rs,n as ls,j as e,c as R,B as nt,t as is,r as h,a1 as rt,V as M,ao as be,bP as cs,bQ as Mt,bR as Bt,bS as Lt,aa as de,bT as Rt,bU as Ht,bV as Ft,bW as he,bX as Xe,bY as Ze,_ as os,bZ as ds,b_ as xs,b$ as ms,c0 as hs,c1 as us,c2 as ps,m as oe,ax as re,a3 as fs,a0 as gs,c3 as X,c4 as ys,c5 as le,c6 as js,c7 as bs,c8 as ht,c9 as Ns,ca as vs,cb as ws,cc as ks,cd as Cs,ce as _s,cf as Je,cg as Ss,at as Ts,a6 as Dt,ch as Ps,ci as Ms,cj as Bs,ck as Ls,aC as At,aD as Et,d as We,cl as Rs,aE as Hs,cm as Fs,cn as lt,co as Ds}from"./index-i0xzpXop.js";import{C as As,u as Es}from"./chevron-up-BVzq549_.js";import{p as Is,e as It,g as zs,b as $s}from"./primitives-QKpQyH4U.js";import{u as Us,r as Os,a as Vs,b as Gs,c as Qs,d as qs,i as Ws}from"./consumer-registry-5uDLywpC.js";import{D as Me,R as Ie,P as Be,g as Ks}from"./badge-colors-Dl76Mz8m.js";import{g as zt,e as Se,a as $t}from"./chat-utils-BdAUDg3r.js";import{S as ze,i as $e,a as Ys,g as ut}from"./SignalIndicator-D8uG_rJC.js";import{A as Xs}from"./arrow-up-D_sZeyuo.js";import{A as ue}from"./arrow-right-BZS-u7CW.js";import{A as Ut}from"./arrow-down-SlBTV0Nc.js";import{C as it}from"./chevron-right-DsOuIRi8.js";import{d as Zs}from"./payload-detail-Bh2WvEK0.js";import{M as Ue}from"./map-pin-C051lstq.js";import{C as Js}from"./circle-question-mark-CJCLhkb9.js";import{L as ea}from"./layers-LQ5jNXOV.js";import{H as Ot}from"./hash-CyK-Kad6.js";import{C as xe}from"./clock-F-4SScS_.js";import{L as ct,R as ta}from"./route-Df1YhBTq.js";import{A as sa}from"./activity-DQoaymFw.js";import{D as aa}from"./database-gsjgeKE3.js";import{H as na,D as et,u as ra}from"./useMapViewStore-DZlzQmak.js";import{S as ke}from"./shield-CxmFjMfw.js";import{C as Vt}from"./MqttModeBadge-Dhi11STL.js";import{Z as pt}from"./zap-tuTM-Jsw.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-DM7wheVG.js","assets/index-CN4vD05c.js","assets/BasemapLayer-B81nTsqc.js","assets/car-CMkH36na.js","assets/useMapViewStore-D6ulpFc9.js","assets/index-G-dTy9iF.js","assets/index-CnWrze_V.js","assets/index-oOga43RI.css","assets/maplibre-gl-B1CfjdFi.css"])))=>i.map(i=>d[i]); +import{e as Pe,bN as ns,bO as Pt,q as rs,n as ls,j as e,c as R,B as nt,t as is,r as h,a1 as rt,V as M,ao as be,bP as cs,bQ as Mt,bR as Bt,bS as Lt,aa as de,bT as Rt,bU as Ht,bV as Ft,bW as he,bX as Xe,bY as Ze,_ as os,bZ as ds,b_ as xs,b$ as ms,c0 as hs,c1 as us,c2 as ps,m as oe,ax as re,a3 as fs,a0 as gs,c3 as X,c4 as ys,c5 as le,c6 as js,c7 as bs,c8 as ht,c9 as Ns,ca as vs,cb as ws,cc as ks,cd as Cs,ce as _s,cf as Je,cg as Ss,at as Ts,a6 as Dt,ch as Ps,ci as Ms,cj as Bs,ck as Ls,aC as At,aD as Et,d as We,cl as Rs,aE as Hs,cm as Fs,cn as lt,co as Ds}from"./index-CN4vD05c.js";import{C as As,u as Es}from"./chevron-up-Tfuf4unO.js";import{p as Is,e as It,g as zs,b as $s}from"./primitives-DS3PJRi6.js";import{u as Us,r as Os,a as Vs,b as Gs,c as Qs,d as qs,i as Ws}from"./consumer-registry-ssgJoJPf.js";import{D as Me,R as Ie,P as Be,g as Ks}from"./badge-colors-Dl76Mz8m.js";import{g as zt,e as Se,a as $t}from"./chat-utils-BLzyljgm.js";import{S as ze,i as $e,a as Ys,g as ut}from"./SignalIndicator-BpXSkqBv.js";import{A as Xs}from"./arrow-up-Cd56Jeq2.js";import{A as ue}from"./arrow-right-9ryFJ0vV.js";import{A as Ut}from"./arrow-down-BuVueZSW.js";import{C as it}from"./chevron-right-BCotFXkU.js";import{d as Zs}from"./payload-detail-DXAypO28.js";import{M as Ue}from"./map-pin-W8m2dIyd.js";import{C as Js}from"./circle-question-mark-z2YWN8ID.js";import{L as ea}from"./layers-DwnLNHzI.js";import{H as Ot}from"./hash-vaiKl847.js";import{C as xe}from"./clock-jH_gnOTU.js";import{L as ct,R as ta}from"./route-4Pe810jq.js";import{A as sa}from"./activity-ZoAXCcWm.js";import{D as aa}from"./database-n5nNHRzj.js";import{H as na,D as et,u as ra}from"./useMapViewStore-D6ulpFc9.js";import{S as ke}from"./shield-DH-P-9VP.js";import{C as Vt}from"./MqttModeBadge-BFJmiZy5.js";import{Z as pt}from"./zap-Ba3ctUHg.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -29,7 +29,7 @@ import{e as Pe,bN as ns,bO as Pt,q as rs,n as ls,j as e,c as R,B as nt,t as is,r * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ha=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ce=Pe("user",ha);function ua(t){t.values.forEach(a=>a.stop())}function tt(t,a){[...a].reverse().forEach(n=>{const i=t.getVariant(n);i&&Pt(t,i),t.variantChildren&&t.variantChildren.forEach(l=>{tt(l,a)})})}function pa(t,a){if(Array.isArray(a))return tt(t,a);if(typeof a=="string")return tt(t,[a]);Pt(t,a)}function fa(){const t=new Set,a={subscribe(s){return t.add(s),()=>void t.delete(s)},start(s,n){const i=[];return t.forEach(l=>{i.push(ns(l,s,{transitionOverride:n}))}),Promise.all(i)},set(s){return t.forEach(n=>{pa(n,s)})},stop(){t.forEach(s=>{ua(s)})},mount(){return()=>{a.stop()}}};return a}function ga(){const t=rs(fa);return ls(t.mount,[]),t}function ya({"aria-label":t="Page navigation",className:a,...s}){return e.jsx("nav",{"aria-label":t,...s,className:R("flex gap-x-2",a)})}function ja({onClick:t,disabled:a=!1,className:s,children:n="Previous"}){return e.jsx("span",{className:R("grow basis-0",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Previous page",className:R("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n]})})}function ba({onClick:t,disabled:a=!1,className:s,children:n="Next"}){return e.jsx("span",{className:R("flex grow basis-0 justify-end",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Next page",className:R("gap-1",a&&"invisible"),children:[n,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function Na({className:t,...a}){return e.jsx("span",{...a,className:R("hidden items-baseline gap-x-2 sm:flex",t)})}function va({page:t,current:a=!1,onClick:s,className:n,children:i}){return e.jsx(nt,{plain:!a,outline:a,onClick:()=>s==null?void 0:s(t),"aria-label":`Page ${t}`,"aria-current":a?"page":void 0,className:R("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",n),children:i??t})}function wa({className:t,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:R("w-[2.25rem] select-none text-center text-sm text-fg-muted",t),children:"…"})}function ka(t,a,s=1){if(a<=7)return Array.from({length:a},(m,g)=>g+1);const n=Math.max(t-s,1),i=Math.min(t+s,a),l=n>2,r=iy+1),"gap",a]}if(l&&!r){const m=3+2*s;return[1,"gap",...Array.from({length:m},(u,y)=>a-m+y+1)]}return[1,"gap",...Array.from({length:i-n+1},(m,g)=>n+g),"gap",a]}const ur=is(t=>({requestedHash:null,requestChannel:a=>t({requestedHash:a}),clearRequest:()=>t({requestedHash:null})}));function Ca(t){if(t.length===0)return[];const a=[];let s=0;for(;s{const r=l===t.length-1,c=n!==null&&cs(i.toUpperCase(),n);return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[c?e.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:i.toUpperCase()}),!r&&e.jsx(it,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${i}-${l}`)})})}const qt=h.memo(Ma);function Wt({channelName:t,onClick:a,active:s,compact:n,className:i}){const l=t.startsWith("#")?t:`#${t}`,r=R("inline-flex items-center flex-shrink-0","font-medium",n?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",s?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!s&&"hover:bg-sys-blue/20 cursor-pointer",i);return a?e.jsx("button",{type:"button",onClick:a,className:r,children:l}):e.jsx("span",{className:r,children:l})}function Kt({packet:t}){return t._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("teal"),children:"HTTP"}):t._mqttSource&&!t._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("purple"),children:"MQTT"}):null}function ye(t){return{"--data-box-accent":he[t]}}function Yt(t){const a=t.payload_type_name||Ht(t.payload_type??t.type),s=t.route_type_name||Ft(t.route_type??t.route),n=Be[a]??"zinc",i=Ie[s]??"zinc";return{payloadType:a,routeType:s,payloadColor:n,routeColor:i}}function Oe(t){if(!t)return[];if(Array.isArray(t))return t;try{const a=JSON.parse(t);return Array.isArray(a)?a:[]}catch{return[]}}function Xt(t,a){if(a){const s=a(t);return{name:s.name,isCompanion:s.isCompanion,isRepeater:s.isRepeater}}return{name:null,isCompanion:!1,isRepeater:!1}}function Ba({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:i,isFlashing:l=!1,isTraceHighlighted:r,onTraceHover:c,traceTag:m,onViewTraceReport:g,dupeGroupPosition:u,isDupeGroupHovered:y=!1,onDupeGroupHover:w,dupeCount:j,getDecodedContent:x,onChannelClick:k}){const B=j?!1:Mt(t.is_duplicate),d=u!==void 0,{payloadType:b,routeType:f,payloadColor:_,routeColor:v}=Yt(t),p=t.packet_origin==="tx_local",E=b==="TRACE",O=Oe(t.original_path),G=Oe(t.forwarded_path),K=G.length>0?G:O,D=t.src_hash?be(t.src_hash):null,{name:Y,isRepeater:I}=Xt(t,i);let H=null,$=null,U=null,J=null;if(b==="GRP_TXT"&&x){const S=x(t);S!=null&&S.decrypted&&($=S.senderName,U=S.channelName,J=S.channelHash,S.text&&(H=S.text))}else if(b==="TXT_MSG"&&t.raw_packet)try{const S=Bt.fromHex(t.raw_packet);if(S.success&&S.packet){const ce=Lt(S.packet.payload);ce&&!ce.encrypted&&(H=ce.text)}}catch{}const T=$||(I?null:Y),z=!!T,te=!z&&I&&!!Y,se=!z&&!te&&b==="GRP_TXT"&&!H,o=t.payload_length??t.length??0;t.lbt_attempts;const Z=h.useCallback(()=>{E&&m&&g?g(m):a(t)},[E,m,g,a,t]),W=h.useCallback(()=>{E&&m&&c&&c(m),d&&w&&t.packet_hash&&w(t.packet_hash)},[E,m,c,d,w,t.packet_hash]),ie=h.useCallback(()=>{c&&c(null),w&&w(null)},[c,w]),P=he[_]||he.zinc,F=y,ae=()=>{const S={pointerEvents:"none"};return u==="first"?{...S,borderTop:`2px solid ${P}`,borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:u==="middle"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:u==="last"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:`2px solid ${P}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...S,border:`2px solid ${P}`,borderRadius:"8px",inset:"-2px"}};return e.jsxs("div",{onClick:Z,onMouseEnter:W,onMouseLeave:ie,className:R("group relative cursor-pointer","hover:bg-subtle-fill",B&&!y&&"opacity-40",l&&"flash-row",p&&"bg-sys-indigo/5",r&&"bg-sys-teal/10"),children:[e.jsx("div",{className:R("absolute pointer-events-none transition-opacity duration-75",d?F?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:ae()}),e.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(Se(T).cleanName)},children:Se(T).emoji?e.jsx("span",{className:"text-base leading-none",children:Se(T).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(T)})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):se?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsx("div",{className:"min-w-0",children:z?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:T}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):te?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:Y}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:D||"—"}),Y&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:Y})]})})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(_),children:b}),p&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("indigo"),children:"LOCAL"}),e.jsx(Kt,{packet:t}),j&&j>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",j]}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(v),children:f}),e.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[o,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:H||U?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[U&&e.jsx(Wt,{channelName:U,compact:!0,onClick:k&&J?S=>{S.stopPropagation(),k(J)}:void 0}),H&&e.jsx("span",{className:"italic truncate",children:H})]}):e.jsx(qt,{path:K,localHash:s})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"data-box data-box-compact",children:Rt(t.timestamp)}),e.jsx(ze,{rssi:t.rssi,snr:t.snr,compact:!0,showValues:!0,validated:$e(t)})]})]})]})}function La({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:i,isFlashing:l=!1,isTraceHighlighted:r,traceTag:c,onViewTraceReport:m,dupeGroupPosition:g,isDupeGroupHovered:u=!1,onDupeGroupHover:y,dupeCount:w,getDecodedContent:j,onChannelClick:x}){const{payloadType:k,routeType:B,payloadColor:d,routeColor:b}=Yt(t),f=t.packet_origin==="tx_local",_=k==="TRACE",v=w?!1:Mt(t.is_duplicate),p=Oe(t.original_path),E=Oe(t.forwarded_path),O=E.length>0?E:p,G=t._hopCount??O.length,K=t.src_hash?be(t.src_hash):null,{name:D,isRepeater:Y}=Xt(t,i);let I=null,H=null,$=null,U=null;if(k==="GRP_TXT"&&j){const P=j(t);P!=null&&P.decrypted&&(H=P.senderName,$=P.channelName,U=P.channelHash,P.text&&(I=P.text))}else if(k==="TXT_MSG"&&t.raw_packet)try{const P=Bt.fromHex(t.raw_packet);if(P.success&&P.packet){const F=Lt(P.packet.payload);F&&!F.encrypted&&(I=F.text)}}catch{}const J=H||(Y?null:D),T=!!J,z=!T&&Y&&!!D,te=!T&&!z&&k==="GRP_TXT"&&!I,se=t.payload_length??t.length??0,o=t.lbt_attempts??0,Z=()=>{_&&c&&m?m(c):a(t)},W=he[d]||he.zinc,ie=()=>{if(!g)return{opacity:0};const P=u?1:.4,F=u?"3px":"2px";return g==="first"?{backgroundColor:W,opacity:P,width:F,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:g==="middle"?{backgroundColor:W,opacity:P,width:F,top:0,bottom:0,borderRadius:0}:g==="last"?{backgroundColor:W,opacity:P,width:F,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:W,opacity:P,width:F,top:"6px",bottom:"6px",borderRadius:"9999px"}};return e.jsxs("div",{onClick:Z,className:R("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",v&&"opacity-40",l&&"flash-row",f&&"bg-sys-indigo/5",r&&"bg-sys-teal/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:ie()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:T?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(Se(J).cleanName)},children:Se(J).emoji?e.jsx("span",{className:"text-base leading-none",children:Se(J).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(J)})}):z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[T?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:J}):z?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:D}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:K||"—"}),D&&e.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:D})]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(d),children:k}),f&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("indigo"),children:"LOCAL"}),e.jsx(Kt,{packet:t}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(b),children:B}),w&&w>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",w]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:t.rssi}),e.jsx(ze,{rssi:t.rssi,compact:!0,showValues:!1,validated:$e(t)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[e.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:Rt(t.timestamp)}),se>0&&e.jsxs("span",{children:[se,"B"]}),o>0&&e.jsxs("span",{className:o>1?"text-sys-amber/60":void 0,children:["LBT:",o]}),t.snr!=null&&e.jsxs("span",{children:[t.snr.toFixed(0),"dB"]}),I||$?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[$&&e.jsx(Wt,{channelName:$,compact:!0,onClick:x&&U?P=>{P.stopPropagation(),x(U)}:void 0}),I&&e.jsx("span",{className:"italic truncate",children:I})]}):G>0?e.jsx(qt,{path:O,localHash:s}):null]})]})]})]})}const Ra=h.memo(Ba),Ha=h.memo(La);function Fa(t,a,s,n,i=!1){const l=t.toUpperCase(),r=[],c=s&&Xe(l,s);c&&r.push(s);for(const j of Object.keys(a))Xe(l,j)&&r.push(j);if(i&&c&&s&&r.length===1)return{matches:r,probability:1,bestMatch:s};if(i&&c&&r.length>1){const j=r.filter(x=>x!==s);if(j.length===1)return{matches:r,probability:1,bestMatch:j[0]}}const m=r.length>0?1/r.length:0,g=[...r].sort();let u=null,y=-1;if(g.length===1)u=g[0];else if(g.length>1&&n){for(const j of g){const x=n.get(j),k=x?typeof x=="number"?x:x.combinedScore:0;k>y&&(y=k,u=j)}u||(u=g[0])}else g.length>0&&(u=g[0]);let w=m;if(r.length>1&&n&&y>0){let j=0;for(const x of r){const k=n.get(x);j+=k?typeof k=="number"?k:k.combinedScore:0}j>0&&(w=Math.min(.95,y/j))}return{matches:r,probability:w,bestMatch:u}}function Da(t,a,s,n){const l=(s-t)*Math.PI/180,r=(n-a)*Math.PI/180,c=Math.sin(l/2)*Math.sin(l/2)+Math.cos(t*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 6371e3*(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)))}function Aa(t){return t<100?1:t<500?.9:t<1e3?.7:t<5e3?.5:t<1e4?.3:.1}const Ea=h.lazy(()=>os(()=>import("./PathMapMapLibre-BsgVWepx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])));function Ia(t,a,s,n,i=!1,l,r,c){const m=ds(a);let g;r&&(g=xs(r,t,{position:c,isLastHop:i}).confidence);const{matches:u,probability:y}=Fa(t,m,n,l,i),w=u.length,j=[],x=t.toUpperCase(),k=s&&s.latitude!==void 0&&s.longitude!==void 0&&(s.latitude!==0||s.longitude!==0);for(const d of u){if(n&&Xe(x,n)&&d===n&&k&&s){j.push({hash:d,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:i?1:y,isLocal:!0});continue}const b=m[d];b!=null&&b.latitude&&(b!=null&&b.longitude)&&!(b.latitude===0&&b.longitude===0)&&j.push({hash:d,name:b.node_name||b.name||"Unknown",latitude:b.latitude,longitude:b.longitude,probability:y,isLocal:!1,isDirectNeighbor:b.zero_hop===!0})}const B=j.length;if(B===1)j[0].probability=g??1;else if(B>1)if(g!==void 0&&g>0){const d=j[0];d.probability=g;const b=1-g,f=B-1;j.slice(1).forEach(_=>{_.probability=b/f})}else{let d=0;const b=j.map(f=>{if(f.isLocal)return{candidate:f,score:1};const _=l==null?void 0:l.get(f.hash);let v=.5;if(k&&s){const E=Da(s.latitude,s.longitude,f.latitude,f.longitude);v=Aa(E)}let p;return _?p=v*.3+_.hopConsistencyScore*.3+_.frequencyScore*.4:(p=v,f.isDirectNeighbor&&(p=Math.max(p,.8))),d+=p,{candidate:f,score:p}});if(d>0)b.forEach(({candidate:f,score:_})=>{f.probability=Math.min(.95,_/d)});else{const f=1/B;j.forEach(_=>_.probability=f)}}return{candidates:j,totalMatches:w}}function za(t,a,s,n,i,l){if(!t||t.length===0)return{hops:[],overallConfidence:0,hasValidPath:!1};const r=t.length-1,c=t.map((u,y)=>{const w=y===r,j=t.length-y,{candidates:x,totalMatches:k}=Ia(u,a,s,n,w,i,l,j),B=x.length>0?Math.max(...x.map(d=>d.probability)):0;return{prefix:u,candidates:x,confidence:B,totalMatches:k}}),m=c.reduce((u,y)=>y.confidence===0?0:u*y.confidence,1),g=c.some(u=>u.candidates.length>0);return{hops:c,overallConfidence:m,hasValidPath:g}}function $a(t){return`${(t*100).toFixed(0)}%`}function Ua(t){return t>=1?"text-sys-green":t>=.5?"text-sys-indigo":t>=.25?"text-signal-poor":t>0?"text-sys-red":"text-fg-muted"}function Oa(t,a,s){let n;return a===0?n=s.muted:t>=1?n=s.success:t>=.5?n=s.secondary:t>=.25?n=s.poor:t>0?n=s.danger:n=s.muted,{color:n}}class Va extends h.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Ve({path:t,neighbors:a,localNode:s,localHash:n,srcHash:i,dstHash:l,neighborAffinity:r,prefixLookup:c,hubNodes:m,traceSnr:g,advertiserSource:u}){const[y,w]=h.useState(null),j=h.useMemo(()=>{if(!u)return null;const f=u.nodeType==="wardrive";return{prefix:u.prefix||"??",candidates:[{hash:u.publicKey||u.prefix||"source",name:u.name,latitude:u.latitude,longitude:u.longitude,probability:1,isLocal:!1,isWardrive:f}],confidence:1,totalMatches:1,isSource:!0}},[u]),x=h.useMemo(()=>{if(u||!i)return null;const f=be(i),_=a[i];if((_==null?void 0:_.latitude)&&(_==null?void 0:_.longitude)&&!(_.latitude===0&&_.longitude===0))return{prefix:f,candidates:[{hash:i,name:_.node_name||_.name||"Source",latitude:_.latitude,longitude:_.longitude,probability:1,isLocal:!1,isDirectNeighbor:_.zero_hop===!0}],confidence:1,totalMatches:1,isSource:!0};const p=(_==null?void 0:_.node_name)||(_==null?void 0:_.name)||i.slice(0,8);return{prefix:f,candidates:[{hash:i,name:p,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[u,i,a]),k=h.useMemo(()=>{const f=l!=null&&l.startsWith("0x")?l.slice(2):l;if((!f||f==="00"||f==="0000000000000000")&&s&&n){const G=be(n),K=s.latitude!==0||s.longitude!==0;return{prefix:G,candidates:[{hash:n,name:s.name||"Local Node",latitude:K?s.latitude:0,longitude:K?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!l)return null;const v=be(l);if(n&&l===n&&s){const G=s.latitude!==0||s.longitude!==0;return{prefix:v,candidates:[{hash:l,name:s.name||"Local Node",latitude:G?s.latitude:0,longitude:G?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const p=a[l];if((p==null?void 0:p.latitude)&&(p==null?void 0:p.longitude)&&!(p.latitude===0&&p.longitude===0))return{prefix:v,candidates:[{hash:l,name:p.node_name||p.name||"Destination",latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isDirectNeighbor:p.zero_hop===!0}],confidence:1,totalMatches:1,isDestination:!0};const O=(p==null?void 0:p.node_name)||(p==null?void 0:p.name)||l.slice(0,8);return{prefix:v,candidates:[{hash:l,name:O,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[l,a,s,n]),B=h.useMemo(()=>za(t,a,s,n,r,c),[t,a,s,n,r,c]),d=h.useMemo(()=>{const f=[];j?f.push(j):x&&f.push(x),f.push(...B.hops),k&&f.push(k);const _=f.reduce((p,E)=>E.confidence===0?0:p*E.confidence,1),v=f.some(p=>p.candidates.some(E=>E.latitude!==0||E.longitude!==0));return{hops:f,overallConfidence:_,hasValidPath:v}},[j,x,B,k]),b=h.useMemo(()=>{const f=getComputedStyle(document.documentElement);return{success:f.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:f.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:f.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:f.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:f.getPropertyValue("--text-muted").trim()||"#767688"}},[]);return d.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),e.jsx("span",{className:Ua(d.overallConfidence),children:$a(d.overallConfidence)}),e.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(Js,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),e.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),e.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),e.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Va,{children:e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:e.jsx(Ea,{resolvedPath:d,localNode:s,hubNodes:m,hoveredHopIndex:y,onHoverHop:w,traceSnr:g})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:d.hops.map((f,_)=>{var G,K,D;const v=f.isSource===!0,p=f.isDestination===!0,E=y===_;let O;return v?O=`Source: ${((G=f.candidates[0])==null?void 0:G.name)||"Unknown"}`:p?O=`Destination: ${((K=f.candidates[0])==null?void 0:K.name)||"Unknown"}`:f.totalMatches===0?O="No matching nodes found":f.totalMatches===1?O=`Exact match: ${((D=f.candidates[0])==null?void 0:D.name)||"Unknown"}`:O=`${f.totalMatches} possible matches (${(f.confidence*100).toFixed(0)}% confidence)`,e.jsxs("div",{className:R("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",E?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",v&&"border border-sys-green/30",p&&"border border-sys-blue/30"),title:O,onMouseEnter:()=>w(_),onMouseLeave:()=>w(null),children:[v&&e.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),p&&e.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:Oa(f.confidence,f.totalMatches,b),children:f.prefix}),!v&&!p&&f.totalMatches>1&&e.jsxs("span",{className:"text-fg-muted",children:["×",f.totalMatches]}),!v&&!p&&f.totalMatches===0&&e.jsx("span",{className:"text-fg-muted",children:"?"})]},_)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[e.jsx(Ue,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]})}const Ke=16;function Ge(t){return t.match(/.{1,2}/g)||[]}function je(t){return t!==null&&t.startsWith("payload:")}const Te={hexRestOpacity:15,cardRestBg:"color-mix(in srgb, var(--elevated) 60%, var(--body))",cardRestShadow:` + */const ha=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ce=Pe("user",ha);function ua(t){t.values.forEach(a=>a.stop())}function tt(t,a){[...a].reverse().forEach(n=>{const i=t.getVariant(n);i&&Pt(t,i),t.variantChildren&&t.variantChildren.forEach(l=>{tt(l,a)})})}function pa(t,a){if(Array.isArray(a))return tt(t,a);if(typeof a=="string")return tt(t,[a]);Pt(t,a)}function fa(){const t=new Set,a={subscribe(s){return t.add(s),()=>void t.delete(s)},start(s,n){const i=[];return t.forEach(l=>{i.push(ns(l,s,{transitionOverride:n}))}),Promise.all(i)},set(s){return t.forEach(n=>{pa(n,s)})},stop(){t.forEach(s=>{ua(s)})},mount(){return()=>{a.stop()}}};return a}function ga(){const t=rs(fa);return ls(t.mount,[]),t}function ya({"aria-label":t="Page navigation",className:a,...s}){return e.jsx("nav",{"aria-label":t,...s,className:R("flex gap-x-2",a)})}function ja({onClick:t,disabled:a=!1,className:s,children:n="Previous"}){return e.jsx("span",{className:R("grow basis-0",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Previous page",className:R("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n]})})}function ba({onClick:t,disabled:a=!1,className:s,children:n="Next"}){return e.jsx("span",{className:R("flex grow basis-0 justify-end",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Next page",className:R("gap-1",a&&"invisible"),children:[n,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function Na({className:t,...a}){return e.jsx("span",{...a,className:R("hidden items-baseline gap-x-2 sm:flex",t)})}function va({page:t,current:a=!1,onClick:s,className:n,children:i}){return e.jsx(nt,{plain:!a,outline:a,onClick:()=>s==null?void 0:s(t),"aria-label":`Page ${t}`,"aria-current":a?"page":void 0,className:R("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",n),children:i??t})}function wa({className:t,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:R("w-[2.25rem] select-none text-center text-sm text-fg-muted",t),children:"…"})}function ka(t,a,s=1){if(a<=7)return Array.from({length:a},(m,g)=>g+1);const n=Math.max(t-s,1),i=Math.min(t+s,a),l=n>2,r=iy+1),"gap",a]}if(l&&!r){const m=3+2*s;return[1,"gap",...Array.from({length:m},(u,y)=>a-m+y+1)]}return[1,"gap",...Array.from({length:i-n+1},(m,g)=>n+g),"gap",a]}const ur=is(t=>({requestedHash:null,requestChannel:a=>t({requestedHash:a}),clearRequest:()=>t({requestedHash:null})}));function Ca(t){if(t.length===0)return[];const a=[];let s=0;for(;s{const r=l===t.length-1,c=n!==null&&cs(i.toUpperCase(),n);return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[c?e.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:i.toUpperCase()}),!r&&e.jsx(it,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${i}-${l}`)})})}const qt=h.memo(Ma);function Wt({channelName:t,onClick:a,active:s,compact:n,className:i}){const l=t.startsWith("#")?t:`#${t}`,r=R("inline-flex items-center flex-shrink-0","font-medium",n?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",s?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!s&&"hover:bg-sys-blue/20 cursor-pointer",i);return a?e.jsx("button",{type:"button",onClick:a,className:r,children:l}):e.jsx("span",{className:r,children:l})}function Kt({packet:t}){return t._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("teal"),children:"HTTP"}):t._mqttSource&&!t._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("purple"),children:"MQTT"}):null}function ye(t){return{"--data-box-accent":he[t]}}function Yt(t){const a=t.payload_type_name||Ht(t.payload_type??t.type),s=t.route_type_name||Ft(t.route_type??t.route),n=Be[a]??"zinc",i=Ie[s]??"zinc";return{payloadType:a,routeType:s,payloadColor:n,routeColor:i}}function Oe(t){if(!t)return[];if(Array.isArray(t))return t;try{const a=JSON.parse(t);return Array.isArray(a)?a:[]}catch{return[]}}function Xt(t,a){if(a){const s=a(t);return{name:s.name,isCompanion:s.isCompanion,isRepeater:s.isRepeater}}return{name:null,isCompanion:!1,isRepeater:!1}}function Ba({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:i,isFlashing:l=!1,isTraceHighlighted:r,onTraceHover:c,traceTag:m,onViewTraceReport:g,dupeGroupPosition:u,isDupeGroupHovered:y=!1,onDupeGroupHover:w,dupeCount:j,getDecodedContent:x,onChannelClick:k}){const B=j?!1:Mt(t.is_duplicate),d=u!==void 0,{payloadType:b,routeType:f,payloadColor:_,routeColor:v}=Yt(t),p=t.packet_origin==="tx_local",E=b==="TRACE",O=Oe(t.original_path),G=Oe(t.forwarded_path),K=G.length>0?G:O,D=t.src_hash?be(t.src_hash):null,{name:Y,isRepeater:I}=Xt(t,i);let H=null,$=null,U=null,J=null;if(b==="GRP_TXT"&&x){const S=x(t);S!=null&&S.decrypted&&($=S.senderName,U=S.channelName,J=S.channelHash,S.text&&(H=S.text))}else if(b==="TXT_MSG"&&t.raw_packet)try{const S=Bt.fromHex(t.raw_packet);if(S.success&&S.packet){const ce=Lt(S.packet.payload);ce&&!ce.encrypted&&(H=ce.text)}}catch{}const T=$||(I?null:Y),z=!!T,te=!z&&I&&!!Y,se=!z&&!te&&b==="GRP_TXT"&&!H,o=t.payload_length??t.length??0;t.lbt_attempts;const Z=h.useCallback(()=>{E&&m&&g?g(m):a(t)},[E,m,g,a,t]),W=h.useCallback(()=>{E&&m&&c&&c(m),d&&w&&t.packet_hash&&w(t.packet_hash)},[E,m,c,d,w,t.packet_hash]),ie=h.useCallback(()=>{c&&c(null),w&&w(null)},[c,w]),P=he[_]||he.zinc,F=y,ae=()=>{const S={pointerEvents:"none"};return u==="first"?{...S,borderTop:`2px solid ${P}`,borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:u==="middle"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:u==="last"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:`2px solid ${P}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...S,border:`2px solid ${P}`,borderRadius:"8px",inset:"-2px"}};return e.jsxs("div",{onClick:Z,onMouseEnter:W,onMouseLeave:ie,className:R("group relative cursor-pointer","hover:bg-subtle-fill",B&&!y&&"opacity-40",l&&"flash-row",p&&"bg-sys-indigo/5",r&&"bg-sys-teal/10"),children:[e.jsx("div",{className:R("absolute pointer-events-none transition-opacity duration-75",d?F?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:ae()}),e.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(Se(T).cleanName)},children:Se(T).emoji?e.jsx("span",{className:"text-base leading-none",children:Se(T).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(T)})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):se?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsx("div",{className:"min-w-0",children:z?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:T}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):te?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:Y}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:D||"—"}),Y&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:Y})]})})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(_),children:b}),p&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("indigo"),children:"LOCAL"}),e.jsx(Kt,{packet:t}),j&&j>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",j]}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(v),children:f}),e.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[o,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:H||U?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[U&&e.jsx(Wt,{channelName:U,compact:!0,onClick:k&&J?S=>{S.stopPropagation(),k(J)}:void 0}),H&&e.jsx("span",{className:"italic truncate",children:H})]}):e.jsx(qt,{path:K,localHash:s})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"data-box data-box-compact",children:Rt(t.timestamp)}),e.jsx(ze,{rssi:t.rssi,snr:t.snr,compact:!0,showValues:!0,validated:$e(t)})]})]})]})}function La({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:i,isFlashing:l=!1,isTraceHighlighted:r,traceTag:c,onViewTraceReport:m,dupeGroupPosition:g,isDupeGroupHovered:u=!1,onDupeGroupHover:y,dupeCount:w,getDecodedContent:j,onChannelClick:x}){const{payloadType:k,routeType:B,payloadColor:d,routeColor:b}=Yt(t),f=t.packet_origin==="tx_local",_=k==="TRACE",v=w?!1:Mt(t.is_duplicate),p=Oe(t.original_path),E=Oe(t.forwarded_path),O=E.length>0?E:p,G=t._hopCount??O.length,K=t.src_hash?be(t.src_hash):null,{name:D,isRepeater:Y}=Xt(t,i);let I=null,H=null,$=null,U=null;if(k==="GRP_TXT"&&j){const P=j(t);P!=null&&P.decrypted&&(H=P.senderName,$=P.channelName,U=P.channelHash,P.text&&(I=P.text))}else if(k==="TXT_MSG"&&t.raw_packet)try{const P=Bt.fromHex(t.raw_packet);if(P.success&&P.packet){const F=Lt(P.packet.payload);F&&!F.encrypted&&(I=F.text)}}catch{}const J=H||(Y?null:D),T=!!J,z=!T&&Y&&!!D,te=!T&&!z&&k==="GRP_TXT"&&!I,se=t.payload_length??t.length??0,o=t.lbt_attempts??0,Z=()=>{_&&c&&m?m(c):a(t)},W=he[d]||he.zinc,ie=()=>{if(!g)return{opacity:0};const P=u?1:.4,F=u?"3px":"2px";return g==="first"?{backgroundColor:W,opacity:P,width:F,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:g==="middle"?{backgroundColor:W,opacity:P,width:F,top:0,bottom:0,borderRadius:0}:g==="last"?{backgroundColor:W,opacity:P,width:F,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:W,opacity:P,width:F,top:"6px",bottom:"6px",borderRadius:"9999px"}};return e.jsxs("div",{onClick:Z,className:R("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",v&&"opacity-40",l&&"flash-row",f&&"bg-sys-indigo/5",r&&"bg-sys-teal/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:ie()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:T?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(Se(J).cleanName)},children:Se(J).emoji?e.jsx("span",{className:"text-base leading-none",children:Se(J).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(J)})}):z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[T?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:J}):z?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:D}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:K||"—"}),D&&e.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:D})]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(d),children:k}),f&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye("indigo"),children:"LOCAL"}),e.jsx(Kt,{packet:t}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:ye(b),children:B}),w&&w>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",w]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:t.rssi}),e.jsx(ze,{rssi:t.rssi,compact:!0,showValues:!1,validated:$e(t)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[e.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:Rt(t.timestamp)}),se>0&&e.jsxs("span",{children:[se,"B"]}),o>0&&e.jsxs("span",{className:o>1?"text-sys-amber/60":void 0,children:["LBT:",o]}),t.snr!=null&&e.jsxs("span",{children:[t.snr.toFixed(0),"dB"]}),I||$?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[$&&e.jsx(Wt,{channelName:$,compact:!0,onClick:x&&U?P=>{P.stopPropagation(),x(U)}:void 0}),I&&e.jsx("span",{className:"italic truncate",children:I})]}):G>0?e.jsx(qt,{path:O,localHash:s}):null]})]})]})]})}const Ra=h.memo(Ba),Ha=h.memo(La);function Fa(t,a,s,n,i=!1){const l=t.toUpperCase(),r=[],c=s&&Xe(l,s);c&&r.push(s);for(const j of Object.keys(a))Xe(l,j)&&r.push(j);if(i&&c&&s&&r.length===1)return{matches:r,probability:1,bestMatch:s};if(i&&c&&r.length>1){const j=r.filter(x=>x!==s);if(j.length===1)return{matches:r,probability:1,bestMatch:j[0]}}const m=r.length>0?1/r.length:0,g=[...r].sort();let u=null,y=-1;if(g.length===1)u=g[0];else if(g.length>1&&n){for(const j of g){const x=n.get(j),k=x?typeof x=="number"?x:x.combinedScore:0;k>y&&(y=k,u=j)}u||(u=g[0])}else g.length>0&&(u=g[0]);let w=m;if(r.length>1&&n&&y>0){let j=0;for(const x of r){const k=n.get(x);j+=k?typeof k=="number"?k:k.combinedScore:0}j>0&&(w=Math.min(.95,y/j))}return{matches:r,probability:w,bestMatch:u}}function Da(t,a,s,n){const l=(s-t)*Math.PI/180,r=(n-a)*Math.PI/180,c=Math.sin(l/2)*Math.sin(l/2)+Math.cos(t*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 6371e3*(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)))}function Aa(t){return t<100?1:t<500?.9:t<1e3?.7:t<5e3?.5:t<1e4?.3:.1}const Ea=h.lazy(()=>os(()=>import("./PathMapMapLibre-DM7wheVG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])));function Ia(t,a,s,n,i=!1,l,r,c){const m=ds(a);let g;r&&(g=xs(r,t,{position:c,isLastHop:i}).confidence);const{matches:u,probability:y}=Fa(t,m,n,l,i),w=u.length,j=[],x=t.toUpperCase(),k=s&&s.latitude!==void 0&&s.longitude!==void 0&&(s.latitude!==0||s.longitude!==0);for(const d of u){if(n&&Xe(x,n)&&d===n&&k&&s){j.push({hash:d,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:i?1:y,isLocal:!0});continue}const b=m[d];b!=null&&b.latitude&&(b!=null&&b.longitude)&&!(b.latitude===0&&b.longitude===0)&&j.push({hash:d,name:b.node_name||b.name||"Unknown",latitude:b.latitude,longitude:b.longitude,probability:y,isLocal:!1,isDirectNeighbor:b.zero_hop===!0})}const B=j.length;if(B===1)j[0].probability=g??1;else if(B>1)if(g!==void 0&&g>0){const d=j[0];d.probability=g;const b=1-g,f=B-1;j.slice(1).forEach(_=>{_.probability=b/f})}else{let d=0;const b=j.map(f=>{if(f.isLocal)return{candidate:f,score:1};const _=l==null?void 0:l.get(f.hash);let v=.5;if(k&&s){const E=Da(s.latitude,s.longitude,f.latitude,f.longitude);v=Aa(E)}let p;return _?p=v*.3+_.hopConsistencyScore*.3+_.frequencyScore*.4:(p=v,f.isDirectNeighbor&&(p=Math.max(p,.8))),d+=p,{candidate:f,score:p}});if(d>0)b.forEach(({candidate:f,score:_})=>{f.probability=Math.min(.95,_/d)});else{const f=1/B;j.forEach(_=>_.probability=f)}}return{candidates:j,totalMatches:w}}function za(t,a,s,n,i,l){if(!t||t.length===0)return{hops:[],overallConfidence:0,hasValidPath:!1};const r=t.length-1,c=t.map((u,y)=>{const w=y===r,j=t.length-y,{candidates:x,totalMatches:k}=Ia(u,a,s,n,w,i,l,j),B=x.length>0?Math.max(...x.map(d=>d.probability)):0;return{prefix:u,candidates:x,confidence:B,totalMatches:k}}),m=c.reduce((u,y)=>y.confidence===0?0:u*y.confidence,1),g=c.some(u=>u.candidates.length>0);return{hops:c,overallConfidence:m,hasValidPath:g}}function $a(t){return`${(t*100).toFixed(0)}%`}function Ua(t){return t>=1?"text-sys-green":t>=.5?"text-sys-indigo":t>=.25?"text-signal-poor":t>0?"text-sys-red":"text-fg-muted"}function Oa(t,a,s){let n;return a===0?n=s.muted:t>=1?n=s.success:t>=.5?n=s.secondary:t>=.25?n=s.poor:t>0?n=s.danger:n=s.muted,{color:n}}class Va extends h.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Ve({path:t,neighbors:a,localNode:s,localHash:n,srcHash:i,dstHash:l,neighborAffinity:r,prefixLookup:c,hubNodes:m,traceSnr:g,advertiserSource:u}){const[y,w]=h.useState(null),j=h.useMemo(()=>{if(!u)return null;const f=u.nodeType==="wardrive";return{prefix:u.prefix||"??",candidates:[{hash:u.publicKey||u.prefix||"source",name:u.name,latitude:u.latitude,longitude:u.longitude,probability:1,isLocal:!1,isWardrive:f}],confidence:1,totalMatches:1,isSource:!0}},[u]),x=h.useMemo(()=>{if(u||!i)return null;const f=be(i),_=a[i];if((_==null?void 0:_.latitude)&&(_==null?void 0:_.longitude)&&!(_.latitude===0&&_.longitude===0))return{prefix:f,candidates:[{hash:i,name:_.node_name||_.name||"Source",latitude:_.latitude,longitude:_.longitude,probability:1,isLocal:!1,isDirectNeighbor:_.zero_hop===!0}],confidence:1,totalMatches:1,isSource:!0};const p=(_==null?void 0:_.node_name)||(_==null?void 0:_.name)||i.slice(0,8);return{prefix:f,candidates:[{hash:i,name:p,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[u,i,a]),k=h.useMemo(()=>{const f=l!=null&&l.startsWith("0x")?l.slice(2):l;if((!f||f==="00"||f==="0000000000000000")&&s&&n){const G=be(n),K=s.latitude!==0||s.longitude!==0;return{prefix:G,candidates:[{hash:n,name:s.name||"Local Node",latitude:K?s.latitude:0,longitude:K?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!l)return null;const v=be(l);if(n&&l===n&&s){const G=s.latitude!==0||s.longitude!==0;return{prefix:v,candidates:[{hash:l,name:s.name||"Local Node",latitude:G?s.latitude:0,longitude:G?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const p=a[l];if((p==null?void 0:p.latitude)&&(p==null?void 0:p.longitude)&&!(p.latitude===0&&p.longitude===0))return{prefix:v,candidates:[{hash:l,name:p.node_name||p.name||"Destination",latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isDirectNeighbor:p.zero_hop===!0}],confidence:1,totalMatches:1,isDestination:!0};const O=(p==null?void 0:p.node_name)||(p==null?void 0:p.name)||l.slice(0,8);return{prefix:v,candidates:[{hash:l,name:O,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[l,a,s,n]),B=h.useMemo(()=>za(t,a,s,n,r,c),[t,a,s,n,r,c]),d=h.useMemo(()=>{const f=[];j?f.push(j):x&&f.push(x),f.push(...B.hops),k&&f.push(k);const _=f.reduce((p,E)=>E.confidence===0?0:p*E.confidence,1),v=f.some(p=>p.candidates.some(E=>E.latitude!==0||E.longitude!==0));return{hops:f,overallConfidence:_,hasValidPath:v}},[j,x,B,k]),b=h.useMemo(()=>{const f=getComputedStyle(document.documentElement);return{success:f.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:f.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:f.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:f.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:f.getPropertyValue("--text-muted").trim()||"#767688"}},[]);return d.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),e.jsx("span",{className:Ua(d.overallConfidence),children:$a(d.overallConfidence)}),e.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(Js,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),e.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),e.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),e.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Va,{children:e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:e.jsx(Ea,{resolvedPath:d,localNode:s,hubNodes:m,hoveredHopIndex:y,onHoverHop:w,traceSnr:g})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:d.hops.map((f,_)=>{var G,K,D;const v=f.isSource===!0,p=f.isDestination===!0,E=y===_;let O;return v?O=`Source: ${((G=f.candidates[0])==null?void 0:G.name)||"Unknown"}`:p?O=`Destination: ${((K=f.candidates[0])==null?void 0:K.name)||"Unknown"}`:f.totalMatches===0?O="No matching nodes found":f.totalMatches===1?O=`Exact match: ${((D=f.candidates[0])==null?void 0:D.name)||"Unknown"}`:O=`${f.totalMatches} possible matches (${(f.confidence*100).toFixed(0)}% confidence)`,e.jsxs("div",{className:R("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",E?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",v&&"border border-sys-green/30",p&&"border border-sys-blue/30"),title:O,onMouseEnter:()=>w(_),onMouseLeave:()=>w(null),children:[v&&e.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),p&&e.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:Oa(f.confidence,f.totalMatches,b),children:f.prefix}),!v&&!p&&f.totalMatches>1&&e.jsxs("span",{className:"text-fg-muted",children:["×",f.totalMatches]}),!v&&!p&&f.totalMatches===0&&e.jsx("span",{className:"text-fg-muted",children:"?"})]},_)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[e.jsx(Ue,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]})}const Ke=16;function Ge(t){return t.match(/.{1,2}/g)||[]}function je(t){return t!==null&&t.startsWith("payload:")}const Te={hexRestOpacity:15,cardRestBg:"color-mix(in srgb, var(--elevated) 60%, var(--body))",cardRestShadow:` var(--depth-stroke-tl), var(--depth-stroke-br) `,selectionBorderWidth:2},st={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function Ga(t,a){return t?`inset 0 0 0 ${Te.selectionBorderWidth}px ${he[a]}`:Te.cardRestShadow}function Qa(t,a){return t?a:`color-mix(in srgb, ${a} ${Te.hexRestOpacity}%, transparent)`}function qa({segments:t,selectedSegment:a,onSegmentClick:s}){const[n,i]=h.useState(null),[l,r]=h.useState(null),c=t.some(u=>u.id!==void 0)&&s,m=[];for(const u of t){const y=Ge(u.hex);for(const w of y)m.push({byte:w.toUpperCase(),color:u.color,id:u.id})}const g=[];for(let u=0;u{const w=u.length{const d=B===u.length-1,b=w&&d,f=he[x],p=(k?n===k:l===x)||!!(k&&a===k);return e.jsx("span",{className:`w-[1.75rem] text-xs text-center py-0.5 font-mono select-text ${c?"cursor-pointer":""}`,style:{backgroundColor:Qa(p,f),color:p?"rgba(255,255,255,0.95)":f,transition:p?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...b?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{k?i(k):r(x)},onMouseLeave:()=>{i(null),r(null)},onClick:()=>k&&(s==null?void 0:s(k)),onTouchStart:()=>{k?i(k):r(x)},onTouchEnd:()=>{i(null),r(null)},children:j},B)})},y)})})}function Wa({rawHex:t,hexSegments:a,selectedSegment:s,onSegmentClick:n}){const[i,l]=h.useState(!1),r=h.useCallback(async()=>{await fs(t.toUpperCase()),l(!0),setTimeout(()=>l(!1),2e3)},[t]);return e.jsxs("div",{className:"bg-inset radius-inner p-6 relative depth-stroke-inset",children:[e.jsx(qa,{segments:a,selectedSegment:s,onSegmentClick:n}),e.jsx("button",{onClick:r,className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-subtle-fill-hover hover:bg-subtle-fill-strong text-fg-muted hover:text-fg-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:i?e.jsxs(e.Fragment,{children:[e.jsx(gs,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"text-sys-green",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy"})]})})]})}function Ka(t,a){const s=[];let n=0;const i=a.slice(0,64);s.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:i,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const l=a.slice(64,72);s.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:l,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:l.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.timestamp," (",le(t.timestamp),")"]})]})}),n+=4;const r=a.slice(72,200);s.push({id:"payload:signature",title:"Signature",color:"teal",hex:r,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=a.slice(200,202);if(s.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-fg-primary mt-1",children:t.flagsDescription}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Node Type: ",t.nodeType]})]})}),n+=1,t.latitude!==void 0){const m=a.slice(n*2,n*2+8);s.push({id:"payload:latitude",title:"Latitude",color:"green",hex:m,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.latitude.toFixed(6),"°"]})]})}),n+=4}if(t.longitude!==void 0){const m=a.slice(n*2,n*2+8);s.push({id:"payload:longitude",title:"Longitude",color:"indigo",hex:m,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.longitude.toFixed(6),"°"]})]})}),n+=4}if(t.name){const m=a.slice(n*2),g=m.length/2;s.push({id:"payload:name",title:"Name",color:"amber",hex:m,startByte:n,endByte:n+g-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:['"',t.name,'"']})]})})}return s}function Ya(t,a){return[{id:"payload:crc",title:"CRC",color:"green",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.crc]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}function Xa(t,a){const s=[];s.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&s.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&s.push({id:"payload:ciphertext",title:t.decrypted?"Message":"Ciphertext",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-fg-primary",children:['"',t.text,'"']}),t.senderName&&e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["From: ",t.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"AES-128-ECB encrypted"})]})}),s}function Za(t,a){const s=[];s.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&s.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&s.push({id:"payload:ciphertext",title:t.decrypted?"Decrypted Data":"Encrypted Data",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:(t.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.dataLength," bytes",t.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),s}function Ja(t,a){const s=[],n=parseInt(a.slice(0,2),16),i=isNaN(n)?{hashSize:1,hopCount:t.pathLength}:js(n),l=i.hopCount*i.hashSize;if(s.push({id:"payload:pathLength",title:"Path Length",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",children:i.hopCount}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[i.hopCount," hop",i.hopCount!==1?"s":"",i.hashSize>1&&` × ${i.hashSize}B hashes`]})]})}),t.path.length>0){const r=a.slice(2,2+l*2);s.push({id:"payload:path",title:"Path Hops",color:"amber",hex:r,startByte:1,endByte:l,decoded:e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.path.map((c,m)=>e.jsxs("span",{className:"flex items-center gap-1",children:[m>0&&e.jsx(ue,{className:"w-3 h-3 text-fg-muted"}),e.jsx(M,{color:"amber",className:"font-mono",children:c})]},m))})})})}if(t.extraType!=null){const r=1+l;s.push({id:"payload:extraType",title:"Extra Type",color:"indigo",hex:a.slice(r*2,r*2+2),startByte:r,endByte:r,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",children:t.extraTypeName??`0x${t.extraType.toString(16).padStart(2,"0")}`}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Bundled payload type"})]})})}if(t.extraData){const r=1+l+1,c=a.slice(r*2);c&&s.push({id:"payload:extraData",title:"Extra Data",color:"indigo",hex:c,startByte:r,endByte:r+c.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:c.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[c.length/2," bytes"]})]})})}return s}function en(t,a){const s=[];s.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.traceTag]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique trace request identifier"})]})}),s.push({id:"payload:mac",title:"Auth Code",color:"indigo",hex:a.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.authCode}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Authentication/verification code"})]})}),s.push({id:"payload:flags",title:"Flags",color:"amber",hex:a.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:t.flags===0?"No flags set":`Flags: ${t.flags.toString(2).padStart(8,"0")}b`})]})});const n=a.slice(18);return n&&s.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.pathHashes.map((i,l)=>{const r=t.snrValues[l],c=r!==void 0?Ks(r):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[l>0&&e.jsx(ue,{className:"w-3 h-3 text-fg-muted"}),e.jsx(M,{color:"indigo",className:"font-mono",children:i}),r!==void 0&&e.jsxs(M,{color:c,className:"font-mono",children:[r>=0?"+":"",Number.isInteger(r)?r:r.toFixed(1),"dB"]})]},l)})}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.pathHashes.length," target ",t.pathHashes.length===1?"hop":"hops",t.snrValues.length>0&&` • ${t.snrValues.length} SNR ${t.snrValues.length===1?"value":"values"} collected`,t.isComplete&&" • ✓ Complete"]})]})}),s}function tn(t,a){const s=[];s.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:a.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique message identifier"})]})}),s.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:a.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.partNumber}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"0-indexed part number"})]})}),s.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:a.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.totalParts}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})});const n=a.slice(8);return n&&s.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[n.length/2," bytes"]})]})}),s}function sn(t,a){switch(t.type){case"advert":return Ka(t,a);case"ack":return Ya(t,a);case"grp_txt":return Xa(t,a);case"grp_data":return Za(t,a);case"path":return Ja(t,a);case"trace":return en(t,a);case"multipart":return tn(t,a);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:a,startByte:0,endByte:a.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:a.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[a.length/2," bytes"]})]})}]}}function an(t){return t.map(a=>({id:a.id,hex:a.hex,color:a.color}))}function nn({bits:t,field:a,value:s,binary:n}){const i=()=>{if(a==="Payload Type"){const l=Be[s]||"zinc";return e.jsx(M,{color:l,children:s})}if(a==="Route Type"){const l=Ie[s]||"zinc";return e.jsx(M,{color:l,children:s})}return e.jsx("span",{className:"text-sm text-fg-primary",children:s})};return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-fg-muted tabular-nums",children:t}),e.jsx("td",{className:"py-1.5 text-sm text-fg-secondary",children:a}),e.jsx("td",{className:"py-1.5",children:i()}),e.jsx("td",{className:"py-1.5 type-data-xs text-sys-cyan",children:n})]})}function jt({id:t,title:a,color:s,hexBytes:n,startByte:i,endByte:l,isSelected:r,children:c}){const m=n?Ge(n):[];return e.jsxs(oe.div,{layout:"position",layoutId:t,transition:st,className:"w-full min-w-0 overflow-hidden radius-inner p-4 sm:p-5 space-y-4",style:{backgroundColor:Te.cardRestBg,boxShadow:Ga(r,s)},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(M,{color:s,children:a}),m.length>0&&m.length<=16&&m.map((g,u)=>e.jsx(M,{color:s,className:"font-mono",children:g.toUpperCase()},u))]}),e.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",i,"-",l]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function rn({advert:t,timestamp:a}){const s=a?le(a):le(t.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-indigo/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:e.jsx(de,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:t.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:t.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[t.latitude!==void 0&&t.longitude!==void 0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ue,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-mono",children:[t.latitude.toFixed(5),"°, ",t.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:s})]})]})]})})}function ln({decoded:t,timestamp:a}){const s=a?le(a):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-teal/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:e.jsx(aa,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:t.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[t.dataLength," bytes • ",t.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ot,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:s})]}),t.decrypted&&t.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:[e.jsx("p",{className:"type-micro text-fg-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(X,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:t.decryptedHex.toUpperCase()})})})]})]})]})})}function cn({decoded:t,timestamp:a,isLoading:s=!1,onDecrypted:n}){const i=a?le(a):"Unknown",[l,r]=h.useState(""),[c,m]=h.useState(!1),[g,u]=h.useState(null),[y,w]=h.useState(!1),j=h.useCallback(async()=>{if(!(!l.trim()||!t.ciphertextHex||!t.macHex)){m(!0),u(null);try{const x=parseInt(t.channelHash,16),k=ht(t.macHex),B=ht(t.ciphertextHex),d=await Ns(l.trim(),x,k,B);if(d.success){const b=d.result.plaintext,f=new TextDecoder("utf-8",{fatal:!1}).decode(b.slice(5)),_=f.indexOf(": "),v={...t,channelName:d.result.channelName,decrypted:!0,timestamp:b[0]|b[1]<<8|b[2]<<16|b[3]<<24,flags:b[4],senderName:_>0?f.slice(0,_):void 0,text:_>0?f.slice(_+2):f};n==null||n(v),r(""),w(!1)}else u(d.error)}catch(x){u(x instanceof Error?x.message:"Unknown error")}finally{m(!1)}}},[l,t,n]);return s?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:` diff --git a/frontend/dist/assets/PacketObservatory-CbUj8V1_.js b/frontend/dist/assets/PacketObservatory-BrZhT-1E.js similarity index 99% rename from frontend/dist/assets/PacketObservatory-CbUj8V1_.js rename to frontend/dist/assets/PacketObservatory-BrZhT-1E.js index f6885bfe..3929f6c4 100644 --- a/frontend/dist/assets/PacketObservatory-CbUj8V1_.js +++ b/frontend/dist/assets/PacketObservatory-BrZhT-1E.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usePipelineStore-BqTRxIqB.js","assets/index-i0xzpXop.js","assets/node-types-rVJPSDxd.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); -import{cn as O,r as T,eU as Fe,eV as Ee,eW as Oe,eX as ze,bV as Be,eY as Ie,eZ as Ge,e_ as Ke,e$ as Ve,bU as Ne,_ as ue,f0 as Ue,f1 as we,b_ as pe,j as e,f2 as G,f3 as K,f4 as V,eu as xe,f5 as qe,V as M,c9 as We,ck as Ce,cu as Ye,f6 as Ze,f7 as Xe,f8 as Qe,f9 as Je,fa as et,fb as J,fc as tt,fd as st,fe as nt,ff as he,at as me,ao as Se,bP as rt,t as at,fg as lt,Q as ot,a6 as ct,fh as it,P as dt,dL as ut}from"./index-i0xzpXop.js";import{usePipelineStore as Y}from"./usePipelineStore-BqTRxIqB.js";import{e as Te,p as pt,A as I,S as U,a as se,c as E,K as i,H as A,B as xt,R as F,T as d,P as re,d as ht,f as S,C as _e,s as ee,h as mt}from"./primitives-QKpQyH4U.js";import{m as ke,i as gt}from"./node-types-rVJPSDxd.js";import{a as ft}from"./payload-detail-Bh2WvEK0.js";function bt(t){const s=t.type??t.payload_type,r=t.duplicates??[],c=t.is_duplicate,a=r.length;let n=null,l=null;if(a>0){const x=[t.rssi,...r.map(g=>g.rssi).filter(g=>g!=null)],m=[t.snr,...r.map(g=>g.snr).filter(g=>g!=null)];x.length>1&&(n=[Math.min(...x),Math.max(...x)]),m.length>1&&(l=[Math.min(...m),Math.max(...m)])}const o=s===O.TRACE;return{isDuplicate:c,dupeCount:a,rssiRange:n,snrRange:l,hashIncludesPathLen:o}}function yt(t,s,r){const c={traceTag:null,siblingCount:0,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:[],thisPathLen:0,minPathLen:0,firstHopPrefix:null};let a=t._traceTag;if(!a&&t.payload&&(a=Te(t.payload)),!a)return{...c,evidence:["no traceTag — cannot correlate"]};const n=s.get(a)??[],l=N=>N.path_length!=null?N.path_length:Array.isArray(N.original_path)?N.original_path.length:0,o=l(t),x=n.length>0?Math.min(...n.map(l)):o,m=t.payload?t.payload.slice(18):"",g=m.length>=2?m.slice(0,2).toUpperCase():null,u=[];if(u.push(`traceTag: ${a}`),u.push(`siblings: ${n.length} observation${n.length!==1?"s":""}`),t.packet_origin==="tx_local")return u.push("packet_origin = tx_local → we initiated this trace"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};const v=n.find(N=>N.packet_origin==="tx_local");if(v)return u.push(`sibling (hash ${v.packet_hash}) has packet_origin = tx_local`),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};if(u.push(`this observation: path_len=${o}, min across siblings: ${x}`),g){if(u.push(`first hop in target path: ${g}`),o===0)return u.push("path_len = 0 → heard directly from initiator (no SNR appended yet)"),u.push("initiator is a direct RF neighbor"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"min_path_len",confidence:"speculative",inferredSrc:null,inferredName:null,evidence:[...u,"initiator is within direct RF range (zero forwarding hops)"],thisPathLen:o,minPathLen:x,firstHopPrefix:g};const f=Object.entries(r).filter(([k])=>k.replace(/^0x/i,"").slice(0,2).toUpperCase()===g);if(f.length===1){const[k,$]=f[0],h=$.name||$.node_name||null;return u.push(`first hop ${g} → unique neighbor: ${h??k}`),u.push("initiator is whoever sent TO this first hop"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"first_hop_neighbor",confidence:"likely",inferredSrc:g,inferredName:h,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}else f.length>1?u.push(`first hop ${g} matches ${f.length} neighbors (ambiguous)`):u.push(`first hop ${g} is not a known neighbor`)}return u.push("insufficient data to identify initiator"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}let ne=null,ce=null;typeof window<"u"&&setTimeout(()=>{ue(()=>import("./usePipelineStore-BqTRxIqB.js"),__vite__mapDeps([0,1,2,3])).then(t=>{ne=t}),ue(()=>import("./index-i0xzpXop.js").then(t=>t.hm),__vite__mapDeps([1,3])).then(t=>{ce=t})},0);const He={advertSender:null,advertNodeType:null,advertFlags:null,advertHasLocation:null,advertHasName:null,advertName:null,advertLatitude:null,advertLongitude:null,channelHash:null,byteLength:void 0,hopCount:0,isZeroHop:!0,preComputed:!1};function jt(t,s){const r=t.type??t.payload_type,c=Ne(r),a=Be(t.route),n=r===O.ADVERT,l=r===O.TRACE,o=r===O.PATH,x=r===O.GRP_TXT||r===O.GRP_DATA,m=Ie(t.snr,t.rssi),g=(m==null?void 0:m.finalGrade)??"critical",u=Ge(t.route),v=Ke(t.route),N=Ve(t.route),f=t.route==null?"unknown":u?"flood":v?"direct":"unknown",k=N?`transport-${f}`:f,$=!!s.advertSender;let h="none";$?h="pubkey":x?h="encrypted":t.src_hash&&(h="prefix");const y=gt(r),p=s.advertNodeType!=null?ke(s.advertNodeType):"unknown",_=y!=="unknown"?y:p,H=t.packet_origin??"rx",C=Math.floor(Date.now()/1e3)-t.timestamp,D=C<10?"live":C<300?"recent":C<3600?"warm":C<86400?"stale":"historic",L=t.path_length??(Array.isArray(t.original_path)?t.original_path.length:void 0),P=Array.isArray(t.original_path)&&t.original_path.length>0,R=L??0,b=s.byteLength??(t.raw_packet?Math.floor(t.raw_packet.length/2):0),w=bt(t);return{pType:r,payloadTypeName:c,routeTypeName:a,isAdvert:n,isTrace:l,isPath:o,isGrp:x,signalClass:g,routeClass:k,isFlood:u,isDirect:v,hasTransport:N,senderTier:h,hasPubkey:$,inferredType:y,advertType:p,effectiveType:_,origin:H,age:D,pathLen:L,pathAvail:P,pathHopCount:R,byteLen:b,dupeAnalysis:w}}function vt(t){var f,k,$,h,y,p;const s=ft(t);if(!s||s.pathHashes.length===0)return null;const{pathHashes:r,snrValues:c}=s;if(r.length<2||!ne||!ce)return null;const a=ne.usePipelineStore.getState().srcHashResolverMap,n=ne.usePipelineStore.getState().neighborContext,l=(n==null?void 0:n.hashToName)??new Map,o=ce.useStore.getState().stats,x=(o==null?void 0:o.neighbors)??{},m=o==null?void 0:o.local_hash,g=(k=(f=o==null?void 0:o.config)==null?void 0:f.repeater)==null?void 0:k.latitude,u=(h=($=o==null?void 0:o.config)==null?void 0:$.repeater)==null?void 0:h.longitude,v=Object.keys(x).length>0?Ue([],x,m,g,u):null,N=[];for(let _=0;_0?[r[_-1].toUpperCase()]:[]],P=ge(H,_,L,a,v),R=[H,..._+20?N:null}function ge(t,s,r,c,a){if(s===0){const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.8};if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}}else{if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.6}}return{hash:null,confidence:0}}function Nt(t){var l;const s=t.raw_packet;if(!s||s.length<2)return null;const r=s.replace(/\s/g,""),c=Math.floor(r.length/2),a=((l=r.match(/.{1,2}/g))==null?void 0:l.join(" "))??"";let n="";for(let o=0;o=32&&x<=126?String.fromCharCode(x):"·"}return{hexBytes:a,utf8:n,byteCount:c}}function wt(t){const s=new Map;let r=0,c="";for(const a of t){if((a.type??a.payload_type)!==O.TRACE)continue;r++,c=a.packet_hash;const l=a._traceTag??(a.payload?Te(a.payload):null);if(!l)continue;let o=s.get(l);o||(o=[],s.set(l,o)),o.push(a)}return{index:s,fingerprint:`${r}:${c}`}}function Ct(t,s,r){const c=T.useRef({parse:0,decode:0,enrich:0,traceIndex:0,total:0}),a=T.useMemo(()=>t?Nt(t):null,[t]),n=T.useMemo(()=>{if(!s||s.length<4)return c.current.parse=0,c.current.decode=0,null;const h=performance.now(),y=pt(s),p=performance.now()-h;return y?(c.current.parse=p,c.current.decode=0,{protocolPacket:y.packet,display:{headerFields:y.headerFields,transportCodesHex:y.transportCodesHex,pathLengthHex:y.pathLengthHex,pathDataHex:y.pathDataHex,payloadHex:y.payloadHex,payloadByteOffset:y.payloadStartByte,pathByteOffset:y.pathByteOffset,pathLenByteOffset:y.pathLenByteOffset},decoded:y.decoded,error:null}):(c.current.parse=p,c.current.decode=0,{protocolPacket:null,display:null,decoded:null,error:"Packet.fromHex() returned failure"})},[s]),l=T.useMemo(()=>{if(!t)return c.current.enrich=0,He;const h=performance.now();if(t._advertSender!==void 0)return c.current.enrich=performance.now()-h,{advertSender:t._advertSender??null,advertNodeType:t._advertNodeType??null,advertFlags:t._advertFlags??null,advertHasLocation:t._advertHasLocation??null,advertHasName:t._advertHasName??null,advertName:t._advertName??null,advertLatitude:t._advertLatitude??null,advertLongitude:t._advertLongitude??null,channelHash:t._channelHash??null,byteLength:t._byteLength,hopCount:t._hopCount??0,isZeroHop:t._isZeroHop??!0,preComputed:!0};const y=t.type??t.payload_type,p=Fe(s,y),_=Ee(s,y),H=Oe(s,t),C=ze(t);return c.current.enrich=performance.now()-h,{...p,channelHash:_,byteLength:H,...C,preComputed:!1}},[t,s]),o=T.useRef({fingerprint:"",index:new Map}),x=T.useMemo(()=>{const h=performance.now(),{index:y,fingerprint:p}=wt(r);return c.current.traceIndex=performance.now()-h,p===o.current.fingerprint?o.current.index:(o.current={fingerprint:p,index:y},y)},[r]),m=T.useMemo(()=>{const h=c.current;return{parse:h.parse,decode:h.decode,enrich:h.enrich,traceIndex:h.traceIndex,total:h.parse+h.decode+h.enrich+h.traceIndex}},[n,l,x]);if(!t)return null;const g=s?n?n.error:"rawHex too short":"No raw_packet (warm-tier)",u=(n==null?void 0:n.protocolPacket)??null,v=u?u.payloadVersion:null,N=v===0,f=v===1,k=jt(t,l);let $=null;return k.isTrace&&($=vt(t)),{wire:a,display:(n==null?void 0:n.display)??null,parseError:g,protocolPacket:u,decoded:(n==null?void 0:n.decoded)??null,payloadVersion:v,isV1:N,isV2:f,enrichment:l,traceTagIndex:x,analysis:k,traceHopDetail:$,timing:m}}function ae({options:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:`w-16 shrink-0 font-medium ${l.active?"text-fg-primary":"text-fg-muted"}`,children:l.label}),l.detail&&e.jsx("span",{className:l.active?"text-fg-primary/70":"text-fg-muted",children:l.detail})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}function St({tokens:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-muted shrink-0",children:l.fn}),e.jsxs("span",{className:l.active?"text-fg-primary":"text-fg-muted",children:["(",l.value??"",")"]})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}const Tt={0:"border-l-sys-green",1:"border-l-sys-blue",2:"border-l-sys-teal",3:"border-l-sys-purple"};function le({stage:t,name:s,fn:r,verdict:c,timeMs:a,skipped:n,skipReason:l,children:o}){const x=Tt[t]??"";return e.jsx(e.Fragment,{children:e.jsx(G,{defaultOpen:!n,children:e.jsxs("div",{className:`surface-base rounded-lg border border-edge-subtle overflow-hidden border-l-2 ${x}`,children:[e.jsxs(K,{className:"px-3 py-2 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-sys-blue shrink-0",children:t}),e.jsx("span",{className:"font-mono text-xs font-medium text-fg-primary truncate",children:s}),r&&!c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted truncate hidden sm:inline",children:r}),c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted/70 truncate hidden sm:inline",children:c})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-zinc-500/20 text-fg-muted",children:"N/A"}),a!=null&&!n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})]})]}),e.jsx(V,{children:e.jsx("div",{className:"px-3 pb-3 font-mono text-xs",children:n?e.jsx("p",{className:"text-fg-muted italic",children:l??"Not applicable for this packet type"}):o})})]})})})}function _t(t,s){return s?"manual":t._stripped?"bulk-tier":qe.isConnected()?"ws-push":"rest-poll"}const kt={connected:"green",degraded:"amber",offline:"red"};function Ht({packet:t,isSynthetic:s}){const r=xe(g=>g.wsState),c=xe(g=>g.health),a=_t(t,s),l=!!t._stripped?"WARM":"HOT",o=[{label:"ws-push",detail:"wsConnected && onPacket()",active:a==="ws-push",color:"green"},{label:"rest-poll",detail:"!wsConnected, 3s interval",active:a==="rest-poll",color:"amber"},{label:"catchup",detail:"wsReconnected, delta > 50",active:a==="catchup",color:"amber"},{label:"bulk-tier",detail:"user extends time range → gzip",active:a==="bulk-tier",color:"blue"},{label:"manual",detail:"hex input — no transport",active:a==="manual",color:"zinc"}],x=[{fn:"transport",value:a,group:"transport",color:a==="ws-push"?"green":a==="bulk-tier"?"blue":"amber"},{fn:"tier",value:l,group:"transport",color:"blue"},{fn:"wsState",value:r,group:"transport",color:r==="connected"?"green":"amber"},{fn:"health",value:c,group:"transport",color:kt[c]}],m=s?"manual hex input":`${a} (${c})`;return e.jsx(le,{stage:0,name:"TRANSPORT",fn:"websocketService / useStore.startPolling",verdict:m,children:s?e.jsx("p",{className:"text-fg-muted italic",children:"Manual hex input — no transport context"}):e.jsx(U,{prefix:"transport",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx(ae,{options:o,nextFn:"ingest()"}),e.jsx(se,{tokens:x})]})})})}function q({start:t,end:s}){const r=s!=null&&s!==t?`[${t}..${s}]`:`[${t}]`;return e.jsx("span",{className:"text-fg-muted text-[9px] font-mono mr-1 select-none",children:r})}const $t={advert:"decodeAdvert()",ack:"decodeAck()",path:"decodePath()",trace:"decodeTraceWithSnr()",txt_msg:"decodeTextMessage()",grp_txt:"decodeGroupText()",grp_data:"decodeGroupData()",multipart:"decodeMultipart()",control:"decodeControl()",req:"decodeRequest()",response:"decodeResponse()",anon_req:"decodeAnonReq()",generic:"decodeGeneric()"};function Dt({rawHex:t,display:s,protocolPacket:r,parseError:c,parseTimeMs:a,payloadVersion:n,isV1:l,isV2:o}){return e.jsx("dl",{className:"space-y-0.5",children:s&&r&&t?e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse — Packet.fromHex()"}),a>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})}),e.jsxs(i,{label:"header byte",children:[e.jsx(q,{start:0}),e.jsx(A,{value:t.slice(0,2)})," ",e.jsx(xt,{value:parseInt(t.slice(0,2),16)})]}),s.headerFields.map(x=>e.jsx(i,{label:` ${x.field}`,children:e.jsx(F,{raw:e.jsxs("span",{className:"text-[10px]",children:["bits[",x.bits,"] = ",x.binary]}),children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:x.value})})},x.field)),e.jsx(i,{label:" version",children:n!=null?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(d,{fn:"payloadVer",value:`${n}`,color:"amber"}),e.jsx(M,{color:l?"green":o?"blue":"zinc",children:l?"v1":o?"v2":`v${n}`}),l&&e.jsx("span",{className:"text-fg-muted text-[10px]",children:"1-byte hashes, 2-byte MAC"}),o&&e.jsx("span",{className:"text-sys-blue text-[10px]",children:"2-byte hashes, 4-byte MAC (speculative)"})]}):e.jsx("span",{className:"text-fg-muted",children:"unknown"})}),e.jsx(E,{title:"Wire Framing"}),e.jsx(i,{label:"transportCodes",children:s.transportCodesHex?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:1,end:4}),e.jsx(d,{fn:"transport",value:s.transportCodesHex,color:"amber"})]}):e.jsx("span",{className:"text-fg-muted",children:"N/A (non-transport route)"})}),e.jsx(i,{label:"pathLen",children:e.jsx(F,{raw:e.jsxs(e.Fragment,{children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(A,{value:s.pathLengthHex})]}),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(d,{fn:"pathLen",value:`${r.pathLen} hop${r.pathLen!==1?"s":""}`,color:"amber"})]})})}),e.jsx(i,{label:"path",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.pathLen>0&&e.jsx(q,{start:s.pathByteOffset,end:s.pathByteOffset+r.pathLen-1}),e.jsx(re,{hops:r.pathHexArray,hexPrefix:s.pathDataHex||void 0})]})}),e.jsx(i,{label:"payloadLen",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.payloadByteOffset,end:s.payloadByteOffset+s.payloadHex.length/2-1}),e.jsx(d,{fn:"payloadLen",value:`${s.payloadHex.length/2} bytes`,color:"amber"})]})}),e.jsx(i,{label:"payloadHex",children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber break-all",children:s.payloadHex})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse"}),e.jsxs(i,{label:"result",children:[e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:"Skipped"}),e.jsx("span",{className:"ml-1 text-fg-muted",children:c??"No raw_packet (warm-tier)"})]})]})})}function Lt({decoded:t,packet:s}){if(!t)return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode"}),e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:"No decoded payload"})]});const r=$t[t.type]??`decode${t.type}()`;return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode — decodePayload()"}),e.jsx(U,{prefix:"decodePayload",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"dispatched",children:r}),e.jsx(E,{}),e.jsx(Pt,{decoded:t,packet:s})]})})]})}function Pt({decoded:t,packet:s}){var r;switch(t.type){case"advert":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"publicKey",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px] break-all",children:t.publicKey}),children:e.jsx(d,{fn:"publicKey",value:t.publicKey,color:"green"})})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(F,{raw:e.jsx(A,{value:t.flags}),children:e.jsx(d,{fn:"flags",value:t.flagsDescription,color:"green"})})}),e.jsx(i,{label:"nodeType",children:e.jsx(d,{fn:"nodeType",value:t.nodeType,color:"green"})}),t.latitude!=null&&e.jsx(i,{label:"latitude",children:e.jsx(d,{fn:"lat",value:t.latitude.toFixed(6),color:"green"})}),t.longitude!=null&&e.jsx(i,{label:"longitude",children:e.jsx(d,{fn:"lon",value:t.longitude.toFixed(6),color:"green"})}),t.name&&e.jsx(i,{label:"name",children:e.jsx(d,{fn:"name",value:t.name,color:"green"})})]});case"ack":return e.jsx(i,{label:"crc",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px]",children:t.crc}),children:e.jsx(d,{fn:"crc",value:t.crc,color:"green"})})});case"trace":{const c=s!=null&&s.src_hash?s.src_hash.replace(/^0x/i,"").slice(0,2).toUpperCase():null;return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"traceTag",children:e.jsx(d,{fn:"traceTag",value:t.traceTag,color:"green"})}),e.jsx(i,{label:"authCode",children:e.jsx(d,{fn:"authCode",value:String(t.authCode),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(A,{value:t.flags})}),e.jsx(i,{label:"target path",children:t.pathHashes.length>0?e.jsx(re,{hops:t.pathHashes.map(a=>a.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),e.jsx(i,{label:"complete",children:t.isComplete?e.jsxs("span",{className:"text-sys-green",children:["✓ all ",t.pathHashes.length," hops reported SNR"]}):e.jsxs("span",{className:"text-sys-amber",children:["✗ ",t.snrValues.length,"/",t.pathHashes.length," hops reported"]})}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1 text-[10px]",children:"Directional Edge SNR — per-hop link quality"}),t.snrValues.length===0?e.jsx("p",{className:"text-fg-muted italic text-[11px] ml-2",children:"No SNR values in path field"}):e.jsx("div",{className:"space-y-0.5 ml-2",children:t.snrValues.map((a,n)=>{var g,u,v,N,f;const l=((g=t.pathHashes[n])==null?void 0:g.toUpperCase())??"??",o=n===0?c??"SRC":((u=t.pathHashes[n-1])==null?void 0:u.toUpperCase())??"??",x=(f=(N=(v=Ye.getState().stats)==null?void 0:v.config)==null?void 0:N.radio)==null?void 0:f.spreading_factor,m=we(a,x);return e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted w-3 text-right",children:n}),e.jsx("span",{className:"text-fg-primary",children:o}),e.jsx("span",{className:"text-fg-muted",children:"→"}),e.jsx("span",{className:"text-fg-primary",children:l}),e.jsx("span",{className:"text-fg-muted",children:"@"}),e.jsxs("span",{className:"font-bold text-sys-green",children:[a>0?"+":"",a.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:m})]},n)})})]})]})}case"path":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"pathLength",children:e.jsx(d,{fn:"pathLength",value:String(t.pathLength),color:"green"})}),e.jsx(i,{label:"path",children:t.path&&t.path.length>0?e.jsx(re,{hops:t.path.map(c=>c.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),t.extraType!=null&&e.jsx(i,{label:"extraType",children:e.jsx(d,{fn:"extraType",value:t.extraTypeName??String(t.extraType),color:"purple"})}),t.extraData&&e.jsxs(i,{label:"extraData",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.extraData}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.extraData.length/2,"B)"]})]})]});case"txt_msg":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),e.jsx(i,{label:"encrypted",children:e.jsx(d,{fn:"encrypted",value:String(t.encrypted),color:"green"})})]});case"grp_txt":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),t.channelName&&e.jsx(i,{label:"channelName",children:e.jsx(d,{fn:"channel",value:t.channelName,color:"green"})}),e.jsx(i,{label:"decrypted",children:e.jsx(d,{fn:"decrypted",value:String(t.decrypted),color:"green"})}),t.text&&e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),t.senderName&&e.jsx(i,{label:"senderName",children:e.jsx(d,{fn:"sender",value:t.senderName,color:"green"})}),t.macCorrupted&&e.jsx(i,{label:"macCorrupted",children:e.jsx(d,{fn:"macCorrupted",value:"true",color:"green"})})]});case"grp_data":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),e.jsx(i,{label:"dataLength",children:t.dataLength}),e.jsx(i,{label:"decrypted",children:String(t.decrypted)})]});case"multipart":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"messageId",children:t.messageId}),e.jsxs(i,{label:"part",children:[t.partNumber+1," / ",t.totalParts]})]});case"control":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"controlType",children:e.jsx(F,{raw:e.jsx(A,{value:t.controlType}),children:e.jsx(d,{fn:"controlType",value:t.subtypeName,color:"green"})})}),e.jsx(i,{label:"subtype",children:e.jsx(d,{fn:"subtype",value:`0x${t.subtype.toString(16).padStart(2,"0")}`,color:"green"})}),t.nodeTypeName&&e.jsxs(i,{label:"nodeType",children:[e.jsx(d,{fn:"nodeType",value:t.nodeTypeName,color:"green"}),e.jsxs("span",{className:"text-fg-muted text-[10px] ml-1",children:["(flags & 0x0F = 0x",(r=t.nodeType)==null?void 0:r.toString(16).padStart(2,"0"),")"]})]}),t.snrDb!=null&&e.jsxs(i,{label:"snr",children:[e.jsxs("span",{className:"font-bold text-sys-green",children:[t.snrDb>0?"+":"",t.snrDb.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:t.snrDb>=5?"strong":t.snrDb>=0?"fair":"weak"})]}),t.tag&&e.jsx(i,{label:"tag",children:e.jsx(d,{fn:"tag",value:t.tag,color:"green"})}),t.publicKey&&e.jsxs(i,{label:"publicKey",children:[e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.publicKey}),e.jsx(M,{color:t.publicKeyFull?"green":"amber",children:t.publicKeyFull?"32B full":`${t.publicKey.length/2}B prefix`})]}),t.typeFilter!=null&&e.jsx(i,{label:"typeFilter",children:e.jsx(F,{raw:e.jsx(A,{value:t.typeFilter}),children:e.jsx(d,{fn:"typeFilter",value:t.typeFilterDescription??"none",color:"green"})})}),t.prefixOnly!=null&&e.jsx(i,{label:"prefixOnly",children:e.jsx(d,{fn:"prefixOnly",value:String(t.prefixOnly),color:"green"})}),t.since!=null&&e.jsx(i,{label:"since",children:e.jsx(d,{fn:"since",value:t.since===0?"all (0)":String(t.since),color:"green"})}),!t.nodeTypeName&&t.typeFilter==null&&t.dataLength>0&&e.jsxs(i,{label:"data",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.dataHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.dataLength,"B)"]})]})]});case"req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"response":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"anon_req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"senderPubKey",children:e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.senderPublicKey})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"generic":return e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"payloadType",children:[e.jsx(ht,{value:t.payloadType})," (",t.payloadTypeName,")"]}),e.jsx(i,{label:"length",children:t.length}),e.jsx(i,{label:"rawHex",children:e.jsx("span",{className:"break-all",children:t.rawHex})})]});default:return e.jsx("p",{className:"text-fg-muted",children:"Unknown decoded type"})}}function Mt({protocolPacket:t,packetHash:s}){const r=t==null?void 0:t.payloadType,c=r===Ze||r===Xe,a=T.useMemo(()=>{if(!c||!t)return null;const p=t.payload;return p.length<4?null:{channelHash:p[0],mac:p.slice(1,3),ciphertext:p.slice(3)}},[t,c]),[n,l]=T.useState("pending"),[o,x]=T.useState([]),[m,g]=T.useState(0);T.useEffect(()=>{if(!a){l(null);return}let p=!1;return(async()=>{const H=performance.now(),C=await Qe(a.channelHash,a.mac,a.ciphertext);p||(l(C),g(performance.now()-H));const D=await Je(a.channelHash);p||x(D)})(),()=>{p=!0}},[a]);const[u,v]=T.useState(""),[N,f]=T.useState(null),[k,$]=T.useState(!1),h=T.useCallback(async()=>{if(!(!a||!u.trim())){$(!0);try{const p=await We(u.trim(),a.channelHash,a.mac,a.ciphertext);if(p.success){const _=new TextDecoder("utf-8",{fatal:!1}).decode(p.result.plaintext.slice(5));f({success:!0,text:_})}else f({success:!1,error:p.error})}catch(p){f({success:!1,error:String(p)})}finally{$(!1)}}},[a,u]),y=Ce(s);return!c||!a?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"C. Decrypt — tryDecryptGroupMessage()"}),m>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:m<1?`${(m*1e3).toFixed(0)}µs`:`${m.toFixed(2)}ms`})}),e.jsx(U,{prefix:"tryDecryptGroupMessage",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"channelHash",children:e.jsx(d,{fn:"channelHash",value:`0x${a.channelHash.toString(16).toUpperCase().padStart(2,"0")}`,color:"teal"})}),e.jsx(i,{label:"mac",children:e.jsx(d,{fn:"mac",value:Array.from(a.mac).map(p=>p.toString(16).padStart(2,"0")).join(""),color:"teal"})}),e.jsx(i,{label:"cipherLen",children:e.jsx(d,{fn:"cipherLen",value:`${a.ciphertext.length}B`,color:"teal"})}),e.jsx(i,{label:"candidates",children:e.jsx(d,{fn:"candidates",value:o.length>0?`${o.length} names`:"0",color:o.length>0?"teal":"zinc"})}),o.length>0&&e.jsxs("details",{className:"mt-1",children:[e.jsx("summary",{className:"text-fg-muted cursor-pointer hover:text-fg-primary text-[10px]",children:"show candidate names"}),e.jsx("div",{className:"mt-1 text-[10px] text-fg-muted break-all max-h-24 overflow-y-auto",children:o.join(", ")})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"Result:"}),n==="pending"?e.jsx("p",{className:"text-fg-muted italic",children:"decrypting…"}):n?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:n.channelName,color:"teal"})}),e.jsx(i,{label:"plaintext",children:e.jsx(d,{fn:"plaintext",value:new TextDecoder("utf-8",{fatal:!1}).decode(n.plaintext.slice(5)).trim()||"(empty)",color:"teal"})}),e.jsx(i,{label:"macValid",children:e.jsx(d,{fn:"macValid",value:n.macCorrupted?"false":"true",color:"teal"})})]}):e.jsxs(i,{label:"decrypt",children:[e.jsx(d,{fn:"decrypt",value:"failed",color:"red"}),e.jsx("span",{className:"text-fg-muted ml-1",children:"channel not in known list"})]})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"testChannelName() — manual test:"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:u,onChange:p=>{v(p.target.value),f(null)},onKeyDown:p=>p.key==="Enter"&&h(),placeholder:"channel name",className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-40"}),e.jsx("button",{onClick:h,disabled:k||!u.trim(),className:"px-2 py-1 rounded text-[10px] font-mono bg-sys-blue/20 text-sys-blue hover:bg-sys-blue/30 disabled:opacity-40 transition-colors",children:k?"…":"Try"})]}),N&&e.jsx("div",{className:"mt-1",children:N.success?e.jsx(i,{label:"result",children:e.jsx(d,{fn:"plaintext",value:N.text??"(empty)",color:"teal"})}):e.jsx(i,{label:"error",children:e.jsx(d,{fn:"error",value:N.error??"unknown",color:"red"})})})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"useDecodedMessage() store result:"}),y?y.decoded?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:y.decoded.channelName??"?",color:"teal"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:y.decoded.text,color:"teal"})})]}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"failed",color:"red"})}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"pending",color:"zinc"})})]})]})})]})}function Rt(t){const{rawHex:s,display:r,protocolPacket:c,decoded:a,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m,packetHash:g,packet:u}=t,v=!!s&&s.length>=4;return e.jsxs(G,{children:[e.jsx(K,{className:"w-full mt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-fg-muted",children:"🔬"}),e.jsx("span",{className:"text-[10px] font-mono font-medium text-fg-muted",children:"Wire Inspection"}),e.jsx("span",{className:"text-[9px] text-fg-muted/50",children:"observatory diagnostic — not a runtime stage"})]})}),e.jsx(V,{children:e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-lg p-3 space-y-1 bg-surface/30",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/50 mb-2",children:"The backend parsed these fields server-side. This panel verifies the wire-level encoding client-side."}),v?e.jsxs(e.Fragment,{children:[e.jsx(Dt,{rawHex:s,display:r,protocolPacket:c,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m}),e.jsx(Lt,{decoded:a,packet:u}),e.jsx(Mt,{protocolPacket:c,packetHash:g})]}):e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:n??"No raw_packet — wire inspection unavailable (warm-tier packet)"})]})})]})}function fe(t){if(!t)return[{fn:"decode",value:"no raw_packet",group:"decode",color:"zinc"}];switch(t.type){case"advert":{const s=t,r=[{fn:"decode.nodeType",value:s.nodeType,group:"decode",color:"blue"}];return s.name&&r.push({fn:"decode.name",value:s.name,group:"decode",color:"blue"}),s.latitude!=null&&s.longitude!=null&&r.push({fn:"decode.location",value:`${s.latitude.toFixed(4)}, ${s.longitude.toFixed(4)}`,group:"decode",color:"blue"}),r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:"blue"}),r}case"trace":{const s=t;return[{fn:"decode.traceTag",value:s.traceTag,group:"decode",color:"blue"},{fn:"decode.hops",value:s.pathHashes.length>0?s.pathString:"empty",group:"decode",color:"blue"},{fn:"decode.snr",value:s.snrValues.length>0?`${s.snrValues.length} values`:"none",group:"decode",color:s.snrValues.length>0?"blue":"zinc"},{fn:"decode.complete",value:s.isComplete?"yes":"partial",group:"decode",color:s.isComplete?"green":"amber"}]}case"path":{const s=t,r=[{fn:"decode.pathLength",value:String(s.pathLength),group:"decode",color:"blue"},{fn:"decode.path",value:s.path.length>0?s.pathString:"empty",group:"decode",color:"blue"}];return s.extraType!=null&&r.push({fn:"decode.extraType",value:s.extraTypeName??String(s.extraType),group:"decode",color:"purple"}),s.extraData&&r.push({fn:"decode.extraData",value:`${s.extraData.length/2}B`,group:"decode",color:"purple"}),r}case"ack":return[{fn:"decode.crc",value:t.crc,group:"decode",color:"blue"}];case"grp_txt":return[{fn:"decode.channelHash",value:t.channelHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:"true — decrypt at cascade",group:"decode",color:"zinc"}];case"grp_data":{const s=t;return[{fn:"decode.channelHash",value:s.channelHash,group:"decode",color:"blue"},{fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"}]}case"txt_msg":{const s=t;return[{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:s.encrypted?"true":"false",group:"decode",color:s.encrypted?"zinc":"green"},...s.encrypted?[]:[{fn:"decode.text",value:s.text,group:"decode",color:"blue"}]]}case"multipart":{const s=t;return[{fn:"decode.part",value:`${s.partNumber+1}/${s.totalParts}`,group:"decode",color:"blue"},{fn:"decode.msgId",value:s.messageId,group:"decode",color:"blue"}]}case"control":{const s=t,r=[{fn:"decode.subtype",value:s.subtypeName,group:"decode",color:"blue"}];return s.nodeTypeName&&r.push({fn:"decode.nodeType",value:s.nodeTypeName,group:"decode",color:"blue"}),s.snrDb!=null&&r.push({fn:"decode.snr",value:`${s.snrDb>0?"+":""}${s.snrDb.toFixed(1)} dB`,group:"decode",color:"blue"}),s.tag&&r.push({fn:"decode.tag",value:s.tag,group:"decode",color:"blue"}),s.publicKey&&r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:s.publicKeyFull?"green":"blue"}),s.typeFilter!=null&&r.push({fn:"decode.typeFilter",value:s.typeFilterDescription??`0x${s.typeFilter.toString(16)}`,group:"decode",color:"blue"}),s.prefixOnly!=null&&r.push({fn:"decode.prefixOnly",value:String(s.prefixOnly),group:"decode",color:"blue"}),!s.nodeTypeName&&!s.tag&&(r.push({fn:"decode.subtypeFlags",value:`0x${s.subtypeFlags.toString(16)}`,group:"decode",color:"blue"}),r.push({fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"})),r}case"req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"response":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"anon_req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.senderPubKey",value:s.senderPublicKey,group:"decode",color:"green"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"generic":return[{fn:"decode.raw",value:`${t.length}B`,group:"decode",color:"zinc"}];default:return[]}}function At({packet:t,pipeline:s,rawHex:r,traceTagIndex:c,neighbors:a}){const{enrichment:n,timing:l,display:o,protocolPacket:x,decoded:m,parseError:g,payloadVersion:u,isV1:v,isV2:N,analysis:f}=s,$=(t.type??t.payload_type)===et,h=f.dupeAnalysis,y=T.useRef(0),p=T.useMemo(()=>{if(!$)return null;const D=performance.now(),L=yt(t,c,a);return y.current=performance.now()-D,L},[t,c,a,$]),_=l.enrich+y.current,H=[];f.byteLen&&H.push(`${f.byteLen}B`),H.push(f.payloadTypeName),n.advertName&&H.push(`"${n.advertName}"`),n.isZeroHop?H.push("zero-hop"):f.pathHopCount>0&&H.push(`${f.pathHopCount}h`),H.push(`${t.rssi}dBm`),h.isDuplicate&&H.push("DUPE");const C=H.join(" — ");return e.jsxs(le,{stage:1,name:"INGEST",fn:n.preComputed?"PacketCache.mergePackets()":"extractAdvertData() + extractHopData() + ...",verdict:C,timeMs:_,children:[e.jsx(Rt,{rawHex:r,display:o,protocolPacket:x,decoded:m,parseError:g,parseTimeMs:l.parse,payloadVersion:u,isV1:v,isV2:N,packetHash:t.packet_hash,packet:t}),e.jsx(E,{title:"Cache Enrichment"}),e.jsx(U,{prefix:"packetCache",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsxs("div",{className:"mb-1.5",children:[n.preComputed?e.jsx(M,{color:"green",children:"PacketCache"}):e.jsx(M,{color:"amber",children:"computed"}),e.jsx("span",{className:"text-[10px] text-fg-muted ml-1.5",children:n.preComputed?"pre-enriched by real pipeline":"synthetic — computed on the fly"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1 mb-1",children:[e.jsx(d,{fn:"_byteLength",value:n.byteLength!=null?`${n.byteLength}B`:void 0,color:"blue"}),e.jsx(d,{fn:"_hopCount",value:String(n.hopCount),color:"blue"}),e.jsx(d,{fn:"_isZeroHop",value:String(n.isZeroHop),color:n.isZeroHop?"green":"blue"}),n.isZeroHop&&e.jsx(M,{color:"blue",children:"direct"}),n.channelHash!=null&&e.jsx(d,{fn:"_channelHash",value:n.channelHash,color:"blue"}),$&&t._traceTag&&e.jsx(d,{fn:"_traceTag",value:t._traceTag,color:"blue"})]}),n.advertSender||n.advertNodeType!=null||n.advertName!=null?e.jsxs("div",{className:"mt-1 mb-1",children:[e.jsx("p",{className:"text-[10px] text-sys-blue font-medium mb-0.5",children:"ADVERT Enrichment"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[n.advertSender&&e.jsx(d,{fn:"_advertSender",value:n.advertSender.slice(0,16)+"…",color:"blue"}),n.advertNodeType!=null&&e.jsx(d,{fn:"_advertNodeType",value:ke(n.advertNodeType),color:"blue"}),n.advertName!=null&&e.jsx(d,{fn:"_advertName",value:n.advertName,color:"blue"}),n.advertFlags!=null&&e.jsx(d,{fn:"_advertFlags",value:`0x${n.advertFlags.toString(16).padStart(2,"0")}`,color:"blue"}),n.advertHasLocation!=null&&e.jsx(d,{fn:"_advertHasLocation",value:String(n.advertHasLocation),color:"blue"}),n.advertHasName!=null&&e.jsx(d,{fn:"_advertHasName",value:String(n.advertHasName),color:"blue"}),n.advertLatitude!=null&&n.advertLongitude!=null&&e.jsx(d,{fn:"location",value:`${n.advertLatitude.toFixed(4)}, ${n.advertLongitude.toFixed(4)}`,color:"blue"})]})]}):e.jsx("p",{className:"text-[10px] text-fg-muted/30 mb-1",children:"ADVERT fields: N/A (non-ADVERT packet)"}),e.jsx(E,{title:"Payload Decode"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${m?"bg-sys-blue":"bg-zinc-500/40"}`}),e.jsx("span",{className:"font-mono text-[10px] font-medium text-fg-primary",children:"decodePayload()"}),e.jsx("span",{className:"text-[9px] text-fg-muted",children:"sync — wire data only, no crypto"})]}),e.jsx("div",{className:"ml-3",children:m?e.jsx("div",{className:"flex flex-wrap gap-x-1.5 gap-y-1",children:fe(m).map((D,L)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:D.fn,value:D.value,color:D.color})},L))}):e.jsx(S,{children:"no raw_packet — warm-tier packet, decode unavailable"})})]}),e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"dupe:"}),h.isDuplicate?e.jsx(d,{fn:"is_duplicate",value:"true",color:"purple"}):e.jsx(S,{children:"none"}),h.dupeCount>0&&e.jsx(d,{fn:"dupeCount",value:`×${h.dupeCount}`,color:"purple"}),h.rssiRange&&e.jsxs(S,{c:"text-fg-primary",children:["Δ",Math.abs(h.rssiRange[1]-h.rssiRange[0]),"dB RSSI"]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"TRACE SRC:"}),p.inferredSrc?e.jsxs(e.Fragment,{children:[e.jsx(d,{fn:"inferredSrc",value:p.inferredSrc,color:"purple"}),p.inferredName&&e.jsx(d,{fn:"name",value:p.inferredName,color:"purple"})]}):e.jsx(S,{children:"unresolvable"}),e.jsx(_e,{color:"purple",children:p.method}),e.jsxs(S,{children:["(",p.confidence,")"]}),e.jsxs(S,{children:["siblings=",p.siblingCount]})]})]}),(()=>{const D=f.pType!=null?`0x${f.pType.toString(16).toUpperCase().padStart(2,"0")}`:void 0,L=t.route!=null?`0x${t.route.toString(16).toUpperCase().padStart(2,"0")}`:void 0,P=fe(m),R=f.signalClass==="excellent"||f.signalClass==="good"?"green":f.signalClass==="fair"?"amber":"red",b=f.senderTier==="pubkey"?"green":f.senderTier==="prefix"?"amber":f.senderTier==="encrypted"?"teal":"zinc",w=[{fn:"type",value:f.payloadTypeName,raw:D,group:"wire",color:"blue"},{fn:"route",value:f.routeTypeName,raw:L,group:"wire",color:"blue"},{fn:"src_hash",value:t.src_hash||void 0,group:"wire",color:"blue"},{fn:"rssi",value:`${t.rssi}dBm`,group:"wire",color:"blue"},{fn:"snr",value:`${t.snr}dB`,group:"wire",color:"blue"},{fn:"_byteLength",value:f.byteLen?`${f.byteLen}B`:void 0,group:"enrichment",color:"blue"},{fn:"_hopCount",value:String(n.hopCount),group:"enrichment",color:"blue"},{fn:"_isZeroHop",value:String(n.isZeroHop),group:"enrichment",color:"blue"},{fn:"_advertSender",value:n.advertSender||void 0,group:"enrichment",color:"blue"},{fn:"_advertNodeType",value:f.advertType!=="unknown"?f.advertType:void 0,group:"enrichment",color:"blue"},{fn:"_advertName",value:n.advertName||void 0,group:"enrichment",color:"blue"},{fn:"_channelHash",value:n.channelHash||void 0,group:"enrichment",color:"blue"},...P,{fn:"is_duplicate",value:String(h.isDuplicate),group:"analysis",color:"purple"},p!=null&&p.inferredSrc?{fn:"traceSrc",value:p.inferredSrc,group:"analysis",color:"purple"}:{fn:"traceSrc"},{fn:"_signalClass",value:f.signalClass,group:"analysis",color:R},{fn:"_routeClass",value:f.routeClass,group:"analysis",color:"purple"},{fn:"_senderTier",value:f.senderTier,group:"analysis",color:b},{fn:"_origin",value:f.origin,group:"analysis",color:f.origin==="tx_local"?"green":f.origin==="tx_forward"?"amber":"purple"},{fn:"_pathAvail",value:f.pathAvail?`${f.pathHopCount} hops`:"none",group:"analysis",color:f.pathAvail?"green":"zinc"},{fn:"_age",value:f.age,group:"analysis",color:f.age==="live"||f.age==="recent"?"green":"zinc"},...h.dupeCount>0?[{fn:"_dupeCount",value:`×${h.dupeCount}`,group:"analysis",color:"purple"},...h.rssiRange?[{fn:"_multipath",value:`Δ${Math.abs(h.rssiRange[1]-h.rssiRange[0])}dB`,group:"analysis",color:Math.abs(h.rssiRange[1]-h.rssiRange[0])>6?"amber":"green"}]:[]]:[],...t.lbt_attempts!=null?[{fn:"_lbt",value:`${t.lbt_attempts} attempt${t.lbt_attempts!==1?"s":""}`,group:"analysis",color:(t.lbt_attempts??0)>1?"amber":"green"}]:[],...t.drop_reason?[{fn:"_dropReason",value:t.drop_reason,group:"analysis",color:"red"}]:[]];return e.jsx(se,{tokens:w})})()]})})]})}function be(t){switch(t){case"excellent":return"green";case"good":return"green";case"fair":return"amber";case"poor":return"red";case"critical":return"red";default:return"zinc"}}function ye(t){return`${Math.round(t*100)}%`}function je(t,s,r){return t||(s?s.slice(0,12):`~${r}`)}function Ft({hops:t}){return t.length===0?null:e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/40",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/40 uppercase tracking-widest font-mono mb-1.5",children:"per-hop trace inspection"}),e.jsx("div",{className:"space-y-1",children:t.map(s=>e.jsx(U,{prefix:`trace.hop[${s.hopIndex}]`,children:e.jsxs("div",{className:"border border-edge-subtle/40 rounded px-2 py-1.5",children:[e.jsxs(i,{label:"link",children:[e.jsx(re,{hops:[s.fromPrefix,s.toPrefix],color:"blue"}),e.jsx("span",{className:"ml-1.5",children:e.jsx(_e,{color:be(s.quality),children:s.quality})})]}),e.jsx(i,{label:"snr",children:e.jsx(F,{raw:e.jsx("span",{className:"text-sys-blue",children:s.snrRaw}),children:e.jsx(d,{fn:"snr",value:`${s.snrRaw.toFixed(1)} dB`,color:be(s.quality)})})}),e.jsxs(i,{label:"from",children:[e.jsx(d,{fn:"resolve",value:je(s.fromName,s.fromHash,s.fromPrefix),color:s.fromHash?s.fromConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.fromConfidence),color:"zinc"})})]}),e.jsxs(i,{label:"to",children:[e.jsx(d,{fn:"resolve",value:je(s.toName,s.toHash,s.toPrefix),color:s.toHash?s.toConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.toConfidence),color:"zinc"})})]})]})},s.hopIndex))}),e.jsx(se,{label:"trace contributes",tokens:Et(t)})]})}function Et(t){const s=t.reduce((n,l)=>n+(l.fromHash?1:0)+(l.toHash?1:0),0),r=t.length*2,c=r-s,a=t.length>0?t.reduce((n,l)=>n+l.snrRaw,0)/t.length:0;return[{fn:"hops",value:String(t.length),group:"wire",color:"blue"},{fn:"resolved",value:`${s}/${r}`,group:"worker",color:"green"},...c>0?[{fn:"ghosts",value:String(c),group:"worker",color:"purple"}]:[],{fn:"avgSnr",value:`${a.toFixed(1)} dB`,group:"analysis",color:a>=5?"green":a>=0?"amber":"red"}]}function Ot(t){if(!t)return"never";const s=Math.floor((Date.now()-t)/1e3);return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:`${Math.floor(s/3600)}h ago`}function zt(t){if(!t)return[];const s=t.decoded;if(!s)return[{fn:"decrypt.result",value:"failed",group:"crypto",color:"red"}];if(!s.decrypted)return[{fn:"decrypt.result",value:"no key match",group:"crypto",color:"zinc"}];const r=[];return s.channelName&&r.push({fn:"decrypt.channelName",value:s.channelName,group:"crypto",color:"teal"}),s.senderName&&r.push({fn:"decrypt.senderName",value:s.senderName,group:"crypto",color:"teal"}),s.text&&r.push({fn:"decrypt.text",value:s.text,group:"crypto",color:"teal"}),s.timestamp&&r.push({fn:"decrypt.timestamp",value:new Date(s.timestamp*1e3).toISOString().slice(11,19),group:"crypto",color:"teal"}),s.macCorrupted&&r.push({fn:"decrypt.macCorrupted",value:"true",group:"crypto",color:"amber"}),r}function Bt({packet:t,decrypted:s,pipeline:r}){var b;const c=J(w=>w.isComputing),a=J(w=>w.lastUpdated),n=J(w=>w.lastComputeTimeMs),l=J(w=>w.topology.edges.length),o=J(w=>w.topology.discoveredNodes.length),x=tt(),m=st(),g=nt(),u=he(w=>w.isComputing),v=he(w=>w.nodeCount),N=me(w=>w.progress),f=me(w=>w.initialDecodeComplete),k=t.type??t.payload_type,$=k===O.GRP_TXT||k===O.GRP_DATA,h=k===O.TRACE,y=k===O.PATH,p=$,_=[{label:"full",detail:"all GRP_TXT → decryption worker",active:p&&f,color:"teal"},{label:"quick",detail:"100 most recent (initial load)",active:p&&!f,color:"amber"},{label:"skip",detail:"non-GRP or catchup path",active:!p,color:"zinc"}],H=zt(s),C=((b=s==null?void 0:s.decoded)==null?void 0:b.decrypted)===!0,D=c?"running":`${l}e ${o}g`,L=u?"running":`${v}n`,P=p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A",R=`topo ${c?"○":"✓"} ${D} · spark ${u?"○":"✓"} ${L} · decrypt ${P}`;return e.jsx(le,{stage:2,name:"CASCADE",fn:"hydrateDownstream()",verdict:R,children:e.jsx(U,{prefix:"cascade",children:e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 py-1.5 text-[11px] font-mono",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"topology"}),e.jsxs("span",{className:"text-fg-muted",children:[l,"e ",o,"g"]}),(h||y)&&e.jsx("span",{className:"text-sys-green text-[9px]",children:"↑signal"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"sparkline"}),e.jsxs("span",{className:"text-fg-muted",children:[v,"n"]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.isDecoding?"bg-sys-amber animate-pulse":p?"bg-sys-teal":"bg-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-primary",children:"decrypt"}),e.jsx("span",{className:p?"text-sys-teal":"text-fg-muted",children:p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A"})]})]}),e.jsxs(G,{defaultOpen:h||y,children:[e.jsx(K,{className:"text-[10px] w-full border-t border-edge-subtle pt-1.5",children:e.jsx("span",{className:"font-mono text-fg-muted/50",children:"topology detail…"})}),e.jsx(V,{children:e.jsxs("div",{className:"ml-3 pb-2",children:[e.jsx(i,{label:"status",children:e.jsx(d,{fn:"isComputing",value:c?"running":"idle",color:c?"amber":"green"})}),e.jsxs(i,{label:"last",children:[e.jsx(d,{fn:"lastUpdated",value:Ot(a),color:"zinc"}),n>0&&e.jsxs("span",{className:"ml-2 text-fg-muted text-[10px]",children:["(",n<1e3?`${n.toFixed(0)}ms`:`${(n/1e3).toFixed(1)}s`,")"]})]}),e.jsxs(i,{label:"output",children:[e.jsx(d,{fn:"edges",value:String(l),color:"green"}),e.jsx(d,{fn:"ghostNodes",value:String(o),color:"purple"})]}),m&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"trace links",children:[e.jsx(d,{fn:"directed",value:String(x.totalDirectedLinks),color:"teal"}),e.jsx(d,{fn:"bidir",value:String(x.bidirectionalLinks),color:"teal"}),e.jsx(d,{fn:"traces",value:String(x.totalTraces),color:"zinc"})]}),e.jsxs(i,{label:"trace SNR",children:[e.jsx(d,{fn:"mean",value:`${x.meanSnr.toFixed(1)} dB`,color:x.meanSnr>=5?"green":x.meanSnr>=0?"amber":"red"}),e.jsx(d,{fn:"median",value:`${x.medianSnr.toFixed(1)} dB`,color:"zinc"}),e.jsx(d,{fn:"confidence",value:`${Math.round(x.avgConfidence*100)}%`,color:"zinc"})]}),h&&e.jsxs(i,{label:"quality",children:[e.jsx(d,{fn:"excellent",value:String(x.qualityCounts.excellent),color:"green"}),e.jsx(d,{fn:"good",value:String(x.qualityCounts.good),color:"green"}),e.jsx(d,{fn:"fair",value:String(x.qualityCounts.fair),color:"amber"}),e.jsx(d,{fn:"poor",value:String(x.qualityCounts.poor),color:"red"}),e.jsx(d,{fn:"critical",value:String(x.qualityCounts.critical),color:"red"})]}),g.confirmedResolutions.size>0&&e.jsxs(i,{label:"feedback",children:[e.jsx(d,{fn:"feedback.confirmed",value:String(g.confirmedResolutions.size),color:"teal"}),e.jsx(d,{fn:"feedback.links",value:String(g.confirmedLinks.length),color:"teal"})]})]}),h&&(r==null?void 0:r.traceHopDetail)&&e.jsx(Ft,{hops:r.traceHopDetail})]})})]}),p&&e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"mode",children:e.jsx(ae,{options:_,nextFn:"queueDecryption()"})}),e.jsx(i,{label:"result",children:e.jsx(d,{fn:"decrypt",value:C?"decrypted":s?"failed":"pending",color:C?"teal":s?"red":"zinc"})}),C&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-1.5 gap-y-1",children:H.map((w,oe)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:w.fn,value:w.value,color:w.color})},oe))})]})}),(()=>{const w=[{fn:"topology.edges",value:String(l),group:"worker",color:"green"},{fn:"topology.ghostNodes",value:String(o),group:"worker",color:"purple"},{fn:"sparkline.nodes",value:`${v}`,group:"worker",color:"green"},...m?[{fn:"trace.directedLinks",value:String(x.totalDirectedLinks),group:"worker",color:"teal"},{fn:"trace.meanSnr",value:`${x.meanSnr.toFixed(1)} dB`,group:"worker",color:"teal"}]:[],...H];return e.jsx(se,{tokens:w})})()]})})})}function It(t,s,r,c){var n;const a=t.src_hash?Se(t.src_hash):"";if(t._advertSender&&s.hash&&s.confident)return{tier:1,label:"_advertSender → pubkey",detail:"ADVERT carried full 32-byte public key — definitive match"};if(c&&s.confident&&((n=s.name)==null?void 0:n.toLowerCase())===c.toLowerCase())return{tier:1.5,label:"decrypt.senderName → nameToHash",detail:`Decrypted sender name “${c}” matched neighbor — high-confidence`};if(a&&r.crossClassPrefixes.has(a))return{tier:2,label:"cross-class prefix",detail:"Prefix has mixed types (repeater + non-repeater); payload type narrows to one class"};if(s.confident){const l=r.prefixIndex.get(a);return(l==null?void 0:l.length)===1?{tier:3,label:"single candidate",detail:"Only one node matches this prefix — unambiguous"}:{tier:3,label:"resolver",detail:"Multi-signal scoring selected best candidate from collision set"}}return{tier:4,label:"ambiguous",detail:"Cannot confidently resolve — multiple same-class candidates, insufficient scoring separation"}}function Gt(t,s){const r=t.original_path??t.forwarded_path,c=new Set;if(r&&Array.isArray(r))for(const a of r){const n=String(a).toUpperCase();n.length>=2&&!rt(n,s)&&c.add(n)}return c}function Kt(t,s,r,c,a,n,l){const o=Math.floor(Date.now()/1e3),x=new Map(r.map(m=>[m.hash,m]));return t.map(m=>{const g=s[m.hash],u=x.get(m.hash);let v=!0,N="";c!=="unknown"?m.type!=="unknown"&&m.type!==c?(v=!1,N=`${m.type} ≠ required ${c}`):m.type===c?N="type matches":N="type unknown — not ruled out":N="payload ambiguous — all types eligible";const f=!!(g!=null&&g.zero_hop),k=(g==null?void 0:g.last_seen)??0;let $=0;if(f&&k>0){const b=(o-k)/3600;$=50*Math.exp(-b/l)}let h=0;if(k>0){const b=(o-k)/3600;h=Math.exp(-b/n)}const y=h*20,p=!!(g!=null&&g.latitude&&(g!=null&&g.longitude)&&(g.latitude!==0||g.longitude!==0)),_=p?5:0,H=(u==null?void 0:u.advertCount)??0,C=Math.min(H*2,30),D=(u==null?void 0:u.forwarderPrefixes.size)??0,L=Math.min(D*3,15);let P=0;if(u&&u.totalForwarderObservations>0&&a.size>0){let b=0;for(const w of a)u.forwarderPrefixes.has(w)&&b++;P=b/a.size}const R=$+y+_+C+L;return{hash:m.hash,name:m.name,type:m.type,roleCompatible:v,roleReason:N,zeroHop:f,zeroHopScore:$,lastSeen:k,recencyScore:h,recencyPoints:y,hasGps:p,gpsScore:_,advertCount:H,advertScore:C,topoWidth:D,topoScore:L,affinity:P,total:R}}).sort((m,g)=>g.total-m.total)}function Vt({packet:t,pipeline:s,resolved:r,resolveTimeMs:c,advertName:a,neighbors:n,decrypted:l}){var ie,de;const o=Y(j=>j.neighborContext),x=Y(j=>j.topologyProfiles),m=Y(j=>j.config),{analysis:g}=s,u=r??{hash:null,type:"unknown",name:null,confident:!1},v=t.src_hash?Se(t.src_hash):"",N=v?o.prefixIndex.get(v)??[]:[],f=v?x.get(v)??[]:[],k=g.pType??-1,$=k>=0?k.toString(16).toUpperCase().padStart(2,"0"):"??",h=g.inferredType,y=g.advertType,p=g.effectiveType,_=t._advertNodeType!=null?t._advertNodeType.toString(16).padStart(2,"0").toUpperCase():"",H=((ie=l==null?void 0:l.decoded)==null?void 0:ie.senderName)??null,C=It(t,u,o,H),D=T.useMemo(()=>Gt(t,v),[t,v]),L=g.pathLen,P=T.useMemo(()=>Kt(N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours),[N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours]),R=P.filter(j=>!j.roleCompatible),b=P.filter(j=>j.roleCompatible),w=t._advertSender?o.pubKeyMap.get(t._advertSender)??null:null,oe=C.tier===1,De=[{fn:"src_hash",value:v||"",active:!!v,color:"blue"},{fn:"_advertSender",value:t._advertSender?t._advertSender.slice(0,12)+"…":"",active:!!t._advertSender,color:"blue"},{fn:"_advertNodeType",value:_?`0x${_}`:"",active:t._advertNodeType!=null,color:"blue"},{fn:"path_length",value:L!=null?L===0?"zero-hop":String(L):"",active:L!=null,color:"blue"},{fn:"decrypt.senderName",value:H??"",active:!!H,color:"teal"}],Le=[{label:"hit",detail:"pubKeyMap.get(_advertSender) → definitive",active:!!w,color:"green"},{label:"miss",detail:t._advertSender?"pubkey not in neighbor table":"no _advertSender",active:!w,color:"zinc"}],Pe=[{label:"payload",detail:`inferDeviceType(0x${$}) → ${h}`,active:h!=="unknown",color:"amber"},{label:"flags",detail:_?`mapAdvertTypeCode(0x${_}) → ${y}`:"no _advertNodeType",active:h==="unknown"&&y!=="unknown",color:"green"},{label:"ambiguous",detail:"all types eligible",active:p==="unknown",color:"zinc"}],Me=u.name??((de=u.hash)==null?void 0:de.slice(0,12))??"?",Re=u.confident?"confident":"ambiguous",Ae=`→ ${Me} (${Re}, Tier ${C.tier})`;return e.jsx(le,{stage:3,name:"RESOLVE",fn:"usePipelineStore.resolveSource()",verdict:Ae,timeMs:c,children:e.jsx(U,{prefix:"resolvePacketSource",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"pt-1 pb-1",children:e.jsx(St,{tokens:De,nextFn:"resolvePacketSource()"})}),t.src_hash?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"1"})," ","PUBKEY LOOKUP"]}),e.jsx(ae,{options:Le,nextFn:"pubKeyMap.get()"}),e.jsx("div",{className:"ml-3 mt-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"resolved",children:e.jsx(d,{fn:"hash",value:w,color:"green"})}),a&&e.jsxs(i,{label:"name",children:[e.jsx(d,{fn:"name",value:a,color:"green"}),u.name&&a===u.name&&e.jsx(S,{c:"text-sys-green ml-1",children:"✓ neighbor match"})]}),e.jsxs(i,{label:"result",children:[e.jsx(M,{color:"green",children:"Tier 1"}),e.jsx(S,{c:"text-fg-primary ml-1",children:"definitive — scoring bypassed"})]})]}):t._advertSender?e.jsx(i,{label:"status",children:e.jsx(S,{c:"text-sys-amber",children:"✗ pubkey not in neighbor table"})}):e.jsx(i,{label:"status",children:e.jsx(S,{children:"no _advertSender — skip to prefix resolution"})})})]}),oe?e.jsx("div",{className:"border-t border-edge-subtle py-2",children:e.jsx("p",{className:"text-[11px] text-fg-muted/40 font-mono ml-3",children:"Steps 2–5 bypassed — pubkey definitive"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"2"})," ","CANDIDATE POOL — ",N.length," node",N.length!==1?"s":"",' match "',v,'"']}),e.jsxs("div",{className:"space-y-0.5 ml-3",children:[P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"break-all text-[10px]",children:j.hash}),e.jsx(M,{color:"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]},j.hash)),N.length===0&&e.jsx(S,{children:"no known nodes for this prefix"})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"3"})," ","TYPE INFERENCE"]}),e.jsx(ae,{options:Pe,nextFn:"effectiveType()"}),e.jsx("div",{className:"ml-3 mt-1",children:e.jsx(i,{label:"effective",children:e.jsx(d,{fn:"effectiveType",value:p,color:p!=="unknown"?h!=="unknown"?"amber":"green":"zinc"})})})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"4"})," ","ROLE-TYPE SCRUB"]}),e.jsx("div",{className:"space-y-0.5 ml-3",children:P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:j.roleCompatible?"text-sys-green":"text-sys-red",children:j.roleCompatible?"✓":"✗"}),e.jsx("span",{className:`break-all text-[10px] ${j.roleCompatible?"":"line-through text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:j.roleCompatible?"zinc":"red",children:j.type||"unknown"}),e.jsx(S,{c:j.roleCompatible?"text-fg-muted":"text-sys-red",children:j.roleReason})]},j.hash))}),R.length>0&&e.jsxs("p",{className:"text-[10px] text-fg-muted mt-1 ml-3",children:[R.length," eliminated, ",b.length," surviving"]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"5"})," ","CANDIDATE SCORING"]}),b.length===0?e.jsx("p",{className:"text-fg-muted italic ml-3",children:"No surviving candidates"}):b.length===1?e.jsxs("div",{className:"ml-3 text-[11px]",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(S,{c:"text-sys-green",children:"→"}),e.jsx("span",{className:"break-all text-[10px]",children:b[0].hash}),b[0].name&&e.jsx(S,{c:"text-fg-muted ml-1",children:b[0].name})]}),e.jsx("p",{className:"text-fg-muted ml-4",children:"single survivor — scoring not needed"})]}):e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] ml-3",children:e.jsxs("span",{className:"font-mono text-fg-muted/50",children:[b.length," candidates scored…"]})}),e.jsx(V,{children:e.jsx("div",{className:"space-y-2 ml-3 mt-1",children:b.map(j=>{const Q=j.hash===u.hash;return e.jsxs("div",{className:`text-[11px] leading-relaxed rounded px-2 py-1 ${Q?"bg-sys-green/8 border border-sys-green/20":"bg-zinc-500/5"}`,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-0.5",children:[e.jsx(S,{c:Q?"text-sys-green":"text-fg-muted",children:Q?"→":" "}),e.jsx("span",{className:`break-all text-[10px] ${Q?"text-fg-primary":"text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:Q?"green":"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]}),e.jsxs("div",{className:"ml-4 flex flex-wrap gap-x-3 gap-y-0.5",children:[e.jsxs("span",{children:[e.jsx(S,{children:"zero_hop:"})," ",e.jsx(S,{c:j.zeroHop?"text-sys-green":"text-fg-muted",children:j.zeroHop?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.zeroHopScore),children:["+",j.zeroHopScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"recency:"})," ",e.jsx(S,{c:"text-fg-primary",children:mt(j.lastSeen)})," ",e.jsxs(M,{color:ee(j.recencyPoints),children:["+",j.recencyPoints.toFixed(1)]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"gps:"})," ",e.jsx(S,{c:j.hasGps?"text-sys-green":"text-fg-muted",children:j.hasGps?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.gpsScore),children:["+",j.gpsScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"adverts:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.advertCount})," ",e.jsxs(M,{color:ee(j.advertScore),children:["+",j.advertScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"topo:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.topoWidth})," ",e.jsxs(M,{color:ee(j.topoScore),children:["+",j.topoScore]})]})]}),e.jsxs("div",{className:"ml-4 mt-0.5",children:[e.jsx(S,{children:"score ≈"})," ",e.jsx(S,{c:"text-fg-primary font-bold",children:j.total.toFixed(1)})]})]},j.hash)})})})]})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-green font-bold",children:"✓"})," ","RESOLUTION"]}),e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"hash",children:u.hash?e.jsx(d,{fn:"resolved.hash",value:u.hash,color:"green"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"type",children:e.jsx(d,{fn:"resolved.type",value:u.type,color:u.confident?"green":"zinc"})}),e.jsx(i,{label:"name",children:u.name?e.jsx(d,{fn:"resolved.name",value:u.name,color:u.confident?"green":"amber"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"confident",children:e.jsx(S,{c:u.confident?"text-sys-green":"text-sys-red",children:String(u.confident)})}),e.jsxs(i,{label:"tier",children:[e.jsx(M,{color:C.tier<=2?"green":C.tier===3?"amber":"red",children:C.tier}),e.jsx(S,{c:"text-fg-primary ml-1",children:C.label})]})]})]})]}):e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx(S,{c:"text-sys-amber",children:"⚠ no src_hash"}),H&&e.jsx(d,{fn:"decrypt.senderName",value:H,color:"teal"}),u.confident?e.jsxs(S,{c:"text-sys-green",children:["→ resolved via ",C.label]}):e.jsx(S,{c:"text-sys-red",children:"ambiguous"})]})}),(()=>{const j=[{fn:"resolved.hash",value:u.hash??"null",group:"resolution",color:u.confident?"green":"zinc"},{fn:"resolved.type",value:u.type,group:"resolution",color:u.type!=="unknown"?u.confident?"green":"amber":"zinc"},{fn:"resolved.name",value:u.name??"null",group:"resolution",color:u.confident?"green":u.name?"amber":"zinc"},{fn:"resolved.confident",value:String(u.confident),group:"resolution",color:u.confident?"green":"red"}];return e.jsx(se,{tokens:j})})()]})})})}const Ut={id:"packet-parse",label:"Packet Parse",inputs:["rawPacket"],outputs:["parsedPacket","decoded","headerFields"],emits:[{fn:"routeType",group:"wire",color:"blue"},{fn:"payloadType",group:"wire",color:"blue"},{fn:"pathLength",group:"wire",color:"blue"},{fn:"version",group:"wire",color:"blue"}],async:!1,observatoryStage:0},qt={id:"enrichment",label:"Ingestion Enrichment",inputs:["parsedPacket"],outputs:["advertSender","channelHash","hopData","byteLength"],emits:[{fn:"_advertSender",group:"enrichment",color:"blue"},{fn:"_advertNodeType",group:"enrichment",color:"blue"},{fn:"_channelHash",group:"enrichment",color:"blue"},{fn:"_hopCount",group:"enrichment",color:"blue"},{fn:"_isZeroHop",group:"enrichment",color:"blue"},{fn:"_byteLength",group:"enrichment",color:"blue"}],async:!1,observatoryStage:1},Wt={id:"topology",label:"Topology Analysis",inputs:["packets","neighbors","srcHashResolver"],outputs:["edges","nodeMetrics","pathHealth","ghostNodes","centrality","loops"],emits:[{fn:"edges",group:"worker",color:"green"},{fn:"ghostNodes",group:"worker",color:"purple"},{fn:"loops",group:"analysis",color:"amber"},{fn:"nodeMetrics",group:"worker",color:"green"},{fn:"pathHealth",group:"worker",color:"green"},{fn:"centrality",group:"worker",color:"green"}],async:!0,worker:"topology.worker.ts",observatoryStage:2},Yt={id:"trace-enrichment",label:"Trace Link Quality",inputs:["packets","prefixLookup","srcHashResolver","edges","pathHealth","nodeMetrics"],outputs:["traceLinks","traceLinkSummary","traceDisambiguationFeedback"],emits:[{fn:"traceLinks.directed",group:"worker",color:"teal"},{fn:"traceLinks.bidir",group:"worker",color:"teal"},{fn:"traceSummary.meanSnr",group:"analysis",color:"green"},{fn:"traceSummary.medianSnr",group:"analysis",color:"zinc"},{fn:"traceSummary.confidence",group:"analysis",color:"zinc"},{fn:"feedback.confirmed",group:"worker",color:"teal"},{fn:"feedback.links",group:"worker",color:"teal"}],async:!1,observatoryStage:2},Zt={id:"disambiguation",label:"Source Disambiguation",inputs:["packets","neighbors","decodedMessages"],outputs:["srcHashResolverMap","neighborContext"],emits:[{fn:"resolvedHash",group:"resolution",color:"purple"},{fn:"resolvedName",group:"resolution",color:"purple"},{fn:"resolvedType",group:"resolution",color:"purple"},{fn:"confidence",group:"resolution",color:"green"}],async:!1,observatoryStage:3},Xt={id:"sparkline",label:"Sparkline Computation",inputs:["packets","neighbors"],outputs:["sparklineData"],emits:[{fn:"sparklines",group:"worker",color:"blue"}],async:!1},Qt={id:"decryption",label:"Channel Decryption",inputs:["packets","channelKeys"],outputs:["decodedMessages"],emits:[{fn:"decrypt.text",group:"crypto",color:"teal"},{fn:"decrypt.senderName",group:"crypto",color:"teal"},{fn:"decrypt.channelName",group:"crypto",color:"teal"},{fn:"decrypt.macCorrupted",group:"crypto",color:"amber"}],async:!0,worker:"decryption.worker.ts",observatoryStage:2},Jt={id:"decoded-content",label:"Decoded Content Policy",inputs:["decodedMessages","packets"],outputs:["decodedContent","contentInheritance"],emits:[{fn:"content.senderName",group:"crypto",color:"teal"},{fn:"content.text",group:"crypto",color:"teal"},{fn:"content.channelName",group:"crypto",color:"teal"},{fn:"content.corrupted",group:"crypto",color:"amber"},{fn:"content.inherited",group:"analysis",color:"purple"}],async:!1},Z=[Ut,qt,Wt,Yt,Zt,Xt,Qt,Jt],es=new Map(Z.map(t=>[t.id,t])),ts=new Map;for(const t of Z)for(const s of t.emits)ts.set(s.fn,t);const $e=new Map;for(const t of Z)for(const s of t.outputs)$e.set(s,t);function ss(){const t=new Map,s=new Map;for(const a of Z)t.has(a.id)||t.set(a.id,0),s.has(a.id)||s.set(a.id,new Set);for(const a of Z)for(const n of a.inputs){const l=$e.get(n);if(l&&l.id!==a.id){const o=s.get(l.id);o.has(a.id)||(o.add(a.id),t.set(a.id,(t.get(a.id)??0)+1))}}const r=[];for(const[a,n]of t)n===0&&r.push(a);const c=[];for(;r.length>0;){const a=r.shift(),n=es.get(a);n&&c.push(n);for(const l of s.get(a)??[]){const o=(t.get(l)??1)-1;t.set(l,o),o===0&&r.push(l)}}for(const a of Z)c.includes(a)||c.push(a);return c}const ns={0:"text-sys-green",1:"text-sys-blue",2:"text-sys-teal",3:"text-sys-purple"};function rs({stage:t,isActive:s,onClick:r}){const c=t.observatoryStage!=null?ns[t.observatoryStage]??"text-fg-muted":"text-fg-muted/40";return e.jsxs("button",{type:"button",onClick:r,className:` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usePipelineStore-BTv04vLL.js","assets/index-CN4vD05c.js","assets/node-types-UozthSpR.js","assets/index-oOga43RI.css"])))=>i.map(i=>d[i]); +import{cn as O,r as T,eU as Fe,eV as Ee,eW as Oe,eX as ze,bV as Be,eY as Ie,eZ as Ge,e_ as Ke,e$ as Ve,bU as Ne,_ as ue,f0 as Ue,f1 as we,b_ as pe,j as e,f2 as G,f3 as K,f4 as V,eu as xe,f5 as qe,V as M,c9 as We,ck as Ce,cu as Ye,f6 as Ze,f7 as Xe,f8 as Qe,f9 as Je,fa as et,fb as J,fc as tt,fd as st,fe as nt,ff as he,at as me,ao as Se,bP as rt,t as at,fg as lt,Q as ot,a6 as ct,fh as it,P as dt,dL as ut}from"./index-CN4vD05c.js";import{usePipelineStore as Y}from"./usePipelineStore-BTv04vLL.js";import{e as Te,p as pt,A as I,S as U,a as se,c as E,K as i,H as A,B as xt,R as F,T as d,P as re,d as ht,f as S,C as _e,s as ee,h as mt}from"./primitives-DS3PJRi6.js";import{m as ke,i as gt}from"./node-types-UozthSpR.js";import{a as ft}from"./payload-detail-DXAypO28.js";function bt(t){const s=t.type??t.payload_type,r=t.duplicates??[],c=t.is_duplicate,a=r.length;let n=null,l=null;if(a>0){const x=[t.rssi,...r.map(g=>g.rssi).filter(g=>g!=null)],m=[t.snr,...r.map(g=>g.snr).filter(g=>g!=null)];x.length>1&&(n=[Math.min(...x),Math.max(...x)]),m.length>1&&(l=[Math.min(...m),Math.max(...m)])}const o=s===O.TRACE;return{isDuplicate:c,dupeCount:a,rssiRange:n,snrRange:l,hashIncludesPathLen:o}}function yt(t,s,r){const c={traceTag:null,siblingCount:0,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:[],thisPathLen:0,minPathLen:0,firstHopPrefix:null};let a=t._traceTag;if(!a&&t.payload&&(a=Te(t.payload)),!a)return{...c,evidence:["no traceTag — cannot correlate"]};const n=s.get(a)??[],l=N=>N.path_length!=null?N.path_length:Array.isArray(N.original_path)?N.original_path.length:0,o=l(t),x=n.length>0?Math.min(...n.map(l)):o,m=t.payload?t.payload.slice(18):"",g=m.length>=2?m.slice(0,2).toUpperCase():null,u=[];if(u.push(`traceTag: ${a}`),u.push(`siblings: ${n.length} observation${n.length!==1?"s":""}`),t.packet_origin==="tx_local")return u.push("packet_origin = tx_local → we initiated this trace"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};const v=n.find(N=>N.packet_origin==="tx_local");if(v)return u.push(`sibling (hash ${v.packet_hash}) has packet_origin = tx_local`),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};if(u.push(`this observation: path_len=${o}, min across siblings: ${x}`),g){if(u.push(`first hop in target path: ${g}`),o===0)return u.push("path_len = 0 → heard directly from initiator (no SNR appended yet)"),u.push("initiator is a direct RF neighbor"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"min_path_len",confidence:"speculative",inferredSrc:null,inferredName:null,evidence:[...u,"initiator is within direct RF range (zero forwarding hops)"],thisPathLen:o,minPathLen:x,firstHopPrefix:g};const f=Object.entries(r).filter(([k])=>k.replace(/^0x/i,"").slice(0,2).toUpperCase()===g);if(f.length===1){const[k,$]=f[0],h=$.name||$.node_name||null;return u.push(`first hop ${g} → unique neighbor: ${h??k}`),u.push("initiator is whoever sent TO this first hop"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"first_hop_neighbor",confidence:"likely",inferredSrc:g,inferredName:h,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}else f.length>1?u.push(`first hop ${g} matches ${f.length} neighbors (ambiguous)`):u.push(`first hop ${g} is not a known neighbor`)}return u.push("insufficient data to identify initiator"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}let ne=null,ce=null;typeof window<"u"&&setTimeout(()=>{ue(()=>import("./usePipelineStore-BTv04vLL.js"),__vite__mapDeps([0,1,2,3])).then(t=>{ne=t}),ue(()=>import("./index-CN4vD05c.js").then(t=>t.hm),__vite__mapDeps([1,3])).then(t=>{ce=t})},0);const He={advertSender:null,advertNodeType:null,advertFlags:null,advertHasLocation:null,advertHasName:null,advertName:null,advertLatitude:null,advertLongitude:null,channelHash:null,byteLength:void 0,hopCount:0,isZeroHop:!0,preComputed:!1};function jt(t,s){const r=t.type??t.payload_type,c=Ne(r),a=Be(t.route),n=r===O.ADVERT,l=r===O.TRACE,o=r===O.PATH,x=r===O.GRP_TXT||r===O.GRP_DATA,m=Ie(t.snr,t.rssi),g=(m==null?void 0:m.finalGrade)??"critical",u=Ge(t.route),v=Ke(t.route),N=Ve(t.route),f=t.route==null?"unknown":u?"flood":v?"direct":"unknown",k=N?`transport-${f}`:f,$=!!s.advertSender;let h="none";$?h="pubkey":x?h="encrypted":t.src_hash&&(h="prefix");const y=gt(r),p=s.advertNodeType!=null?ke(s.advertNodeType):"unknown",_=y!=="unknown"?y:p,H=t.packet_origin??"rx",C=Math.floor(Date.now()/1e3)-t.timestamp,D=C<10?"live":C<300?"recent":C<3600?"warm":C<86400?"stale":"historic",L=t.path_length??(Array.isArray(t.original_path)?t.original_path.length:void 0),P=Array.isArray(t.original_path)&&t.original_path.length>0,R=L??0,b=s.byteLength??(t.raw_packet?Math.floor(t.raw_packet.length/2):0),w=bt(t);return{pType:r,payloadTypeName:c,routeTypeName:a,isAdvert:n,isTrace:l,isPath:o,isGrp:x,signalClass:g,routeClass:k,isFlood:u,isDirect:v,hasTransport:N,senderTier:h,hasPubkey:$,inferredType:y,advertType:p,effectiveType:_,origin:H,age:D,pathLen:L,pathAvail:P,pathHopCount:R,byteLen:b,dupeAnalysis:w}}function vt(t){var f,k,$,h,y,p;const s=ft(t);if(!s||s.pathHashes.length===0)return null;const{pathHashes:r,snrValues:c}=s;if(r.length<2||!ne||!ce)return null;const a=ne.usePipelineStore.getState().srcHashResolverMap,n=ne.usePipelineStore.getState().neighborContext,l=(n==null?void 0:n.hashToName)??new Map,o=ce.useStore.getState().stats,x=(o==null?void 0:o.neighbors)??{},m=o==null?void 0:o.local_hash,g=(k=(f=o==null?void 0:o.config)==null?void 0:f.repeater)==null?void 0:k.latitude,u=(h=($=o==null?void 0:o.config)==null?void 0:$.repeater)==null?void 0:h.longitude,v=Object.keys(x).length>0?Ue([],x,m,g,u):null,N=[];for(let _=0;_0?[r[_-1].toUpperCase()]:[]],P=ge(H,_,L,a,v),R=[H,..._+20?N:null}function ge(t,s,r,c,a){if(s===0){const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.8};if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}}else{if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.6}}return{hash:null,confidence:0}}function Nt(t){var l;const s=t.raw_packet;if(!s||s.length<2)return null;const r=s.replace(/\s/g,""),c=Math.floor(r.length/2),a=((l=r.match(/.{1,2}/g))==null?void 0:l.join(" "))??"";let n="";for(let o=0;o=32&&x<=126?String.fromCharCode(x):"·"}return{hexBytes:a,utf8:n,byteCount:c}}function wt(t){const s=new Map;let r=0,c="";for(const a of t){if((a.type??a.payload_type)!==O.TRACE)continue;r++,c=a.packet_hash;const l=a._traceTag??(a.payload?Te(a.payload):null);if(!l)continue;let o=s.get(l);o||(o=[],s.set(l,o)),o.push(a)}return{index:s,fingerprint:`${r}:${c}`}}function Ct(t,s,r){const c=T.useRef({parse:0,decode:0,enrich:0,traceIndex:0,total:0}),a=T.useMemo(()=>t?Nt(t):null,[t]),n=T.useMemo(()=>{if(!s||s.length<4)return c.current.parse=0,c.current.decode=0,null;const h=performance.now(),y=pt(s),p=performance.now()-h;return y?(c.current.parse=p,c.current.decode=0,{protocolPacket:y.packet,display:{headerFields:y.headerFields,transportCodesHex:y.transportCodesHex,pathLengthHex:y.pathLengthHex,pathDataHex:y.pathDataHex,payloadHex:y.payloadHex,payloadByteOffset:y.payloadStartByte,pathByteOffset:y.pathByteOffset,pathLenByteOffset:y.pathLenByteOffset},decoded:y.decoded,error:null}):(c.current.parse=p,c.current.decode=0,{protocolPacket:null,display:null,decoded:null,error:"Packet.fromHex() returned failure"})},[s]),l=T.useMemo(()=>{if(!t)return c.current.enrich=0,He;const h=performance.now();if(t._advertSender!==void 0)return c.current.enrich=performance.now()-h,{advertSender:t._advertSender??null,advertNodeType:t._advertNodeType??null,advertFlags:t._advertFlags??null,advertHasLocation:t._advertHasLocation??null,advertHasName:t._advertHasName??null,advertName:t._advertName??null,advertLatitude:t._advertLatitude??null,advertLongitude:t._advertLongitude??null,channelHash:t._channelHash??null,byteLength:t._byteLength,hopCount:t._hopCount??0,isZeroHop:t._isZeroHop??!0,preComputed:!0};const y=t.type??t.payload_type,p=Fe(s,y),_=Ee(s,y),H=Oe(s,t),C=ze(t);return c.current.enrich=performance.now()-h,{...p,channelHash:_,byteLength:H,...C,preComputed:!1}},[t,s]),o=T.useRef({fingerprint:"",index:new Map}),x=T.useMemo(()=>{const h=performance.now(),{index:y,fingerprint:p}=wt(r);return c.current.traceIndex=performance.now()-h,p===o.current.fingerprint?o.current.index:(o.current={fingerprint:p,index:y},y)},[r]),m=T.useMemo(()=>{const h=c.current;return{parse:h.parse,decode:h.decode,enrich:h.enrich,traceIndex:h.traceIndex,total:h.parse+h.decode+h.enrich+h.traceIndex}},[n,l,x]);if(!t)return null;const g=s?n?n.error:"rawHex too short":"No raw_packet (warm-tier)",u=(n==null?void 0:n.protocolPacket)??null,v=u?u.payloadVersion:null,N=v===0,f=v===1,k=jt(t,l);let $=null;return k.isTrace&&($=vt(t)),{wire:a,display:(n==null?void 0:n.display)??null,parseError:g,protocolPacket:u,decoded:(n==null?void 0:n.decoded)??null,payloadVersion:v,isV1:N,isV2:f,enrichment:l,traceTagIndex:x,analysis:k,traceHopDetail:$,timing:m}}function ae({options:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:`w-16 shrink-0 font-medium ${l.active?"text-fg-primary":"text-fg-muted"}`,children:l.label}),l.detail&&e.jsx("span",{className:l.active?"text-fg-primary/70":"text-fg-muted",children:l.detail})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}function St({tokens:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-muted shrink-0",children:l.fn}),e.jsxs("span",{className:l.active?"text-fg-primary":"text-fg-muted",children:["(",l.value??"",")"]})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}const Tt={0:"border-l-sys-green",1:"border-l-sys-blue",2:"border-l-sys-teal",3:"border-l-sys-purple"};function le({stage:t,name:s,fn:r,verdict:c,timeMs:a,skipped:n,skipReason:l,children:o}){const x=Tt[t]??"";return e.jsx(e.Fragment,{children:e.jsx(G,{defaultOpen:!n,children:e.jsxs("div",{className:`surface-base rounded-lg border border-edge-subtle overflow-hidden border-l-2 ${x}`,children:[e.jsxs(K,{className:"px-3 py-2 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-sys-blue shrink-0",children:t}),e.jsx("span",{className:"font-mono text-xs font-medium text-fg-primary truncate",children:s}),r&&!c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted truncate hidden sm:inline",children:r}),c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted/70 truncate hidden sm:inline",children:c})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-zinc-500/20 text-fg-muted",children:"N/A"}),a!=null&&!n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})]})]}),e.jsx(V,{children:e.jsx("div",{className:"px-3 pb-3 font-mono text-xs",children:n?e.jsx("p",{className:"text-fg-muted italic",children:l??"Not applicable for this packet type"}):o})})]})})})}function _t(t,s){return s?"manual":t._stripped?"bulk-tier":qe.isConnected()?"ws-push":"rest-poll"}const kt={connected:"green",degraded:"amber",offline:"red"};function Ht({packet:t,isSynthetic:s}){const r=xe(g=>g.wsState),c=xe(g=>g.health),a=_t(t,s),l=!!t._stripped?"WARM":"HOT",o=[{label:"ws-push",detail:"wsConnected && onPacket()",active:a==="ws-push",color:"green"},{label:"rest-poll",detail:"!wsConnected, 3s interval",active:a==="rest-poll",color:"amber"},{label:"catchup",detail:"wsReconnected, delta > 50",active:a==="catchup",color:"amber"},{label:"bulk-tier",detail:"user extends time range → gzip",active:a==="bulk-tier",color:"blue"},{label:"manual",detail:"hex input — no transport",active:a==="manual",color:"zinc"}],x=[{fn:"transport",value:a,group:"transport",color:a==="ws-push"?"green":a==="bulk-tier"?"blue":"amber"},{fn:"tier",value:l,group:"transport",color:"blue"},{fn:"wsState",value:r,group:"transport",color:r==="connected"?"green":"amber"},{fn:"health",value:c,group:"transport",color:kt[c]}],m=s?"manual hex input":`${a} (${c})`;return e.jsx(le,{stage:0,name:"TRANSPORT",fn:"websocketService / useStore.startPolling",verdict:m,children:s?e.jsx("p",{className:"text-fg-muted italic",children:"Manual hex input — no transport context"}):e.jsx(U,{prefix:"transport",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx(ae,{options:o,nextFn:"ingest()"}),e.jsx(se,{tokens:x})]})})})}function q({start:t,end:s}){const r=s!=null&&s!==t?`[${t}..${s}]`:`[${t}]`;return e.jsx("span",{className:"text-fg-muted text-[9px] font-mono mr-1 select-none",children:r})}const $t={advert:"decodeAdvert()",ack:"decodeAck()",path:"decodePath()",trace:"decodeTraceWithSnr()",txt_msg:"decodeTextMessage()",grp_txt:"decodeGroupText()",grp_data:"decodeGroupData()",multipart:"decodeMultipart()",control:"decodeControl()",req:"decodeRequest()",response:"decodeResponse()",anon_req:"decodeAnonReq()",generic:"decodeGeneric()"};function Dt({rawHex:t,display:s,protocolPacket:r,parseError:c,parseTimeMs:a,payloadVersion:n,isV1:l,isV2:o}){return e.jsx("dl",{className:"space-y-0.5",children:s&&r&&t?e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse — Packet.fromHex()"}),a>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})}),e.jsxs(i,{label:"header byte",children:[e.jsx(q,{start:0}),e.jsx(A,{value:t.slice(0,2)})," ",e.jsx(xt,{value:parseInt(t.slice(0,2),16)})]}),s.headerFields.map(x=>e.jsx(i,{label:` ${x.field}`,children:e.jsx(F,{raw:e.jsxs("span",{className:"text-[10px]",children:["bits[",x.bits,"] = ",x.binary]}),children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:x.value})})},x.field)),e.jsx(i,{label:" version",children:n!=null?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(d,{fn:"payloadVer",value:`${n}`,color:"amber"}),e.jsx(M,{color:l?"green":o?"blue":"zinc",children:l?"v1":o?"v2":`v${n}`}),l&&e.jsx("span",{className:"text-fg-muted text-[10px]",children:"1-byte hashes, 2-byte MAC"}),o&&e.jsx("span",{className:"text-sys-blue text-[10px]",children:"2-byte hashes, 4-byte MAC (speculative)"})]}):e.jsx("span",{className:"text-fg-muted",children:"unknown"})}),e.jsx(E,{title:"Wire Framing"}),e.jsx(i,{label:"transportCodes",children:s.transportCodesHex?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:1,end:4}),e.jsx(d,{fn:"transport",value:s.transportCodesHex,color:"amber"})]}):e.jsx("span",{className:"text-fg-muted",children:"N/A (non-transport route)"})}),e.jsx(i,{label:"pathLen",children:e.jsx(F,{raw:e.jsxs(e.Fragment,{children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(A,{value:s.pathLengthHex})]}),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(d,{fn:"pathLen",value:`${r.pathLen} hop${r.pathLen!==1?"s":""}`,color:"amber"})]})})}),e.jsx(i,{label:"path",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.pathLen>0&&e.jsx(q,{start:s.pathByteOffset,end:s.pathByteOffset+r.pathLen-1}),e.jsx(re,{hops:r.pathHexArray,hexPrefix:s.pathDataHex||void 0})]})}),e.jsx(i,{label:"payloadLen",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.payloadByteOffset,end:s.payloadByteOffset+s.payloadHex.length/2-1}),e.jsx(d,{fn:"payloadLen",value:`${s.payloadHex.length/2} bytes`,color:"amber"})]})}),e.jsx(i,{label:"payloadHex",children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber break-all",children:s.payloadHex})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse"}),e.jsxs(i,{label:"result",children:[e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:"Skipped"}),e.jsx("span",{className:"ml-1 text-fg-muted",children:c??"No raw_packet (warm-tier)"})]})]})})}function Lt({decoded:t,packet:s}){if(!t)return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode"}),e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:"No decoded payload"})]});const r=$t[t.type]??`decode${t.type}()`;return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode — decodePayload()"}),e.jsx(U,{prefix:"decodePayload",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"dispatched",children:r}),e.jsx(E,{}),e.jsx(Pt,{decoded:t,packet:s})]})})]})}function Pt({decoded:t,packet:s}){var r;switch(t.type){case"advert":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"publicKey",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px] break-all",children:t.publicKey}),children:e.jsx(d,{fn:"publicKey",value:t.publicKey,color:"green"})})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(F,{raw:e.jsx(A,{value:t.flags}),children:e.jsx(d,{fn:"flags",value:t.flagsDescription,color:"green"})})}),e.jsx(i,{label:"nodeType",children:e.jsx(d,{fn:"nodeType",value:t.nodeType,color:"green"})}),t.latitude!=null&&e.jsx(i,{label:"latitude",children:e.jsx(d,{fn:"lat",value:t.latitude.toFixed(6),color:"green"})}),t.longitude!=null&&e.jsx(i,{label:"longitude",children:e.jsx(d,{fn:"lon",value:t.longitude.toFixed(6),color:"green"})}),t.name&&e.jsx(i,{label:"name",children:e.jsx(d,{fn:"name",value:t.name,color:"green"})})]});case"ack":return e.jsx(i,{label:"crc",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px]",children:t.crc}),children:e.jsx(d,{fn:"crc",value:t.crc,color:"green"})})});case"trace":{const c=s!=null&&s.src_hash?s.src_hash.replace(/^0x/i,"").slice(0,2).toUpperCase():null;return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"traceTag",children:e.jsx(d,{fn:"traceTag",value:t.traceTag,color:"green"})}),e.jsx(i,{label:"authCode",children:e.jsx(d,{fn:"authCode",value:String(t.authCode),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(A,{value:t.flags})}),e.jsx(i,{label:"target path",children:t.pathHashes.length>0?e.jsx(re,{hops:t.pathHashes.map(a=>a.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),e.jsx(i,{label:"complete",children:t.isComplete?e.jsxs("span",{className:"text-sys-green",children:["✓ all ",t.pathHashes.length," hops reported SNR"]}):e.jsxs("span",{className:"text-sys-amber",children:["✗ ",t.snrValues.length,"/",t.pathHashes.length," hops reported"]})}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1 text-[10px]",children:"Directional Edge SNR — per-hop link quality"}),t.snrValues.length===0?e.jsx("p",{className:"text-fg-muted italic text-[11px] ml-2",children:"No SNR values in path field"}):e.jsx("div",{className:"space-y-0.5 ml-2",children:t.snrValues.map((a,n)=>{var g,u,v,N,f;const l=((g=t.pathHashes[n])==null?void 0:g.toUpperCase())??"??",o=n===0?c??"SRC":((u=t.pathHashes[n-1])==null?void 0:u.toUpperCase())??"??",x=(f=(N=(v=Ye.getState().stats)==null?void 0:v.config)==null?void 0:N.radio)==null?void 0:f.spreading_factor,m=we(a,x);return e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted w-3 text-right",children:n}),e.jsx("span",{className:"text-fg-primary",children:o}),e.jsx("span",{className:"text-fg-muted",children:"→"}),e.jsx("span",{className:"text-fg-primary",children:l}),e.jsx("span",{className:"text-fg-muted",children:"@"}),e.jsxs("span",{className:"font-bold text-sys-green",children:[a>0?"+":"",a.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:m})]},n)})})]})]})}case"path":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"pathLength",children:e.jsx(d,{fn:"pathLength",value:String(t.pathLength),color:"green"})}),e.jsx(i,{label:"path",children:t.path&&t.path.length>0?e.jsx(re,{hops:t.path.map(c=>c.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),t.extraType!=null&&e.jsx(i,{label:"extraType",children:e.jsx(d,{fn:"extraType",value:t.extraTypeName??String(t.extraType),color:"purple"})}),t.extraData&&e.jsxs(i,{label:"extraData",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.extraData}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.extraData.length/2,"B)"]})]})]});case"txt_msg":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),e.jsx(i,{label:"encrypted",children:e.jsx(d,{fn:"encrypted",value:String(t.encrypted),color:"green"})})]});case"grp_txt":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),t.channelName&&e.jsx(i,{label:"channelName",children:e.jsx(d,{fn:"channel",value:t.channelName,color:"green"})}),e.jsx(i,{label:"decrypted",children:e.jsx(d,{fn:"decrypted",value:String(t.decrypted),color:"green"})}),t.text&&e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),t.senderName&&e.jsx(i,{label:"senderName",children:e.jsx(d,{fn:"sender",value:t.senderName,color:"green"})}),t.macCorrupted&&e.jsx(i,{label:"macCorrupted",children:e.jsx(d,{fn:"macCorrupted",value:"true",color:"green"})})]});case"grp_data":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),e.jsx(i,{label:"dataLength",children:t.dataLength}),e.jsx(i,{label:"decrypted",children:String(t.decrypted)})]});case"multipart":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"messageId",children:t.messageId}),e.jsxs(i,{label:"part",children:[t.partNumber+1," / ",t.totalParts]})]});case"control":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"controlType",children:e.jsx(F,{raw:e.jsx(A,{value:t.controlType}),children:e.jsx(d,{fn:"controlType",value:t.subtypeName,color:"green"})})}),e.jsx(i,{label:"subtype",children:e.jsx(d,{fn:"subtype",value:`0x${t.subtype.toString(16).padStart(2,"0")}`,color:"green"})}),t.nodeTypeName&&e.jsxs(i,{label:"nodeType",children:[e.jsx(d,{fn:"nodeType",value:t.nodeTypeName,color:"green"}),e.jsxs("span",{className:"text-fg-muted text-[10px] ml-1",children:["(flags & 0x0F = 0x",(r=t.nodeType)==null?void 0:r.toString(16).padStart(2,"0"),")"]})]}),t.snrDb!=null&&e.jsxs(i,{label:"snr",children:[e.jsxs("span",{className:"font-bold text-sys-green",children:[t.snrDb>0?"+":"",t.snrDb.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:t.snrDb>=5?"strong":t.snrDb>=0?"fair":"weak"})]}),t.tag&&e.jsx(i,{label:"tag",children:e.jsx(d,{fn:"tag",value:t.tag,color:"green"})}),t.publicKey&&e.jsxs(i,{label:"publicKey",children:[e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.publicKey}),e.jsx(M,{color:t.publicKeyFull?"green":"amber",children:t.publicKeyFull?"32B full":`${t.publicKey.length/2}B prefix`})]}),t.typeFilter!=null&&e.jsx(i,{label:"typeFilter",children:e.jsx(F,{raw:e.jsx(A,{value:t.typeFilter}),children:e.jsx(d,{fn:"typeFilter",value:t.typeFilterDescription??"none",color:"green"})})}),t.prefixOnly!=null&&e.jsx(i,{label:"prefixOnly",children:e.jsx(d,{fn:"prefixOnly",value:String(t.prefixOnly),color:"green"})}),t.since!=null&&e.jsx(i,{label:"since",children:e.jsx(d,{fn:"since",value:t.since===0?"all (0)":String(t.since),color:"green"})}),!t.nodeTypeName&&t.typeFilter==null&&t.dataLength>0&&e.jsxs(i,{label:"data",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.dataHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.dataLength,"B)"]})]})]});case"req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"response":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"anon_req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"senderPubKey",children:e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.senderPublicKey})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"generic":return e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"payloadType",children:[e.jsx(ht,{value:t.payloadType})," (",t.payloadTypeName,")"]}),e.jsx(i,{label:"length",children:t.length}),e.jsx(i,{label:"rawHex",children:e.jsx("span",{className:"break-all",children:t.rawHex})})]});default:return e.jsx("p",{className:"text-fg-muted",children:"Unknown decoded type"})}}function Mt({protocolPacket:t,packetHash:s}){const r=t==null?void 0:t.payloadType,c=r===Ze||r===Xe,a=T.useMemo(()=>{if(!c||!t)return null;const p=t.payload;return p.length<4?null:{channelHash:p[0],mac:p.slice(1,3),ciphertext:p.slice(3)}},[t,c]),[n,l]=T.useState("pending"),[o,x]=T.useState([]),[m,g]=T.useState(0);T.useEffect(()=>{if(!a){l(null);return}let p=!1;return(async()=>{const H=performance.now(),C=await Qe(a.channelHash,a.mac,a.ciphertext);p||(l(C),g(performance.now()-H));const D=await Je(a.channelHash);p||x(D)})(),()=>{p=!0}},[a]);const[u,v]=T.useState(""),[N,f]=T.useState(null),[k,$]=T.useState(!1),h=T.useCallback(async()=>{if(!(!a||!u.trim())){$(!0);try{const p=await We(u.trim(),a.channelHash,a.mac,a.ciphertext);if(p.success){const _=new TextDecoder("utf-8",{fatal:!1}).decode(p.result.plaintext.slice(5));f({success:!0,text:_})}else f({success:!1,error:p.error})}catch(p){f({success:!1,error:String(p)})}finally{$(!1)}}},[a,u]),y=Ce(s);return!c||!a?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"C. Decrypt — tryDecryptGroupMessage()"}),m>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:m<1?`${(m*1e3).toFixed(0)}µs`:`${m.toFixed(2)}ms`})}),e.jsx(U,{prefix:"tryDecryptGroupMessage",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"channelHash",children:e.jsx(d,{fn:"channelHash",value:`0x${a.channelHash.toString(16).toUpperCase().padStart(2,"0")}`,color:"teal"})}),e.jsx(i,{label:"mac",children:e.jsx(d,{fn:"mac",value:Array.from(a.mac).map(p=>p.toString(16).padStart(2,"0")).join(""),color:"teal"})}),e.jsx(i,{label:"cipherLen",children:e.jsx(d,{fn:"cipherLen",value:`${a.ciphertext.length}B`,color:"teal"})}),e.jsx(i,{label:"candidates",children:e.jsx(d,{fn:"candidates",value:o.length>0?`${o.length} names`:"0",color:o.length>0?"teal":"zinc"})}),o.length>0&&e.jsxs("details",{className:"mt-1",children:[e.jsx("summary",{className:"text-fg-muted cursor-pointer hover:text-fg-primary text-[10px]",children:"show candidate names"}),e.jsx("div",{className:"mt-1 text-[10px] text-fg-muted break-all max-h-24 overflow-y-auto",children:o.join(", ")})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"Result:"}),n==="pending"?e.jsx("p",{className:"text-fg-muted italic",children:"decrypting…"}):n?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:n.channelName,color:"teal"})}),e.jsx(i,{label:"plaintext",children:e.jsx(d,{fn:"plaintext",value:new TextDecoder("utf-8",{fatal:!1}).decode(n.plaintext.slice(5)).trim()||"(empty)",color:"teal"})}),e.jsx(i,{label:"macValid",children:e.jsx(d,{fn:"macValid",value:n.macCorrupted?"false":"true",color:"teal"})})]}):e.jsxs(i,{label:"decrypt",children:[e.jsx(d,{fn:"decrypt",value:"failed",color:"red"}),e.jsx("span",{className:"text-fg-muted ml-1",children:"channel not in known list"})]})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"testChannelName() — manual test:"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:u,onChange:p=>{v(p.target.value),f(null)},onKeyDown:p=>p.key==="Enter"&&h(),placeholder:"channel name",className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-40"}),e.jsx("button",{onClick:h,disabled:k||!u.trim(),className:"px-2 py-1 rounded text-[10px] font-mono bg-sys-blue/20 text-sys-blue hover:bg-sys-blue/30 disabled:opacity-40 transition-colors",children:k?"…":"Try"})]}),N&&e.jsx("div",{className:"mt-1",children:N.success?e.jsx(i,{label:"result",children:e.jsx(d,{fn:"plaintext",value:N.text??"(empty)",color:"teal"})}):e.jsx(i,{label:"error",children:e.jsx(d,{fn:"error",value:N.error??"unknown",color:"red"})})})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"useDecodedMessage() store result:"}),y?y.decoded?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:y.decoded.channelName??"?",color:"teal"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:y.decoded.text,color:"teal"})})]}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"failed",color:"red"})}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"pending",color:"zinc"})})]})]})})]})}function Rt(t){const{rawHex:s,display:r,protocolPacket:c,decoded:a,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m,packetHash:g,packet:u}=t,v=!!s&&s.length>=4;return e.jsxs(G,{children:[e.jsx(K,{className:"w-full mt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-fg-muted",children:"🔬"}),e.jsx("span",{className:"text-[10px] font-mono font-medium text-fg-muted",children:"Wire Inspection"}),e.jsx("span",{className:"text-[9px] text-fg-muted/50",children:"observatory diagnostic — not a runtime stage"})]})}),e.jsx(V,{children:e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-lg p-3 space-y-1 bg-surface/30",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/50 mb-2",children:"The backend parsed these fields server-side. This panel verifies the wire-level encoding client-side."}),v?e.jsxs(e.Fragment,{children:[e.jsx(Dt,{rawHex:s,display:r,protocolPacket:c,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m}),e.jsx(Lt,{decoded:a,packet:u}),e.jsx(Mt,{protocolPacket:c,packetHash:g})]}):e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:n??"No raw_packet — wire inspection unavailable (warm-tier packet)"})]})})]})}function fe(t){if(!t)return[{fn:"decode",value:"no raw_packet",group:"decode",color:"zinc"}];switch(t.type){case"advert":{const s=t,r=[{fn:"decode.nodeType",value:s.nodeType,group:"decode",color:"blue"}];return s.name&&r.push({fn:"decode.name",value:s.name,group:"decode",color:"blue"}),s.latitude!=null&&s.longitude!=null&&r.push({fn:"decode.location",value:`${s.latitude.toFixed(4)}, ${s.longitude.toFixed(4)}`,group:"decode",color:"blue"}),r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:"blue"}),r}case"trace":{const s=t;return[{fn:"decode.traceTag",value:s.traceTag,group:"decode",color:"blue"},{fn:"decode.hops",value:s.pathHashes.length>0?s.pathString:"empty",group:"decode",color:"blue"},{fn:"decode.snr",value:s.snrValues.length>0?`${s.snrValues.length} values`:"none",group:"decode",color:s.snrValues.length>0?"blue":"zinc"},{fn:"decode.complete",value:s.isComplete?"yes":"partial",group:"decode",color:s.isComplete?"green":"amber"}]}case"path":{const s=t,r=[{fn:"decode.pathLength",value:String(s.pathLength),group:"decode",color:"blue"},{fn:"decode.path",value:s.path.length>0?s.pathString:"empty",group:"decode",color:"blue"}];return s.extraType!=null&&r.push({fn:"decode.extraType",value:s.extraTypeName??String(s.extraType),group:"decode",color:"purple"}),s.extraData&&r.push({fn:"decode.extraData",value:`${s.extraData.length/2}B`,group:"decode",color:"purple"}),r}case"ack":return[{fn:"decode.crc",value:t.crc,group:"decode",color:"blue"}];case"grp_txt":return[{fn:"decode.channelHash",value:t.channelHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:"true — decrypt at cascade",group:"decode",color:"zinc"}];case"grp_data":{const s=t;return[{fn:"decode.channelHash",value:s.channelHash,group:"decode",color:"blue"},{fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"}]}case"txt_msg":{const s=t;return[{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:s.encrypted?"true":"false",group:"decode",color:s.encrypted?"zinc":"green"},...s.encrypted?[]:[{fn:"decode.text",value:s.text,group:"decode",color:"blue"}]]}case"multipart":{const s=t;return[{fn:"decode.part",value:`${s.partNumber+1}/${s.totalParts}`,group:"decode",color:"blue"},{fn:"decode.msgId",value:s.messageId,group:"decode",color:"blue"}]}case"control":{const s=t,r=[{fn:"decode.subtype",value:s.subtypeName,group:"decode",color:"blue"}];return s.nodeTypeName&&r.push({fn:"decode.nodeType",value:s.nodeTypeName,group:"decode",color:"blue"}),s.snrDb!=null&&r.push({fn:"decode.snr",value:`${s.snrDb>0?"+":""}${s.snrDb.toFixed(1)} dB`,group:"decode",color:"blue"}),s.tag&&r.push({fn:"decode.tag",value:s.tag,group:"decode",color:"blue"}),s.publicKey&&r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:s.publicKeyFull?"green":"blue"}),s.typeFilter!=null&&r.push({fn:"decode.typeFilter",value:s.typeFilterDescription??`0x${s.typeFilter.toString(16)}`,group:"decode",color:"blue"}),s.prefixOnly!=null&&r.push({fn:"decode.prefixOnly",value:String(s.prefixOnly),group:"decode",color:"blue"}),!s.nodeTypeName&&!s.tag&&(r.push({fn:"decode.subtypeFlags",value:`0x${s.subtypeFlags.toString(16)}`,group:"decode",color:"blue"}),r.push({fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"})),r}case"req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"response":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"anon_req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.senderPubKey",value:s.senderPublicKey,group:"decode",color:"green"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"generic":return[{fn:"decode.raw",value:`${t.length}B`,group:"decode",color:"zinc"}];default:return[]}}function At({packet:t,pipeline:s,rawHex:r,traceTagIndex:c,neighbors:a}){const{enrichment:n,timing:l,display:o,protocolPacket:x,decoded:m,parseError:g,payloadVersion:u,isV1:v,isV2:N,analysis:f}=s,$=(t.type??t.payload_type)===et,h=f.dupeAnalysis,y=T.useRef(0),p=T.useMemo(()=>{if(!$)return null;const D=performance.now(),L=yt(t,c,a);return y.current=performance.now()-D,L},[t,c,a,$]),_=l.enrich+y.current,H=[];f.byteLen&&H.push(`${f.byteLen}B`),H.push(f.payloadTypeName),n.advertName&&H.push(`"${n.advertName}"`),n.isZeroHop?H.push("zero-hop"):f.pathHopCount>0&&H.push(`${f.pathHopCount}h`),H.push(`${t.rssi}dBm`),h.isDuplicate&&H.push("DUPE");const C=H.join(" — ");return e.jsxs(le,{stage:1,name:"INGEST",fn:n.preComputed?"PacketCache.mergePackets()":"extractAdvertData() + extractHopData() + ...",verdict:C,timeMs:_,children:[e.jsx(Rt,{rawHex:r,display:o,protocolPacket:x,decoded:m,parseError:g,parseTimeMs:l.parse,payloadVersion:u,isV1:v,isV2:N,packetHash:t.packet_hash,packet:t}),e.jsx(E,{title:"Cache Enrichment"}),e.jsx(U,{prefix:"packetCache",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsxs("div",{className:"mb-1.5",children:[n.preComputed?e.jsx(M,{color:"green",children:"PacketCache"}):e.jsx(M,{color:"amber",children:"computed"}),e.jsx("span",{className:"text-[10px] text-fg-muted ml-1.5",children:n.preComputed?"pre-enriched by real pipeline":"synthetic — computed on the fly"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1 mb-1",children:[e.jsx(d,{fn:"_byteLength",value:n.byteLength!=null?`${n.byteLength}B`:void 0,color:"blue"}),e.jsx(d,{fn:"_hopCount",value:String(n.hopCount),color:"blue"}),e.jsx(d,{fn:"_isZeroHop",value:String(n.isZeroHop),color:n.isZeroHop?"green":"blue"}),n.isZeroHop&&e.jsx(M,{color:"blue",children:"direct"}),n.channelHash!=null&&e.jsx(d,{fn:"_channelHash",value:n.channelHash,color:"blue"}),$&&t._traceTag&&e.jsx(d,{fn:"_traceTag",value:t._traceTag,color:"blue"})]}),n.advertSender||n.advertNodeType!=null||n.advertName!=null?e.jsxs("div",{className:"mt-1 mb-1",children:[e.jsx("p",{className:"text-[10px] text-sys-blue font-medium mb-0.5",children:"ADVERT Enrichment"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[n.advertSender&&e.jsx(d,{fn:"_advertSender",value:n.advertSender.slice(0,16)+"…",color:"blue"}),n.advertNodeType!=null&&e.jsx(d,{fn:"_advertNodeType",value:ke(n.advertNodeType),color:"blue"}),n.advertName!=null&&e.jsx(d,{fn:"_advertName",value:n.advertName,color:"blue"}),n.advertFlags!=null&&e.jsx(d,{fn:"_advertFlags",value:`0x${n.advertFlags.toString(16).padStart(2,"0")}`,color:"blue"}),n.advertHasLocation!=null&&e.jsx(d,{fn:"_advertHasLocation",value:String(n.advertHasLocation),color:"blue"}),n.advertHasName!=null&&e.jsx(d,{fn:"_advertHasName",value:String(n.advertHasName),color:"blue"}),n.advertLatitude!=null&&n.advertLongitude!=null&&e.jsx(d,{fn:"location",value:`${n.advertLatitude.toFixed(4)}, ${n.advertLongitude.toFixed(4)}`,color:"blue"})]})]}):e.jsx("p",{className:"text-[10px] text-fg-muted/30 mb-1",children:"ADVERT fields: N/A (non-ADVERT packet)"}),e.jsx(E,{title:"Payload Decode"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${m?"bg-sys-blue":"bg-zinc-500/40"}`}),e.jsx("span",{className:"font-mono text-[10px] font-medium text-fg-primary",children:"decodePayload()"}),e.jsx("span",{className:"text-[9px] text-fg-muted",children:"sync — wire data only, no crypto"})]}),e.jsx("div",{className:"ml-3",children:m?e.jsx("div",{className:"flex flex-wrap gap-x-1.5 gap-y-1",children:fe(m).map((D,L)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:D.fn,value:D.value,color:D.color})},L))}):e.jsx(S,{children:"no raw_packet — warm-tier packet, decode unavailable"})})]}),e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"dupe:"}),h.isDuplicate?e.jsx(d,{fn:"is_duplicate",value:"true",color:"purple"}):e.jsx(S,{children:"none"}),h.dupeCount>0&&e.jsx(d,{fn:"dupeCount",value:`×${h.dupeCount}`,color:"purple"}),h.rssiRange&&e.jsxs(S,{c:"text-fg-primary",children:["Δ",Math.abs(h.rssiRange[1]-h.rssiRange[0]),"dB RSSI"]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"TRACE SRC:"}),p.inferredSrc?e.jsxs(e.Fragment,{children:[e.jsx(d,{fn:"inferredSrc",value:p.inferredSrc,color:"purple"}),p.inferredName&&e.jsx(d,{fn:"name",value:p.inferredName,color:"purple"})]}):e.jsx(S,{children:"unresolvable"}),e.jsx(_e,{color:"purple",children:p.method}),e.jsxs(S,{children:["(",p.confidence,")"]}),e.jsxs(S,{children:["siblings=",p.siblingCount]})]})]}),(()=>{const D=f.pType!=null?`0x${f.pType.toString(16).toUpperCase().padStart(2,"0")}`:void 0,L=t.route!=null?`0x${t.route.toString(16).toUpperCase().padStart(2,"0")}`:void 0,P=fe(m),R=f.signalClass==="excellent"||f.signalClass==="good"?"green":f.signalClass==="fair"?"amber":"red",b=f.senderTier==="pubkey"?"green":f.senderTier==="prefix"?"amber":f.senderTier==="encrypted"?"teal":"zinc",w=[{fn:"type",value:f.payloadTypeName,raw:D,group:"wire",color:"blue"},{fn:"route",value:f.routeTypeName,raw:L,group:"wire",color:"blue"},{fn:"src_hash",value:t.src_hash||void 0,group:"wire",color:"blue"},{fn:"rssi",value:`${t.rssi}dBm`,group:"wire",color:"blue"},{fn:"snr",value:`${t.snr}dB`,group:"wire",color:"blue"},{fn:"_byteLength",value:f.byteLen?`${f.byteLen}B`:void 0,group:"enrichment",color:"blue"},{fn:"_hopCount",value:String(n.hopCount),group:"enrichment",color:"blue"},{fn:"_isZeroHop",value:String(n.isZeroHop),group:"enrichment",color:"blue"},{fn:"_advertSender",value:n.advertSender||void 0,group:"enrichment",color:"blue"},{fn:"_advertNodeType",value:f.advertType!=="unknown"?f.advertType:void 0,group:"enrichment",color:"blue"},{fn:"_advertName",value:n.advertName||void 0,group:"enrichment",color:"blue"},{fn:"_channelHash",value:n.channelHash||void 0,group:"enrichment",color:"blue"},...P,{fn:"is_duplicate",value:String(h.isDuplicate),group:"analysis",color:"purple"},p!=null&&p.inferredSrc?{fn:"traceSrc",value:p.inferredSrc,group:"analysis",color:"purple"}:{fn:"traceSrc"},{fn:"_signalClass",value:f.signalClass,group:"analysis",color:R},{fn:"_routeClass",value:f.routeClass,group:"analysis",color:"purple"},{fn:"_senderTier",value:f.senderTier,group:"analysis",color:b},{fn:"_origin",value:f.origin,group:"analysis",color:f.origin==="tx_local"?"green":f.origin==="tx_forward"?"amber":"purple"},{fn:"_pathAvail",value:f.pathAvail?`${f.pathHopCount} hops`:"none",group:"analysis",color:f.pathAvail?"green":"zinc"},{fn:"_age",value:f.age,group:"analysis",color:f.age==="live"||f.age==="recent"?"green":"zinc"},...h.dupeCount>0?[{fn:"_dupeCount",value:`×${h.dupeCount}`,group:"analysis",color:"purple"},...h.rssiRange?[{fn:"_multipath",value:`Δ${Math.abs(h.rssiRange[1]-h.rssiRange[0])}dB`,group:"analysis",color:Math.abs(h.rssiRange[1]-h.rssiRange[0])>6?"amber":"green"}]:[]]:[],...t.lbt_attempts!=null?[{fn:"_lbt",value:`${t.lbt_attempts} attempt${t.lbt_attempts!==1?"s":""}`,group:"analysis",color:(t.lbt_attempts??0)>1?"amber":"green"}]:[],...t.drop_reason?[{fn:"_dropReason",value:t.drop_reason,group:"analysis",color:"red"}]:[]];return e.jsx(se,{tokens:w})})()]})})]})}function be(t){switch(t){case"excellent":return"green";case"good":return"green";case"fair":return"amber";case"poor":return"red";case"critical":return"red";default:return"zinc"}}function ye(t){return`${Math.round(t*100)}%`}function je(t,s,r){return t||(s?s.slice(0,12):`~${r}`)}function Ft({hops:t}){return t.length===0?null:e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/40",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/40 uppercase tracking-widest font-mono mb-1.5",children:"per-hop trace inspection"}),e.jsx("div",{className:"space-y-1",children:t.map(s=>e.jsx(U,{prefix:`trace.hop[${s.hopIndex}]`,children:e.jsxs("div",{className:"border border-edge-subtle/40 rounded px-2 py-1.5",children:[e.jsxs(i,{label:"link",children:[e.jsx(re,{hops:[s.fromPrefix,s.toPrefix],color:"blue"}),e.jsx("span",{className:"ml-1.5",children:e.jsx(_e,{color:be(s.quality),children:s.quality})})]}),e.jsx(i,{label:"snr",children:e.jsx(F,{raw:e.jsx("span",{className:"text-sys-blue",children:s.snrRaw}),children:e.jsx(d,{fn:"snr",value:`${s.snrRaw.toFixed(1)} dB`,color:be(s.quality)})})}),e.jsxs(i,{label:"from",children:[e.jsx(d,{fn:"resolve",value:je(s.fromName,s.fromHash,s.fromPrefix),color:s.fromHash?s.fromConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.fromConfidence),color:"zinc"})})]}),e.jsxs(i,{label:"to",children:[e.jsx(d,{fn:"resolve",value:je(s.toName,s.toHash,s.toPrefix),color:s.toHash?s.toConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.toConfidence),color:"zinc"})})]})]})},s.hopIndex))}),e.jsx(se,{label:"trace contributes",tokens:Et(t)})]})}function Et(t){const s=t.reduce((n,l)=>n+(l.fromHash?1:0)+(l.toHash?1:0),0),r=t.length*2,c=r-s,a=t.length>0?t.reduce((n,l)=>n+l.snrRaw,0)/t.length:0;return[{fn:"hops",value:String(t.length),group:"wire",color:"blue"},{fn:"resolved",value:`${s}/${r}`,group:"worker",color:"green"},...c>0?[{fn:"ghosts",value:String(c),group:"worker",color:"purple"}]:[],{fn:"avgSnr",value:`${a.toFixed(1)} dB`,group:"analysis",color:a>=5?"green":a>=0?"amber":"red"}]}function Ot(t){if(!t)return"never";const s=Math.floor((Date.now()-t)/1e3);return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:`${Math.floor(s/3600)}h ago`}function zt(t){if(!t)return[];const s=t.decoded;if(!s)return[{fn:"decrypt.result",value:"failed",group:"crypto",color:"red"}];if(!s.decrypted)return[{fn:"decrypt.result",value:"no key match",group:"crypto",color:"zinc"}];const r=[];return s.channelName&&r.push({fn:"decrypt.channelName",value:s.channelName,group:"crypto",color:"teal"}),s.senderName&&r.push({fn:"decrypt.senderName",value:s.senderName,group:"crypto",color:"teal"}),s.text&&r.push({fn:"decrypt.text",value:s.text,group:"crypto",color:"teal"}),s.timestamp&&r.push({fn:"decrypt.timestamp",value:new Date(s.timestamp*1e3).toISOString().slice(11,19),group:"crypto",color:"teal"}),s.macCorrupted&&r.push({fn:"decrypt.macCorrupted",value:"true",group:"crypto",color:"amber"}),r}function Bt({packet:t,decrypted:s,pipeline:r}){var b;const c=J(w=>w.isComputing),a=J(w=>w.lastUpdated),n=J(w=>w.lastComputeTimeMs),l=J(w=>w.topology.edges.length),o=J(w=>w.topology.discoveredNodes.length),x=tt(),m=st(),g=nt(),u=he(w=>w.isComputing),v=he(w=>w.nodeCount),N=me(w=>w.progress),f=me(w=>w.initialDecodeComplete),k=t.type??t.payload_type,$=k===O.GRP_TXT||k===O.GRP_DATA,h=k===O.TRACE,y=k===O.PATH,p=$,_=[{label:"full",detail:"all GRP_TXT → decryption worker",active:p&&f,color:"teal"},{label:"quick",detail:"100 most recent (initial load)",active:p&&!f,color:"amber"},{label:"skip",detail:"non-GRP or catchup path",active:!p,color:"zinc"}],H=zt(s),C=((b=s==null?void 0:s.decoded)==null?void 0:b.decrypted)===!0,D=c?"running":`${l}e ${o}g`,L=u?"running":`${v}n`,P=p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A",R=`topo ${c?"○":"✓"} ${D} · spark ${u?"○":"✓"} ${L} · decrypt ${P}`;return e.jsx(le,{stage:2,name:"CASCADE",fn:"hydrateDownstream()",verdict:R,children:e.jsx(U,{prefix:"cascade",children:e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 py-1.5 text-[11px] font-mono",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"topology"}),e.jsxs("span",{className:"text-fg-muted",children:[l,"e ",o,"g"]}),(h||y)&&e.jsx("span",{className:"text-sys-green text-[9px]",children:"↑signal"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"sparkline"}),e.jsxs("span",{className:"text-fg-muted",children:[v,"n"]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.isDecoding?"bg-sys-amber animate-pulse":p?"bg-sys-teal":"bg-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-primary",children:"decrypt"}),e.jsx("span",{className:p?"text-sys-teal":"text-fg-muted",children:p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A"})]})]}),e.jsxs(G,{defaultOpen:h||y,children:[e.jsx(K,{className:"text-[10px] w-full border-t border-edge-subtle pt-1.5",children:e.jsx("span",{className:"font-mono text-fg-muted/50",children:"topology detail…"})}),e.jsx(V,{children:e.jsxs("div",{className:"ml-3 pb-2",children:[e.jsx(i,{label:"status",children:e.jsx(d,{fn:"isComputing",value:c?"running":"idle",color:c?"amber":"green"})}),e.jsxs(i,{label:"last",children:[e.jsx(d,{fn:"lastUpdated",value:Ot(a),color:"zinc"}),n>0&&e.jsxs("span",{className:"ml-2 text-fg-muted text-[10px]",children:["(",n<1e3?`${n.toFixed(0)}ms`:`${(n/1e3).toFixed(1)}s`,")"]})]}),e.jsxs(i,{label:"output",children:[e.jsx(d,{fn:"edges",value:String(l),color:"green"}),e.jsx(d,{fn:"ghostNodes",value:String(o),color:"purple"})]}),m&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"trace links",children:[e.jsx(d,{fn:"directed",value:String(x.totalDirectedLinks),color:"teal"}),e.jsx(d,{fn:"bidir",value:String(x.bidirectionalLinks),color:"teal"}),e.jsx(d,{fn:"traces",value:String(x.totalTraces),color:"zinc"})]}),e.jsxs(i,{label:"trace SNR",children:[e.jsx(d,{fn:"mean",value:`${x.meanSnr.toFixed(1)} dB`,color:x.meanSnr>=5?"green":x.meanSnr>=0?"amber":"red"}),e.jsx(d,{fn:"median",value:`${x.medianSnr.toFixed(1)} dB`,color:"zinc"}),e.jsx(d,{fn:"confidence",value:`${Math.round(x.avgConfidence*100)}%`,color:"zinc"})]}),h&&e.jsxs(i,{label:"quality",children:[e.jsx(d,{fn:"excellent",value:String(x.qualityCounts.excellent),color:"green"}),e.jsx(d,{fn:"good",value:String(x.qualityCounts.good),color:"green"}),e.jsx(d,{fn:"fair",value:String(x.qualityCounts.fair),color:"amber"}),e.jsx(d,{fn:"poor",value:String(x.qualityCounts.poor),color:"red"}),e.jsx(d,{fn:"critical",value:String(x.qualityCounts.critical),color:"red"})]}),g.confirmedResolutions.size>0&&e.jsxs(i,{label:"feedback",children:[e.jsx(d,{fn:"feedback.confirmed",value:String(g.confirmedResolutions.size),color:"teal"}),e.jsx(d,{fn:"feedback.links",value:String(g.confirmedLinks.length),color:"teal"})]})]}),h&&(r==null?void 0:r.traceHopDetail)&&e.jsx(Ft,{hops:r.traceHopDetail})]})})]}),p&&e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"mode",children:e.jsx(ae,{options:_,nextFn:"queueDecryption()"})}),e.jsx(i,{label:"result",children:e.jsx(d,{fn:"decrypt",value:C?"decrypted":s?"failed":"pending",color:C?"teal":s?"red":"zinc"})}),C&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-1.5 gap-y-1",children:H.map((w,oe)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:w.fn,value:w.value,color:w.color})},oe))})]})}),(()=>{const w=[{fn:"topology.edges",value:String(l),group:"worker",color:"green"},{fn:"topology.ghostNodes",value:String(o),group:"worker",color:"purple"},{fn:"sparkline.nodes",value:`${v}`,group:"worker",color:"green"},...m?[{fn:"trace.directedLinks",value:String(x.totalDirectedLinks),group:"worker",color:"teal"},{fn:"trace.meanSnr",value:`${x.meanSnr.toFixed(1)} dB`,group:"worker",color:"teal"}]:[],...H];return e.jsx(se,{tokens:w})})()]})})})}function It(t,s,r,c){var n;const a=t.src_hash?Se(t.src_hash):"";if(t._advertSender&&s.hash&&s.confident)return{tier:1,label:"_advertSender → pubkey",detail:"ADVERT carried full 32-byte public key — definitive match"};if(c&&s.confident&&((n=s.name)==null?void 0:n.toLowerCase())===c.toLowerCase())return{tier:1.5,label:"decrypt.senderName → nameToHash",detail:`Decrypted sender name “${c}” matched neighbor — high-confidence`};if(a&&r.crossClassPrefixes.has(a))return{tier:2,label:"cross-class prefix",detail:"Prefix has mixed types (repeater + non-repeater); payload type narrows to one class"};if(s.confident){const l=r.prefixIndex.get(a);return(l==null?void 0:l.length)===1?{tier:3,label:"single candidate",detail:"Only one node matches this prefix — unambiguous"}:{tier:3,label:"resolver",detail:"Multi-signal scoring selected best candidate from collision set"}}return{tier:4,label:"ambiguous",detail:"Cannot confidently resolve — multiple same-class candidates, insufficient scoring separation"}}function Gt(t,s){const r=t.original_path??t.forwarded_path,c=new Set;if(r&&Array.isArray(r))for(const a of r){const n=String(a).toUpperCase();n.length>=2&&!rt(n,s)&&c.add(n)}return c}function Kt(t,s,r,c,a,n,l){const o=Math.floor(Date.now()/1e3),x=new Map(r.map(m=>[m.hash,m]));return t.map(m=>{const g=s[m.hash],u=x.get(m.hash);let v=!0,N="";c!=="unknown"?m.type!=="unknown"&&m.type!==c?(v=!1,N=`${m.type} ≠ required ${c}`):m.type===c?N="type matches":N="type unknown — not ruled out":N="payload ambiguous — all types eligible";const f=!!(g!=null&&g.zero_hop),k=(g==null?void 0:g.last_seen)??0;let $=0;if(f&&k>0){const b=(o-k)/3600;$=50*Math.exp(-b/l)}let h=0;if(k>0){const b=(o-k)/3600;h=Math.exp(-b/n)}const y=h*20,p=!!(g!=null&&g.latitude&&(g!=null&&g.longitude)&&(g.latitude!==0||g.longitude!==0)),_=p?5:0,H=(u==null?void 0:u.advertCount)??0,C=Math.min(H*2,30),D=(u==null?void 0:u.forwarderPrefixes.size)??0,L=Math.min(D*3,15);let P=0;if(u&&u.totalForwarderObservations>0&&a.size>0){let b=0;for(const w of a)u.forwarderPrefixes.has(w)&&b++;P=b/a.size}const R=$+y+_+C+L;return{hash:m.hash,name:m.name,type:m.type,roleCompatible:v,roleReason:N,zeroHop:f,zeroHopScore:$,lastSeen:k,recencyScore:h,recencyPoints:y,hasGps:p,gpsScore:_,advertCount:H,advertScore:C,topoWidth:D,topoScore:L,affinity:P,total:R}}).sort((m,g)=>g.total-m.total)}function Vt({packet:t,pipeline:s,resolved:r,resolveTimeMs:c,advertName:a,neighbors:n,decrypted:l}){var ie,de;const o=Y(j=>j.neighborContext),x=Y(j=>j.topologyProfiles),m=Y(j=>j.config),{analysis:g}=s,u=r??{hash:null,type:"unknown",name:null,confident:!1},v=t.src_hash?Se(t.src_hash):"",N=v?o.prefixIndex.get(v)??[]:[],f=v?x.get(v)??[]:[],k=g.pType??-1,$=k>=0?k.toString(16).toUpperCase().padStart(2,"0"):"??",h=g.inferredType,y=g.advertType,p=g.effectiveType,_=t._advertNodeType!=null?t._advertNodeType.toString(16).padStart(2,"0").toUpperCase():"",H=((ie=l==null?void 0:l.decoded)==null?void 0:ie.senderName)??null,C=It(t,u,o,H),D=T.useMemo(()=>Gt(t,v),[t,v]),L=g.pathLen,P=T.useMemo(()=>Kt(N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours),[N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours]),R=P.filter(j=>!j.roleCompatible),b=P.filter(j=>j.roleCompatible),w=t._advertSender?o.pubKeyMap.get(t._advertSender)??null:null,oe=C.tier===1,De=[{fn:"src_hash",value:v||"",active:!!v,color:"blue"},{fn:"_advertSender",value:t._advertSender?t._advertSender.slice(0,12)+"…":"",active:!!t._advertSender,color:"blue"},{fn:"_advertNodeType",value:_?`0x${_}`:"",active:t._advertNodeType!=null,color:"blue"},{fn:"path_length",value:L!=null?L===0?"zero-hop":String(L):"",active:L!=null,color:"blue"},{fn:"decrypt.senderName",value:H??"",active:!!H,color:"teal"}],Le=[{label:"hit",detail:"pubKeyMap.get(_advertSender) → definitive",active:!!w,color:"green"},{label:"miss",detail:t._advertSender?"pubkey not in neighbor table":"no _advertSender",active:!w,color:"zinc"}],Pe=[{label:"payload",detail:`inferDeviceType(0x${$}) → ${h}`,active:h!=="unknown",color:"amber"},{label:"flags",detail:_?`mapAdvertTypeCode(0x${_}) → ${y}`:"no _advertNodeType",active:h==="unknown"&&y!=="unknown",color:"green"},{label:"ambiguous",detail:"all types eligible",active:p==="unknown",color:"zinc"}],Me=u.name??((de=u.hash)==null?void 0:de.slice(0,12))??"?",Re=u.confident?"confident":"ambiguous",Ae=`→ ${Me} (${Re}, Tier ${C.tier})`;return e.jsx(le,{stage:3,name:"RESOLVE",fn:"usePipelineStore.resolveSource()",verdict:Ae,timeMs:c,children:e.jsx(U,{prefix:"resolvePacketSource",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"pt-1 pb-1",children:e.jsx(St,{tokens:De,nextFn:"resolvePacketSource()"})}),t.src_hash?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"1"})," ","PUBKEY LOOKUP"]}),e.jsx(ae,{options:Le,nextFn:"pubKeyMap.get()"}),e.jsx("div",{className:"ml-3 mt-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"resolved",children:e.jsx(d,{fn:"hash",value:w,color:"green"})}),a&&e.jsxs(i,{label:"name",children:[e.jsx(d,{fn:"name",value:a,color:"green"}),u.name&&a===u.name&&e.jsx(S,{c:"text-sys-green ml-1",children:"✓ neighbor match"})]}),e.jsxs(i,{label:"result",children:[e.jsx(M,{color:"green",children:"Tier 1"}),e.jsx(S,{c:"text-fg-primary ml-1",children:"definitive — scoring bypassed"})]})]}):t._advertSender?e.jsx(i,{label:"status",children:e.jsx(S,{c:"text-sys-amber",children:"✗ pubkey not in neighbor table"})}):e.jsx(i,{label:"status",children:e.jsx(S,{children:"no _advertSender — skip to prefix resolution"})})})]}),oe?e.jsx("div",{className:"border-t border-edge-subtle py-2",children:e.jsx("p",{className:"text-[11px] text-fg-muted/40 font-mono ml-3",children:"Steps 2–5 bypassed — pubkey definitive"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"2"})," ","CANDIDATE POOL — ",N.length," node",N.length!==1?"s":"",' match "',v,'"']}),e.jsxs("div",{className:"space-y-0.5 ml-3",children:[P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"break-all text-[10px]",children:j.hash}),e.jsx(M,{color:"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]},j.hash)),N.length===0&&e.jsx(S,{children:"no known nodes for this prefix"})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"3"})," ","TYPE INFERENCE"]}),e.jsx(ae,{options:Pe,nextFn:"effectiveType()"}),e.jsx("div",{className:"ml-3 mt-1",children:e.jsx(i,{label:"effective",children:e.jsx(d,{fn:"effectiveType",value:p,color:p!=="unknown"?h!=="unknown"?"amber":"green":"zinc"})})})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"4"})," ","ROLE-TYPE SCRUB"]}),e.jsx("div",{className:"space-y-0.5 ml-3",children:P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:j.roleCompatible?"text-sys-green":"text-sys-red",children:j.roleCompatible?"✓":"✗"}),e.jsx("span",{className:`break-all text-[10px] ${j.roleCompatible?"":"line-through text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:j.roleCompatible?"zinc":"red",children:j.type||"unknown"}),e.jsx(S,{c:j.roleCompatible?"text-fg-muted":"text-sys-red",children:j.roleReason})]},j.hash))}),R.length>0&&e.jsxs("p",{className:"text-[10px] text-fg-muted mt-1 ml-3",children:[R.length," eliminated, ",b.length," surviving"]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"5"})," ","CANDIDATE SCORING"]}),b.length===0?e.jsx("p",{className:"text-fg-muted italic ml-3",children:"No surviving candidates"}):b.length===1?e.jsxs("div",{className:"ml-3 text-[11px]",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(S,{c:"text-sys-green",children:"→"}),e.jsx("span",{className:"break-all text-[10px]",children:b[0].hash}),b[0].name&&e.jsx(S,{c:"text-fg-muted ml-1",children:b[0].name})]}),e.jsx("p",{className:"text-fg-muted ml-4",children:"single survivor — scoring not needed"})]}):e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] ml-3",children:e.jsxs("span",{className:"font-mono text-fg-muted/50",children:[b.length," candidates scored…"]})}),e.jsx(V,{children:e.jsx("div",{className:"space-y-2 ml-3 mt-1",children:b.map(j=>{const Q=j.hash===u.hash;return e.jsxs("div",{className:`text-[11px] leading-relaxed rounded px-2 py-1 ${Q?"bg-sys-green/8 border border-sys-green/20":"bg-zinc-500/5"}`,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-0.5",children:[e.jsx(S,{c:Q?"text-sys-green":"text-fg-muted",children:Q?"→":" "}),e.jsx("span",{className:`break-all text-[10px] ${Q?"text-fg-primary":"text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:Q?"green":"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]}),e.jsxs("div",{className:"ml-4 flex flex-wrap gap-x-3 gap-y-0.5",children:[e.jsxs("span",{children:[e.jsx(S,{children:"zero_hop:"})," ",e.jsx(S,{c:j.zeroHop?"text-sys-green":"text-fg-muted",children:j.zeroHop?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.zeroHopScore),children:["+",j.zeroHopScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"recency:"})," ",e.jsx(S,{c:"text-fg-primary",children:mt(j.lastSeen)})," ",e.jsxs(M,{color:ee(j.recencyPoints),children:["+",j.recencyPoints.toFixed(1)]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"gps:"})," ",e.jsx(S,{c:j.hasGps?"text-sys-green":"text-fg-muted",children:j.hasGps?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.gpsScore),children:["+",j.gpsScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"adverts:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.advertCount})," ",e.jsxs(M,{color:ee(j.advertScore),children:["+",j.advertScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"topo:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.topoWidth})," ",e.jsxs(M,{color:ee(j.topoScore),children:["+",j.topoScore]})]})]}),e.jsxs("div",{className:"ml-4 mt-0.5",children:[e.jsx(S,{children:"score ≈"})," ",e.jsx(S,{c:"text-fg-primary font-bold",children:j.total.toFixed(1)})]})]},j.hash)})})})]})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-green font-bold",children:"✓"})," ","RESOLUTION"]}),e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"hash",children:u.hash?e.jsx(d,{fn:"resolved.hash",value:u.hash,color:"green"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"type",children:e.jsx(d,{fn:"resolved.type",value:u.type,color:u.confident?"green":"zinc"})}),e.jsx(i,{label:"name",children:u.name?e.jsx(d,{fn:"resolved.name",value:u.name,color:u.confident?"green":"amber"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"confident",children:e.jsx(S,{c:u.confident?"text-sys-green":"text-sys-red",children:String(u.confident)})}),e.jsxs(i,{label:"tier",children:[e.jsx(M,{color:C.tier<=2?"green":C.tier===3?"amber":"red",children:C.tier}),e.jsx(S,{c:"text-fg-primary ml-1",children:C.label})]})]})]})]}):e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx(S,{c:"text-sys-amber",children:"⚠ no src_hash"}),H&&e.jsx(d,{fn:"decrypt.senderName",value:H,color:"teal"}),u.confident?e.jsxs(S,{c:"text-sys-green",children:["→ resolved via ",C.label]}):e.jsx(S,{c:"text-sys-red",children:"ambiguous"})]})}),(()=>{const j=[{fn:"resolved.hash",value:u.hash??"null",group:"resolution",color:u.confident?"green":"zinc"},{fn:"resolved.type",value:u.type,group:"resolution",color:u.type!=="unknown"?u.confident?"green":"amber":"zinc"},{fn:"resolved.name",value:u.name??"null",group:"resolution",color:u.confident?"green":u.name?"amber":"zinc"},{fn:"resolved.confident",value:String(u.confident),group:"resolution",color:u.confident?"green":"red"}];return e.jsx(se,{tokens:j})})()]})})})}const Ut={id:"packet-parse",label:"Packet Parse",inputs:["rawPacket"],outputs:["parsedPacket","decoded","headerFields"],emits:[{fn:"routeType",group:"wire",color:"blue"},{fn:"payloadType",group:"wire",color:"blue"},{fn:"pathLength",group:"wire",color:"blue"},{fn:"version",group:"wire",color:"blue"}],async:!1,observatoryStage:0},qt={id:"enrichment",label:"Ingestion Enrichment",inputs:["parsedPacket"],outputs:["advertSender","channelHash","hopData","byteLength"],emits:[{fn:"_advertSender",group:"enrichment",color:"blue"},{fn:"_advertNodeType",group:"enrichment",color:"blue"},{fn:"_channelHash",group:"enrichment",color:"blue"},{fn:"_hopCount",group:"enrichment",color:"blue"},{fn:"_isZeroHop",group:"enrichment",color:"blue"},{fn:"_byteLength",group:"enrichment",color:"blue"}],async:!1,observatoryStage:1},Wt={id:"topology",label:"Topology Analysis",inputs:["packets","neighbors","srcHashResolver"],outputs:["edges","nodeMetrics","pathHealth","ghostNodes","centrality","loops"],emits:[{fn:"edges",group:"worker",color:"green"},{fn:"ghostNodes",group:"worker",color:"purple"},{fn:"loops",group:"analysis",color:"amber"},{fn:"nodeMetrics",group:"worker",color:"green"},{fn:"pathHealth",group:"worker",color:"green"},{fn:"centrality",group:"worker",color:"green"}],async:!0,worker:"topology.worker.ts",observatoryStage:2},Yt={id:"trace-enrichment",label:"Trace Link Quality",inputs:["packets","prefixLookup","srcHashResolver","edges","pathHealth","nodeMetrics"],outputs:["traceLinks","traceLinkSummary","traceDisambiguationFeedback"],emits:[{fn:"traceLinks.directed",group:"worker",color:"teal"},{fn:"traceLinks.bidir",group:"worker",color:"teal"},{fn:"traceSummary.meanSnr",group:"analysis",color:"green"},{fn:"traceSummary.medianSnr",group:"analysis",color:"zinc"},{fn:"traceSummary.confidence",group:"analysis",color:"zinc"},{fn:"feedback.confirmed",group:"worker",color:"teal"},{fn:"feedback.links",group:"worker",color:"teal"}],async:!1,observatoryStage:2},Zt={id:"disambiguation",label:"Source Disambiguation",inputs:["packets","neighbors","decodedMessages"],outputs:["srcHashResolverMap","neighborContext"],emits:[{fn:"resolvedHash",group:"resolution",color:"purple"},{fn:"resolvedName",group:"resolution",color:"purple"},{fn:"resolvedType",group:"resolution",color:"purple"},{fn:"confidence",group:"resolution",color:"green"}],async:!1,observatoryStage:3},Xt={id:"sparkline",label:"Sparkline Computation",inputs:["packets","neighbors"],outputs:["sparklineData"],emits:[{fn:"sparklines",group:"worker",color:"blue"}],async:!1},Qt={id:"decryption",label:"Channel Decryption",inputs:["packets","channelKeys"],outputs:["decodedMessages"],emits:[{fn:"decrypt.text",group:"crypto",color:"teal"},{fn:"decrypt.senderName",group:"crypto",color:"teal"},{fn:"decrypt.channelName",group:"crypto",color:"teal"},{fn:"decrypt.macCorrupted",group:"crypto",color:"amber"}],async:!0,worker:"decryption.worker.ts",observatoryStage:2},Jt={id:"decoded-content",label:"Decoded Content Policy",inputs:["decodedMessages","packets"],outputs:["decodedContent","contentInheritance"],emits:[{fn:"content.senderName",group:"crypto",color:"teal"},{fn:"content.text",group:"crypto",color:"teal"},{fn:"content.channelName",group:"crypto",color:"teal"},{fn:"content.corrupted",group:"crypto",color:"amber"},{fn:"content.inherited",group:"analysis",color:"purple"}],async:!1},Z=[Ut,qt,Wt,Yt,Zt,Xt,Qt,Jt],es=new Map(Z.map(t=>[t.id,t])),ts=new Map;for(const t of Z)for(const s of t.emits)ts.set(s.fn,t);const $e=new Map;for(const t of Z)for(const s of t.outputs)$e.set(s,t);function ss(){const t=new Map,s=new Map;for(const a of Z)t.has(a.id)||t.set(a.id,0),s.has(a.id)||s.set(a.id,new Set);for(const a of Z)for(const n of a.inputs){const l=$e.get(n);if(l&&l.id!==a.id){const o=s.get(l.id);o.has(a.id)||(o.add(a.id),t.set(a.id,(t.get(a.id)??0)+1))}}const r=[];for(const[a,n]of t)n===0&&r.push(a);const c=[];for(;r.length>0;){const a=r.shift(),n=es.get(a);n&&c.push(n);for(const l of s.get(a)??[]){const o=(t.get(l)??1)-1;t.set(l,o),o===0&&r.push(l)}}for(const a of Z)c.includes(a)||c.push(a);return c}const ns={0:"text-sys-green",1:"text-sys-blue",2:"text-sys-teal",3:"text-sys-purple"};function rs({stage:t,isActive:s,onClick:r}){const c=t.observatoryStage!=null?ns[t.observatoryStage]??"text-fg-muted":"text-fg-muted/40";return e.jsxs("button",{type:"button",onClick:r,className:` flex items-center gap-1.5 w-full px-1.5 py-1 rounded transition-base text-left ${s?"bg-sys-blue/10 ring-1 ring-sys-blue/30":"hover:bg-zinc-500/5"} `,children:[e.jsx("span",{className:`font-mono text-[9px] font-bold w-3 shrink-0 text-center ${c}`,children:t.observatoryStage??"·"}),e.jsx("span",{className:"font-mono text-[9px] text-fg-primary truncate flex-1",children:t.label}),t.async&&e.jsx("span",{className:"font-mono text-[7px] px-1 py-px rounded bg-sys-amber/15 text-sys-amber shrink-0 leading-tight",children:"⚡"}),t.emits.length>0&&e.jsxs("span",{className:"flex items-center gap-px shrink-0",children:[t.emits.slice(0,6).map(a=>{var n;return e.jsx("span",{className:`inline-block w-1 h-1 rounded-full ${((n=I[a.color])==null?void 0:n.dot)??"bg-zinc-500"}`,title:`${a.fn} [${a.group}]`},a.fn)}),t.emits.length>6&&e.jsxs("span",{className:"font-mono text-[7px] text-fg-muted/40 ml-0.5",children:["+",t.emits.length-6]})]})]})}function as({activeStageId:t,onStageClick:s}){const r=T.useMemo(()=>ss(),[]),c=T.useMemo(()=>{const a=new Map;for(const l of r){const o=l.observatoryStage??"other";let x=a.get(o);x||(x=[],a.set(o,x)),x.push(l)}const n=[];for(const l of[0,1,2,3,"other"]){const o=a.get(l);o!=null&&o.length&&n.push({key:l,stages:o})}return n},[r]);return e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono text-[8px] text-fg-muted/40 uppercase tracking-widest",children:"Pipeline DAG"}),e.jsxs("span",{className:"font-mono text-[8px] text-fg-muted/30",children:[r.length," stages"]})]}),e.jsx("div",{className:"space-y-px",children:c.map((a,n)=>e.jsxs("div",{children:[n>0&&e.jsx("div",{className:"flex items-center pl-2.5 py-px",children:e.jsx("svg",{width:"6",height:"8",viewBox:"0 0 6 8",className:"text-fg-muted/20",children:e.jsx("path",{d:"M3 0 L3 6 M1 4 L3 6 L5 4",fill:"none",stroke:"currentColor",strokeWidth:"1"})})}),a.stages.map(l=>e.jsx(rs,{stage:l,isActive:t===l.id,onClick:s?()=>s(l.id):void 0},l.id))]},String(a.key)))})]})}const ve=200,z={status:"idle",lastDurationMs:null,lastTs:null,runCount:0};function ls(t,s,r){var c,a,n;switch(t.type){case"transport:ws:state":s.wsState=((c=t.data)==null?void 0:c.state)??r.wsState;break;case"transport:ws:packet":s.wsPacketCount=(s.wsPacketCount??r.wsPacketCount)+1;break;case"transport:ws:stats":s.wsStatsCount=(s.wsStatsCount??r.wsStatsCount)+1;break;case"transport:rest:stats":s.restStatsCount=(s.restStatsCount??r.restStatsCount)+1;break;case"transport:rest:packets":s.restPacketsCount=(s.restPacketsCount??r.restPacketsCount)+1;break;case"store:packets:ws-merge":s.wsMergeCount=(s.wsMergeCount??r.wsMergeCount)+1;break;case"cascade:hydrate":s.lastHydrateTs=t.ts,s.hydrateCount=(s.hydrateCount??r.hydrateCount)+1;break;case"worker:topology:start":case"worker:sparkline:start":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z};s.workers={...o,[l]:{...x,status:"running",lastTs:t.ts}}}break;case"worker:topology:done":case"worker:sparkline:done":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z},m=((a=t.data)==null?void 0:a.ms)??null;s.workers={...o,[l]:{...x,status:"done",lastDurationMs:m,lastTs:t.ts,runCount:x.runCount+1}}}break;case"worker:decryption:batch":{const l=s.workers??r.workers,o=l.decryption??{...z},x=((n=t.data)==null?void 0:n.ms)??null;s.workers={...l,decryption:{...o,status:"done",lastDurationMs:x,lastTs:t.ts,runCount:o.runCount+1}}}break;case"pipeline:disambig:recompute":s.disambigCount=(s.disambigCount??r.disambigCount)+1;break}}const te=at(t=>({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null,_pushBatch:s=>t(r=>{if(s.length===0)return r;let c=[...r.events,...s];c.length>ve&&(c=c.slice(c.length-ve));const a={events:c,eventCount:r.eventCount+s.length};for(const n of s)ls(n,a,r);return a}),clear:()=>t({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null})}));let W=null,B=[],X=null;function os(){if(X=null,B.length===0)return;const t=B;B=[],te.getState()._pushBatch(t)}function cs(){W||(B=[],W=lt.subscribe(t=>{B.push(t),X===null&&(X=requestAnimationFrame(os))}))}function is(){if(W==null||W(),W=null,X!==null&&(cancelAnimationFrame(X),X=null),B.length>0){const t=B;B=[],te.getState()._pushBatch(t)}}function ds(t){switch(t){case"active":return"●";case"skipped":return"○";case"inferred":return"◌"}}function us(t){switch(t){case"active":return"text-sys-green";case"skipped":return"text-fg-muted/30";case"inferred":return"text-sys-amber"}}function ps(t){switch(t){case"transport":return"text-sys-blue";case"store":return"text-sys-amber";case"worker":return"text-sys-violet";case"pipeline":return"text-sys-green";case"consumer":return"text-sys-teal"}}function xs(t,s,r,c,a){var m,g;const n=[];if(a?n.push({label:"Hex Input",detail:"Manual hex — no transport",status:"skipped",lane:"transport"}):s.age==="live"||s.age==="recent"?n.push({label:"WebSocket",detail:"ws:packet → real-time push",status:"active",lane:"transport"}):n.push({label:"REST Poll",detail:"fetchPackets → packetCache.poll()",status:"inferred",lane:"transport"}),!a){n.push({label:"Cache Merge",detail:"packetCache.mergePacketsDirectly()",status:"active",lane:"store"});const u=s.age==="live"||s.age==="recent";n.push({label:"Flash",detail:u?"flashReceived++ → sidebar blink":"Not newest — no flash",status:u?"active":"skipped",lane:"store"}),n.push({label:"Hydrate Cascade",detail:"hydrateDownstream() → schedule workers",status:"active",lane:"store"})}const l=s.pathAvail||s.pathHopCount>0;n.push({label:"Topology Worker",detail:l?`Path data (${s.pathHopCount} hops) → edge extraction`:"No path data — still included in batch recompute",status:"active",lane:"worker"}),n.push({label:"Sparkline Worker",detail:`Contributes to sparkline for src ${((m=t.src_hash)==null?void 0:m.slice(0,4))??"??"}`,status:"active",lane:"worker"});const o=s.isGrp;n.push({label:"Decryption Worker",detail:o?`GRP_TXT → queued for channel key search${c?" → decrypted ✓":""}`:`${s.payloadTypeName} — not encrypted, skipped`,status:o?"active":"skipped",lane:"worker"}),n.push({label:"Source Disambiguation",detail:r?`→ ${r.name??((g=r.hash)==null?void 0:g.slice(0,8))??"?"} (${r.type}${r.confident?", confident":", ambiguous"})`:"Pending recompute",status:r?"active":"inferred",lane:"pipeline"}),s.isAdvert&&n.push({label:"ADVERT Discovery",detail:"pubkey → extended hash-to-type + name extraction",status:"active",lane:"pipeline"}),o&&(c!=null&&c.decoded)&&n.push({label:"Decoded Content Policy",detail:`macCorrupted=${c.decoded.macCorrupted?"true":"false"} → cross-hash inheritance`,status:"active",lane:"pipeline"});const x=["Packets","Dashboard","Statistics"];return l&&x.push("Map","Graph"),s.isTrace&&x.push("Trace Detail"),n.push({label:"Page Hydration",detail:x.join(", "),status:"active",lane:"consumer"}),n}const hs=[],ms=["transport","store","worker","pipeline","consumer"],gs={transport:"Transport",store:"Store",worker:"Workers",pipeline:"Pipeline",consumer:"Consumers"};function fs(t){return t.replace("transport:","").replace("store:packets:","").replace("cascade:","").replace("worker:","w:").replace("pipeline:","p:").replace("packet","pkt").replace("sparkline","spark").replace("topology","topo").replace("decryption","dec").replace("disambig","dis").replace("recompute","recomp")}function bs(t){return t.startsWith("transport:")?"text-sys-blue":t.startsWith("store:")||t.startsWith("cascade:")?"text-sys-amber":t.startsWith("worker:")?"text-sys-violet":t.startsWith("pipeline:")?"text-sys-green":"text-fg-muted"}const ys=T.memo(function({event:s}){const r=`${(s.ts/1e3).toFixed(1)}s`,c=s.data?Object.entries(s.data).map(([a,n])=>{var l;return`${a}=${typeof n=="number"?((l=n.toFixed)==null?void 0:l.call(n,1))??n:n}`}).join(" "):"";return e.jsxs("div",{className:"flex gap-2 text-[9px] font-mono leading-tight",children:[e.jsx("span",{className:"text-fg-muted/40 w-12 shrink-0 text-right",children:r}),e.jsx("span",{className:`w-20 shrink-0 ${bs(s.type)}`,children:fs(s.type)}),e.jsx("span",{className:"text-fg-muted/60 truncate",children:c})]})});function js({packet:t,pipeline:s,resolved:r,decrypted:c,isSynthetic:a,liveMode:n}){const[l,o]=T.useState(!1);T.useEffect(()=>{if(l)return cs(),()=>{is()}},[l]);const x=s==null?void 0:s.analysis,m=T.useMemo(()=>!t||!x?null:xs(t,x,r,c,a),[t,x,r,c,a]),g=T.useMemo(()=>{if(!m)return null;const h=new Map;for(const y of m){let p=h.get(y.lane);p||(p=[],h.set(y.lane,p)),p.push(y)}return h},[m]),u=te(h=>l?h.events:hs),v=te(h=>l?h.eventCount:0),N=te(h=>h.clear),f=T.useRef(null);T.useEffect(()=>{l&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[v,l]);const k=(m==null?void 0:m.filter(h=>h.status==="active").length)??0,$=(m==null?void 0:m.length)??0;return e.jsxs(G,{defaultOpen:!0,children:[e.jsx(K,{className:"text-[10px]",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-sys-green",children:"CFT"}),e.jsx("span",{className:"text-fg-muted/40",children:"Control Flow Trace"}),t&&e.jsxs("span",{className:"text-fg-muted/30",children:["— ",k,"/",$," stages active"]})]})}),e.jsx(V,{children:e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 space-y-3",children:[t?g?e.jsx("div",{className:"space-y-2",children:ms.map(h=>{const y=g.get(h);return y?e.jsxs("div",{children:[e.jsx("div",{className:`text-[8px] uppercase tracking-widest font-mono mb-0.5 ${ps(h)}`,children:gs[h]}),y.map((p,_)=>e.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] font-mono leading-snug ml-1",children:[e.jsx("span",{className:`shrink-0 ${us(p.status)}`,children:ds(p.status)}),e.jsx("span",{className:"text-fg-primary",children:p.label}),e.jsx("span",{className:"text-fg-muted/50 truncate",children:p.detail})]},_))]},h):null})}):null:e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-2 text-center",children:"Select a packet to trace its flow"}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(h=>!h),className:`px-2 py-0.5 rounded text-[9px] font-mono transition-colors ${l?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:l?"● LIVE":"○ LIVE"}),e.jsx("span",{className:"text-[9px] text-fg-muted/40 font-mono",children:l?`${v} events`:"Subscribe to all pipeline events"}),l&&e.jsx("button",{onClick:N,className:"text-[9px] text-fg-muted/40 hover:text-fg-muted font-mono transition-colors ml-auto",children:"clear"})]}),l&&e.jsx("div",{ref:f,className:"max-h-32 overflow-y-auto space-y-px",children:u.length===0?e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-1 text-center",children:"Waiting for events…"}):u.map((h,y)=>e.jsx(ys,{event:h},`${h.ts}-${y}`))})]})})]})}function vs(t){const s=Ne(t.type??t.payload_type??-1).padEnd(7),r=t.packet_hash.slice(0,8),c=(t.src_hash??"—").replace(/^0x/i,"").slice(0,4).toUpperCase(),a=t._hopCount!=null?`${t._hopCount}h`:"",n=ut(t.timestamp);return`${r} ${s} ←${c} ${t.rssi}dBm ${a} ${n}`}function _s(){const t=ot(),s=ct(),r=it(),c=(s==null?void 0:s.neighbors)??{},a=Y(b=>b.resolveSource),n=Y(b=>b.config),l=Y(b=>b.setConfig),[o,x]=T.useState(-1),m=T.useMemo(()=>{let b=t;return o!==-1&&(b=t.filter(w=>(w.type??w.payload_type)===o)),b.slice(-50).reverse()},[t,o]),[g,u]=T.useState(""),[v,N]=T.useState(""),[f,k]=T.useState(!1),$=T.useRef(r);T.useEffect(()=>{f&&r!==$.current&&m.length>0&&(u(m[0].packet_hash),N("")),$.current=r},[r,f,m]),T.useEffect(()=>{!g&&m.length>0&&!v&&u(m[0].packet_hash)},[g,m,v]);const h=T.useMemo(()=>v.trim()?null:m.find(b=>b.packet_hash===g)??null,[g,m,v]),y=T.useMemo(()=>{const b=v.replace(/\s+/g,"").trim();return b?{packet_hash:"manual-hex-input",timestamp:0,rssi:0,snr:0,transmitted:!1,drop_reason:null,is_duplicate:!1,raw_packet:b}:null},[v]),p=h??y,_=!!v.trim(),H=v.trim().replace(/\s+/g,"")||(p==null?void 0:p.raw_packet),C=Ct(p,H,t),D=(C==null?void 0:C.enrichment)??He,L=Ce((p==null?void 0:p.packet_hash)??""),P=T.useRef(0),R=T.useMemo(()=>{if(!p)return null;const b=performance.now(),w=a(p);return P.current=performance.now()-b,w},[p,a]);return e.jsxs("div",{className:"max-w-[960px] mx-auto",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h1",{className:"text-sm font-bold text-fg-primary tracking-wide font-mono",children:"PACKET OBSERVATORY"}),e.jsx("p",{className:"text-[11px] text-fg-muted font-mono",children:"Pipeline introspection — select a packet to trace its journey"})]}),e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 mb-3",children:[e.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[e.jsxs("select",{value:o,onChange:b=>{x(Number(b.target.value)),u("")},className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-36",children:[e.jsx("option",{value:-1,children:"ALL TYPES"}),Object.entries(dt).map(([b,w])=>e.jsxs("option",{value:Number(b),children:["0x",Number(b).toString(16).toUpperCase().padStart(2,"0")," ",w]},b))]}),e.jsxs("select",{value:g,onChange:b=>{u(b.target.value),N("")},className:"surface-input flex-1 min-w-0 px-2 py-1 rounded text-[11px] font-mono text-fg-primary truncate",children:[m.map((b,w)=>e.jsx("option",{value:b.packet_hash,children:vs(b)},`${b.packet_hash}-${w}`)),m.length===0&&e.jsxs("option",{value:"",children:["No packets",o!==-1?" matching filter":" loaded"]})]}),e.jsx("button",{onClick:()=>k(b=>!b),className:`px-2 py-1 rounded text-[11px] font-mono transition-colors shrink-0 ${f?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:f?"● LIVE":"○ LIVE"})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] text-fg-muted/50 hover:text-fg-muted mt-1.5",children:e.jsx("span",{className:"font-mono",children:"Paste hex…"})}),e.jsx(V,{children:e.jsx("textarea",{value:v,onChange:b=>N(b.target.value),placeholder:"Paste raw packet hex (overrides dropdown)",rows:2,className:"surface-input w-full mt-1 px-2 py-1 rounded text-[11px] font-mono text-fg-primary resize-y"})})]})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[11px] mb-3 w-full",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-fg-muted/50",children:"⚙"}),e.jsx("span",{className:"text-fg-muted/50",children:"Pipeline Config & Dev Tools"}),e.jsxs("span",{className:"text-fg-muted/30 text-[10px]",children:["disambig=",n.disambiguationEnabled?"on":"off"," mac=",n.macCorruptedPolicy," decay=",n.recencyDecayHours,"h"]})]})}),e.jsx(V,{children:e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3",children:[e.jsx("h2",{className:"text-[10px] text-fg-muted/50 uppercase tracking-widest font-mono mb-2",children:"Pipeline Config"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Disambiguation"}),e.jsx("button",{onClick:()=>l({disambiguationEnabled:!n.disambiguationEnabled}),className:`px-2 py-0.5 rounded text-[11px] font-mono transition-colors ${n.disambiguationEnabled?"bg-sys-green/20 text-sys-green":"bg-sys-red/20 text-sys-red"}`,children:n.disambiguationEnabled?"● ON":"○ OFF"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"MAC policy"}),e.jsxs("select",{value:n.macCorruptedPolicy,onChange:b=>l({macCorruptedPolicy:b.target.value}),className:"surface-input px-1.5 py-0.5 rounded text-[11px] font-mono text-fg-primary",children:[e.jsx("option",{value:"strict",children:"strict (drop)"}),e.jsx("option",{value:"name-only",children:"name-only"}),e.jsx("option",{value:"permissive",children:"permissive"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Recency decay"}),e.jsx("input",{type:"range",min:1,max:48,step:1,value:n.recencyDecayHours,onChange:b=>l({recencyDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-8 text-right",children:[n.recencyDecayHours,"h"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Zero-hop decay"}),e.jsx("input",{type:"range",min:12,max:168,step:6,value:n.zeroHopDecayHours,onChange:b=>l({zeroHopDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-10 text-right",children:[n.zeroHopDecayHours,"h"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(js,{packet:p,pipeline:C,resolved:R,decrypted:L??null,isSynthetic:_,liveMode:f}),e.jsx(as,{})]})]})})]}),p?e.jsxs("div",{className:"space-y-1",children:[e.jsx(Ht,{packet:p,isSynthetic:_}),e.jsx(At,{packet:p,pipeline:C,rawHex:H,traceTagIndex:(C==null?void 0:C.traceTagIndex)??new Map,neighbors:c}),e.jsx(Bt,{packet:p,decrypted:L??void 0,pipeline:C}),e.jsx(Vt,{packet:p,pipeline:C,resolved:R,decrypted:L??void 0,resolveTimeMs:P.current,neighbors:c,advertName:D.advertName})]}):e.jsx("div",{className:"surface-base rounded-lg border border-edge-subtle p-8 text-center",children:e.jsx("p",{className:"text-fg-muted text-xs",children:"Select a packet from the dropdown or paste hex above"})})]})}export{_s as default}; diff --git a/frontend/dist/assets/Packets-BMtxtCyl.js b/frontend/dist/assets/Packets-BJYka-4Q.js similarity index 96% rename from frontend/dist/assets/Packets-BMtxtCyl.js rename to frontend/dist/assets/Packets-BJYka-4Q.js index 23851070..f9f088e8 100644 --- a/frontend/dist/assets/Packets-BMtxtCyl.js +++ b/frontend/dist/assets/Packets-BJYka-4Q.js @@ -1,4 +1,4 @@ -import{r as c,aT as _,aU as dt,aV as Te,aW as We,aX as ut,aY as ce,aZ as Ye,a_ as pt,a$ as mt,b0 as bt,b1 as ge,b2 as ft,b3 as vt,b4 as Oe,b5 as U,b6 as xt,b7 as ke,b8 as X,b9 as re,ba as $e,bb as Ee,bc as gt,bd as Xe,be as Je,bf as he,bg as Pe,bh as ye,bi as ht,bj as yt,bk as St,bl as Re,bm as Ct,bn as Ot,bo as Ce,bp as wt,bq as Nt,br as jt,bs as ie,bt as Et,bu as W,bv as Pt,bw as It,bx as Tt,by as kt,bz as $t,bA as Rt,bB as Mt,bC as Ft,bD as Dt,bE as _t,bF as At,bG as Me,e as Vt,j as n,c as J,aE as Lt,a0 as zt,bH as Bt,a1 as Ht,bI as Ut,Q as Gt,a6 as qt,ac as Kt,ad as Wt,aA as Yt,aR as Xt,ae as Fe,P as De,bJ as _e,bK as Ae,B as Ne,bL as Ve,a7 as Le,bM as ze,a8 as Jt}from"./index-i0xzpXop.js";import{c as Qt}from"./node-types-rVJPSDxd.js";import{u as Zt}from"./chevron-up-BVzq549_.js";import{c as H,p as eo,a as ve,f as Be,b as to,L as oo,S as me,s as so,g as ao,u as no,d as lo}from"./element-movement-BD3SL-GU.js";import{F as io,y as ro,R as co,T as uo,w as He,A as po}from"./map-pin-C051lstq.js";import{F as mo}from"./use-tree-walker-B4ov8RnQ.js";import{u as Ue,s as bo}from"./frozen-D4mEoVft.js";import{g as Qe,u as fo,P as vo}from"./PacketList-CbchJDnI.js";import{useGetDecodedContent as xo,useResolveSource as go}from"./usePipelineStore-BqTRxIqB.js";import{c as ho,a as yo,D as So,b as Co}from"./AnalyzerFilterPanel-DPT1vjKV.js";import{u as Oo,r as wo}from"./consumer-registry-5uDLywpC.js";import{A as No}from"./arrow-down-SlBTV0Nc.js";import{A as jo}from"./arrow-right-BZS-u7CW.js";import{P as Eo,a as Po,B as Io,C as Ge}from"./PageLayout-B4RCJ-XT.js";import{T as To,M as ko}from"./MqttModeBadge-Dhi11STL.js";import{F as qe}from"./funnel-CitfWrkD.js";import{R as $o}from"./route-Df1YhBTq.js";import{S as Ro}from"./search-DsTk_ZsM.js";import"./primitives-QKpQyH4U.js";import"./badge-colors-Dl76Mz8m.js";import"./chat-utils-BdAUDg3r.js";import"./SignalIndicator-D8uG_rJC.js";import"./arrow-up-D_sZeyuo.js";import"./chevron-right-DsOuIRi8.js";import"./payload-detail-Bh2WvEK0.js";import"./circle-question-mark-CJCLhkb9.js";import"./layers-LQ5jNXOV.js";import"./hash-CyK-Kad6.js";import"./clock-F-4SScS_.js";import"./activity-DQoaymFw.js";import"./database-gsjgeKE3.js";import"./useMapViewStore-DZlzQmak.js";import"./index-BCuGA4PV.js";import"./index-CBEGRHd5.js";import"./shield-CxmFjMfw.js";import"./zap-tuTM-Jsw.js";function Ze(e){let o=c.useRef({value:"",selectionStart:null,selectionEnd:null});return dt(e,"blur",t=>{let l=t.target;Te(l)&&(o.current={value:l.value,selectionStart:l.selectionStart,selectionEnd:l.selectionEnd})}),_(()=>{if(!We(e)&&Te(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==o.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:l}=o.current;t!==null&&l!==null&&e.setSelectionRange(t,l)}o.current={value:"",selectionStart:null,selectionEnd:null}}})}var Mo=Object.defineProperty,Fo=(e,o,t)=>o in e?Mo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,Ke=(e,o,t)=>(Fo(e,typeof o!="symbol"?o+"":o,t),t),S=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(S||{}),Q=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Q||{}),oe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(oe||{}),et=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(et||{});function je(e,o=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,l=o(e.options.slice()),a=l.length>0&&l[0].dataRef.current.order!==null?l.sort((d,x)=>d.dataRef.current.order-x.dataRef.current.order):mt(l,d=>d.dataRef.current.domRef.current),i=t?a.indexOf(t):null;return i===-1&&(i=null),{options:a,activeOptionIndex:i}}let Do={1(e){var o;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===1)return e;let t=e.inputElement?ve.Tracked(to(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:t,__demoMode:!1}},0(e){var o,t;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let l=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(l!==-1)return{...e,activeOptionIndex:l,comboboxState:0,__demoMode:!1,inputPositionState:ve.Idle}}return{...e,comboboxState:0,inputPositionState:ve.Idle,__demoMode:!1}},3(e,o){return e.isTyping===o.isTyping?e:{...e,isTyping:o.isTyping}},2(e,o){var t,l,a,i;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((l=e.dataRef.current)!=null&&l.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:f,disabled:y}=e.virtual,N=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>f,resolveActiveIndex:()=>{var b,m;return(m=(b=e.activeOptionIndex)!=null?b:f.findIndex(P=>!y(P)))!=null?m:null},resolveDisabled:y,resolveId(){throw new Error("Function not implemented.")}}),C=(a=o.trigger)!=null?a:2;return e.activeOptionIndex===N&&e.activationTrigger===C?e:{...e,activeOptionIndex:N,activationTrigger:C,isTyping:!1,__demoMode:!1}}let d=je(e);if(d.activeOptionIndex===null){let f=d.options.findIndex(y=>!y.dataRef.current.disabled);f!==-1&&(d.activeOptionIndex=f)}let x=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>d.options,resolveActiveIndex:()=>d.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled}),p=(i=o.trigger)!=null?i:2;return e.activeOptionIndex===x&&e.activationTrigger===p?e:{...e,...d,isTyping:!1,activeOptionIndex:x,activationTrigger:p,__demoMode:!1}},4:(e,o)=>{var t,l,a,i;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,o.payload]};let d=o.payload,x=je(e,f=>(f.push(d),f));e.activeOptionIndex===null&&(a=(l=e.dataRef.current).isSelected)!=null&&a.call(l,o.payload.dataRef.current.value)&&(x.activeOptionIndex=x.options.indexOf(d));let p={...e,...x,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(p.activeOptionIndex=0),p},5:(e,o)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(a=>a.id!==o.id)};let l=je(e,a=>{let i=a.findIndex(d=>d.id===o.id);return i!==-1&&a.splice(i,1),a});return{...e,...l,activationTrigger:2}},6:(e,o)=>e.defaultToFirstOption===o.value?e:{...e,defaultToFirstOption:o.value},7:(e,o)=>e.activationTrigger===o.trigger?e:{...e,activationTrigger:o.trigger},8:(e,o)=>{var t,l;if(e.virtual===null)return{...e,virtual:{options:o.options,disabled:(t=o.disabled)!=null?t:()=>!1}};if(e.virtual.options===o.options&&e.virtual.disabled===o.disabled)return e;let a=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=o.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?a=i:a=null}return{...e,activeOptionIndex:a,virtual:{options:o.options,disabled:(l=o.disabled)!=null?l:()=>!1}}},9:(e,o)=>e.inputElement===o.element?e:{...e,inputElement:o.element},10:(e,o)=>e.buttonElement===o.element?e:{...e,buttonElement:o.element},11:(e,o)=>e.optionsElement===o.element?e:{...e,optionsElement:o.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:ve.Moved}}};class Ie extends ut{constructor(o){super(o),Ke(this,"actions",{onChange:t=>{let{onChange:l,compare:a,mode:i,value:d}=this.state.dataRef.current;return ce(i,{0:()=>l==null?void 0:l(t),1:()=>{let x=d.slice(),p=x.findIndex(f=>a(f,t));return p===-1?x.push(t):x.splice(p,1),l==null?void 0:l(x)}})},registerOption:(t,l)=>(this.send({type:4,payload:{id:t,dataRef:l}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(l.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,l)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:l})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,l;this.send({type:1}),this.send({type:6,value:!1}),(l=(t=this.state.dataRef.current).onClose)==null||l.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:l}=this.state.options[t];this.actions.onChange(l.current.value)}this.actions.goToOption({focus:H.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),Ke(this,"selectors",{activeDescendantId:t=>{var l,a;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(a=t.options.find(d=>!d.dataRef.current.disabled&&t.dataRef.current.compare(d.dataRef.current.value,t.virtual.options[i])))==null?void 0:a.id:(l=t.options[i])==null?void 0:l.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:a,disabled:i}=t.virtual,d=a.findIndex(x=>{var p;return!((p=i==null?void 0:i(x))!=null&&p)});if(d!==-1)return d}let l=t.options.findIndex(a=>!a.dataRef.current.disabled);if(l!==-1)return l}return t.activeOptionIndex},activeOption:t=>{var l,a;let i=this.selectors.activeOptionIndex(t);return i===null?null:t.virtual?t.virtual.options[i??0]:(a=(l=t.options[i])==null?void 0:l.dataRef.current.value)!=null?a:null},isActive:(t,l,a)=>{var i;let d=this.selectors.activeOptionIndex(t);return d===null?!1:t.virtual?d===t.dataRef.current.calculateIndex(l):((i=t.options[d])==null?void 0:i.id)===a},shouldScrollIntoView:(t,l,a)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,l,a)),didInputMove(t){return t.inputPositionState.kind==="Moved"}});{let t=this.state.id,l=Ye.get(null);this.disposables.add(l.on(pt.Push,a=>{!l.selectors.isTop(a,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>l.actions.push(t)),this.on(1,()=>l.actions.pop(t))}this.disposables.group(t=>{this.on(1,l=>{l.inputElement&&(t.dispose(),t.add(eo(l.inputElement,l.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:o,virtual:t=null,__demoMode:l=!1}){var a;return new Ie({id:o,dataRef:{current:{}},comboboxState:l?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(a=t.disabled)!=null?a:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:l,inputPositionState:ve.Idle})}reduce(o,t){return ce(t.type,Do,o,t)}}const tt=c.createContext(null);function Se(e){let o=c.useContext(tt);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ot),t}return o}function ot({id:e,virtual:o=null,__demoMode:t=!1}){let l=c.useMemo(()=>Ie.new({id:e,virtual:o,__demoMode:t}),[]);return bt(()=>l.dispose()),l}let xe=c.createContext(null);xe.displayName="ComboboxDataContext";function de(e){let o=c.useContext(xe);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return o}let st=c.createContext(null);function _o(e){let o=Se("VirtualProvider"),t=de("VirtualProvider"),{options:l}=t.virtual,a=U(o,b=>b.optionsElement),[i,d]=c.useMemo(()=>{let b=a;if(!b)return[0,0];let m=window.getComputedStyle(b);return[parseFloat(m.paddingBlockStart||m.paddingTop),parseFloat(m.paddingBlockEnd||m.paddingBottom)]},[a]),x=Zt({enabled:l.length!==0,scrollPaddingStart:i,scrollPaddingEnd:d,count:l.length,estimateSize(){return 40},getScrollElement(){return o.state.optionsElement},overscan:12}),[p,f]=c.useState(0);ie(()=>{f(b=>b+1)},[l]);let y=x.getVirtualItems(),N=U(o,b=>b.activationTrigger===oe.Pointer),C=U(o,o.selectors.activeOptionIndex);return y.length===0?null:W.createElement(st.Provider,{value:x},W.createElement("div",{style:{position:"relative",width:"100%",height:`${x.getTotalSize()}px`},ref:b=>{b&&(N||C!==null&&l.length>C&&x.scrollToIndex(C))}},y.map(b=>{var m;return W.createElement(c.Fragment,{key:b.key},W.cloneElement((m=e.children)==null?void 0:m.call(e,{...e.slot,option:l[b.index]}),{key:`${p}-${b.key}`,"data-index":b.index,"aria-setsize":l.length,"aria-posinset":b.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${b.start}px)`,overflowAnchor:"none"}}))})))}let Ao=c.Fragment;function Vo(e,o){let t=c.useId(),l=$t(),{value:a,defaultValue:i,onChange:d,form:x,name:p,by:f,invalid:y=!1,disabled:N=l||!1,onClose:C,__demoMode:b=!1,multiple:m=!1,immediate:P=!1,virtual:u=null,nullable:M,...h}=e,O=Rt(i),[T=m?[]:void 0,L]=Mt(a,d,O),j=ot({id:t,virtual:u,__demoMode:b}),A=c.useRef({static:!1,hold:!1}),$=lo(f),F=_(I=>u?f===null?u.options.indexOf(I):u.options.findIndex(ne=>$(ne,I)):j.state.options.findIndex(ne=>$(ne.dataRef.current.value,I))),G=c.useCallback(I=>ce(V.mode,{[Q.Multi]:()=>T.some(ne=>$(ne,I)),[Q.Single]:()=>$(T,I)}),[T]),q=U(j,I=>I.virtual),E=_(()=>C==null?void 0:C()),V=c.useMemo(()=>({__demoMode:b,immediate:P,optionsPropsRef:A,value:T,defaultValue:O,disabled:N,invalid:y,mode:m?Q.Multi:Q.Single,virtual:u?q:null,onChange:L,isSelected:G,calculateIndex:F,compare:$,onClose:E}),[b,P,A,T,O,N,y,m,u,q,L,G,F,$,E]);ie(()=>{var I;u&&j.send({type:et.UpdateVirtualConfiguration,options:u.options,disabled:(I=u.disabled)!=null?I:null})},[u,u==null?void 0:u.options,u==null?void 0:u.disabled]),ie(()=>{j.state.dataRef.current=V},[V]);let[z,w,Y,le]=U(j,I=>[I.comboboxState,I.buttonElement,I.inputElement,I.optionsElement]),Z=Ye.get(null),ee=U(Z,c.useCallback(I=>Z.selectors.isTop(I,t),[Z,t]));Ft(ee,[w,Y,le],()=>j.actions.closeCombobox());let se=U(j,j.selectors.activeOptionIndex),ae=U(j,j.selectors.activeOption),v=he({open:z===S.Open,disabled:N,invalid:y,activeIndex:se,activeOption:ae,value:T}),[K,R]=Dt(),D=o===null?{}:{ref:o},k=c.useCallback(()=>{if(O!==void 0)return L==null?void 0:L(O)},[L,O]),B=ye();return W.createElement(R,{value:K,props:{htmlFor:Y==null?void 0:Y.id},slot:{open:z===S.Open,disabled:N}},W.createElement(po,null,W.createElement(xe.Provider,{value:V},W.createElement(tt.Provider,{value:j},W.createElement(_t,{value:ce(z,{[S.Open]:Ce.Open,[S.Closed]:Ce.Closed})},p!=null&&W.createElement(At,{disabled:N,data:T!=null?{[p]:T}:{},form:x,onReset:k}),B({ourProps:D,theirProps:h,slot:v,defaultTag:Ao,name:"Combobox"}))))))}let Lo="input";function zo(e,o){var t,l;let a=Se("Combobox.Input"),i=de("Combobox.Input"),d=c.useId(),x=vt(),{id:p=x||`headlessui-combobox-input-${d}`,onChange:f,displayValue:y,disabled:N=i.disabled||!1,autoFocus:C=!1,type:b="text",...m}=e,P=c.useRef(null),u=Oe(P,o,io(),a.actions.setInputElement),[M,h]=U(a,v=>[v.comboboxState,v.isTyping]),O=xt(),T=_(()=>{a.actions.onChange(null),a.state.optionsElement&&(a.state.optionsElement.scrollTop=0),a.actions.goToOption({focus:H.Nothing})}),L=c.useMemo(()=>{var v;return typeof y=="function"&&i.value!==void 0?(v=y(i.value))!=null?v:"":typeof i.value=="string"?i.value:""},[i.value,y]);ke(([v,K],[R,D])=>{if(a.state.isTyping)return;let k=P.current;k&&((D===S.Open&&K===S.Closed||v!==R)&&(k.value=v),requestAnimationFrame(()=>{if(a.state.isTyping||!k||We(k))return;let{selectionStart:B,selectionEnd:I}=k;Math.abs((I??0)-(B??0))===0&&B===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[L,M,h]),ke(([v],[K])=>{if(v===S.Open&&K===S.Closed){if(a.state.isTyping)return;let R=P.current;if(!R)return;let D=R.value,{selectionStart:k,selectionEnd:B,selectionDirection:I}=R;R.value="",R.value=D,I!==null?R.setSelectionRange(k,B,I):R.setSelectionRange(k,B)}},[M]);let j=c.useRef(!1),A=_(()=>{j.current=!0}),$=_(()=>{O.nextFrame(()=>{j.current=!1})}),F=_(v=>{switch(a.actions.setIsTyping(!0),v.key){case X.Enter:if(a.state.comboboxState!==S.Open||j.current)return;if(v.preventDefault(),v.stopPropagation(),a.selectors.activeOptionIndex(a.state)===null){a.actions.closeCombobox();return}a.actions.selectActiveOption(),i.mode===Q.Single&&a.actions.closeCombobox();break;case X.ArrowDown:return v.preventDefault(),v.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Next}),[S.Closed]:()=>a.actions.openCombobox()});case X.ArrowUp:return v.preventDefault(),v.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Previous}),[S.Closed]:()=>{re.flushSync(()=>a.actions.openCombobox()),i.value||a.actions.goToOption({focus:H.Last})}});case X.Home:if(a.state.comboboxState===S.Closed||v.shiftKey)break;return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.First});case X.PageUp:return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.First});case X.End:if(a.state.comboboxState===S.Closed||v.shiftKey)break;return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.PageDown:return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.Escape:return a.state.comboboxState!==S.Open?void 0:(v.preventDefault(),a.state.optionsElement&&!i.optionsPropsRef.current.static&&v.stopPropagation(),i.mode===Q.Single&&i.value===null&&T(),a.actions.closeCombobox());case X.Tab:if(a.actions.setIsTyping(!1),a.state.comboboxState!==S.Open)return;i.mode===Q.Single&&a.state.activationTrigger!==oe.Focus&&a.actions.selectActiveOption(),a.actions.closeCombobox();break}}),G=_(v=>{f==null||f(v),i.mode===Q.Single&&v.target.value===""&&T(),a.actions.openCombobox()}),q=_(v=>{var K,R,D;let k=(K=v.relatedTarget)!=null?K:$e.find(B=>B!==v.currentTarget);if(!((R=a.state.optionsElement)!=null&&R.contains(k))&&!((D=a.state.buttonElement)!=null&&D.contains(k))&&a.state.comboboxState===S.Open)return v.preventDefault(),i.mode===Q.Single&&i.value===null&&T(),a.actions.closeCombobox()}),E=_(v=>{var K,R,D;let k=(K=v.relatedTarget)!=null?K:$e.find(B=>B!==v.currentTarget);(R=a.state.buttonElement)!=null&&R.contains(k)||(D=a.state.optionsElement)!=null&&D.contains(k)||i.disabled||i.immediate&&a.state.comboboxState!==S.Open&&O.microTask(()=>{re.flushSync(()=>a.actions.openCombobox()),a.actions.setActivationTrigger(oe.Focus)})}),V=Ee(),z=gt(),{isFocused:w,focusProps:Y}=Xe({autoFocus:C}),{isHovered:le,hoverProps:Z}=Je({isDisabled:N}),ee=U(a,v=>v.optionsElement),se=he({open:M===S.Open,disabled:N,invalid:i.invalid,hover:le,focus:w,autofocus:C}),ae=Pe({ref:u,id:p,role:"combobox",type:b,"aria-controls":ee==null?void 0:ee.id,"aria-expanded":M===S.Open,"aria-activedescendant":U(a,a.selectors.activeDescendantId),"aria-labelledby":V,"aria-describedby":z,"aria-autocomplete":"list",defaultValue:(l=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?y==null?void 0:y(i.defaultValue):null)!=null?l:i.defaultValue,disabled:N||void 0,autoFocus:C,onCompositionStart:A,onCompositionEnd:$,onKeyDown:F,onChange:G,onFocus:E,onBlur:q},Y,Z);return ye()({ourProps:ae,theirProps:m,slot:se,defaultTag:Lo,name:"Combobox.Input"})}let Bo="button";function Ho(e,o){let t=Se("Combobox.Button"),l=de("Combobox.Button"),[a,i]=c.useState(null),d=Oe(o,i,t.actions.setButtonElement),x=c.useId(),{id:p=`headlessui-combobox-button-${x}`,disabled:f=l.disabled||!1,autoFocus:y=!1,...N}=e,[C,b,m]=U(t,E=>[E.comboboxState,E.inputElement,E.optionsElement]),P=Ze(b),u=C===S.Open;oo(u,{trigger:a,action:c.useCallback(E=>{if(a!=null&&a.contains(E.target))return me.Ignore;if(b!=null&&b.contains(E.target))return me.Ignore;let V=E.target.closest('[role="option"]:not([data-disabled])');return ht(V)?me.Select(V):m!=null&&m.contains(E.target)?me.Ignore:me.Close},[a,b,m]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let M=_(E=>{switch(E.key){case X.Space:case X.Enter:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&re.flushSync(()=>t.actions.openCombobox()),P();return;case X.ArrowDown:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.First})),P();return;case X.ArrowUp:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.Last})),P();return;case X.Escape:if(t.state.comboboxState!==S.Open)return;E.preventDefault(),t.state.optionsElement&&!l.optionsPropsRef.current.static&&E.stopPropagation(),re.flushSync(()=>t.actions.closeCombobox()),P();return;default:return}}),h=so(()=>{t.state.comboboxState===S.Open?t.actions.closeCombobox():t.actions.openCombobox(),P()}),O=Ee([p]),{isFocusVisible:T,focusProps:L}=Xe({autoFocus:y}),{isHovered:j,hoverProps:A}=Je({isDisabled:f}),{pressed:$,pressProps:F}=yt({disabled:f}),G=he({open:C===S.Open,active:$||C===S.Open,disabled:f,invalid:l.invalid,value:l.value,hover:j,focus:T}),q=Pe({ref:d,id:p,type:St(e,a),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":C===S.Open,"aria-labelledby":O,disabled:f||void 0,autoFocus:y,onKeyDown:M},h,L,A,F);return ye()({ourProps:q,theirProps:N,slot:G,defaultTag:Bo,name:"Combobox.Button"})}let Uo="div",Go=Me.RenderStrategy|Me.Static;function qo(e,o){var t,l,a;let i=c.useId(),{id:d=`headlessui-combobox-options-${i}`,hold:x=!1,anchor:p,portal:f=!1,modal:y=!0,transition:N=!1,...C}=e,b=Se("Combobox.Options"),m=de("Combobox.Options"),P=ro(p);P&&(f=!0);let[u,M]=co(P),[h,O]=c.useState(null),T=uo(),L=Oe(o,P?u:null,b.actions.setOptionsElement,O),[j,A,$,F,G]=U(b,s=>[s.comboboxState,s.inputElement,s.buttonElement,s.optionsElement,s.activationTrigger]),q=Re(A||$),E=Re(F),V=Ct(),[z,w]=Ot(N,h,V!==null?(V&Ce.Open)===Ce.Open:j===S.Open);wt(z,A,b.actions.closeCombobox);let Y=m.__demoMode?!1:y&&j===S.Open;Nt(Y,E);let le=m.__demoMode?!1:y&&j===S.Open;jt(le,{allowed:c.useCallback(()=>[A,$,F],[A,$,F])});let Z=U(b,b.selectors.didInputMove)?!1:z;ie(()=>{var s;m.optionsPropsRef.current.static=(s=e.static)!=null?s:!1},[m.optionsPropsRef,e.static]),ie(()=>{m.optionsPropsRef.current.hold=x},[m.optionsPropsRef,x]),mo(j===S.Open,{container:F,accept(s){return s.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:s.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(s){s.setAttribute("role","none")}});let ee=Ee([$==null?void 0:$.id]),se=he({open:j===S.Open,option:void 0}),ae=_(()=>{b.actions.setActivationTrigger(oe.Pointer)}),v=_(s=>{s.preventDefault(),b.actions.setActivationTrigger(oe.Pointer)}),K=Pe(P?T():{},{"aria-labelledby":ee,role:"listbox","aria-multiselectable":m.mode===Q.Multi?!0:void 0,id:d,ref:L,style:{...C.style,...M,"--input-width":He(z,A,!0).width,"--button-width":He(z,$,!0).width},onWheel:G===oe.Pointer?void 0:ae,onMouseDown:v,...Et(w)}),R=z&&j===S.Closed&&!e.static,D=Ue(R,(t=m.virtual)==null?void 0:t.options),k=Ue(R,m.value),B=c.useCallback(s=>m.compare(k,s),[m.compare,k]),I=c.useMemo(()=>{if(!m.virtual)return m;if(D===void 0)throw new Error("Missing `options` in virtual mode");return D!==m.virtual.options?{...m,virtual:{...m.virtual,options:D}}:m},[m,D,(l=m.virtual)==null?void 0:l.options]);m.virtual&&Object.assign(C,{children:W.createElement(xe.Provider,{value:I},W.createElement(_o,{slot:se},C.children))});let ne=ye(),we=c.useMemo(()=>m.mode===Q.Multi?m:{...m,isSelected:B},[m,B]);return W.createElement(Pt,{enabled:f?e.static||z:!1,ownerDocument:q},W.createElement(xe.Provider,{value:we},ne({ourProps:K,theirProps:{...C,children:W.createElement(bo,{freeze:R},typeof C.children=="function"?(a=C.children)==null?void 0:a.call(C,se):C.children)},slot:se,defaultTag:Uo,features:Go,visible:Z,name:"Combobox.Options"})))}let Ko="div";function Wo(e,o){var t,l,a;let i=de("Combobox.Option"),d=Se("Combobox.Option"),x=c.useId(),{id:p=`headlessui-combobox-option-${x}`,value:f,disabled:y=(a=(l=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:l.call(t,f))!=null?a:!1,order:N=null,...C}=e,[b]=U(d,w=>[w.inputElement]),m=Ze(b),P=U(d,c.useCallback(w=>d.selectors.isActive(w,f,p),[f,p])),u=i.isSelected(f),M=c.useRef(null),h=It({disabled:y,value:f,domRef:M,order:N}),O=c.useContext(st),T=Oe(o,M,O?O.measureElement:null),L=_(()=>{d.actions.setIsTyping(!1),d.actions.onChange(f)});ie(()=>d.actions.registerOption(p,h),[h,p]);let j=U(d,c.useCallback(w=>d.selectors.shouldScrollIntoView(w,f,p),[f,p]));ie(()=>{if(j)return Tt().requestAnimationFrame(()=>{var w,Y;(Y=(w=M.current)==null?void 0:w.scrollIntoView)==null||Y.call(w,{block:"nearest"})})},[j,M]);let A=_(w=>{w.preventDefault(),w.button===ao.Left&&(y||(L(),kt()||requestAnimationFrame(()=>m()),i.mode===Q.Single&&d.actions.closeCombobox()))}),$=_(()=>{if(y)return d.actions.goToOption({focus:H.Nothing});let w=i.calculateIndex(f);d.actions.goToOption({focus:H.Specific,idx:w})}),F=no(),G=_(w=>F.update(w)),q=_(w=>{if(!F.wasMoved(w)||y||P&&d.state.activationTrigger===oe.Pointer)return;let Y=i.calculateIndex(f);d.actions.goToOption({focus:H.Specific,idx:Y},oe.Pointer)}),E=_(w=>{F.wasMoved(w)&&(y||P&&(i.optionsPropsRef.current.hold||d.state.activationTrigger===oe.Pointer&&d.actions.goToOption({focus:H.Nothing})))}),V=he({active:P,focus:P,selected:u,disabled:y}),z={id:p,ref:T,role:"option",tabIndex:y===!0?void 0:-1,"aria-disabled":y===!0?!0:void 0,"aria-selected":u,disabled:void 0,onMouseDown:A,onFocus:$,onPointerEnter:G,onMouseEnter:G,onPointerMove:q,onMouseMove:q,onPointerLeave:E,onMouseLeave:E};return ye()({ourProps:z,theirProps:C,slot:V,defaultTag:Ko,name:"Combobox.Option"})}let Yo=ge(Vo),at=ge(Ho),nt=ge(zo),Xo=ft,lt=ge(qo),it=ge(Wo),Jo=Object.assign(Yo,{Input:nt,Button:at,Label:Xo,Options:lt,Option:it});/** +import{r as c,aT as _,aU as dt,aV as Te,aW as We,aX as ut,aY as ce,aZ as Ye,a_ as pt,a$ as mt,b0 as bt,b1 as ge,b2 as ft,b3 as vt,b4 as Oe,b5 as U,b6 as xt,b7 as ke,b8 as X,b9 as re,ba as $e,bb as Ee,bc as gt,bd as Xe,be as Je,bf as he,bg as Pe,bh as ye,bi as ht,bj as yt,bk as St,bl as Re,bm as Ct,bn as Ot,bo as Ce,bp as wt,bq as Nt,br as jt,bs as ie,bt as Et,bu as W,bv as Pt,bw as It,bx as Tt,by as kt,bz as $t,bA as Rt,bB as Mt,bC as Ft,bD as Dt,bE as _t,bF as At,bG as Me,e as Vt,j as n,c as J,aE as Lt,a0 as zt,bH as Bt,a1 as Ht,bI as Ut,Q as Gt,a6 as qt,ac as Kt,ad as Wt,aA as Yt,aR as Xt,ae as Fe,P as De,bJ as _e,bK as Ae,B as Ne,bL as Ve,a7 as Le,bM as ze,a8 as Jt}from"./index-CN4vD05c.js";import{c as Qt}from"./node-types-UozthSpR.js";import{u as Zt}from"./chevron-up-Tfuf4unO.js";import{c as H,p as eo,a as ve,f as Be,b as to,L as oo,S as me,s as so,g as ao,u as no,d as lo}from"./element-movement-22ZdBM88.js";import{F as io,y as ro,R as co,T as uo,w as He,A as po}from"./map-pin-W8m2dIyd.js";import{F as mo}from"./use-tree-walker-Dw8GtAHe.js";import{u as Ue,s as bo}from"./frozen-ZI0va0FF.js";import{g as Qe,u as fo,P as vo}from"./PacketList-Dq4ygXCy.js";import{useGetDecodedContent as xo,useResolveSource as go}from"./usePipelineStore-BTv04vLL.js";import{c as ho,a as yo,D as So,b as Co}from"./AnalyzerFilterPanel-BjXbv0-E.js";import{u as Oo,r as wo}from"./consumer-registry-ssgJoJPf.js";import{A as No}from"./arrow-down-BuVueZSW.js";import{A as jo}from"./arrow-right-9ryFJ0vV.js";import{P as Eo,a as Po,B as Io,C as Ge}from"./PageLayout-DJSWC4zL.js";import{T as To,M as ko}from"./MqttModeBadge-BFJmiZy5.js";import{F as qe}from"./funnel-Bd2d2Gy-.js";import{R as $o}from"./route-4Pe810jq.js";import{S as Ro}from"./search-D1TEdb7u.js";import"./primitives-DS3PJRi6.js";import"./badge-colors-Dl76Mz8m.js";import"./chat-utils-BLzyljgm.js";import"./SignalIndicator-BpXSkqBv.js";import"./arrow-up-Cd56Jeq2.js";import"./chevron-right-BCotFXkU.js";import"./payload-detail-DXAypO28.js";import"./circle-question-mark-z2YWN8ID.js";import"./layers-DwnLNHzI.js";import"./hash-vaiKl847.js";import"./clock-jH_gnOTU.js";import"./activity-ZoAXCcWm.js";import"./database-n5nNHRzj.js";import"./useMapViewStore-D6ulpFc9.js";import"./index-G-dTy9iF.js";import"./index-CnWrze_V.js";import"./shield-DH-P-9VP.js";import"./zap-Ba3ctUHg.js";function Ze(e){let o=c.useRef({value:"",selectionStart:null,selectionEnd:null});return dt(e,"blur",t=>{let l=t.target;Te(l)&&(o.current={value:l.value,selectionStart:l.selectionStart,selectionEnd:l.selectionEnd})}),_(()=>{if(!We(e)&&Te(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==o.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:l}=o.current;t!==null&&l!==null&&e.setSelectionRange(t,l)}o.current={value:"",selectionStart:null,selectionEnd:null}}})}var Mo=Object.defineProperty,Fo=(e,o,t)=>o in e?Mo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,Ke=(e,o,t)=>(Fo(e,typeof o!="symbol"?o+"":o,t),t),S=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(S||{}),Q=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Q||{}),oe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(oe||{}),et=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(et||{});function je(e,o=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,l=o(e.options.slice()),a=l.length>0&&l[0].dataRef.current.order!==null?l.sort((d,x)=>d.dataRef.current.order-x.dataRef.current.order):mt(l,d=>d.dataRef.current.domRef.current),i=t?a.indexOf(t):null;return i===-1&&(i=null),{options:a,activeOptionIndex:i}}let Do={1(e){var o;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===1)return e;let t=e.inputElement?ve.Tracked(to(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:t,__demoMode:!1}},0(e){var o,t;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let l=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(l!==-1)return{...e,activeOptionIndex:l,comboboxState:0,__demoMode:!1,inputPositionState:ve.Idle}}return{...e,comboboxState:0,inputPositionState:ve.Idle,__demoMode:!1}},3(e,o){return e.isTyping===o.isTyping?e:{...e,isTyping:o.isTyping}},2(e,o){var t,l,a,i;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((l=e.dataRef.current)!=null&&l.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:f,disabled:y}=e.virtual,N=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>f,resolveActiveIndex:()=>{var b,m;return(m=(b=e.activeOptionIndex)!=null?b:f.findIndex(P=>!y(P)))!=null?m:null},resolveDisabled:y,resolveId(){throw new Error("Function not implemented.")}}),C=(a=o.trigger)!=null?a:2;return e.activeOptionIndex===N&&e.activationTrigger===C?e:{...e,activeOptionIndex:N,activationTrigger:C,isTyping:!1,__demoMode:!1}}let d=je(e);if(d.activeOptionIndex===null){let f=d.options.findIndex(y=>!y.dataRef.current.disabled);f!==-1&&(d.activeOptionIndex=f)}let x=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>d.options,resolveActiveIndex:()=>d.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled}),p=(i=o.trigger)!=null?i:2;return e.activeOptionIndex===x&&e.activationTrigger===p?e:{...e,...d,isTyping:!1,activeOptionIndex:x,activationTrigger:p,__demoMode:!1}},4:(e,o)=>{var t,l,a,i;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,o.payload]};let d=o.payload,x=je(e,f=>(f.push(d),f));e.activeOptionIndex===null&&(a=(l=e.dataRef.current).isSelected)!=null&&a.call(l,o.payload.dataRef.current.value)&&(x.activeOptionIndex=x.options.indexOf(d));let p={...e,...x,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(p.activeOptionIndex=0),p},5:(e,o)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(a=>a.id!==o.id)};let l=je(e,a=>{let i=a.findIndex(d=>d.id===o.id);return i!==-1&&a.splice(i,1),a});return{...e,...l,activationTrigger:2}},6:(e,o)=>e.defaultToFirstOption===o.value?e:{...e,defaultToFirstOption:o.value},7:(e,o)=>e.activationTrigger===o.trigger?e:{...e,activationTrigger:o.trigger},8:(e,o)=>{var t,l;if(e.virtual===null)return{...e,virtual:{options:o.options,disabled:(t=o.disabled)!=null?t:()=>!1}};if(e.virtual.options===o.options&&e.virtual.disabled===o.disabled)return e;let a=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=o.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?a=i:a=null}return{...e,activeOptionIndex:a,virtual:{options:o.options,disabled:(l=o.disabled)!=null?l:()=>!1}}},9:(e,o)=>e.inputElement===o.element?e:{...e,inputElement:o.element},10:(e,o)=>e.buttonElement===o.element?e:{...e,buttonElement:o.element},11:(e,o)=>e.optionsElement===o.element?e:{...e,optionsElement:o.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:ve.Moved}}};class Ie extends ut{constructor(o){super(o),Ke(this,"actions",{onChange:t=>{let{onChange:l,compare:a,mode:i,value:d}=this.state.dataRef.current;return ce(i,{0:()=>l==null?void 0:l(t),1:()=>{let x=d.slice(),p=x.findIndex(f=>a(f,t));return p===-1?x.push(t):x.splice(p,1),l==null?void 0:l(x)}})},registerOption:(t,l)=>(this.send({type:4,payload:{id:t,dataRef:l}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(l.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,l)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:l})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,l;this.send({type:1}),this.send({type:6,value:!1}),(l=(t=this.state.dataRef.current).onClose)==null||l.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:l}=this.state.options[t];this.actions.onChange(l.current.value)}this.actions.goToOption({focus:H.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),Ke(this,"selectors",{activeDescendantId:t=>{var l,a;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(a=t.options.find(d=>!d.dataRef.current.disabled&&t.dataRef.current.compare(d.dataRef.current.value,t.virtual.options[i])))==null?void 0:a.id:(l=t.options[i])==null?void 0:l.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:a,disabled:i}=t.virtual,d=a.findIndex(x=>{var p;return!((p=i==null?void 0:i(x))!=null&&p)});if(d!==-1)return d}let l=t.options.findIndex(a=>!a.dataRef.current.disabled);if(l!==-1)return l}return t.activeOptionIndex},activeOption:t=>{var l,a;let i=this.selectors.activeOptionIndex(t);return i===null?null:t.virtual?t.virtual.options[i??0]:(a=(l=t.options[i])==null?void 0:l.dataRef.current.value)!=null?a:null},isActive:(t,l,a)=>{var i;let d=this.selectors.activeOptionIndex(t);return d===null?!1:t.virtual?d===t.dataRef.current.calculateIndex(l):((i=t.options[d])==null?void 0:i.id)===a},shouldScrollIntoView:(t,l,a)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,l,a)),didInputMove(t){return t.inputPositionState.kind==="Moved"}});{let t=this.state.id,l=Ye.get(null);this.disposables.add(l.on(pt.Push,a=>{!l.selectors.isTop(a,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>l.actions.push(t)),this.on(1,()=>l.actions.pop(t))}this.disposables.group(t=>{this.on(1,l=>{l.inputElement&&(t.dispose(),t.add(eo(l.inputElement,l.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:o,virtual:t=null,__demoMode:l=!1}){var a;return new Ie({id:o,dataRef:{current:{}},comboboxState:l?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(a=t.disabled)!=null?a:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:l,inputPositionState:ve.Idle})}reduce(o,t){return ce(t.type,Do,o,t)}}const tt=c.createContext(null);function Se(e){let o=c.useContext(tt);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ot),t}return o}function ot({id:e,virtual:o=null,__demoMode:t=!1}){let l=c.useMemo(()=>Ie.new({id:e,virtual:o,__demoMode:t}),[]);return bt(()=>l.dispose()),l}let xe=c.createContext(null);xe.displayName="ComboboxDataContext";function de(e){let o=c.useContext(xe);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return o}let st=c.createContext(null);function _o(e){let o=Se("VirtualProvider"),t=de("VirtualProvider"),{options:l}=t.virtual,a=U(o,b=>b.optionsElement),[i,d]=c.useMemo(()=>{let b=a;if(!b)return[0,0];let m=window.getComputedStyle(b);return[parseFloat(m.paddingBlockStart||m.paddingTop),parseFloat(m.paddingBlockEnd||m.paddingBottom)]},[a]),x=Zt({enabled:l.length!==0,scrollPaddingStart:i,scrollPaddingEnd:d,count:l.length,estimateSize(){return 40},getScrollElement(){return o.state.optionsElement},overscan:12}),[p,f]=c.useState(0);ie(()=>{f(b=>b+1)},[l]);let y=x.getVirtualItems(),N=U(o,b=>b.activationTrigger===oe.Pointer),C=U(o,o.selectors.activeOptionIndex);return y.length===0?null:W.createElement(st.Provider,{value:x},W.createElement("div",{style:{position:"relative",width:"100%",height:`${x.getTotalSize()}px`},ref:b=>{b&&(N||C!==null&&l.length>C&&x.scrollToIndex(C))}},y.map(b=>{var m;return W.createElement(c.Fragment,{key:b.key},W.cloneElement((m=e.children)==null?void 0:m.call(e,{...e.slot,option:l[b.index]}),{key:`${p}-${b.key}`,"data-index":b.index,"aria-setsize":l.length,"aria-posinset":b.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${b.start}px)`,overflowAnchor:"none"}}))})))}let Ao=c.Fragment;function Vo(e,o){let t=c.useId(),l=$t(),{value:a,defaultValue:i,onChange:d,form:x,name:p,by:f,invalid:y=!1,disabled:N=l||!1,onClose:C,__demoMode:b=!1,multiple:m=!1,immediate:P=!1,virtual:u=null,nullable:M,...h}=e,O=Rt(i),[T=m?[]:void 0,L]=Mt(a,d,O),j=ot({id:t,virtual:u,__demoMode:b}),A=c.useRef({static:!1,hold:!1}),$=lo(f),F=_(I=>u?f===null?u.options.indexOf(I):u.options.findIndex(ne=>$(ne,I)):j.state.options.findIndex(ne=>$(ne.dataRef.current.value,I))),G=c.useCallback(I=>ce(V.mode,{[Q.Multi]:()=>T.some(ne=>$(ne,I)),[Q.Single]:()=>$(T,I)}),[T]),q=U(j,I=>I.virtual),E=_(()=>C==null?void 0:C()),V=c.useMemo(()=>({__demoMode:b,immediate:P,optionsPropsRef:A,value:T,defaultValue:O,disabled:N,invalid:y,mode:m?Q.Multi:Q.Single,virtual:u?q:null,onChange:L,isSelected:G,calculateIndex:F,compare:$,onClose:E}),[b,P,A,T,O,N,y,m,u,q,L,G,F,$,E]);ie(()=>{var I;u&&j.send({type:et.UpdateVirtualConfiguration,options:u.options,disabled:(I=u.disabled)!=null?I:null})},[u,u==null?void 0:u.options,u==null?void 0:u.disabled]),ie(()=>{j.state.dataRef.current=V},[V]);let[z,w,Y,le]=U(j,I=>[I.comboboxState,I.buttonElement,I.inputElement,I.optionsElement]),Z=Ye.get(null),ee=U(Z,c.useCallback(I=>Z.selectors.isTop(I,t),[Z,t]));Ft(ee,[w,Y,le],()=>j.actions.closeCombobox());let se=U(j,j.selectors.activeOptionIndex),ae=U(j,j.selectors.activeOption),v=he({open:z===S.Open,disabled:N,invalid:y,activeIndex:se,activeOption:ae,value:T}),[K,R]=Dt(),D=o===null?{}:{ref:o},k=c.useCallback(()=>{if(O!==void 0)return L==null?void 0:L(O)},[L,O]),B=ye();return W.createElement(R,{value:K,props:{htmlFor:Y==null?void 0:Y.id},slot:{open:z===S.Open,disabled:N}},W.createElement(po,null,W.createElement(xe.Provider,{value:V},W.createElement(tt.Provider,{value:j},W.createElement(_t,{value:ce(z,{[S.Open]:Ce.Open,[S.Closed]:Ce.Closed})},p!=null&&W.createElement(At,{disabled:N,data:T!=null?{[p]:T}:{},form:x,onReset:k}),B({ourProps:D,theirProps:h,slot:v,defaultTag:Ao,name:"Combobox"}))))))}let Lo="input";function zo(e,o){var t,l;let a=Se("Combobox.Input"),i=de("Combobox.Input"),d=c.useId(),x=vt(),{id:p=x||`headlessui-combobox-input-${d}`,onChange:f,displayValue:y,disabled:N=i.disabled||!1,autoFocus:C=!1,type:b="text",...m}=e,P=c.useRef(null),u=Oe(P,o,io(),a.actions.setInputElement),[M,h]=U(a,v=>[v.comboboxState,v.isTyping]),O=xt(),T=_(()=>{a.actions.onChange(null),a.state.optionsElement&&(a.state.optionsElement.scrollTop=0),a.actions.goToOption({focus:H.Nothing})}),L=c.useMemo(()=>{var v;return typeof y=="function"&&i.value!==void 0?(v=y(i.value))!=null?v:"":typeof i.value=="string"?i.value:""},[i.value,y]);ke(([v,K],[R,D])=>{if(a.state.isTyping)return;let k=P.current;k&&((D===S.Open&&K===S.Closed||v!==R)&&(k.value=v),requestAnimationFrame(()=>{if(a.state.isTyping||!k||We(k))return;let{selectionStart:B,selectionEnd:I}=k;Math.abs((I??0)-(B??0))===0&&B===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[L,M,h]),ke(([v],[K])=>{if(v===S.Open&&K===S.Closed){if(a.state.isTyping)return;let R=P.current;if(!R)return;let D=R.value,{selectionStart:k,selectionEnd:B,selectionDirection:I}=R;R.value="",R.value=D,I!==null?R.setSelectionRange(k,B,I):R.setSelectionRange(k,B)}},[M]);let j=c.useRef(!1),A=_(()=>{j.current=!0}),$=_(()=>{O.nextFrame(()=>{j.current=!1})}),F=_(v=>{switch(a.actions.setIsTyping(!0),v.key){case X.Enter:if(a.state.comboboxState!==S.Open||j.current)return;if(v.preventDefault(),v.stopPropagation(),a.selectors.activeOptionIndex(a.state)===null){a.actions.closeCombobox();return}a.actions.selectActiveOption(),i.mode===Q.Single&&a.actions.closeCombobox();break;case X.ArrowDown:return v.preventDefault(),v.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Next}),[S.Closed]:()=>a.actions.openCombobox()});case X.ArrowUp:return v.preventDefault(),v.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Previous}),[S.Closed]:()=>{re.flushSync(()=>a.actions.openCombobox()),i.value||a.actions.goToOption({focus:H.Last})}});case X.Home:if(a.state.comboboxState===S.Closed||v.shiftKey)break;return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.First});case X.PageUp:return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.First});case X.End:if(a.state.comboboxState===S.Closed||v.shiftKey)break;return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.PageDown:return v.preventDefault(),v.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.Escape:return a.state.comboboxState!==S.Open?void 0:(v.preventDefault(),a.state.optionsElement&&!i.optionsPropsRef.current.static&&v.stopPropagation(),i.mode===Q.Single&&i.value===null&&T(),a.actions.closeCombobox());case X.Tab:if(a.actions.setIsTyping(!1),a.state.comboboxState!==S.Open)return;i.mode===Q.Single&&a.state.activationTrigger!==oe.Focus&&a.actions.selectActiveOption(),a.actions.closeCombobox();break}}),G=_(v=>{f==null||f(v),i.mode===Q.Single&&v.target.value===""&&T(),a.actions.openCombobox()}),q=_(v=>{var K,R,D;let k=(K=v.relatedTarget)!=null?K:$e.find(B=>B!==v.currentTarget);if(!((R=a.state.optionsElement)!=null&&R.contains(k))&&!((D=a.state.buttonElement)!=null&&D.contains(k))&&a.state.comboboxState===S.Open)return v.preventDefault(),i.mode===Q.Single&&i.value===null&&T(),a.actions.closeCombobox()}),E=_(v=>{var K,R,D;let k=(K=v.relatedTarget)!=null?K:$e.find(B=>B!==v.currentTarget);(R=a.state.buttonElement)!=null&&R.contains(k)||(D=a.state.optionsElement)!=null&&D.contains(k)||i.disabled||i.immediate&&a.state.comboboxState!==S.Open&&O.microTask(()=>{re.flushSync(()=>a.actions.openCombobox()),a.actions.setActivationTrigger(oe.Focus)})}),V=Ee(),z=gt(),{isFocused:w,focusProps:Y}=Xe({autoFocus:C}),{isHovered:le,hoverProps:Z}=Je({isDisabled:N}),ee=U(a,v=>v.optionsElement),se=he({open:M===S.Open,disabled:N,invalid:i.invalid,hover:le,focus:w,autofocus:C}),ae=Pe({ref:u,id:p,role:"combobox",type:b,"aria-controls":ee==null?void 0:ee.id,"aria-expanded":M===S.Open,"aria-activedescendant":U(a,a.selectors.activeDescendantId),"aria-labelledby":V,"aria-describedby":z,"aria-autocomplete":"list",defaultValue:(l=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?y==null?void 0:y(i.defaultValue):null)!=null?l:i.defaultValue,disabled:N||void 0,autoFocus:C,onCompositionStart:A,onCompositionEnd:$,onKeyDown:F,onChange:G,onFocus:E,onBlur:q},Y,Z);return ye()({ourProps:ae,theirProps:m,slot:se,defaultTag:Lo,name:"Combobox.Input"})}let Bo="button";function Ho(e,o){let t=Se("Combobox.Button"),l=de("Combobox.Button"),[a,i]=c.useState(null),d=Oe(o,i,t.actions.setButtonElement),x=c.useId(),{id:p=`headlessui-combobox-button-${x}`,disabled:f=l.disabled||!1,autoFocus:y=!1,...N}=e,[C,b,m]=U(t,E=>[E.comboboxState,E.inputElement,E.optionsElement]),P=Ze(b),u=C===S.Open;oo(u,{trigger:a,action:c.useCallback(E=>{if(a!=null&&a.contains(E.target))return me.Ignore;if(b!=null&&b.contains(E.target))return me.Ignore;let V=E.target.closest('[role="option"]:not([data-disabled])');return ht(V)?me.Select(V):m!=null&&m.contains(E.target)?me.Ignore:me.Close},[a,b,m]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let M=_(E=>{switch(E.key){case X.Space:case X.Enter:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&re.flushSync(()=>t.actions.openCombobox()),P();return;case X.ArrowDown:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.First})),P();return;case X.ArrowUp:E.preventDefault(),E.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.Last})),P();return;case X.Escape:if(t.state.comboboxState!==S.Open)return;E.preventDefault(),t.state.optionsElement&&!l.optionsPropsRef.current.static&&E.stopPropagation(),re.flushSync(()=>t.actions.closeCombobox()),P();return;default:return}}),h=so(()=>{t.state.comboboxState===S.Open?t.actions.closeCombobox():t.actions.openCombobox(),P()}),O=Ee([p]),{isFocusVisible:T,focusProps:L}=Xe({autoFocus:y}),{isHovered:j,hoverProps:A}=Je({isDisabled:f}),{pressed:$,pressProps:F}=yt({disabled:f}),G=he({open:C===S.Open,active:$||C===S.Open,disabled:f,invalid:l.invalid,value:l.value,hover:j,focus:T}),q=Pe({ref:d,id:p,type:St(e,a),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":C===S.Open,"aria-labelledby":O,disabled:f||void 0,autoFocus:y,onKeyDown:M},h,L,A,F);return ye()({ourProps:q,theirProps:N,slot:G,defaultTag:Bo,name:"Combobox.Button"})}let Uo="div",Go=Me.RenderStrategy|Me.Static;function qo(e,o){var t,l,a;let i=c.useId(),{id:d=`headlessui-combobox-options-${i}`,hold:x=!1,anchor:p,portal:f=!1,modal:y=!0,transition:N=!1,...C}=e,b=Se("Combobox.Options"),m=de("Combobox.Options"),P=ro(p);P&&(f=!0);let[u,M]=co(P),[h,O]=c.useState(null),T=uo(),L=Oe(o,P?u:null,b.actions.setOptionsElement,O),[j,A,$,F,G]=U(b,s=>[s.comboboxState,s.inputElement,s.buttonElement,s.optionsElement,s.activationTrigger]),q=Re(A||$),E=Re(F),V=Ct(),[z,w]=Ot(N,h,V!==null?(V&Ce.Open)===Ce.Open:j===S.Open);wt(z,A,b.actions.closeCombobox);let Y=m.__demoMode?!1:y&&j===S.Open;Nt(Y,E);let le=m.__demoMode?!1:y&&j===S.Open;jt(le,{allowed:c.useCallback(()=>[A,$,F],[A,$,F])});let Z=U(b,b.selectors.didInputMove)?!1:z;ie(()=>{var s;m.optionsPropsRef.current.static=(s=e.static)!=null?s:!1},[m.optionsPropsRef,e.static]),ie(()=>{m.optionsPropsRef.current.hold=x},[m.optionsPropsRef,x]),mo(j===S.Open,{container:F,accept(s){return s.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:s.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(s){s.setAttribute("role","none")}});let ee=Ee([$==null?void 0:$.id]),se=he({open:j===S.Open,option:void 0}),ae=_(()=>{b.actions.setActivationTrigger(oe.Pointer)}),v=_(s=>{s.preventDefault(),b.actions.setActivationTrigger(oe.Pointer)}),K=Pe(P?T():{},{"aria-labelledby":ee,role:"listbox","aria-multiselectable":m.mode===Q.Multi?!0:void 0,id:d,ref:L,style:{...C.style,...M,"--input-width":He(z,A,!0).width,"--button-width":He(z,$,!0).width},onWheel:G===oe.Pointer?void 0:ae,onMouseDown:v,...Et(w)}),R=z&&j===S.Closed&&!e.static,D=Ue(R,(t=m.virtual)==null?void 0:t.options),k=Ue(R,m.value),B=c.useCallback(s=>m.compare(k,s),[m.compare,k]),I=c.useMemo(()=>{if(!m.virtual)return m;if(D===void 0)throw new Error("Missing `options` in virtual mode");return D!==m.virtual.options?{...m,virtual:{...m.virtual,options:D}}:m},[m,D,(l=m.virtual)==null?void 0:l.options]);m.virtual&&Object.assign(C,{children:W.createElement(xe.Provider,{value:I},W.createElement(_o,{slot:se},C.children))});let ne=ye(),we=c.useMemo(()=>m.mode===Q.Multi?m:{...m,isSelected:B},[m,B]);return W.createElement(Pt,{enabled:f?e.static||z:!1,ownerDocument:q},W.createElement(xe.Provider,{value:we},ne({ourProps:K,theirProps:{...C,children:W.createElement(bo,{freeze:R},typeof C.children=="function"?(a=C.children)==null?void 0:a.call(C,se):C.children)},slot:se,defaultTag:Uo,features:Go,visible:Z,name:"Combobox.Options"})))}let Ko="div";function Wo(e,o){var t,l,a;let i=de("Combobox.Option"),d=Se("Combobox.Option"),x=c.useId(),{id:p=`headlessui-combobox-option-${x}`,value:f,disabled:y=(a=(l=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:l.call(t,f))!=null?a:!1,order:N=null,...C}=e,[b]=U(d,w=>[w.inputElement]),m=Ze(b),P=U(d,c.useCallback(w=>d.selectors.isActive(w,f,p),[f,p])),u=i.isSelected(f),M=c.useRef(null),h=It({disabled:y,value:f,domRef:M,order:N}),O=c.useContext(st),T=Oe(o,M,O?O.measureElement:null),L=_(()=>{d.actions.setIsTyping(!1),d.actions.onChange(f)});ie(()=>d.actions.registerOption(p,h),[h,p]);let j=U(d,c.useCallback(w=>d.selectors.shouldScrollIntoView(w,f,p),[f,p]));ie(()=>{if(j)return Tt().requestAnimationFrame(()=>{var w,Y;(Y=(w=M.current)==null?void 0:w.scrollIntoView)==null||Y.call(w,{block:"nearest"})})},[j,M]);let A=_(w=>{w.preventDefault(),w.button===ao.Left&&(y||(L(),kt()||requestAnimationFrame(()=>m()),i.mode===Q.Single&&d.actions.closeCombobox()))}),$=_(()=>{if(y)return d.actions.goToOption({focus:H.Nothing});let w=i.calculateIndex(f);d.actions.goToOption({focus:H.Specific,idx:w})}),F=no(),G=_(w=>F.update(w)),q=_(w=>{if(!F.wasMoved(w)||y||P&&d.state.activationTrigger===oe.Pointer)return;let Y=i.calculateIndex(f);d.actions.goToOption({focus:H.Specific,idx:Y},oe.Pointer)}),E=_(w=>{F.wasMoved(w)&&(y||P&&(i.optionsPropsRef.current.hold||d.state.activationTrigger===oe.Pointer&&d.actions.goToOption({focus:H.Nothing})))}),V=he({active:P,focus:P,selected:u,disabled:y}),z={id:p,ref:T,role:"option",tabIndex:y===!0?void 0:-1,"aria-disabled":y===!0?!0:void 0,"aria-selected":u,disabled:void 0,onMouseDown:A,onFocus:$,onPointerEnter:G,onMouseEnter:G,onPointerMove:q,onMouseMove:q,onPointerLeave:E,onMouseLeave:E};return ye()({ourProps:z,theirProps:C,slot:V,defaultTag:Ko,name:"Combobox.Option"})}let Yo=ge(Vo),at=ge(Ho),nt=ge(zo),Xo=ft,lt=ge(qo),it=ge(Wo),Jo=Object.assign(Yo,{Input:nt,Button:at,Label:Xo,Options:lt,Option:it});/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/PageLayout-B4RCJ-XT.js b/frontend/dist/assets/PageLayout-DJSWC4zL.js similarity index 95% rename from frontend/dist/assets/PageLayout-B4RCJ-XT.js rename to frontend/dist/assets/PageLayout-DJSWC4zL.js index 1b80b632..21ad393b 100644 --- a/frontend/dist/assets/PageLayout-B4RCJ-XT.js +++ b/frontend/dist/assets/PageLayout-DJSWC4zL.js @@ -1 +1 @@ -import{j as e,Y as d,c as x,aQ as o,r as i,gx as f}from"./index-i0xzpXop.js";function p({children:a,className:s}){return e.jsx("div",{className:x("section-gap",s),children:a})}function g({children:a,className:s,ready:n}){const r=o(),t=n??r,[m,c]=i.useState(!1);return i.useEffect(()=>{if(!t){c(!1);return}let l=!1;return requestAnimationFrame(()=>{requestAnimationFrame(()=>{l||i.startTransition(()=>c(!0))})}),()=>{l=!0}},[t]),e.jsx(f.Provider,{value:m,children:e.jsx("div",{className:x("bento-section",s),children:a})})}function j({title:a,icon:s,controls:n,leading:r,subtitle:t}){return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-9",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("h1",{className:"type-title text-fg-primary flex items-baseline gap-2 sm:gap-3 min-w-0",children:[s&&e.jsx("span",{className:"text-icon-page-title flex-shrink-0 translate-y-[0.1em] [&>svg]:h-[1em] [&>svg]:w-[1em] [&>svg]:stroke-[1.5]",children:s}),e.jsx("span",{className:"truncate",children:a})]}),r]}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:n})]}),t&&e.jsx("div",{children:t})]})}function h({size:a,...s}){return e.jsx(d,{...s})}export{g as B,h as C,p as P,j as a}; +import{j as e,Y as d,c as x,aQ as o,r as i,gx as f}from"./index-CN4vD05c.js";function p({children:a,className:s}){return e.jsx("div",{className:x("section-gap",s),children:a})}function g({children:a,className:s,ready:n}){const r=o(),t=n??r,[m,c]=i.useState(!1);return i.useEffect(()=>{if(!t){c(!1);return}let l=!1;return requestAnimationFrame(()=>{requestAnimationFrame(()=>{l||i.startTransition(()=>c(!0))})}),()=>{l=!0}},[t]),e.jsx(f.Provider,{value:m,children:e.jsx("div",{className:x("bento-section",s),children:a})})}function j({title:a,icon:s,controls:n,leading:r,subtitle:t}){return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-9",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("h1",{className:"type-title text-fg-primary flex items-baseline gap-2 sm:gap-3 min-w-0",children:[s&&e.jsx("span",{className:"text-icon-page-title flex-shrink-0 translate-y-[0.1em] [&>svg]:h-[1em] [&>svg]:w-[1em] [&>svg]:stroke-[1.5]",children:s}),e.jsx("span",{className:"truncate",children:a})]}),r]}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:n})]}),t&&e.jsx("div",{children:t})]})}function h({size:a,...s}){return e.jsx(d,{...s})}export{g as B,h as C,p as P,j as a}; diff --git a/frontend/dist/assets/PathMapMapLibre-BsgVWepx.js b/frontend/dist/assets/PathMapMapLibre-DM7wheVG.js similarity index 96% rename from frontend/dist/assets/PathMapMapLibre-BsgVWepx.js rename to frontend/dist/assets/PathMapMapLibre-DM7wheVG.js index 172350de..10a566af 100644 --- a/frontend/dist/assets/PathMapMapLibre-BsgVWepx.js +++ b/frontend/dist/assets/PathMapMapLibre-DM7wheVG.js @@ -1 +1 @@ -import{r as a,c$ as ae,cb as ie,b$ as le,gy as de,Z as J,ce,j as t,V as K,c as z,gz as ue}from"./index-i0xzpXop.js";import{M as pe,S as me,L as fe,a as _,P as ge}from"./maplibre-gl-B20pCOz8.js";import{B as xe}from"./BasemapLayer-Bv4kYAcR.js";import{C as he}from"./car-aFMoKQAR.js";import{H as be}from"./useMapViewStore-DZlzQmak.js";import"./index-BCuGA4PV.js";import"./index-CBEGRHd5.js";const ye={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"},h={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(c,r){if(!c)return r;if(c.startsWith("#"))return c;const m=ue(c);return m?`#${m.r.toString(16).padStart(2,"0")}${m.g.toString(16).padStart(2,"0")}${m.b.toString(16).padStart(2,"0")}`:r}function G(){if(typeof document>"u")return h;const c=document.documentElement,r=getComputedStyle(c);return{nodeColor:C(r.getPropertyValue("--map-node-stroke").trim(),h.nodeColor),localColor:C(r.getPropertyValue("--map-local-color").trim(),h.localColor),hubColor:C(r.getPropertyValue("--map-hub-color").trim(),h.hubColor),edgeColor:C(r.getPropertyValue("--map-edge-rest").trim(),h.edgeColor),ambiguousColor:C(r.getPropertyValue("--sys-indigo").trim(),h.ambiguousColor),highlightColor:C(r.getPropertyValue("--sys-blue").trim(),h.highlightColor),sourceColor:C(r.getPropertyValue("--sys-green").trim(),h.sourceColor),destinationColor:C(r.getPropertyValue("--sys-blue").trim(),h.destinationColor)}}function Ce({prefix:c,isLocal:r,isSource:m,isDestination:B,isLastHop:b,isHighlighted:g,isWardrive:k,candidate:x,onHover:E,onLeave:N,onClick:S}){const[n,w]=a.useState(!1),P=a.useCallback(()=>{w(!0),E()},[E]),j=a.useCallback(()=>{w(!1),N()},[N]),D=()=>k?"orange":r?"amber":m?"green":b?"amber":B?"purple":"blue";return k?t.jsxs("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded-full",n&&"relative z-50"),onMouseEnter:P,onMouseLeave:j,onClick:S,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:z("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",n&&"scale-110"),children:t.jsx(he,{className:"w-4 h-4",strokeWidth:2.5})}),n&&t.jsxs(K,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[c,x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})]}):t.jsx("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded",n&&"relative z-50"),onMouseEnter:P,onMouseLeave:j,onClick:S,style:{pointerEvents:"auto"},children:t.jsxs(K,{color:D(),filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[r&&t.jsx(be,{className:"w-2.5 h-2.5 mr-1"}),c,n&&x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})})}function je({hopNumber:c,snr:r,edgeColor:m}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:m||J[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:c}),r!==void 0&&t.jsx(K,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:r.toFixed(1)})]})}function Ee({resolvedPath:c,localNode:r,hubNodes:m=[],hoveredHopIndex:B,onHoverHop:b,traceSnr:g}){const k=g!==void 0&&g.length>0,x=a.useRef(null),E=ae(),N=ie(),S=a.useMemo(()=>new Set(m),[m]),[n,w]=a.useState(null),P=le(),[j,D]=a.useState(!1),[Z,U]=a.useState(0);a.useEffect(()=>{var f;const e=(f=x.current)==null?void 0:f.getMap();if(!e)return;const o=e.getCanvas();if(!o)return;const s=l=>{l.preventDefault(),console.warn("[PathMapMapLibre] WebGL context lost")},i=()=>{console.warn("[PathMapMapLibre] WebGL context restored, remounting..."),U(l=>l+1)};return o.addEventListener("webglcontextlost",s),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",s),o.removeEventListener("webglcontextrestored",i)}},[Z]);const{positions:v,markers:W,edges:I}=a.useMemo(()=>{const e=[],o=[],s=[],i=[],f=(p,V)=>p!==0||V!==0;let l=0,y=!1;return c.hops.forEach((p,V)=>{const Y=p.candidates.filter(d=>f(d.latitude,d.longitude));if(Y.length===0)return;const R=[...Y].sort((d,F)=>F.probability-d.probability),A=R[0],L=[A.longitude,A.latitude];if(i.push(L),i.length>=2){const d=i[i.length-2],F=i.length-2,M=g==null?void 0:g[F],T=L[0]-d[0],se=L[1]-d[1],ne=Math.atan2(T,se)*(180/Math.PI),re=G();let $;y?$="#F97316":M!==void 0?$=de()[ce(M,N)]||J[500]:$=re.edgeColor,s.push({from:d,to:L,snrFwd:M,midpoint:[(d[0]+L[0])/2,(d[1]+L[1])/2],bearing:ne,color:$,isFromWardrive:y})}const te=p.isSource===!0,oe=p.isDestination===!0;y=A.isWardrive===!0,R.forEach((d,F)=>{const M=[d.latitude,d.longitude];e.push(M);const T=F===0;o.push({position:M,prefix:p.prefix,confidence:p.confidence,candidateCount:R.length,hopIndex:V,candidate:d,isHub:S.has(d.hash),isPrimary:T,isSource:te,isDestination:oe,validIndex:l})}),l++}),{positions:e,markers:o,edges:s}},[c,S,g,N]),q=a.useMemo(()=>I.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[I]),u=a.useMemo(()=>{const e=W.filter(l=>l.isPrimary&&(l.confidence>=.5||l.isSource||l.isDestination));if(e.length===0)return null;let o=1/0,s=-1/0,i=1/0,f=-1/0;for(const l of e){const[y,p]=l.position;ys&&(s=y),pf&&(f=p)}return[[i,o],[f,s]]},[W]),O=a.useMemo(()=>{if(v.length===0)return r?[r.longitude,r.latitude]:[0,0];let e=0,o=0;for(const[s,i]of v)e+=s,o+=i;return[o/v.length,e/v.length]},[v,r]),H=a.useCallback(()=>{var o;const e=(o=x.current)==null?void 0:o.getMap();if(!e||!u){D(!0);return}e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{D(!0)},50)},[u]),X=a.useMemo(()=>u?`${u[0][0].toFixed(5)},${u[0][1].toFixed(5)},${u[1][0].toFixed(5)},${u[1][1].toFixed(5)}`:"",[u]);a.useEffect(()=>{var o;if(!j)return;const e=(o=x.current)==null?void 0:o.getMap();!e||!u||e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[X,j,u]);const Q=P&&j,ee=a.useCallback(e=>{w({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return v.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden depth-stroke-inset",children:[!Q&&t.jsx("div",{className:"absolute inset-0 bg-elevated flex items-center justify-center pointer-events-none",children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:Q?1:0},children:t.jsxs(pe,{ref:x,initialViewState:{longitude:O[0],latitude:O[1],zoom:10},onLoad:H,style:{height:"100%",width:"100%"},mapStyle:ye,attributionControl:!1,children:[t.jsx(xe,{mode:E}),I.map((e,o)=>t.jsx(me,{id:`edge-${o}`,type:"geojson",data:q[o],children:t.jsx(fe,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)),I.map((e,o)=>t.jsx(_,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(je,{hopNumber:o+1,snr:k?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=W.filter(s=>s.isPrimary),o=e.length>1?e.length-2:-1;return e.map((s,i)=>{const f=B===s.hopIndex,l=i===o&&!s.candidate.isLocal&&!s.isDestination;return t.jsx(_,{longitude:s.position[1],latitude:s.position[0],anchor:"center",children:t.jsx(Ce,{prefix:s.prefix,isLocal:s.candidate.isLocal||!1,isSource:s.isSource,isDestination:s.isDestination,isLastHop:l,isHighlighted:f,isWardrive:s.candidate.isWardrive||!1,candidate:s.candidate,onHover:()=>b==null?void 0:b(s.hopIndex),onLeave:()=>b==null?void 0:b(null),onClick:()=>ee(s)})},`${s.hopIndex}-${s.candidate.hash}`)})})(),n&&t.jsx(ge,{longitude:n.longitude,latitude:n.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>w(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:n.marker.candidate.name}),(()=>{const e=G();return t.jsxs(t.Fragment,{children:[n.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),n.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),n.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),n.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),n.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[n.marker.prefix," • ",n.marker.candidate.hash.slice(0,10),"..."]}),!n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{style:{color:G().ambiguousColor},children:["Alternative (",(n.marker.candidate.probability*100).toFixed(0),"%)"]}),n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[n.marker.candidateCount," candidates"]})]})})]},Z)})]})}export{Ee as default}; +import{r as a,c$ as ae,cb as ie,b$ as le,gy as de,Z as J,ce,j as t,V as K,c as z,gz as ue}from"./index-CN4vD05c.js";import{M as pe,S as me,L as fe,a as _,P as ge}from"./maplibre-gl-CRRd6W2P.js";import{B as xe}from"./BasemapLayer-B81nTsqc.js";import{C as he}from"./car-CMkH36na.js";import{H as be}from"./useMapViewStore-D6ulpFc9.js";import"./index-G-dTy9iF.js";import"./index-CnWrze_V.js";const ye={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"},h={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(c,r){if(!c)return r;if(c.startsWith("#"))return c;const m=ue(c);return m?`#${m.r.toString(16).padStart(2,"0")}${m.g.toString(16).padStart(2,"0")}${m.b.toString(16).padStart(2,"0")}`:r}function G(){if(typeof document>"u")return h;const c=document.documentElement,r=getComputedStyle(c);return{nodeColor:C(r.getPropertyValue("--map-node-stroke").trim(),h.nodeColor),localColor:C(r.getPropertyValue("--map-local-color").trim(),h.localColor),hubColor:C(r.getPropertyValue("--map-hub-color").trim(),h.hubColor),edgeColor:C(r.getPropertyValue("--map-edge-rest").trim(),h.edgeColor),ambiguousColor:C(r.getPropertyValue("--sys-indigo").trim(),h.ambiguousColor),highlightColor:C(r.getPropertyValue("--sys-blue").trim(),h.highlightColor),sourceColor:C(r.getPropertyValue("--sys-green").trim(),h.sourceColor),destinationColor:C(r.getPropertyValue("--sys-blue").trim(),h.destinationColor)}}function Ce({prefix:c,isLocal:r,isSource:m,isDestination:B,isLastHop:b,isHighlighted:g,isWardrive:k,candidate:x,onHover:E,onLeave:N,onClick:S}){const[n,w]=a.useState(!1),P=a.useCallback(()=>{w(!0),E()},[E]),j=a.useCallback(()=>{w(!1),N()},[N]),D=()=>k?"orange":r?"amber":m?"green":b?"amber":B?"purple":"blue";return k?t.jsxs("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded-full",n&&"relative z-50"),onMouseEnter:P,onMouseLeave:j,onClick:S,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:z("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",n&&"scale-110"),children:t.jsx(he,{className:"w-4 h-4",strokeWidth:2.5})}),n&&t.jsxs(K,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[c,x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})]}):t.jsx("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded",n&&"relative z-50"),onMouseEnter:P,onMouseLeave:j,onClick:S,style:{pointerEvents:"auto"},children:t.jsxs(K,{color:D(),filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[r&&t.jsx(be,{className:"w-2.5 h-2.5 mr-1"}),c,n&&x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})})}function je({hopNumber:c,snr:r,edgeColor:m}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:m||J[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:c}),r!==void 0&&t.jsx(K,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:r.toFixed(1)})]})}function Ee({resolvedPath:c,localNode:r,hubNodes:m=[],hoveredHopIndex:B,onHoverHop:b,traceSnr:g}){const k=g!==void 0&&g.length>0,x=a.useRef(null),E=ae(),N=ie(),S=a.useMemo(()=>new Set(m),[m]),[n,w]=a.useState(null),P=le(),[j,D]=a.useState(!1),[Z,U]=a.useState(0);a.useEffect(()=>{var f;const e=(f=x.current)==null?void 0:f.getMap();if(!e)return;const o=e.getCanvas();if(!o)return;const s=l=>{l.preventDefault(),console.warn("[PathMapMapLibre] WebGL context lost")},i=()=>{console.warn("[PathMapMapLibre] WebGL context restored, remounting..."),U(l=>l+1)};return o.addEventListener("webglcontextlost",s),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",s),o.removeEventListener("webglcontextrestored",i)}},[Z]);const{positions:v,markers:W,edges:I}=a.useMemo(()=>{const e=[],o=[],s=[],i=[],f=(p,V)=>p!==0||V!==0;let l=0,y=!1;return c.hops.forEach((p,V)=>{const Y=p.candidates.filter(d=>f(d.latitude,d.longitude));if(Y.length===0)return;const R=[...Y].sort((d,F)=>F.probability-d.probability),A=R[0],L=[A.longitude,A.latitude];if(i.push(L),i.length>=2){const d=i[i.length-2],F=i.length-2,M=g==null?void 0:g[F],T=L[0]-d[0],se=L[1]-d[1],ne=Math.atan2(T,se)*(180/Math.PI),re=G();let $;y?$="#F97316":M!==void 0?$=de()[ce(M,N)]||J[500]:$=re.edgeColor,s.push({from:d,to:L,snrFwd:M,midpoint:[(d[0]+L[0])/2,(d[1]+L[1])/2],bearing:ne,color:$,isFromWardrive:y})}const te=p.isSource===!0,oe=p.isDestination===!0;y=A.isWardrive===!0,R.forEach((d,F)=>{const M=[d.latitude,d.longitude];e.push(M);const T=F===0;o.push({position:M,prefix:p.prefix,confidence:p.confidence,candidateCount:R.length,hopIndex:V,candidate:d,isHub:S.has(d.hash),isPrimary:T,isSource:te,isDestination:oe,validIndex:l})}),l++}),{positions:e,markers:o,edges:s}},[c,S,g,N]),q=a.useMemo(()=>I.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[I]),u=a.useMemo(()=>{const e=W.filter(l=>l.isPrimary&&(l.confidence>=.5||l.isSource||l.isDestination));if(e.length===0)return null;let o=1/0,s=-1/0,i=1/0,f=-1/0;for(const l of e){const[y,p]=l.position;ys&&(s=y),pf&&(f=p)}return[[i,o],[f,s]]},[W]),O=a.useMemo(()=>{if(v.length===0)return r?[r.longitude,r.latitude]:[0,0];let e=0,o=0;for(const[s,i]of v)e+=s,o+=i;return[o/v.length,e/v.length]},[v,r]),H=a.useCallback(()=>{var o;const e=(o=x.current)==null?void 0:o.getMap();if(!e||!u){D(!0);return}e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{D(!0)},50)},[u]),X=a.useMemo(()=>u?`${u[0][0].toFixed(5)},${u[0][1].toFixed(5)},${u[1][0].toFixed(5)},${u[1][1].toFixed(5)}`:"",[u]);a.useEffect(()=>{var o;if(!j)return;const e=(o=x.current)==null?void 0:o.getMap();!e||!u||e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[X,j,u]);const Q=P&&j,ee=a.useCallback(e=>{w({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return v.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden depth-stroke-inset",children:[!Q&&t.jsx("div",{className:"absolute inset-0 bg-elevated flex items-center justify-center pointer-events-none",children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:Q?1:0},children:t.jsxs(pe,{ref:x,initialViewState:{longitude:O[0],latitude:O[1],zoom:10},onLoad:H,style:{height:"100%",width:"100%"},mapStyle:ye,attributionControl:!1,children:[t.jsx(xe,{mode:E}),I.map((e,o)=>t.jsx(me,{id:`edge-${o}`,type:"geojson",data:q[o],children:t.jsx(fe,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)),I.map((e,o)=>t.jsx(_,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(je,{hopNumber:o+1,snr:k?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=W.filter(s=>s.isPrimary),o=e.length>1?e.length-2:-1;return e.map((s,i)=>{const f=B===s.hopIndex,l=i===o&&!s.candidate.isLocal&&!s.isDestination;return t.jsx(_,{longitude:s.position[1],latitude:s.position[0],anchor:"center",children:t.jsx(Ce,{prefix:s.prefix,isLocal:s.candidate.isLocal||!1,isSource:s.isSource,isDestination:s.isDestination,isLastHop:l,isHighlighted:f,isWardrive:s.candidate.isWardrive||!1,candidate:s.candidate,onHover:()=>b==null?void 0:b(s.hopIndex),onLeave:()=>b==null?void 0:b(null),onClick:()=>ee(s)})},`${s.hopIndex}-${s.candidate.hash}`)})})(),n&&t.jsx(ge,{longitude:n.longitude,latitude:n.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>w(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:n.marker.candidate.name}),(()=>{const e=G();return t.jsxs(t.Fragment,{children:[n.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),n.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),n.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),n.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),n.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[n.marker.prefix," • ",n.marker.candidate.hash.slice(0,10),"..."]}),!n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{style:{color:G().ambiguousColor},children:["Alternative (",(n.marker.candidate.probability*100).toFixed(0),"%)"]}),n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[n.marker.candidateCount," candidates"]})]})})]},Z)})]})}export{Ee as default}; diff --git a/frontend/dist/assets/RoomServer-DiCPtnmR.js b/frontend/dist/assets/RoomServer-CzNntLvv.js similarity index 97% rename from frontend/dist/assets/RoomServer-DiCPtnmR.js rename to frontend/dist/assets/RoomServer-CzNntLvv.js index 503b0781..74a81ecd 100644 --- a/frontend/dist/assets/RoomServer-DiCPtnmR.js +++ b/frontend/dist/assets/RoomServer-CzNntLvv.js @@ -1,4 +1,4 @@ -import{e as Y,r as l,j as e,cs as I,aa as De,c as A,aC as Ae,aK as $e,aD as Ke,V as U,I as E,eJ as Fe,B as b,ca as we,aE as ie,O as Oe,a7 as te,a3 as Ce,a0 as G,a1 as Be,eK as Se,eL as ze,bI as _e,eM as qe,eN as He,eO as Ve,eP as Ue,eQ as Ge,eR as Ie,eS as We,eT as Ye,a6 as Qe,Q as Je,eE as Xe,cu as ce}from"./index-i0xzpXop.js";import{C as q,P as de,a as me,B as Ze}from"./PageLayout-B4RCJ-XT.js";import{R as es,C as ue}from"./Grid-BhoD4aLU.js";import{c as ss,m as ts}from"./node-types-rVJPSDxd.js";import{R as as}from"./repeat-BSIxXQ81.js";import{L as ns,a as rs,b as ls}from"./listbox-C1gGOelh.js";import{P as os}from"./plus-Bb8eT78f.js";import{F as P,L as D,D as is}from"./fieldset-DCj-Bavz.js";import{M as Z}from"./map-pin-C051lstq.js";import{T as Re}from"./trash-2-DCqpUdF7.js";import{S as ee,K as W}from"./KeycapButton-BjL5Ht30.js";import{C as xe}from"./ConfirmModal-CtS0orbM.js";import{S as cs,C as ds}from"./ChatBubble-DL8lfbnv.js";import{e as ms,g as us,a as xs}from"./chat-utils-BdAUDg3r.js";import{W as se}from"./wifi-DYlEDPZY.js";import{M as ps}from"./message-square-text-CIgRIHv3.js";import{K as hs}from"./key-round-BpDWKeL5.js";import"./element-movement-BD3SL-GU.js";import"./use-text-value-T4f0bwXS.js";import"./frozen-D4mEoVft.js";import"./keycap-sfx-ByZp-njj.js";/** +import{e as Y,r as l,j as e,cs as I,aa as De,c as A,aC as Ae,aK as $e,aD as Ke,V as U,I as E,eJ as Fe,B as b,ca as we,aE as ie,O as Oe,a7 as te,a3 as Ce,a0 as G,a1 as Be,eK as Se,eL as ze,bI as _e,eM as qe,eN as He,eO as Ve,eP as Ue,eQ as Ge,eR as Ie,eS as We,eT as Ye,a6 as Qe,Q as Je,eE as Xe,cu as ce}from"./index-CN4vD05c.js";import{C as q,P as de,a as me,B as Ze}from"./PageLayout-DJSWC4zL.js";import{R as es,C as ue}from"./Grid-DeJEUuBo.js";import{c as ss,m as ts}from"./node-types-UozthSpR.js";import{R as as}from"./repeat-CTlAf3ox.js";import{L as ns,a as rs,b as ls}from"./listbox-Cfex3RUz.js";import{P as os}from"./plus-3025QRmd.js";import{F as P,L as D,D as is}from"./fieldset-D4C8gyQW.js";import{M as Z}from"./map-pin-W8m2dIyd.js";import{T as Re}from"./trash-2-DqmFYXqQ.js";import{S as ee,K as W}from"./KeycapButton-DFXxSuaV.js";import{C as xe}from"./ConfirmModal-CH_Er4VJ.js";import{S as cs,C as ds}from"./ChatBubble-CFCWQdGy.js";import{e as ms,g as us,a as xs}from"./chat-utils-BLzyljgm.js";import{W as se}from"./wifi-BF-rEj1F.js";import{M as ps}from"./message-square-text-CjTpe3p8.js";import{K as hs}from"./key-round-CiTX8EjL.js";import"./element-movement-22ZdBM88.js";import"./use-text-value-DHtdh4JM.js";import"./frozen-ZI0va0FF.js";import"./keycap-sfx-ByZp-njj.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Sessions-CqZugS72.js b/frontend/dist/assets/Sessions-BgoBMfDO.js similarity index 97% rename from frontend/dist/assets/Sessions-CqZugS72.js rename to frontend/dist/assets/Sessions-BgoBMfDO.js index a89fdd53..3deac42a 100644 --- a/frontend/dist/assets/Sessions-CqZugS72.js +++ b/frontend/dist/assets/Sessions-BgoBMfDO.js @@ -1,4 +1,4 @@ -import{e as b,r as l,fk as U,fl as z,eg as V,j as e,B as g,a2 as M,a0 as Y,dV as J,bI as C,c as N,bY as Q,eL as Z,cU as W,cE as X,cs as ee,c3 as se}from"./index-i0xzpXop.js";import{C as ae}from"./ConfirmModal-CtS0orbM.js";import{P as te,a as le,B as ie,C as P}from"./PageLayout-B4RCJ-XT.js";import{R as T,C as y}from"./Grid-BhoD4aLU.js";import{S as B}from"./shield-check-DlsLo8Eo.js";import{C as ne}from"./circle-question-mark-CJCLhkb9.js";import{S as ce}from"./shield-CxmFjMfw.js";import{A as re}from"./antenna-C7FNplvf.js";import{T as D}from"./trash-2-DCqpUdF7.js";/** +import{e as b,r as l,fk as U,fl as z,eg as V,j as e,B as g,a2 as M,a0 as Y,dV as J,bI as C,c as N,bY as Q,eL as Z,cU as W,cE as X,cs as ee,c3 as se}from"./index-CN4vD05c.js";import{C as ae}from"./ConfirmModal-CH_Er4VJ.js";import{P as te,a as le,B as ie,C as P}from"./PageLayout-DJSWC4zL.js";import{R as T,C as y}from"./Grid-DeJEUuBo.js";import{S as B}from"./shield-check-WAIr0NHG.js";import{C as ne}from"./circle-question-mark-z2YWN8ID.js";import{S as ce}from"./shield-DH-P-9VP.js";import{A as re}from"./antenna-CnCmnu-_.js";import{T as D}from"./trash-2-DqmFYXqQ.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/SignalIndicator-D8uG_rJC.js b/frontend/dist/assets/SignalIndicator-BpXSkqBv.js similarity index 99% rename from frontend/dist/assets/SignalIndicator-D8uG_rJC.js rename to frontend/dist/assets/SignalIndicator-BpXSkqBv.js index 2078f329..a4112b31 100644 --- a/frontend/dist/assets/SignalIndicator-D8uG_rJC.js +++ b/frontend/dist/assets/SignalIndicator-BpXSkqBv.js @@ -1,4 +1,4 @@ -import{e as l,r as m,c as i,j as r,gm as j,dw as _,e8 as k}from"./index-i0xzpXop.js";/** +import{e as l,r as m,c as i,j as r,gm as j,dw as _,e8 as k}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Statistics-xvNcJQ3I.js b/frontend/dist/assets/Statistics-CDDutBX6.js similarity index 98% rename from frontend/dist/assets/Statistics-xvNcJQ3I.js rename to frontend/dist/assets/Statistics-CDDutBX6.js index b707a79b..e31d14c2 100644 --- a/frontend/dist/assets/Statistics-xvNcJQ3I.js +++ b/frontend/dist/assets/Statistics-CDDutBX6.js @@ -1,4 +1,4 @@ -var Rt=Object.defineProperty;var Tt=(t,s,n)=>s in t?Rt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var ye=(t,s,n)=>Tt(t,typeof s!="symbol"?s+"":s,n);import{e as Re,r as o,j as e,G as Ae,c as at,P as Nt,cF as vt,cG as et,w as we,cH as Dt,V as _e,cI as Lt,cJ as Et,cK as It,x as Pt,cL as Ot,cM as Ft,cN as Ht,cO as Bt,cP as $t,cb as zt,cQ as $e,ce as Wt,cR as Ut,cS as Gt,a7 as ke,cT as Vt,bY as it,c3 as qt,af as kt,ag as Kt,cU as Yt,bK as Xt,a6 as Zt,ac as Qt,ab as Jt,Q as es,aQ as ts,aR as ss,ad as ns,aA as as,cV as ze,aj as is,cW as rt,as as rs,aa as ls,cX as os}from"./index-i0xzpXop.js";import{L as Se}from"./layers-LQ5jNXOV.js";import{u as tt,h as cs,r as st}from"./consumer-registry-5uDLywpC.js";import{e as ms}from"./easing-BdzuOPcT.js";import{C as We}from"./compass-0fhguiKE.js";import{T as ds,M as us}from"./MqttModeBadge-Dhi11STL.js";import{C as he,P as hs,a as xs,B as ps}from"./PageLayout-B4RCJ-XT.js";import{A as Ue,D as Oe}from"./DataValue-Cj0a0QCM.js";import{C as fs}from"./CollisionExplorerModal-DAlBzVhS.js";import{H as lt}from"./hash-CyK-Kad6.js";import{L as Fe}from"./LightSparkline-DC33xzFq.js";import{A as gs}from"./activity-DQoaymFw.js";import{c as bs,a as ys,A as js}from"./AnalyzerFilterPanel-DPT1vjKV.js";import{useResolveSource as Ns}from"./usePipelineStore-BqTRxIqB.js";import{R as je,C as Ce}from"./Grid-BhoD4aLU.js";import{S as vs}from"./settings-2-B0xGzDNd.js";import{N as ks}from"./network-CeKhSsIh.js";import"./chevron-right-DsOuIRi8.js";import"./map-pin-C051lstq.js";import"./index-BCuGA4PV.js";import"./index-CBEGRHd5.js";import"./maplibre-gl-B20pCOz8.js";import"./BasemapLayer-Bv4kYAcR.js";import"./share-2-B5yQaExh.js";import"./node-types-rVJPSDxd.js";import"./circle-question-mark-CJCLhkb9.js";import"./funnel-CitfWrkD.js";import"./search-DsTk_ZsM.js";/** +var Rt=Object.defineProperty;var Tt=(t,s,n)=>s in t?Rt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var ye=(t,s,n)=>Tt(t,typeof s!="symbol"?s+"":s,n);import{e as Re,r as o,j as e,G as Ae,c as at,P as Nt,cF as vt,cG as et,w as we,cH as Dt,V as _e,cI as Lt,cJ as Et,cK as It,x as Pt,cL as Ot,cM as Ft,cN as Ht,cO as Bt,cP as $t,cb as zt,cQ as $e,ce as Wt,cR as Ut,cS as Gt,a7 as ke,cT as Vt,bY as it,c3 as qt,af as kt,ag as Kt,cU as Yt,bK as Xt,a6 as Zt,ac as Qt,ab as Jt,Q as es,aQ as ts,aR as ss,ad as ns,aA as as,cV as ze,aj as is,cW as rt,as as rs,aa as ls,cX as os}from"./index-CN4vD05c.js";import{L as Se}from"./layers-DwnLNHzI.js";import{u as tt,h as cs,r as st}from"./consumer-registry-ssgJoJPf.js";import{e as ms}from"./easing-Cg6LL_7U.js";import{C as We}from"./compass-Ddh177-W.js";import{T as ds,M as us}from"./MqttModeBadge-BFJmiZy5.js";import{C as he,P as hs,a as xs,B as ps}from"./PageLayout-DJSWC4zL.js";import{A as Ue,D as Oe}from"./DataValue-CdynXJno.js";import{C as fs}from"./CollisionExplorerModal-CDRCTbR-.js";import{H as lt}from"./hash-vaiKl847.js";import{L as Fe}from"./LightSparkline-Bfgi1R3B.js";import{A as gs}from"./activity-ZoAXCcWm.js";import{c as bs,a as ys,A as js}from"./AnalyzerFilterPanel-BjXbv0-E.js";import{useResolveSource as Ns}from"./usePipelineStore-BTv04vLL.js";import{R as je,C as Ce}from"./Grid-DeJEUuBo.js";import{S as vs}from"./settings-2-CUT2ngOp.js";import{N as ks}from"./network-DgftOg20.js";import"./chevron-right-BCotFXkU.js";import"./map-pin-W8m2dIyd.js";import"./index-G-dTy9iF.js";import"./index-CnWrze_V.js";import"./maplibre-gl-CRRd6W2P.js";import"./BasemapLayer-B81nTsqc.js";import"./share-2-FGmu8UDX.js";import"./node-types-UozthSpR.js";import"./circle-question-mark-z2YWN8ID.js";import"./funnel-Bd2d2Gy-.js";import"./search-D1TEdb7u.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/System-Cocq8BLz.js b/frontend/dist/assets/System-2yGnS_a1.js similarity index 98% rename from frontend/dist/assets/System-Cocq8BLz.js rename to frontend/dist/assets/System-2yGnS_a1.js index b32722e5..98710567 100644 --- a/frontend/dist/assets/System-Cocq8BLz.js +++ b/frontend/dist/assets/System-2yGnS_a1.js @@ -1,4 +1,4 @@ -import{e as ee,aJ as A,O as B,r as l,L as Z,j as e,dQ as z,c as F,bY as se,a7 as E,dR as te,dS as re,dT as ne,dU as ae,cF as oe,B as le,dV as ce,dW as ie,dX as G}from"./index-i0xzpXop.js";import{C as P,P as de,a as me,B as ue}from"./PageLayout-B4RCJ-XT.js";import{A as xe}from"./arrow-up-D_sZeyuo.js";import{N as fe}from"./network-CeKhSsIh.js";import{A as he}from"./arrow-down-SlBTV0Nc.js";import{T as pe}from"./thermometer-DhPCT8Cn.js";import{A as D}from"./activity-DQoaymFw.js";import{C as ge}from"./cpu-BxgsQ0OY.js";import{R as H,C as $}from"./Grid-BhoD4aLU.js";/** +import{e as ee,aJ as A,O as B,r as l,L as Z,j as e,dQ as z,c as F,bY as se,a7 as E,dR as te,dS as re,dT as ne,dU as ae,cF as oe,B as le,dV as ce,dW as ie,dX as G}from"./index-CN4vD05c.js";import{C as P,P as de,a as me,B as ue}from"./PageLayout-DJSWC4zL.js";import{A as xe}from"./arrow-up-Cd56Jeq2.js";import{N as fe}from"./network-DgftOg20.js";import{A as he}from"./arrow-down-BuVueZSW.js";import{T as pe}from"./thermometer-lyVPAuKn.js";import{A as D}from"./activity-ZoAXCcWm.js";import{C as ge}from"./cpu-6yAZtSYM.js";import{R as H,C as $}from"./Grid-DeJEUuBo.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Terminal-aB_59Bcc.js b/frontend/dist/assets/Terminal-CBFaPt_l.js similarity index 99% rename from frontend/dist/assets/Terminal-aB_59Bcc.js rename to frontend/dist/assets/Terminal-CBFaPt_l.js index 2a3285e3..c6803a41 100644 --- a/frontend/dist/assets/Terminal-aB_59Bcc.js +++ b/frontend/dist/assets/Terminal-CBFaPt_l.js @@ -1,4 +1,4 @@ -var Ua=Object.defineProperty;var ja=(e,t,i)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var D=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);import{e as ls,Z as si,O as me,e4 as Ka,e5 as rt,e6 as es,e7 as qa,e8 as Co,dt as xo,du as Va,X as ko,e9 as Ga,ea as Xa,eb as Ya,cC as Ja,ec as Za,ct as Qa,t as Eo,ds as el,bR as tl,ed as il,c8 as Ro,ee as Se,bJ as sl,P as rl,cu as xt,ef as nl,eg as ol,eh as al,ei as ll,dX as zr,ej as vi,ek as Bo,el as Mo,em as Lo,j as m,aC as Do,aK as To,dK as Ur,aD as $o,B as hl,r as U,d as fs,m as $i,en as jr,eo as Kr,cZ as cl,ep as dl,c as ts,eq as ul,er as _l,a6 as fl,es as pl,et as ml,eu as gl}from"./index-i0xzpXop.js";import{g as vl,r as Sl}from"./system-Xia4FpjC.js";import{P as yl,B as bl,C as wl}from"./PageLayout-B4RCJ-XT.js";import{K as Ao,S as Cl}from"./KeycapButton-BjL5Ht30.js";import{S as qr}from"./search-DsTk_ZsM.js";import{C as xl}from"./chevron-right-DsOuIRi8.js";import"./keycap-sfx-ByZp-njj.js";/** +var Ua=Object.defineProperty;var ja=(e,t,i)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var D=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);import{e as ls,Z as si,O as me,e4 as Ka,e5 as rt,e6 as es,e7 as qa,e8 as Co,dt as xo,du as Va,X as ko,e9 as Ga,ea as Xa,eb as Ya,cC as Ja,ec as Za,ct as Qa,t as Eo,ds as el,bR as tl,ed as il,c8 as Ro,ee as Se,bJ as sl,P as rl,cu as xt,ef as nl,eg as ol,eh as al,ei as ll,dX as zr,ej as vi,ek as Bo,el as Mo,em as Lo,j as m,aC as Do,aK as To,dK as Ur,aD as $o,B as hl,r as U,d as fs,m as $i,en as jr,eo as Kr,cZ as cl,ep as dl,c as ts,eq as ul,er as _l,a6 as fl,es as pl,et as ml,eu as gl}from"./index-CN4vD05c.js";import{g as vl,r as Sl}from"./system-Bx1EMTn3.js";import{P as yl,B as bl,C as wl}from"./PageLayout-DJSWC4zL.js";import{K as Ao,S as Cl}from"./KeycapButton-DFXxSuaV.js";import{S as qr}from"./search-D1TEdb7u.js";import{C as xl}from"./chevron-right-BCotFXkU.js";import"./keycap-sfx-ByZp-njj.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -136,13 +136,13 @@ Use "list cap" to see available reports.`,"error");return}Oa(a,o),i.write(`✓ D `))}catch(n){i.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class R_ extends se{constructor(){super(...arguments);D(this,"name","rooms");D(this,"description","Show room server statistics")}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("rooms"),` ${b("Display room server statistics and sync status.")}`,"",B("rooms","list rooms")].join(` `));return}const r=i.write("processing...","system");try{const n=await al();if(!n.success||!n.data){i.update(r,n.error||"Failed to fetch room stats","error");return}const o=n.data.rooms||[];if(o.length===0){i.update(r,"No room servers configured.","warning");return}const a=[z(`Rooms (${o.length})`),"",...o.map(h=>[` ${it(h.room_name)}`,` ${w("msgs",y(String(h.total_messages)))} ${w("clients",`${y(String(h.active_clients))}${Pe(`/${h.total_clients}`)}`)} ${w("sync",h.sync_running?y("running"):Pe("idle"))}`]).flat()];i.update(r,a.join(` `))}catch(n){i.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class B_ extends se{constructor(){super(...arguments);D(this,"name","restart");D(this,"description","Restart pymc-repeater service");D(this,"aliases",["reboot"])}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("restart"),` ${b("Restart the pymc-repeater systemd service.")}`,"",B("restart","restart the service"),"",z("Aliases"),` ${b("reboot")}`,"",st("Requires polkit permissions for the web user."),st("The page will need a manual refresh after restart.")].join(` -`));return}const r=i.write("Restarting service...","system");try{const n=await Sl(AbortSignal.timeout(8e3));if(n.success){i.update(r,"Service restart initiated.","success"),await this.waitForService(i);return}const o=n.status;if(o===403||o===401){i.update(r,`Error: Permission denied. +`));return}const r=i.write("Restarting service...","system");try{const n=new AbortController,o=setTimeout(()=>n.abort(),8e3),a=await Sl(n.signal);if(clearTimeout(o),a.success){i.update(r,"Service restart initiated.","success"),await this.waitForService(i);return}const h=a.status;if(h===403||h===401){i.update(r,`Error: Permission denied. The web user needs polkit permissions to restart the service. -See: /etc/polkit-1/localauthority/50-local.d/pymc-repeater.pkla`,"error");return}i.update(r,n.error||"Restart failed","error")}catch(n){const o=n instanceof Error?n.message:"";o.includes("ERR_NETWORK")||o.includes("ECONNRESET")||o.includes("Failed to fetch")||o.includes("Load failed")||o.includes("network connection was lost")||o.includes("abort")||o.includes("timeout")||n instanceof DOMException&&n.name==="TimeoutError"||n instanceof DOMException&&n.name==="AbortError"?(i.update(r,"Service is restarting (connection dropped).","success"),await this.waitForService(i)):i.update(r,`Error: ${o||"Restart failed"}`,"error")}}waitForService(i){return new Promise(s=>{const r=i.write("Waiting for service...","system");let n=0;const o=30;setTimeout(()=>{const a=setInterval(async()=>{n++,i.update(r,`Waiting for service... ${n}s`,"system");try{const h=new AbortController,l=setTimeout(()=>h.abort(),3e3);await fetch(`${ll}/api/stats`,{signal:h.signal}),clearTimeout(l),clearInterval(a),i.update(r,`Service connected. (${n+4}s)`,"success"),s();return}catch{}n>=o&&(clearInterval(a),i.update(r,`Service did not respond within ${o+4}s. Check manually.`,"warning"),s())},1e3)},4e3)})}}const Wt="\x1B[",Oe=`${Wt}0m`,Fa=`${Wt}32m`,Fr=`${Wt}33m`,Hr=`${Wt}31m`,M_=`${Wt}36m`,Mt=`${Wt}90m`,Ha=`${Wt}1m`;function Yt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)}G`:e>=1048576?`${(e/1048576).toFixed(0)}M`:e>=1024?`${(e/1024).toFixed(0)}K`:`${e}B`}function co(e){const t=Math.floor(e/86400),i=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${i}h ${s}m`:i>0?`${i}h ${s}m`:`${s}m`}function L_(e,t){const i=Math.max(0,Math.min(100,e)),s=Math.round(i/100*t),r=t-s,n=i>=90?Hr:i>=70?Fr:Fa,o=`${n}${"█".repeat(s)}${Oe}${Mt}${"░".repeat(r)}${Oe}`,a=`${i.toFixed(1)}%`.padStart(6);return`[${o}] ${n}${a}${Oe}`}function D_(e){return e>=80?`${Hr}${Ha}${e.toFixed(1)}°C${Oe}`:e>=60?`${Fr}${e.toFixed(1)}°C${Oe}`:`${Fa}${e.toFixed(1)}°C${Oe}`}const Ci=2,uo=" ";function Jt(e,t){const i=" ".repeat(Ci),s=t-Ci,r=uo.length,n=[];let o="",a=0;for(const h of e){const l=uu(h);a===0?(o=h,a=l):a+r+l<=s?(o+=uo+h,a+=r+l):(n.push(i+o),o=h,a=l)}return a>0&&n.push(i+o),n}function T_(e,t,i){var d,u;const s=e.node_name||"unknown",r=e.version?`v${e.version}`:"",n=(d=t.system)!=null&&d.uptime?co(t.system.uptime):"?",o=co(e.uptime_seconds||0),a=Math.max(3,i-Ci*2),h=((u=t.cpu.load_avg)==null?void 0:u["1min"].toFixed(2))??"?",l=t.cpu.load_avg?`${h} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",c=i>=60?l:h;return[` ${M_}${Ha}${s}${Oe} ${Mt}${r}${Oe}`,` ${Mt}${"─".repeat(a)}${Oe}`,...Jt([w("Sys",y(n)),w("Svc",y(o)),w("Load",y(c))],i)]}function $_(e,t){const s=Ci+4+1+2+6,r=Math.max(6,Math.min(30,t-s)),n=s+r,o=t-n-2,a=[""],h=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,l=`${Yt(e.memory.used)}/${Yt(e.memory.total)}`,c=`${Yt(e.disk.used)}/${Yt(e.disk.total)}`,d=(f,_,p)=>{const g=L_(_,r),k=o>=p.length?` ${Pe(p)}`:"";return` ${b(f.padEnd(4))}${g}${k}`};a.push(d("CPU",e.cpu.usage_percent,h)),a.push(d("Mem",e.memory.usage_percent,l)),a.push(d("Dsk",e.disk.usage_percent,c));const u=Object.entries(e.temperatures||{});if(u.length>0){const f=u.map(([_,p])=>`${Pe(_+":")} ${D_(p)}`);a.push(...Jt(f,t))}return a}function A_(e,t){var l,c;const i=e.neighbors||{},s=Object.keys(i).length,r=Object.values(i).filter(d=>d.zero_hop).length,n=((c=(l=e.config)==null?void 0:l.repeater)==null?void 0:c.mode)||"?",o=e.noise_floor_dbm!=null?`${e.noise_floor_dbm}dBm`:"?",a=e.duty_cycle_percent??0,h=["",` ${Mt}MESH${Oe}`];return h.push(...Jt([w("Mode",y(n)),w("Nbrs",`${y(String(r))}${Pe(`/${s}`)}`),w("Noise",y(o)),w("Air",y(`${a.toFixed(1)}%`))],t)),h.push(...Jt([w("RX",y(String(e.rx_count??0))),w("TX",y(String(e.tx_count??0))),w("FWD",y(String(e.forwarded_count??0))),w("Drop",y(String(e.dropped_count??0)))],t)),h.push(...Jt([w("RX/h",y(String(Math.round(e.rx_per_hour??0)))),w("FWD/h",y(String(Math.round(e.forwarded_per_hour??0))))],t)),h}function P_(e,t){if(!e.network)return[];const i=["",` ${Mt}NET${Oe}`];return i.push(...Jt([w("TX",y(Yt(e.network.bytes_sent))),w("RX",y(Yt(e.network.bytes_recv))),w("Pkt",`${y(String(e.network.packets_sent))}${Pe("/")}${y(String(e.network.packets_recv))}`)],t)),i}function N_(e,t,i){if(e.length===0)return[];const s=t>=50,r=t>=50?6:5,n=t>=50?6:5,o=s?7:0,a=Ci+0,h=Math.max(4,t-a-o-r-n-4),l=3,c=t>=50?8:5,d=i!=null?Math.max(0,Math.min(c,i-l)):c;if(d<=0)return[];const u=["",` ${Mt}PROCS${Oe}`],f=(s?"PID".padEnd(o):"")+"CPU".padStart(r)+"MEM".padStart(n)+" NAME";u.push(` ${Pe(f)}`);for(const _ of e.slice(0,d)){const p=s?Pe(String(_.pid).padEnd(o)):"",g=(t>=50?_.cpu_percent.toFixed(1):_.cpu_percent.toFixed(0)).padStart(r),k=(t>=50?_.memory_percent.toFixed(1):_.memory_percent.toFixed(0)).padStart(n),q=_.name.length>h?_.name.slice(0,h-1)+"…":_.name,F=_.cpu_percent>=50?Hr:_.cpu_percent>=20?Fr:"",T=F?`${F}${g}${Oe}`:g;u.push(` ${p}${T}${Pe(k)} ${q}`)}return u}function I_(){return new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function _o(e,t,i,s,r){if(!e||!t)return` ${Mt}Waiting for data…${Oe}`;const n=T_(e,t,s),o=$_(t,s),a=A_(e,s),h=P_(t,s),l=["",` ${Mt}${I_()} · Ctrl+C to exit${Oe}`],c=[...n,...o,...a,...h,...l],d=r?br(c,s):0,u=r?Math.max(0,r-d):void 0,f=N_(i,s,u),_=[...c.slice(0,-l.length),...f,...l];return r&&_.length>r&&(_.length=r),_.join(` +See: /etc/polkit-1/localauthority/50-local.d/pymc-repeater.pkla`,"error");return}i.update(r,a.error||"Restart failed","error")}catch(n){const o=n instanceof Error?n.message:"";o.includes("ERR_NETWORK")||o.includes("ECONNRESET")||o.includes("Failed to fetch")||o.includes("Load failed")||o.includes("network connection was lost")||o.includes("abort")||o.includes("timeout")||n instanceof DOMException&&n.name==="TimeoutError"||n instanceof DOMException&&n.name==="AbortError"?(i.update(r,"Service is restarting (connection dropped).","success"),await this.waitForService(i)):i.update(r,`Error: ${o||"Restart failed"}`,"error")}}waitForService(i){return new Promise(s=>{const r=i.write("Waiting for service...","system");let n=0;const o=30;setTimeout(()=>{const a=setInterval(async()=>{n++,i.update(r,`Waiting for service... ${n}s`,"system");try{const h=new AbortController,l=setTimeout(()=>h.abort(),3e3);await fetch(`${ll}/api/stats`,{signal:h.signal}),clearTimeout(l),clearInterval(a),i.update(r,`Service connected. (${n+4}s)`,"success"),s();return}catch{}n>=o&&(clearInterval(a),i.update(r,`Service did not respond within ${o+4}s. Check manually.`,"warning"),s())},1e3)},4e3)})}}const Wt="\x1B[",Oe=`${Wt}0m`,Fa=`${Wt}32m`,Fr=`${Wt}33m`,Hr=`${Wt}31m`,M_=`${Wt}36m`,Mt=`${Wt}90m`,Ha=`${Wt}1m`;function Yt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)}G`:e>=1048576?`${(e/1048576).toFixed(0)}M`:e>=1024?`${(e/1024).toFixed(0)}K`:`${e}B`}function co(e){const t=Math.floor(e/86400),i=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${i}h ${s}m`:i>0?`${i}h ${s}m`:`${s}m`}function L_(e,t){const i=Math.max(0,Math.min(100,e)),s=Math.round(i/100*t),r=t-s,n=i>=90?Hr:i>=70?Fr:Fa,o=`${n}${"█".repeat(s)}${Oe}${Mt}${"░".repeat(r)}${Oe}`,a=`${i.toFixed(1)}%`.padStart(6);return`[${o}] ${n}${a}${Oe}`}function D_(e){return e>=80?`${Hr}${Ha}${e.toFixed(1)}°C${Oe}`:e>=60?`${Fr}${e.toFixed(1)}°C${Oe}`:`${Fa}${e.toFixed(1)}°C${Oe}`}const Ci=2,uo=" ";function Jt(e,t){const i=" ".repeat(Ci),s=t-Ci,r=uo.length,n=[];let o="",a=0;for(const h of e){const l=uu(h);a===0?(o=h,a=l):a+r+l<=s?(o+=uo+h,a+=r+l):(n.push(i+o),o=h,a=l)}return a>0&&n.push(i+o),n}function T_(e,t,i){var d,u;const s=e.node_name||"unknown",r=e.version?`v${e.version}`:"",n=(d=t.system)!=null&&d.uptime?co(t.system.uptime):"?",o=co(e.uptime_seconds||0),a=Math.max(3,i-Ci*2),h=((u=t.cpu.load_avg)==null?void 0:u["1min"].toFixed(2))??"?",l=t.cpu.load_avg?`${h} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",c=i>=60?l:h;return[` ${M_}${Ha}${s}${Oe} ${Mt}${r}${Oe}`,` ${Mt}${"─".repeat(a)}${Oe}`,...Jt([w("Sys",y(n)),w("Svc",y(o)),w("Load",y(c))],i)]}function $_(e,t){const s=Ci+4+1+2+6,r=Math.max(6,Math.min(30,t-s)),n=s+r,o=t-n-2,a=[""],h=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,l=`${Yt(e.memory.used)}/${Yt(e.memory.total)}`,c=`${Yt(e.disk.used)}/${Yt(e.disk.total)}`,d=(f,_,p)=>{const g=L_(_,r),k=o>=p.length?` ${Pe(p)}`:"";return` ${b(f.padEnd(4))}${g}${k}`};a.push(d("CPU",e.cpu.usage_percent,h)),a.push(d("Mem",e.memory.usage_percent,l)),a.push(d("Dsk",e.disk.usage_percent,c));const u=Object.entries(e.temperatures||{});if(u.length>0){const f=u.map(([_,p])=>`${Pe(_+":")} ${D_(p)}`);a.push(...Jt(f,t))}return a}function A_(e,t){var l,c;const i=e.neighbors||{},s=Object.keys(i).length,r=Object.values(i).filter(d=>d.zero_hop).length,n=((c=(l=e.config)==null?void 0:l.repeater)==null?void 0:c.mode)||"?",o=e.noise_floor_dbm!=null?`${e.noise_floor_dbm}dBm`:"?",a=e.duty_cycle_percent??0,h=["",` ${Mt}MESH${Oe}`];return h.push(...Jt([w("Mode",y(n)),w("Nbrs",`${y(String(r))}${Pe(`/${s}`)}`),w("Noise",y(o)),w("Air",y(`${a.toFixed(1)}%`))],t)),h.push(...Jt([w("RX",y(String(e.rx_count??0))),w("TX",y(String(e.tx_count??0))),w("FWD",y(String(e.forwarded_count??0))),w("Drop",y(String(e.dropped_count??0)))],t)),h.push(...Jt([w("RX/h",y(String(Math.round(e.rx_per_hour??0)))),w("FWD/h",y(String(Math.round(e.forwarded_per_hour??0))))],t)),h}function P_(e,t){if(!e.network)return[];const i=["",` ${Mt}NET${Oe}`];return i.push(...Jt([w("TX",y(Yt(e.network.bytes_sent))),w("RX",y(Yt(e.network.bytes_recv))),w("Pkt",`${y(String(e.network.packets_sent))}${Pe("/")}${y(String(e.network.packets_recv))}`)],t)),i}function N_(e,t,i){if(e.length===0)return[];const s=t>=50,r=t>=50?6:5,n=t>=50?6:5,o=s?7:0,a=Ci+0,h=Math.max(4,t-a-o-r-n-4),l=3,c=t>=50?8:5,d=i!=null?Math.max(0,Math.min(c,i-l)):c;if(d<=0)return[];const u=["",` ${Mt}PROCS${Oe}`],f=(s?"PID".padEnd(o):"")+"CPU".padStart(r)+"MEM".padStart(n)+" NAME";u.push(` ${Pe(f)}`);for(const _ of e.slice(0,d)){const p=s?Pe(String(_.pid).padEnd(o)):"",g=(t>=50?_.cpu_percent.toFixed(1):_.cpu_percent.toFixed(0)).padStart(r),k=(t>=50?_.memory_percent.toFixed(1):_.memory_percent.toFixed(0)).padStart(n),q=_.name.length>h?_.name.slice(0,h-1)+"…":_.name,F=_.cpu_percent>=50?Hr:_.cpu_percent>=20?Fr:"",T=F?`${F}${g}${Oe}`:g;u.push(` ${p}${T}${Pe(k)} ${q}`)}return u}function I_(){return new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function _o(e,t,i,s,r){if(!e||!t)return` ${Mt}Waiting for data…${Oe}`;const n=T_(e,t,s),o=$_(t,s),a=A_(e,s),h=P_(t,s),l=["",` ${Mt}${I_()} · Ctrl+C to exit${Oe}`],c=[...n,...o,...a,...h,...l],d=r?br(c,s):0,u=r?Math.max(0,r-d):void 0,f=N_(i,s,u),_=[...c.slice(0,-l.length),...f,...l];return r&&_.length>r&&(_.length=r),_.join(` `)}const O_=3e3;class F_ extends se{constructor(){super(...arguments);D(this,"name","top");D(this,"description","Live system overview (Ctrl+C to exit)");D(this,"aliases",["htop"])}async execute({output:i,rawInput:s,cols:r,signal:n}){var l,c;if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("top"),` ${b("Live-updating system overview combining hardware")}`,` ${b("stats, mesh metrics, and running processes.")}`,` ${b("Refreshes every 3s. Press Ctrl+C to exit.")}`,"",B("top","start live display"),"",z("Sections"),` ${b("Header Node name, version, uptime, load average")}`,` ${b("Gauges CPU, memory, disk usage with bar charts")}`,` ${b("Mesh Mode, neighbors, packet counts, airtime")}`,` ${b("Network TCP/IP bytes and packet counters")}`,` ${b("Processes Top 8 processes by CPU usage")}`,"",z("Aliases"),` ${b("htop")}`].join(` `));return}let o=null,a=[],h=xt.getState().stats;try{const[d,u]=await Promise.all([es(),zr()]);d.success&&d.data&&(o=d.data),u.success&&u.data&&(a=u.data.processes.sort((f,_)=>_.cpu_percent-f.cpu_percent))}catch{}if(!n.aborted){(l=i.enterFullscreen)==null||l.call(i);try{const d=i.write(_o(h,o,a,i.cols??r,i.rows));await new Promise(u=>{if(n.aborted){u();return}const f=async()=>{h=xt.getState().stats;try{const[p,g]=await Promise.all([es(),zr()]);p.success&&p.data&&(o=p.data),g.success&&g.data&&(a=g.data.processes.sort((k,q)=>q.cpu_percent-k.cpu_percent))}catch{}n.aborted||i.update(d,_o(h,o,a,i.cols??r,i.rows))},_=setInterval(()=>{if(n.aborted){clearInterval(_),u();return}f()},O_);n.addEventListener("abort",()=>{clearInterval(_),u()},{once:!0})})}finally{(c=i.exitFullscreen)==null||c.call(i)}}}}const fo=["DONT PANIC","C0FFEE","FEED C0DE","LOL","I CANNOT DO THAT"];function Wr(){return fo[Math.floor(Math.random()*fo.length)]}const Cr=new EventTarget,xr="shell-phrase";function Wa(e){Cr.dispatchEvent(new CustomEvent(xr,{detail:e??Wr()}))}function H_(e){const t=i=>e(i.detail);return Cr.addEventListener(xr,t),()=>Cr.removeEventListener(xr,t)}class W_ extends se{constructor(){super(...arguments);D(this,"name","fortune");D(this,"description","Display a fortune on the header");D(this,"aliases",["lol"])}execute({output:i}){const s=Wr();Wa(s),i.write(b(` ${s}`))}}const kr=new EventTarget,Er="party-time";function z_(){kr.dispatchEvent(new Event(Er))}function U_(e){return kr.addEventListener(Er,e),()=>kr.removeEventListener(Er,e)}class j_ extends se{constructor(){super(...arguments);D(this,"name","partytime");D(this,"description","Party on, Garth!");D(this,"aliases",["party","excellent","waynesworld"])}execute({output:i}){z_(),Wa("PARTY 0N GARTH"),i.write(b(" SCHWING!"))}}class K_ extends se{constructor(){super(...arguments);D(this,"name","ver");D(this,"description","Show version info");D(this,"aliases",["version"])}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("ver"),` ${b("Display pyMC_Repeater, core, and console version.")}`,` ${b('Equivalent to firmware serial CLI "ver" command.')}`,"",B("ver","show version"),"",z("Aliases"),` ${b("version")}`].join(` -`));return}const r=i.write("processing...","system");try{const n=await rt();i.update(r,[` ${w("pyMC_Repeater",y(`v${n.version||"?"}`))}`,` ${w("pyMC_Core",y(n.core_version||"?"))}`,` ${w("pyMC_Console",y("v0.9.309"))}`].join(` +`));return}const r=i.write("processing...","system");try{const n=await rt();i.update(r,[` ${w("pyMC_Repeater",y(`v${n.version||"?"}`))}`,` ${w("pyMC_Core",y(n.core_version||"?"))}`,` ${w("pyMC_Console",y("v0.9.310"))}`].join(` `),"value")}catch(n){i.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class q_ extends se{constructor(){super(...arguments);D(this,"name","clock");D(this,"description","Show system UTC time")}execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("clock"),` ${b("Display the current system UTC time.")}`,` ${b('Equivalent to firmware serial CLI "clock" command.')}`,` ${b("Use to verify NTP sync and correlate packet timestamps.")}`,"",B("clock","show UTC time")].join(` `));return}const r=new Date;i.write([` ${w("UTC",y(r.toUTCString()))}`,` ${w("ISO",y(r.toISOString()))}`,` ${w("Unix",y(String(Math.floor(r.getTime()/1e3))))}`].join(` `),"value")}}class V_ extends se{constructor(){super(...arguments);D(this,"name","stats-packets");D(this,"description","Packet counters")}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([z("stats-packets"),` ${b("Display packet counters: sent, received, forwarded, dropped.")}`,` ${b('Equivalent to firmware serial CLI "stats-packets" command.')}`,"",B("stats-packets","show packet counters")].join(` diff --git a/frontend/dist/assets/Test-COE9gN1S.js b/frontend/dist/assets/Test-O-okW-Fy.js similarity index 99% rename from frontend/dist/assets/Test-COE9gN1S.js rename to frontend/dist/assets/Test-O-okW-Fy.js index 1ac67583..80634b8d 100644 --- a/frontend/dist/assets/Test-COE9gN1S.js +++ b/frontend/dist/assets/Test-O-okW-Fy.js @@ -1,4 +1,4 @@ -import{e as Ae,r as p,gt as _e,gu as Ie,af as Be,ag as Ve,j as e,a7 as U,V as ye,dV as He,dJ as qe,c as le,aE as We,Q as Ye,a6 as Oe,gv as Xe,O as $,cn as z,v as ze,c7 as Ge,bY as Je,H as me,Z,gw as Qe,L as xe}from"./index-i0xzpXop.js";import{C as Q,P as Ke,a as Ue,B as De}from"./PageLayout-B4RCJ-XT.js";import{useResolveSource as Ze}from"./usePipelineStore-BqTRxIqB.js";import{C as et}from"./chevron-right-DsOuIRi8.js";import{R as se,C as ae}from"./Grid-BhoD4aLU.js";import"./node-types-rVJPSDxd.js";/** +import{e as Ae,r as p,gt as _e,gu as Ie,af as Be,ag as Ve,j as e,a7 as U,V as ye,dV as He,dJ as qe,c as le,aE as We,Q as Ye,a6 as Oe,gv as Xe,O as $,cn as z,v as ze,c7 as Ge,bY as Je,H as me,Z,gw as Qe,L as xe}from"./index-CN4vD05c.js";import{C as Q,P as Ke,a as Ue,B as De}from"./PageLayout-DJSWC4zL.js";import{useResolveSource as Ze}from"./usePipelineStore-BTv04vLL.js";import{C as et}from"./chevron-right-BCotFXkU.js";import{R as se,C as ae}from"./Grid-DeJEUuBo.js";import"./node-types-UozthSpR.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/activity-DQoaymFw.js b/frontend/dist/assets/activity-ZoAXCcWm.js similarity index 89% rename from frontend/dist/assets/activity-DQoaymFw.js rename to frontend/dist/assets/activity-ZoAXCcWm.js index dad94a51..646aa4c9 100644 --- a/frontend/dist/assets/activity-DQoaymFw.js +++ b/frontend/dist/assets/activity-ZoAXCcWm.js @@ -1,4 +1,4 @@ -import{e as t}from"./index-i0xzpXop.js";/** +import{e as t}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/antenna-C7FNplvf.js b/frontend/dist/assets/antenna-CnCmnu-_.js similarity index 91% rename from frontend/dist/assets/antenna-C7FNplvf.js rename to frontend/dist/assets/antenna-CnCmnu-_.js index cad8af02..346203b0 100644 --- a/frontend/dist/assets/antenna-C7FNplvf.js +++ b/frontend/dist/assets/antenna-CnCmnu-_.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/arrow-down-SlBTV0Nc.js b/frontend/dist/assets/arrow-down-BuVueZSW.js similarity index 86% rename from frontend/dist/assets/arrow-down-SlBTV0Nc.js rename to frontend/dist/assets/arrow-down-BuVueZSW.js index 86b1cf11..a0dab575 100644 --- a/frontend/dist/assets/arrow-down-SlBTV0Nc.js +++ b/frontend/dist/assets/arrow-down-BuVueZSW.js @@ -1,4 +1,4 @@ -import{e as o}from"./index-i0xzpXop.js";/** +import{e as o}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/arrow-right-BZS-u7CW.js b/frontend/dist/assets/arrow-right-9ryFJ0vV.js similarity index 86% rename from frontend/dist/assets/arrow-right-BZS-u7CW.js rename to frontend/dist/assets/arrow-right-9ryFJ0vV.js index 043e4e6a..22fa0765 100644 --- a/frontend/dist/assets/arrow-right-BZS-u7CW.js +++ b/frontend/dist/assets/arrow-right-9ryFJ0vV.js @@ -1,4 +1,4 @@ -import{e as o}from"./index-i0xzpXop.js";/** +import{e as o}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/arrow-up-D_sZeyuo.js b/frontend/dist/assets/arrow-up-Cd56Jeq2.js similarity index 86% rename from frontend/dist/assets/arrow-up-D_sZeyuo.js rename to frontend/dist/assets/arrow-up-Cd56Jeq2.js index 1b2752de..f701202b 100644 --- a/frontend/dist/assets/arrow-up-D_sZeyuo.js +++ b/frontend/dist/assets/arrow-up-Cd56Jeq2.js @@ -1,4 +1,4 @@ -import{e as o}from"./index-i0xzpXop.js";/** +import{e as o}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/car-aFMoKQAR.js b/frontend/dist/assets/car-CMkH36na.js similarity index 92% rename from frontend/dist/assets/car-aFMoKQAR.js rename to frontend/dist/assets/car-CMkH36na.js index 5d7250c2..7abba4cb 100644 --- a/frontend/dist/assets/car-aFMoKQAR.js +++ b/frontend/dist/assets/car-CMkH36na.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/chat-utils-BdAUDg3r.js b/frontend/dist/assets/chat-utils-BLzyljgm.js similarity index 97% rename from frontend/dist/assets/chat-utils-BdAUDg3r.js rename to frontend/dist/assets/chat-utils-BLzyljgm.js index 8237e3f3..a06682cc 100644 --- a/frontend/dist/assets/chat-utils-BdAUDg3r.js +++ b/frontend/dist/assets/chat-utils-BLzyljgm.js @@ -1 +1 @@ -import{r as g,Z as d,O as l}from"./index-i0xzpXop.js";function p(e){const n=parseInt(e.slice(1,3),16)/255,t=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,o=Math.max(n,t,r),i=Math.min(n,t,r),a=(o+i)/2;if(o===i)return[0,0,a];const s=o-i,u=a>.5?s/(2-o-i):s/(o+i);let c=0;return o===n?c=((t-r)/s+(t(c<0&&(c+=1),c>1&&(c-=1),c<1/6?s+(u-s)*6*c:c<1/2?u:c<2/3?s+(u-s)*(2/3-c)*6:s),o=t<.5?t*(1+n):t+n-t*n,i=2*t-o,a=s=>Math.round(s*255).toString(16).padStart(2,"0");return`#${a(r(i,o,e+1/3))}${a(r(i,o,e))}${a(r(i,o,e-1/3))}`}function S(e,n,t){let r=n[0]-e[0];return r>.5&&(r-=1),r<-.5&&(r+=1),[(e[0]+r*t+1)%1,e[1]+(n[1]-e[1])*t,e[2]+(n[2]-e[2])*t]}const x=[l.red,l.orange,l.amber,l.green,l.teal,l.cyan,l.blue,l.indigo,l.purple,l.pink],m=4,h=[];{const e=x.map(p);for(let n=0;n3||n.replace(f,"").replace(/[\u200D\uFE0F\s]/g,"").length>0?0:t.length}function C(e){const n=e.match(f);if(n&&n.length>0){const t=n[0],r=e.replace(f,"").trim();return{emoji:t,cleanName:r||e}}return{emoji:null,cleanName:e}}function y(e){const{cleanName:n}=C(e),t=n.split(/[\s-_]+/).filter(Boolean);if(t.length>=2){const o=Array.from(t[0])[0]||"",i=Array.from(t[1])[0]||"";return(o+i).toUpperCase()}return Array.from(n).slice(0,2).join("").toUpperCase()}function M(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function T(e,n){const t=/@\[([^\]]+)\]/g,r=[];let o=0,i;const a=n!=null&&n.isOutgoing?d[200]:l.blue,s=n==null?void 0:n.onMentionClick;for(;(i=t.exec(e))!==null;){i.index>o&&r.push(e.slice(o,i.index));const u=i[1];r.push(g.createElement(s?"button":"span",{key:i.index,className:s?"font-bold hover:underline underline-offset-2 cursor-pointer":"font-bold",style:{color:a},...s&&{type:"button",onClick:c=>{c.stopPropagation(),s(u)}}},u)),o=i.index+i[0].length}return o0?r:e}export{y as a,N as b,M as c,C as e,T as f,j as g}; +import{r as g,Z as d,O as l}from"./index-CN4vD05c.js";function p(e){const n=parseInt(e.slice(1,3),16)/255,t=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,o=Math.max(n,t,r),i=Math.min(n,t,r),a=(o+i)/2;if(o===i)return[0,0,a];const s=o-i,u=a>.5?s/(2-o-i):s/(o+i);let c=0;return o===n?c=((t-r)/s+(t(c<0&&(c+=1),c>1&&(c-=1),c<1/6?s+(u-s)*6*c:c<1/2?u:c<2/3?s+(u-s)*(2/3-c)*6:s),o=t<.5?t*(1+n):t+n-t*n,i=2*t-o,a=s=>Math.round(s*255).toString(16).padStart(2,"0");return`#${a(r(i,o,e+1/3))}${a(r(i,o,e))}${a(r(i,o,e-1/3))}`}function S(e,n,t){let r=n[0]-e[0];return r>.5&&(r-=1),r<-.5&&(r+=1),[(e[0]+r*t+1)%1,e[1]+(n[1]-e[1])*t,e[2]+(n[2]-e[2])*t]}const x=[l.red,l.orange,l.amber,l.green,l.teal,l.cyan,l.blue,l.indigo,l.purple,l.pink],m=4,h=[];{const e=x.map(p);for(let n=0;n3||n.replace(f,"").replace(/[\u200D\uFE0F\s]/g,"").length>0?0:t.length}function C(e){const n=e.match(f);if(n&&n.length>0){const t=n[0],r=e.replace(f,"").trim();return{emoji:t,cleanName:r||e}}return{emoji:null,cleanName:e}}function y(e){const{cleanName:n}=C(e),t=n.split(/[\s-_]+/).filter(Boolean);if(t.length>=2){const o=Array.from(t[0])[0]||"",i=Array.from(t[1])[0]||"";return(o+i).toUpperCase()}return Array.from(n).slice(0,2).join("").toUpperCase()}function M(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function T(e,n){const t=/@\[([^\]]+)\]/g,r=[];let o=0,i;const a=n!=null&&n.isOutgoing?d[200]:l.blue,s=n==null?void 0:n.onMentionClick;for(;(i=t.exec(e))!==null;){i.index>o&&r.push(e.slice(o,i.index));const u=i[1];r.push(g.createElement(s?"button":"span",{key:i.index,className:s?"font-bold hover:underline underline-offset-2 cursor-pointer":"font-bold",style:{color:a},...s&&{type:"button",onClick:c=>{c.stopPropagation(),s(u)}}},u)),o=i.index+i[0].length}return o0?r:e}export{y as a,N as b,M as c,C as e,T as f,j as g}; diff --git a/frontend/dist/assets/check-check-AfNqagLY.js b/frontend/dist/assets/check-check-CL5EVU8z.js similarity index 88% rename from frontend/dist/assets/check-check-AfNqagLY.js rename to frontend/dist/assets/check-check-CL5EVU8z.js index 6aaa9250..939de942 100644 --- a/frontend/dist/assets/check-check-AfNqagLY.js +++ b/frontend/dist/assets/check-check-CL5EVU8z.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/chevron-right-DsOuIRi8.js b/frontend/dist/assets/chevron-right-BCotFXkU.js similarity index 85% rename from frontend/dist/assets/chevron-right-DsOuIRi8.js rename to frontend/dist/assets/chevron-right-BCotFXkU.js index fea65326..c07faed3 100644 --- a/frontend/dist/assets/chevron-right-DsOuIRi8.js +++ b/frontend/dist/assets/chevron-right-BCotFXkU.js @@ -1,4 +1,4 @@ -import{e as o}from"./index-i0xzpXop.js";/** +import{e as o}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/chevron-up-BVzq549_.js b/frontend/dist/assets/chevron-up-Tfuf4unO.js similarity index 99% rename from frontend/dist/assets/chevron-up-BVzq549_.js rename to frontend/dist/assets/chevron-up-Tfuf4unO.js index 8e953644..a061af0c 100644 --- a/frontend/dist/assets/chevron-up-BVzq549_.js +++ b/frontend/dist/assets/chevron-up-Tfuf4unO.js @@ -1,4 +1,4 @@ -import{r as x,b9 as F,e as R}from"./index-i0xzpXop.js";function S(r,l,e){let s=e.initialDeps??[],t,n=!0;function o(){var i,h,u;let c;e.key&&((i=e.debug)!=null&&i.call(e))&&(c=Date.now());const f=r();if(!(f.length!==s.length||f.some((p,d)=>s[d]!==p)))return t;s=f;let m;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(m=Date.now()),t=l(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const p=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-m)*100)/100,b=d/16,E=(g,w)=>{for(g=String(g);g.lengths[d]!==p)))return t;s=f;let m;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(m=Date.now()),t=l(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const p=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-m)*100)/100,b=d/16,E=(g,w)=>{for(g=String(g);g.length{s=i},o}function M(r,l){if(r===void 0)throw new Error("Unexpected undefined");return r}const _=(r,l)=>Math.abs(r-l)<1.01,T=(r,l,e)=>{let s;return function(...t){r.clearTimeout(s),s=r.setTimeout(()=>l.apply(this,t),e)}},z=r=>{const{offsetWidth:l,offsetHeight:e}=r;return{width:l,height:e}},k=r=>r,W=r=>{const l=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},D=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;const t=o=>{const{width:i,height:h}=o;l({width:Math.round(i),height:Math.round(h)})};if(t(z(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(o=>{const i=()=>{const h=o[0];if(h!=null&&h.borderBoxSize){const u=h.borderBoxSize[0];if(u){t({width:u.inlineSize,height:u.blockSize});return}}t(z(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},C={passive:!0},O=typeof window>"u"?!0:"onscrollend"in window,L=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;let t=0;const n=r.options.useScrollendEvent&&O?()=>{}:T(s,()=>{l(t,!1)},r.options.isScrollingResetDelay),o=c=>()=>{const{horizontal:f,isRtl:a}=r.options;t=f?e.scrollLeft*(a&&-1||1):e.scrollTop,n(),l(t,c)},i=o(!0),h=o(!1);e.addEventListener("scroll",i,C);const u=r.options.useScrollendEvent&&O;return u&&e.addEventListener("scrollend",h,C),()=>{e.removeEventListener("scroll",i),u&&e.removeEventListener("scrollend",h)}},j=(r,l,e)=>{if(l!=null&&l.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},P=(r,{adjustments:l=0,behavior:e},s)=>{var t,n;const o=r+l;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:o,behavior:e})};class B{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const o=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:k,rangeExtractor:W,onChange:()=>{},measureElement:j,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=S(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,n=new Map;for(let o=s-1;o>=0;o--){const i=e[o];if(t.has(i.lane))continue;const h=n.get(i.lane);if(h==null||i.end>h.end?n.set(i.lane,i):i.endo.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=S(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,n,o,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i}),{key:!1}),this.getMeasurements=S(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i},h)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const a of this.laneAssignments.keys())a>=e&&this.laneAssignments.delete(a);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const c=this.measurementsCache.slice(0,u),f=new Array(i).fill(void 0);for(let a=0;a1){d=p;const v=f[d],y=v!==void 0?c[v]:void 0;b=y?y.end+this.options.gap:s+t}else{const v=this.options.lanes===1?c[a-1]:this.getFurthestMeasurement(c,a);b=v?v.end+this.options.gap:s+t,d=v?v.lane:a%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(a,d)}const E=h.get(m),g=typeof E=="number"?E:this.options.estimateSize(a),w=b+g;c[a]={index:a,start:b,size:g,end:w,key:m,lane:d},f[d]=a}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=S(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?H({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=S(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,o)=>n===null||o===null?[]:e({startIndex:n,endIndex:o,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const o=n.key,i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const n=this.itemSizeCache.get(t.key)??t.size,o=s-n;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,o,this):t.start{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=S(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,o=e.length;nthis.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return M(s[A(0,s.length-1,t=>M(s[t]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,s,t=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=e>=o+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const n=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(t.end>=o+n-this.options.scrollPaddingEnd)s="end";else if(t.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];if(s==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),s];const i=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1)),this.currentScrollToIndex=e;let n=0;const o=10,i=u=>{if(!this.targetWindow)return;const c=this.getOffsetForIndex(e,u);if(!c){console.warn("Failed to get offset for index:",e);return}const[f,a]=c;this._scrollToOffset(f,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==e)return;const p=this.getScrollOffset(),d=this.getOffsetForIndex(e,a);if(!d){console.warn("Failed to get offset for index:",e);return}_(d[0],p)||h(a)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},h=u=>{this.targetWindow&&this.currentScrollToIndex===e&&(n++,ni(u)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};i(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&n.some(i=>i===null);){const i=s[o];n[i.lane]===null&&(n[i.lane]=i.end),o--}t=Math.max(...n.filter(i=>i!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(l)}}const A=(r,l,e,s)=>{for(;r<=l;){const t=(r+l)/2|0,n=e(t);if(ns)l=t-1;else return t}return r>0?r-1:0};function H({measurements:r,outerSize:l,scrollOffset:e,lanes:s}){const t=r.length-1,n=h=>r[h].start;if(r.length<=s)return{startIndex:0,endIndex:t};let o=A(0,t,n,e),i=o;if(s===1)for(;i1){const h=Array(s).fill(0);for(;ic=0&&u.some(c=>c>=e);){const c=r[o];u[c.lane]=c.start,o--}o=Math.max(0,o-o%s),i=Math.min(t,i+(s-1-i%s))}return{startIndex:o,endIndex:i}}const I=typeof document<"u"?x.useLayoutEffect:x.useEffect;function N({useFlushSync:r=!0,...l}){const e=x.useReducer(()=>({}),{})[1],s={...l,onChange:(n,o)=>{var i;r&&o?F.flushSync(e):e(),(i=l.onChange)==null||i.call(l,n,o)}},[t]=x.useState(()=>new B(s));return t.setOptions(s),I(()=>t._didMount(),[]),I(()=>t._willUpdate()),t}function q(r){return N({observeElementRect:D,observeElementOffset:L,scrollToFn:P,...r})}/** diff --git a/frontend/dist/assets/circle-alert-PnLnz8pa.js b/frontend/dist/assets/circle-alert-NywFrEoZ.js similarity index 90% rename from frontend/dist/assets/circle-alert-PnLnz8pa.js rename to frontend/dist/assets/circle-alert-NywFrEoZ.js index 41a03107..26f3b43f 100644 --- a/frontend/dist/assets/circle-alert-PnLnz8pa.js +++ b/frontend/dist/assets/circle-alert-NywFrEoZ.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-question-mark-CJCLhkb9.js b/frontend/dist/assets/circle-question-mark-z2YWN8ID.js similarity index 89% rename from frontend/dist/assets/circle-question-mark-CJCLhkb9.js rename to frontend/dist/assets/circle-question-mark-z2YWN8ID.js index 10bb297c..c2a50d40 100644 --- a/frontend/dist/assets/circle-question-mark-CJCLhkb9.js +++ b/frontend/dist/assets/circle-question-mark-z2YWN8ID.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-stop--JH-Omkf.js b/frontend/dist/assets/circle-stop-DyVWFFOh.js similarity index 94% rename from frontend/dist/assets/circle-stop--JH-Omkf.js rename to frontend/dist/assets/circle-stop-DyVWFFOh.js index 9652f70d..562559ca 100644 --- a/frontend/dist/assets/circle-stop--JH-Omkf.js +++ b/frontend/dist/assets/circle-stop-DyVWFFOh.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/clock-F-4SScS_.js b/frontend/dist/assets/clock-jH_gnOTU.js similarity index 87% rename from frontend/dist/assets/clock-F-4SScS_.js rename to frontend/dist/assets/clock-jH_gnOTU.js index 76fd27f1..5281d476 100644 --- a/frontend/dist/assets/clock-F-4SScS_.js +++ b/frontend/dist/assets/clock-jH_gnOTU.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/compass-0fhguiKE.js b/frontend/dist/assets/compass-Ddh177-W.js similarity index 89% rename from frontend/dist/assets/compass-0fhguiKE.js rename to frontend/dist/assets/compass-Ddh177-W.js index 54123e20..9c2fd090 100644 --- a/frontend/dist/assets/compass-0fhguiKE.js +++ b/frontend/dist/assets/compass-Ddh177-W.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/consumer-registry-5uDLywpC.js b/frontend/dist/assets/consumer-registry-ssgJoJPf.js similarity index 92% rename from frontend/dist/assets/consumer-registry-5uDLywpC.js rename to frontend/dist/assets/consumer-registry-ssgJoJPf.js index 0d237c50..9fcd005b 100644 --- a/frontend/dist/assets/consumer-registry-5uDLywpC.js +++ b/frontend/dist/assets/consumer-registry-ssgJoJPf.js @@ -1 +1 @@ -import{ax as n,r as i}from"./index-i0xzpXop.js";const p=t=>(t.type??t.payload_type)===n.ADVERT,l=t=>(t.type??t.payload_type)===n.TRACE,h=t=>(t.type??t.payload_type)===n.TXT_MSG,_=t=>(t.type??t.payload_type)===n.PATH,d=t=>(t.type??t.payload_type)===n.ACK,g=t=>{const e=t.type??t.payload_type;return e===n.GRP_TXT||e===n.GRP_DATA},m=t=>(t.path_length??(Array.isArray(t.original_path)?t.original_path.length:0))>0,A=t=>!!t.src_hash,T=t=>t.airtime_ms!=null,c=new Set,o=new Map;function a(t,e){return`${t}|${e}`}function u(t,e){const s=a(t,e);o.set(s,(o.get(s)??0)+1)}function y(t,e){const s=a(t,e),r=o.get(s)??0;r>1?o.set(s,r-1):o.delete(s)}function C(t){for(const e of t){const s=a(e.target,e.fn);c.has(s)||c.add(s)}}function P(t){i.useEffect(()=>{for(const e of t)u(e.target,e.fn);return()=>{for(const e of t)y(e.target,e.fn)}},[t])}export{m as a,A as b,h as c,d,p as e,l as f,_ as g,T as h,g as i,C as r,P as u}; +import{ax as n,r as i}from"./index-CN4vD05c.js";const p=t=>(t.type??t.payload_type)===n.ADVERT,l=t=>(t.type??t.payload_type)===n.TRACE,h=t=>(t.type??t.payload_type)===n.TXT_MSG,_=t=>(t.type??t.payload_type)===n.PATH,d=t=>(t.type??t.payload_type)===n.ACK,g=t=>{const e=t.type??t.payload_type;return e===n.GRP_TXT||e===n.GRP_DATA},m=t=>(t.path_length??(Array.isArray(t.original_path)?t.original_path.length:0))>0,A=t=>!!t.src_hash,T=t=>t.airtime_ms!=null,c=new Set,o=new Map;function a(t,e){return`${t}|${e}`}function u(t,e){const s=a(t,e);o.set(s,(o.get(s)??0)+1)}function y(t,e){const s=a(t,e),r=o.get(s)??0;r>1?o.set(s,r-1):o.delete(s)}function C(t){for(const e of t){const s=a(e.target,e.fn);c.has(s)||c.add(s)}}function P(t){i.useEffect(()=>{for(const e of t)u(e.target,e.fn);return()=>{for(const e of t)y(e.target,e.fn)}},[t])}export{m as a,A as b,h as c,d,p as e,l as f,_ as g,T as h,g as i,C as r,P as u}; diff --git a/frontend/dist/assets/cpu-BxgsQ0OY.js b/frontend/dist/assets/cpu-6yAZtSYM.js similarity index 94% rename from frontend/dist/assets/cpu-BxgsQ0OY.js rename to frontend/dist/assets/cpu-6yAZtSYM.js index 21b4dae7..4cc1fd8e 100644 --- a/frontend/dist/assets/cpu-BxgsQ0OY.js +++ b/frontend/dist/assets/cpu-6yAZtSYM.js @@ -1,4 +1,4 @@ -import{e as h}from"./index-i0xzpXop.js";/** +import{e as h}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/database-gsjgeKE3.js b/frontend/dist/assets/database-n5nNHRzj.js similarity index 90% rename from frontend/dist/assets/database-gsjgeKE3.js rename to frontend/dist/assets/database-n5nNHRzj.js index e6be8371..e6b181ea 100644 --- a/frontend/dist/assets/database-gsjgeKE3.js +++ b/frontend/dist/assets/database-n5nNHRzj.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/easing-BdzuOPcT.js b/frontend/dist/assets/easing-Cg6LL_7U.js similarity index 57% rename from frontend/dist/assets/easing-BdzuOPcT.js rename to frontend/dist/assets/easing-Cg6LL_7U.js index 892cfd70..2a398df8 100644 --- a/frontend/dist/assets/easing-BdzuOPcT.js +++ b/frontend/dist/assets/easing-Cg6LL_7U.js @@ -1 +1 @@ -import{gS as s}from"./index-i0xzpXop.js";const e=s(.65,0,.35,1),t=s(.33,1,.68,1),c=s(.33,.67,.67,1),u=s(.76,0,.24,1);export{t as a,e as b,c,u as e}; +import{gS as s}from"./index-CN4vD05c.js";const e=s(.65,0,.35,1),t=s(.33,1,.68,1),c=s(.33,.67,.67,1),u=s(.76,0,.24,1);export{t as a,e as b,c,u as e}; diff --git a/frontend/dist/assets/element-movement-BD3SL-GU.js b/frontend/dist/assets/element-movement-22ZdBM88.js similarity index 97% rename from frontend/dist/assets/element-movement-BD3SL-GU.js rename to frontend/dist/assets/element-movement-22ZdBM88.js index e853dead..25ee6769 100644 --- a/frontend/dist/assets/element-movement-BD3SL-GU.js +++ b/frontend/dist/assets/element-movement-22ZdBM88.js @@ -1 +1 @@ -import{r as o,aT as p,d3 as v,gq as b,gr as x,dj as $,bx as m}from"./index-i0xzpXop.js";function y(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function D(e=y){return o.useCallback((t,n)=>{if(typeof e=="string"){let u=e;return(t==null?void 0:t[u])===(n==null?void 0:n[u])}return e(t,n)},[e])}var w=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(w||{});function M(e){let t=o.useRef(null),n=p(l=>{t.current=l.pointerType,!v(l.currentTarget)&&l.pointerType==="mouse"&&l.button===w.Left&&(l.preventDefault(),e(l))}),u=p(l=>{t.current!=="mouse"&&(v(l.currentTarget)||e(l))});return{onPointerDown:n,onClick:u}}var R=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(R||{});const j={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},I=200,h=5;function E(e,{trigger:t,action:n,close:u,select:l}){let r=o.useRef(null),i=o.useRef(null),c=o.useRef(null);b(e&&t!==null,"pointerdown",s=>{x(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(i.current=s.x,c.current=s.y,r.current=s.timeStamp)}),b(e&&t!==null,"pointerup",s=>{var a,d;let f=r.current;if(f===null||(r.current=null,!$(s.target))||Math.abs(s.x-((a=i.current)!=null?a:s.x))I&&(l(g.target),u());break}case 2:{u();break}}},{capture:!0})}function k(e){return[e.screenX,e.screenY]}function N(){let e=o.useRef([-1,-1]);return{wasMoved(t){let n=k(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=k(t)}}}function L(e){throw new Error("Unexpected object: "+e)}var S=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(S||{});function P(e,t){let n=t.resolveItems();if(n.length<=0)return null;let u=t.resolveActiveIndex(),l=u??-1;switch(e.focus){case 0:{for(let r=0;r=0;--r)if(!t.resolveDisabled(n[r],r,n))return r;return u}case 2:{for(let r=l+1;r=0;--r)if(!t.resolveDisabled(n[r],r,n))return r;return u}case 4:{for(let r=0;r({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function T(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function F(e,t,n){let u=m();if(t.kind==="Tracked"){let l=function(){r!==T(e)&&(u.dispose(),n())},{position:r}=t,i=new ResizeObserver(l);i.observe(e),u.add(()=>i.disconnect()),u.addEventListener(window,"scroll",l,{passive:!0}),u.addEventListener(window,"resize",l)}return()=>u.dispose()}export{E as L,j as S,z as a,T as b,S as c,D as d,P as f,w as g,F as p,M as s,N as u}; +import{r as o,aT as p,d3 as v,gq as b,gr as x,dj as $,bx as m}from"./index-CN4vD05c.js";function y(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function D(e=y){return o.useCallback((t,n)=>{if(typeof e=="string"){let u=e;return(t==null?void 0:t[u])===(n==null?void 0:n[u])}return e(t,n)},[e])}var w=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(w||{});function M(e){let t=o.useRef(null),n=p(l=>{t.current=l.pointerType,!v(l.currentTarget)&&l.pointerType==="mouse"&&l.button===w.Left&&(l.preventDefault(),e(l))}),u=p(l=>{t.current!=="mouse"&&(v(l.currentTarget)||e(l))});return{onPointerDown:n,onClick:u}}var R=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(R||{});const j={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},I=200,h=5;function E(e,{trigger:t,action:n,close:u,select:l}){let r=o.useRef(null),i=o.useRef(null),c=o.useRef(null);b(e&&t!==null,"pointerdown",s=>{x(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(i.current=s.x,c.current=s.y,r.current=s.timeStamp)}),b(e&&t!==null,"pointerup",s=>{var a,d;let f=r.current;if(f===null||(r.current=null,!$(s.target))||Math.abs(s.x-((a=i.current)!=null?a:s.x))I&&(l(g.target),u());break}case 2:{u();break}}},{capture:!0})}function k(e){return[e.screenX,e.screenY]}function N(){let e=o.useRef([-1,-1]);return{wasMoved(t){let n=k(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=k(t)}}}function L(e){throw new Error("Unexpected object: "+e)}var S=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(S||{});function P(e,t){let n=t.resolveItems();if(n.length<=0)return null;let u=t.resolveActiveIndex(),l=u??-1;switch(e.focus){case 0:{for(let r=0;r=0;--r)if(!t.resolveDisabled(n[r],r,n))return r;return u}case 2:{for(let r=l+1;r=0;--r)if(!t.resolveDisabled(n[r],r,n))return r;return u}case 4:{for(let r=0;r({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function T(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function F(e,t,n){let u=m();if(t.kind==="Tracked"){let l=function(){r!==T(e)&&(u.dispose(),n())},{position:r}=t,i=new ResizeObserver(l);i.observe(e),u.add(()=>i.disconnect()),u.addEventListener(window,"scroll",l,{passive:!0}),u.addEventListener(window,"resize",l)}return()=>u.dispose()}export{E as L,j as S,z as a,T as b,S as c,D as d,P as f,w as g,F as p,M as s,N as u}; diff --git a/frontend/dist/assets/fieldset-DCj-Bavz.js b/frontend/dist/assets/fieldset-D4C8gyQW.js similarity index 80% rename from frontend/dist/assets/fieldset-DCj-Bavz.js rename to frontend/dist/assets/fieldset-D4C8gyQW.js index a627eb35..e8b91322 100644 --- a/frontend/dist/assets/fieldset-DCj-Bavz.js +++ b/frontend/dist/assets/fieldset-D4C8gyQW.js @@ -1 +1 @@ -import{j as a,dM as l,c as i,b2 as n,fH as c}from"./index-i0xzpXop.js";function x({disabled:e,className:s,children:t}){return a.jsx(l,{disabled:e,className:i("flex flex-col gap-2",s),children:t})}function m({required:e,className:s,children:t,...r}){return a.jsxs(n,{className:i("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",r.title&&"cursor-help",s),...r,children:[t,e&&a.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function o({className:e,children:s,...t}){return a.jsx(c,{className:i("text-sm text-fg-muted","data-[disabled]:opacity-50",e),...t,children:s})}export{o as D,x as F,m as L}; +import{j as a,dM as l,c as i,b2 as n,fH as c}from"./index-CN4vD05c.js";function x({disabled:e,className:s,children:t}){return a.jsx(l,{disabled:e,className:i("flex flex-col gap-2",s),children:t})}function m({required:e,className:s,children:t,...r}){return a.jsxs(n,{className:i("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",r.title&&"cursor-help",s),...r,children:[t,e&&a.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function o({className:e,children:s,...t}){return a.jsx(c,{className:i("text-sm text-fg-muted","data-[disabled]:opacity-50",e),...t,children:s})}export{o as D,x as F,m as L}; diff --git a/frontend/dist/assets/frozen-D4mEoVft.js b/frontend/dist/assets/frozen-ZI0va0FF.js similarity index 78% rename from frontend/dist/assets/frozen-D4mEoVft.js rename to frontend/dist/assets/frozen-ZI0va0FF.js index 57e0788e..4fd47894 100644 --- a/frontend/dist/assets/frozen-D4mEoVft.js +++ b/frontend/dist/assets/frozen-ZI0va0FF.js @@ -1 +1 @@ -import{bu as l,r as o}from"./index-i0xzpXop.js";function a({children:t,freeze:e},n){let r=f(e,t);return o.isValidElement(r)?o.cloneElement(r,{ref:n}):l.createElement(l.Fragment,null,r)}const c=l.forwardRef(a);function f(t,e){let[n,r]=o.useState(e);return!t&&n!==e&&r(e),t?n:e}export{c as s,f as u}; +import{bu as l,r as o}from"./index-CN4vD05c.js";function a({children:t,freeze:e},n){let r=f(e,t);return o.isValidElement(r)?o.cloneElement(r,{ref:n}):l.createElement(l.Fragment,null,r)}const c=l.forwardRef(a);function f(t,e){let[n,r]=o.useState(e);return!t&&n!==e&&r(e),t?n:e}export{c as s,f as u}; diff --git a/frontend/dist/assets/funnel-CitfWrkD.js b/frontend/dist/assets/funnel-Bd2d2Gy-.js similarity index 90% rename from frontend/dist/assets/funnel-CitfWrkD.js rename to frontend/dist/assets/funnel-Bd2d2Gy-.js index fb9c4357..b9e6ac3e 100644 --- a/frontend/dist/assets/funnel-CitfWrkD.js +++ b/frontend/dist/assets/funnel-Bd2d2Gy-.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/git-branch-DrsZ9sUq.js b/frontend/dist/assets/git-branch-DpI9mavY.js similarity index 90% rename from frontend/dist/assets/git-branch-DrsZ9sUq.js rename to frontend/dist/assets/git-branch-DpI9mavY.js index ecfd1bda..1b15420f 100644 --- a/frontend/dist/assets/git-branch-DrsZ9sUq.js +++ b/frontend/dist/assets/git-branch-DpI9mavY.js @@ -1,4 +1,4 @@ -import{e as c}from"./index-i0xzpXop.js";/** +import{e as c}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/hash-CyK-Kad6.js b/frontend/dist/assets/hash-vaiKl847.js similarity index 91% rename from frontend/dist/assets/hash-CyK-Kad6.js rename to frontend/dist/assets/hash-vaiKl847.js index 16ecb9c9..0a66d101 100644 --- a/frontend/dist/assets/hash-CyK-Kad6.js +++ b/frontend/dist/assets/hash-vaiKl847.js @@ -1,4 +1,4 @@ -import{e}from"./index-i0xzpXop.js";/** +import{e}from"./index-CN4vD05c.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/index-i0xzpXop.js b/frontend/dist/assets/index-CN4vD05c.js similarity index 75% rename from frontend/dist/assets/index-i0xzpXop.js rename to frontend/dist/assets/index-CN4vD05c.js index 2ceb9029..ee42568e 100644 --- a/frontend/dist/assets/index-i0xzpXop.js +++ b/frontend/dist/assets/index-CN4vD05c.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CDloj9Ii.js","assets/PageLayout-B4RCJ-XT.js","assets/consumer-registry-5uDLywpC.js","assets/DataValue-Cj0a0QCM.js","assets/index-BCuGA4PV.js","assets/index-CBEGRHd5.js","assets/node-types-rVJPSDxd.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/PacketList-CbchJDnI.js","assets/chevron-up-BVzq549_.js","assets/primitives-QKpQyH4U.js","assets/badge-colors-Dl76Mz8m.js","assets/chat-utils-BdAUDg3r.js","assets/SignalIndicator-D8uG_rJC.js","assets/arrow-up-D_sZeyuo.js","assets/arrow-right-BZS-u7CW.js","assets/arrow-down-SlBTV0Nc.js","assets/chevron-right-DsOuIRi8.js","assets/payload-detail-Bh2WvEK0.js","assets/map-pin-C051lstq.js","assets/circle-question-mark-CJCLhkb9.js","assets/layers-LQ5jNXOV.js","assets/hash-CyK-Kad6.js","assets/clock-F-4SScS_.js","assets/route-Df1YhBTq.js","assets/activity-DQoaymFw.js","assets/database-gsjgeKE3.js","assets/useMapViewStore-DZlzQmak.js","assets/shield-CxmFjMfw.js","assets/MqttModeBadge-Dhi11STL.js","assets/zap-tuTM-Jsw.js","assets/usePipelineStore-BqTRxIqB.js","assets/LightSparkline-DC33xzFq.js","assets/link-scoring-BqsMOwtz.js","assets/AutoConfigureDialog-C9ytM4jL.js","assets/wand-sparkles-DBzA3PXL.js","assets/ChatBubble-DL8lfbnv.js","assets/message-square-text-CIgRIHv3.js","assets/message-square-BzLgyIjH.js","assets/shield-check-DlsLo8Eo.js","assets/Grid-BhoD4aLU.js","assets/Packets-BMtxtCyl.js","assets/element-movement-BD3SL-GU.js","assets/use-tree-walker-B4ov8RnQ.js","assets/frozen-D4mEoVft.js","assets/AnalyzerFilterPanel-DPT1vjKV.js","assets/funnel-CitfWrkD.js","assets/search-DsTk_ZsM.js","assets/Contacts-CkDqsspC.js","assets/listbox-C1gGOelh.js","assets/use-text-value-T4f0bwXS.js","assets/CollisionExplorerModal-DAlBzVhS.js","assets/BasemapLayer-Bv4kYAcR.js","assets/share-2-B5yQaExh.js","assets/target-BAeWmUfa.js","assets/map-pin-off-CPSqCYZk.js","assets/trash-2-DCqpUdF7.js","assets/ConfirmModal-CtS0orbM.js","assets/maplibre-gl-B1CfjdFi.css","assets/Statistics-xvNcJQ3I.js","assets/easing-BdzuOPcT.js","assets/compass-0fhguiKE.js","assets/settings-2-B0xGzDNd.js","assets/network-CeKhSsIh.js","assets/MeshGraph-DWjajU3T.js","assets/max-C_kLXH5u.js","assets/variants-Bbq7uzV_.js","assets/git-branch-DrsZ9sUq.js","assets/rotate-ccw-DqV8JyUZ.js","assets/System-Cocq8BLz.js","assets/thermometer-DhPCT8Cn.js","assets/cpu-BxgsQ0OY.js","assets/Logs-DxRQJIYV.js","assets/circle-stop--JH-Omkf.js","assets/Terminal-aB_59Bcc.js","assets/system-Xia4FpjC.js","assets/KeycapButton-BjL5Ht30.js","assets/keycap-sfx-ByZp-njj.js","assets/Terminal-6GBZ9nXN.css","assets/Configuration-C6MYk4Vr.js","assets/pencil-8q_J08l4.js","assets/repeat-BSIxXQ81.js","assets/antenna-C7FNplvf.js","assets/plus-Bb8eT78f.js","assets/key-round-BpDWKeL5.js","assets/RoomServer-DiCPtnmR.js","assets/fieldset-DCj-Bavz.js","assets/wifi-DYlEDPZY.js","assets/PacketObservatory-CbUj8V1_.js","assets/Sessions-CqZugS72.js","assets/Mqtt-DoM7Zof1.js","assets/check-check-AfNqagLY.js","assets/wifi-off-CQ0s_9cO.js","assets/Companion-CSLLhavp.js","assets/circle-alert-PnLnz8pa.js","assets/Test-COE9gN1S.js"])))=>i.map(i=>d[i]); -var $M=Object.defineProperty;var Gk=e=>{throw TypeError(e)};var UM=(e,t,n)=>t in e?$M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>UM(e,typeof t!="symbol"?t+"":t,n),H0=(e,t,n)=>t.has(e)||Gk("Cannot "+n);var ge=(e,t,n)=>(H0(e,t,"read from private field"),n?n.call(e):t.get(e)),Zt=(e,t,n)=>t.has(e)?Gk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tt=(e,t,n,r)=>(H0(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),yt=(e,t,n)=>(H0(e,t,"access private method"),n);var yp=(e,t,n,r)=>({set _(s){Tt(e,t,s,n)},get _(){return ge(e,t,r)}});function zM(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function VM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W0={exports:{}},Ed={},q0={exports:{}},qt={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-B_DHVbWG.js","assets/PageLayout-DJSWC4zL.js","assets/consumer-registry-ssgJoJPf.js","assets/DataValue-CdynXJno.js","assets/index-G-dTy9iF.js","assets/index-CnWrze_V.js","assets/node-types-UozthSpR.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/PacketList-Dq4ygXCy.js","assets/chevron-up-Tfuf4unO.js","assets/primitives-DS3PJRi6.js","assets/badge-colors-Dl76Mz8m.js","assets/chat-utils-BLzyljgm.js","assets/SignalIndicator-BpXSkqBv.js","assets/arrow-up-Cd56Jeq2.js","assets/arrow-right-9ryFJ0vV.js","assets/arrow-down-BuVueZSW.js","assets/chevron-right-BCotFXkU.js","assets/payload-detail-DXAypO28.js","assets/map-pin-W8m2dIyd.js","assets/circle-question-mark-z2YWN8ID.js","assets/layers-DwnLNHzI.js","assets/hash-vaiKl847.js","assets/clock-jH_gnOTU.js","assets/route-4Pe810jq.js","assets/activity-ZoAXCcWm.js","assets/database-n5nNHRzj.js","assets/useMapViewStore-D6ulpFc9.js","assets/shield-DH-P-9VP.js","assets/MqttModeBadge-BFJmiZy5.js","assets/zap-Ba3ctUHg.js","assets/usePipelineStore-BTv04vLL.js","assets/LightSparkline-Bfgi1R3B.js","assets/link-scoring--28z7vGg.js","assets/AutoConfigureDialog-LhNiSavq.js","assets/wand-sparkles-Bg4EWlYl.js","assets/ChatBubble-CFCWQdGy.js","assets/message-square-text-CjTpe3p8.js","assets/message-square-EOpOlt3H.js","assets/shield-check-WAIr0NHG.js","assets/Grid-DeJEUuBo.js","assets/Packets-BJYka-4Q.js","assets/element-movement-22ZdBM88.js","assets/use-tree-walker-Dw8GtAHe.js","assets/frozen-ZI0va0FF.js","assets/AnalyzerFilterPanel-BjXbv0-E.js","assets/funnel-Bd2d2Gy-.js","assets/search-D1TEdb7u.js","assets/Contacts-BgYz8bSj.js","assets/listbox-Cfex3RUz.js","assets/use-text-value-DHtdh4JM.js","assets/CollisionExplorerModal-CDRCTbR-.js","assets/BasemapLayer-B81nTsqc.js","assets/share-2-FGmu8UDX.js","assets/target-CftUJhmo.js","assets/map-pin-off-VHAD8rJE.js","assets/trash-2-DqmFYXqQ.js","assets/ConfirmModal-CH_Er4VJ.js","assets/maplibre-gl-B1CfjdFi.css","assets/Statistics-CDDutBX6.js","assets/easing-Cg6LL_7U.js","assets/compass-Ddh177-W.js","assets/settings-2-CUT2ngOp.js","assets/network-DgftOg20.js","assets/MeshGraph-P8jwne_q.js","assets/max-BbWCrv_A.js","assets/variants-WkuRUM3u.js","assets/git-branch-DpI9mavY.js","assets/rotate-ccw-D-KWB9ub.js","assets/System-2yGnS_a1.js","assets/thermometer-lyVPAuKn.js","assets/cpu-6yAZtSYM.js","assets/Logs-BOXDno8q.js","assets/circle-stop-DyVWFFOh.js","assets/Terminal-CBFaPt_l.js","assets/system-Bx1EMTn3.js","assets/KeycapButton-DFXxSuaV.js","assets/keycap-sfx-ByZp-njj.js","assets/Terminal-6GBZ9nXN.css","assets/Configuration-Dg0qrWk7.js","assets/pencil-BEPIyoAD.js","assets/repeat-CTlAf3ox.js","assets/antenna-CnCmnu-_.js","assets/plus-3025QRmd.js","assets/key-round-CiTX8EjL.js","assets/RoomServer-CzNntLvv.js","assets/fieldset-D4C8gyQW.js","assets/wifi-BF-rEj1F.js","assets/PacketObservatory-BrZhT-1E.js","assets/Sessions-BgoBMfDO.js","assets/Mqtt-DR3VniFT.js","assets/check-check-CL5EVU8z.js","assets/wifi-off-Bfc2_ayY.js","assets/Companion-qTbNLFUD.js","assets/circle-alert-NywFrEoZ.js","assets/Test-O-okW-Fy.js"])))=>i.map(i=>d[i]); +var UM=Object.defineProperty;var Gk=e=>{throw TypeError(e)};var zM=(e,t,n)=>t in e?UM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>zM(e,typeof t!="symbol"?t+"":t,n),H0=(e,t,n)=>t.has(e)||Gk("Cannot "+n);var ge=(e,t,n)=>(H0(e,t,"read from private field"),n?n.call(e):t.get(e)),Zt=(e,t,n)=>t.has(e)?Gk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tt=(e,t,n,r)=>(H0(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),yt=(e,t,n)=>(H0(e,t,"access private method"),n);var bp=(e,t,n,r)=>({set _(s){Tt(e,t,s,n)},get _(){return ge(e,t,r)}});function VM(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function HM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W0={exports:{}},Ed={},q0={exports:{}},qt={};/** * @license React * react.production.min.js * @@ -7,7 +7,7 @@ var $M=Object.defineProperty;var Gk=e=>{throw TypeError(e)};var UM=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Kk;function HM(){if(Kk)return qt;Kk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.iterator;function p(q){return q===null||typeof q!="object"?null:(q=h&&q[h]||q["@@iterator"],typeof q=="function"?q:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function w(q,V,G){this.props=q,this.context=V,this.refs=b,this.updater=G||g}w.prototype.isReactComponent={},w.prototype.setState=function(q,V){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,V,"setState")},w.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function x(){}x.prototype=w.prototype;function v(q,V,G){this.props=q,this.context=V,this.refs=b,this.updater=G||g}var C=v.prototype=new x;C.constructor=v,y(C,w.prototype),C.isPureReactComponent=!0;var _=Array.isArray,S=Object.prototype.hasOwnProperty,k={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function A(q,V,G){var ye,ee={},ke=null,ne=null;if(V!=null)for(ye in V.ref!==void 0&&(ne=V.ref),V.key!==void 0&&(ke=""+V.key),V)S.call(V,ye)&&!P.hasOwnProperty(ye)&&(ee[ye]=V[ye]);var te=arguments.length-2;if(te===1)ee.children=G;else if(1{throw TypeError(e)};var UM=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Qk;function WM(){if(Qk)return Ed;Qk=1;var e=Rg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(a,c,u){var f,h={},p=null,g=null;u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(g=c.ref);for(f in c)r.call(c,f)&&!o.hasOwnProperty(f)&&(h[f]=c[f]);if(a&&a.defaultProps)for(f in c=a.defaultProps,c)h[f]===void 0&&(h[f]=c[f]);return{$$typeof:t,type:a,key:p,ref:g,props:h,_owner:s.current}}return Ed.Fragment=n,Ed.jsx=i,Ed.jsxs=i,Ed}var Xk;function qM(){return Xk||(Xk=1,W0.exports=WM()),W0.exports}var F=qM(),B=Rg();const at=VM(B),Jk=zM({__proto__:null,default:at},[B]);var bp={},G0={exports:{}},_s={},K0={exports:{}},Y0={};/** + */var Qk;function qM(){if(Qk)return Ed;Qk=1;var e=Rg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(a,c,u){var f,h={},p=null,g=null;u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(g=c.ref);for(f in c)r.call(c,f)&&!o.hasOwnProperty(f)&&(h[f]=c[f]);if(a&&a.defaultProps)for(f in c=a.defaultProps,c)h[f]===void 0&&(h[f]=c[f]);return{$$typeof:t,type:a,key:p,ref:g,props:h,_owner:s.current}}return Ed.Fragment=n,Ed.jsx=i,Ed.jsxs=i,Ed}var Xk;function GM(){return Xk||(Xk=1,W0.exports=qM()),W0.exports}var F=GM(),B=Rg();const at=HM(B),Jk=VM({__proto__:null,default:at},[B]);var vp={},G0={exports:{}},_s={},K0={exports:{}},Y0={};/** * @license React * scheduler.production.min.js * @@ -23,7 +23,7 @@ var $M=Object.defineProperty;var Gk=e=>{throw TypeError(e)};var UM=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Zk;function GM(){return Zk||(Zk=1,(function(e){function t(K,se){var Y=K.length;K.push(se);e:for(;0>>1,V=K[q];if(0>>1;qs(ee,Y))kes(ne,ee)?(K[q]=ne,K[ke]=Y,q=ke):(K[q]=ee,K[ye]=Y,q=ye);else if(kes(ne,Y))K[q]=ne,K[ke]=Y,q=ke;else break e}}return se}function s(K,se){var Y=K.sortIndex-se.sortIndex;return Y!==0?Y:K.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var c=[],u=[],f=1,h=null,p=3,g=!1,y=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(K){for(var se=n(u);se!==null;){if(se.callback===null)r(u);else if(se.startTime<=K)r(u),se.sortIndex=se.expirationTime,t(c,se);else break;se=n(u)}}function _(K){if(b=!1,C(K),!y)if(n(c)!==null)y=!0,Z(S);else{var se=n(u);se!==null&&W(_,se.startTime-K)}}function S(K,se){y=!1,b&&(b=!1,x(A),A=-1),g=!0;var Y=p;try{for(C(se),h=n(c);h!==null&&(!(h.expirationTime>se)||K&&!N());){var q=h.callback;if(typeof q=="function"){h.callback=null,p=h.priorityLevel;var V=q(h.expirationTime<=se);se=e.unstable_now(),typeof V=="function"?h.callback=V:h===n(c)&&r(c),C(se)}else r(c);h=n(c)}if(h!==null)var G=!0;else{var ye=n(u);ye!==null&&W(_,ye.startTime-se),G=!1}return G}finally{h=null,p=Y,g=!1}}var k=!1,P=null,A=-1,D=5,R=-1;function N(){return!(e.unstable_now()-RK||125q?(K.sortIndex=Y,t(u,K),n(c)===null&&K===n(u)&&(b?(x(A),A=-1):b=!0,W(_,Y-q))):(K.sortIndex=V,t(c,K),y||g||(y=!0,Z(S))),K},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(K){var se=p;return function(){var Y=p;p=se;try{return K.apply(this,arguments)}finally{p=Y}}}})(Y0)),Y0}var eS;function KM(){return eS||(eS=1,K0.exports=GM()),K0.exports}/** + */var Zk;function KM(){return Zk||(Zk=1,(function(e){function t(K,se){var Y=K.length;K.push(se);e:for(;0>>1,V=K[q];if(0>>1;qs(ee,Y))kes(ne,ee)?(K[q]=ne,K[ke]=Y,q=ke):(K[q]=ee,K[ye]=Y,q=ye);else if(kes(ne,Y))K[q]=ne,K[ke]=Y,q=ke;else break e}}return se}function s(K,se){var Y=K.sortIndex-se.sortIndex;return Y!==0?Y:K.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var c=[],u=[],f=1,h=null,p=3,g=!1,y=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(K){for(var se=n(u);se!==null;){if(se.callback===null)r(u);else if(se.startTime<=K)r(u),se.sortIndex=se.expirationTime,t(c,se);else break;se=n(u)}}function _(K){if(b=!1,C(K),!y)if(n(c)!==null)y=!0,Z(S);else{var se=n(u);se!==null&&W(_,se.startTime-K)}}function S(K,se){y=!1,b&&(b=!1,x(A),A=-1),g=!0;var Y=p;try{for(C(se),h=n(c);h!==null&&(!(h.expirationTime>se)||K&&!N());){var q=h.callback;if(typeof q=="function"){h.callback=null,p=h.priorityLevel;var V=q(h.expirationTime<=se);se=e.unstable_now(),typeof V=="function"?h.callback=V:h===n(c)&&r(c),C(se)}else r(c);h=n(c)}if(h!==null)var G=!0;else{var ye=n(u);ye!==null&&W(_,ye.startTime-se),G=!1}return G}finally{h=null,p=Y,g=!1}}var k=!1,P=null,A=-1,D=5,R=-1;function N(){return!(e.unstable_now()-RK||125q?(K.sortIndex=Y,t(u,K),n(c)===null&&K===n(u)&&(b?(x(A),A=-1):b=!0,W(_,Y-q))):(K.sortIndex=V,t(c,K),y||g||(y=!0,Z(S))),K},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(K){var se=p;return function(){var Y=p;p=se;try{return K.apply(this,arguments)}finally{p=Y}}}})(Y0)),Y0}var eS;function YM(){return eS||(eS=1,K0.exports=KM()),K0.exports}/** * @license React * react-dom.production.min.js * @@ -31,14 +31,14 @@ var $M=Object.defineProperty;var Gk=e=>{throw TypeError(e)};var UM=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var tS;function YM(){if(tS)return _s;tS=1;var e=Rg(),t=KM();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,m=1;m"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},h={};function p(l){return c.call(h,l)?!0:c.call(f,l)?!1:u.test(l)?h[l]=!0:(f[l]=!0,!1)}function g(l,d,m,E){if(m!==null&&m.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return E?!1:m!==null?!m.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function y(l,d,m,E){if(d===null||typeof d>"u"||g(l,d,m,E))return!0;if(E)return!1;if(m!==null)switch(m.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function b(l,d,m,E,M,j,Q){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=E,this.attributeNamespace=M,this.mustUseProperty=m,this.propertyName=l,this.type=d,this.sanitizeURL=j,this.removeEmptyString=Q}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new b(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new b(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new b(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new b(l,5,!1,l.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function v(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,m,E){var M=w.hasOwnProperty(d)?w[d]:null;(M!==null?M.type!==0:E||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},h={};function p(l){return c.call(h,l)?!0:c.call(f,l)?!1:u.test(l)?h[l]=!0:(f[l]=!0,!1)}function g(l,d,m,E){if(m!==null&&m.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return E?!1:m!==null?!m.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function y(l,d,m,E){if(d===null||typeof d>"u"||g(l,d,m,E))return!0;if(E)return!1;if(m!==null)switch(m.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function b(l,d,m,E,M,j,Q){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=E,this.attributeNamespace=M,this.mustUseProperty=m,this.propertyName=l,this.type=d,this.sanitizeURL=j,this.removeEmptyString=Q}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new b(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new b(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new b(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new b(l,5,!1,l.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function v(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(x,v);w[d]=new b(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,m,E){var M=w.hasOwnProperty(d)?w[d]:null;(M!==null?M.type!==0:E||!(2be||M[Q]!==j[be]){var xe=` -`+M[Q].replace(" at new "," at ");return l.displayName&&xe.includes("")&&(xe=xe.replace("",l.displayName)),xe}while(1<=Q&&0<=be);break}}}finally{G=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?V(l):""}function ee(l){switch(l.tag){case 5:return V(l.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return l=ye(l.type,!1),l;case 11:return l=ye(l.type.render,!1),l;case 1:return l=ye(l.type,!0),l;default:return""}}function ke(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case k:return"Portal";case D:return"Profiler";case A:return"StrictMode";case U:return"Suspense";case $:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case N:return(l.displayName||"Context")+".Consumer";case R:return(l._context.displayName||"Context")+".Provider";case L:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case z:return d=l.displayName||null,d!==null?d:ke(l.type)||"Memo";case Z:d=l._payload,l=l._init;try{return ke(l(d))}catch{}}return null}function ne(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(d);case 8:return d===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function te(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ae(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function re(l){var d=ae(l)?"checked":"value",m=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),E=""+l[d];if(!l.hasOwnProperty(d)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var M=m.get,j=m.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return M.call(this)},set:function(Q){E=""+Q,j.call(this,Q)}}),Object.defineProperty(l,d,{enumerable:m.enumerable}),{getValue:function(){return E},setValue:function(Q){E=""+Q},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function he(l){l._valueTracker||(l._valueTracker=re(l))}function Ee(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var m=d.getValue(),E="";return l&&(E=ae(l)?l.checked?"true":"false":l.value),l=E,l!==m?(d.setValue(l),!0):!1}function Be(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function _e(l,d){var m=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??l._wrapperState.initialChecked})}function ie(l,d){var m=d.defaultValue==null?"":d.defaultValue,E=d.checked!=null?d.checked:d.defaultChecked;m=te(d.value!=null?d.value:m),l._wrapperState={initialChecked:E,initialValue:m,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function me(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Te(l,d){me(l,d);var m=te(d.value),E=d.type;if(m!=null)E==="number"?(m===0&&l.value===""||l.value!=m)&&(l.value=""+m):l.value!==""+m&&(l.value=""+m);else if(E==="submit"||E==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Le(l,d.type,m):d.hasOwnProperty("defaultValue")&&Le(l,d.type,te(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Ne(l,d,m){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var E=d.type;if(!(E!=="submit"&&E!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,m||d===l.value||(l.value=d),l.defaultValue=d}m=l.name,m!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,m!==""&&(l.name=m)}function Le(l,d,m){(d!=="number"||Be(l.ownerDocument)!==l)&&(m==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+m&&(l.defaultValue=""+m))}var Ue=Array.isArray;function ve(l,d,m,E){if(l=l.options,d){d={};for(var M=0;M"+d.valueOf().toString()+"",d=O.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ue(l,d){if(d){var m=l.firstChild;if(m&&m===l.lastChild&&m.nodeType===3){m.nodeValue=d;return}}l.textContent=d}var ce={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ce=["Webkit","ms","Moz","O"];Object.keys(ce).forEach(function(l){Ce.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),ce[d]=ce[l]})});function fe(l,d,m){return d==null||typeof d=="boolean"||d===""?"":m||typeof d!="number"||d===0||ce.hasOwnProperty(l)&&ce[l]?(""+d).trim():d+"px"}function we(l,d){l=l.style;for(var m in d)if(d.hasOwnProperty(m)){var E=m.indexOf("--")===0,M=fe(m,d[m],E);m==="float"&&(m="cssFloat"),E?l.setProperty(m,M):l[m]=M}}var Qe=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nt(l,d){if(d){if(Qe[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function it(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mt=null;function zt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var an=null,xt=null,Vt=null;function kt(l){if(l=id(l)){if(typeof an!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Ph(d),an(l.stateNode,l.type,d))}}function Ht(l){xt?Vt?Vt.push(l):Vt=[l]:xt=l}function Xt(){if(xt){var l=xt,d=Vt;if(Vt=xt=null,kt(l),d)for(l=0;l>>=0,l===0?32:31-(Hu(l)/Ur|0)|0}var tl=64,Qi=4194304;function Xi(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function uc(l,d){var m=l.pendingLanes;if(m===0)return 0;var E=0,M=l.suspendedLanes,j=l.pingedLanes,Q=m&268435455;if(Q!==0){var be=Q&~M;be!==0?E=Xi(be):(j&=Q,j!==0&&(E=Xi(j)))}else Q=m&~M,Q!==0?E=Xi(Q):j!==0&&(E=Xi(j));if(E===0)return 0;if(d!==0&&d!==E&&(d&M)===0&&(M=E&-E,j=d&-d,M>=j||M===16&&(j&4194240)!==0))return d;if((E&4)!==0&&(E|=m&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=E;0m;m++)d.push(l);return d}function Ji(l,d,m){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-ts(d),l[d]=m}function Gu(l,d){var m=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var E=l.eventTimes;for(l=l.expirationTimes;0=bi),Sh=" ",wc=!1;function H(l,d){switch(l){case"keyup":return Xn.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var le=!1;function pe(l,d){switch(l){case"compositionend":return X(d);case"keypress":return d.which!==32?null:(wc=!0,Sh);case"textInput":return l=d.data,l===Sh&&wc?null:l;default:return null}}function Ae(l,d){if(le)return l==="compositionend"||!vc&&H(l,d)?(l=Is(),Rs=Xu=Ms=null,le=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:m,offset:d-l};l=E}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=Es(m)}}function Vr(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Vr(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function os(){for(var l=window,d=Be();d instanceof l.HTMLIFrameElement;){try{var m=typeof d.contentWindow.location.href=="string"}catch{m=!1}if(m)l=d.contentWindow;else break;d=Be(l.document)}return d}function is(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function Js(l){var d=os(),m=l.focusedElem,E=l.selectionRange;if(d!==m&&m&&m.ownerDocument&&Vr(m.ownerDocument.documentElement,m)){if(E!==null&&is(m)){if(d=E.start,l=E.end,l===void 0&&(l=d),"selectionStart"in m)m.selectionStart=d,m.selectionEnd=Math.min(l,m.value.length);else if(l=(d=m.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var M=m.textContent.length,j=Math.min(E.start,M);E=E.end===void 0?j:Math.min(E.end,M),!l.extend&&j>E&&(M=E,E=j,j=M),M=Ns(m,j);var Q=Ns(m,E);M&&Q&&(l.rangeCount!==1||l.anchorNode!==M.node||l.anchorOffset!==M.offset||l.focusNode!==Q.node||l.focusOffset!==Q.offset)&&(d=d.createRange(),d.setStart(M.node,M.offset),l.removeAllRanges(),j>E?(l.addRange(d),l.extend(Q.node,Q.offset)):(d.setEnd(Q.node,Q.offset),l.addRange(d)))}}for(d=[],l=m;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m=document.documentMode,lr=null,vo=null,rr=null,Ec=!1;function ZC(l,d,m){var E=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Ec||lr==null||lr!==Be(E)||(E=lr,"selectionStart"in E&&is(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),rr&&kr(rr,E)||(rr=E,E=Th(vo,"onSelect"),0Ac||(l.current=Uy[Ac],Uy[Ac]=null,Ac--)}function Sn(l,d){Ac++,Uy[Ac]=l.current,l.current=d}var fa={},Hr=da(fa),Cs=da(!1),fl=fa;function _c(l,d){var m=l.type.contextTypes;if(!m)return fa;var E=l.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===d)return E.__reactInternalMemoizedMaskedChildContext;var M={},j;for(j in m)M[j]=d[j];return E&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=M),M}function xs(l){return l=l.childContextTypes,l!=null}function Mh(){Dn(Cs),Dn(Hr)}function px(l,d,m){if(Hr.current!==fa)throw Error(n(168));Sn(Hr,d),Sn(Cs,m)}function mx(l,d,m){var E=l.stateNode;if(d=d.childContextTypes,typeof E.getChildContext!="function")return m;E=E.getChildContext();for(var M in E)if(!(M in d))throw Error(n(108,ne(l)||"Unknown",M));return Y({},m,E)}function Rh(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||fa,fl=Hr.current,Sn(Hr,l),Sn(Cs,Cs.current),!0}function gx(l,d,m){var E=l.stateNode;if(!E)throw Error(n(169));m?(l=mx(l,d,fl),E.__reactInternalMemoizedMergedChildContext=l,Dn(Cs),Dn(Hr),Sn(Hr,l)):Dn(Cs),Sn(Cs,m)}var wi=null,Ih=!1,zy=!1;function yx(l){wi===null?wi=[l]:wi.push(l)}function oM(l){Ih=!0,yx(l)}function ha(){if(!zy&&wi!==null){zy=!0;var l=0,d=Yt;try{var m=wi;for(Yt=1;l>=Q,M-=Q,Ei=1<<32-ts(d)+M|m<Rt?(_r=Dt,Dt=null):_r=Dt.sibling;var nn=Je(Me,Dt,je[Rt],ot);if(nn===null){Dt===null&&(Dt=_r);break}l&&Dt&&nn.alternate===null&&d(Me,Dt),Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn,Dt=_r}if(Rt===je.length)return m(Me,Dt),Rn&&pl(Me,Rt),Ct;if(Dt===null){for(;RtRt?(_r=Dt,Dt=null):_r=Dt.sibling;var Ca=Je(Me,Dt,nn.value,ot);if(Ca===null){Dt===null&&(Dt=_r);break}l&&Dt&&Ca.alternate===null&&d(Me,Dt),Fe=j(Ca,Fe,Rt),_t===null?Ct=Ca:_t.sibling=Ca,_t=Ca,Dt=_r}if(nn.done)return m(Me,Dt),Rn&&pl(Me,Rt),Ct;if(Dt===null){for(;!nn.done;Rt++,nn=je.next())nn=tt(Me,nn.value,ot),nn!==null&&(Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn);return Rn&&pl(Me,Rt),Ct}for(Dt=E(Me,Dt);!nn.done;Rt++,nn=je.next())nn=ht(Dt,Me,Rt,nn.value,ot),nn!==null&&(l&&nn.alternate!==null&&Dt.delete(nn.key===null?Rt:nn.key),Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn);return l&&Dt.forEach(function(OM){return d(Me,OM)}),Rn&&pl(Me,Rt),Ct}function sr(Me,Fe,je,ot){if(typeof je=="object"&&je!==null&&je.type===P&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case S:e:{for(var Ct=je.key,_t=Fe;_t!==null;){if(_t.key===Ct){if(Ct=je.type,Ct===P){if(_t.tag===7){m(Me,_t.sibling),Fe=M(_t,je.props.children),Fe.return=Me,Me=Fe;break e}}else if(_t.elementType===Ct||typeof Ct=="object"&&Ct!==null&&Ct.$$typeof===Z&&kx(Ct)===_t.type){m(Me,_t.sibling),Fe=M(_t,je.props),Fe.ref=ad(Me,_t,je),Fe.return=Me,Me=Fe;break e}m(Me,_t);break}else d(Me,_t);_t=_t.sibling}je.type===P?(Fe=Cl(je.props.children,Me.mode,ot,je.key),Fe.return=Me,Me=Fe):(ot=cp(je.type,je.key,je.props,null,Me.mode,ot),ot.ref=ad(Me,Fe,je),ot.return=Me,Me=ot)}return Q(Me);case k:e:{for(_t=je.key;Fe!==null;){if(Fe.key===_t)if(Fe.tag===4&&Fe.stateNode.containerInfo===je.containerInfo&&Fe.stateNode.implementation===je.implementation){m(Me,Fe.sibling),Fe=M(Fe,je.children||[]),Fe.return=Me,Me=Fe;break e}else{m(Me,Fe);break}else d(Me,Fe);Fe=Fe.sibling}Fe=O0(je,Me.mode,ot),Fe.return=Me,Me=Fe}return Q(Me);case Z:return _t=je._init,sr(Me,Fe,_t(je._payload),ot)}if(Ue(je))return bt(Me,Fe,je,ot);if(se(je))return wt(Me,Fe,je,ot);Oh(Me,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,Fe!==null&&Fe.tag===6?(m(Me,Fe.sibling),Fe=M(Fe,je),Fe.return=Me,Me=Fe):(m(Me,Fe),Fe=j0(je,Me.mode,ot),Fe.return=Me,Me=Fe),Q(Me)):m(Me,Fe)}return sr}var Fc=Sx(!0),Ax=Sx(!1),$h=da(null),Uh=null,Pc=null,Ky=null;function Yy(){Ky=Pc=Uh=null}function Qy(l){var d=$h.current;Dn($h),l._currentValue=d}function Xy(l,d,m){for(;l!==null;){var E=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,E!==null&&(E.childLanes|=d)):E!==null&&(E.childLanes&d)!==d&&(E.childLanes|=d),l===m)break;l=l.return}}function Mc(l,d){Uh=l,Ky=Pc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ks=!0),l.firstContext=null)}function to(l){var d=l._currentValue;if(Ky!==l)if(l={context:l,memoizedValue:d,next:null},Pc===null){if(Uh===null)throw Error(n(308));Pc=l,Uh.dependencies={lanes:0,firstContext:l}}else Pc=Pc.next=l;return d}var ml=null;function Jy(l){ml===null?ml=[l]:ml.push(l)}function _x(l,d,m,E){var M=d.interleaved;return M===null?(m.next=m,Jy(d)):(m.next=M.next,M.next=m),d.interleaved=m,xi(l,E)}function xi(l,d){l.lanes|=d;var m=l.alternate;for(m!==null&&(m.lanes|=d),m=l,l=l.return;l!==null;)l.childLanes|=d,m=l.alternate,m!==null&&(m.childLanes|=d),m=l,l=l.return;return m.tag===3?m.stateNode:null}var pa=!1;function Zy(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dx(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function ki(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function ma(l,d,m){var E=l.updateQueue;if(E===null)return null;if(E=E.shared,(Jt&2)!==0){var M=E.pending;return M===null?d.next=d:(d.next=M.next,M.next=d),E.pending=d,xi(l,m)}return M=E.interleaved,M===null?(d.next=d,Jy(E)):(d.next=M.next,M.next=d),E.interleaved=d,xi(l,m)}function zh(l,d,m){if(d=d.updateQueue,d!==null&&(d=d.shared,(m&4194240)!==0)){var E=d.lanes;E&=l.pendingLanes,m|=E,d.lanes=m,Zi(l,m)}}function Tx(l,d){var m=l.updateQueue,E=l.alternate;if(E!==null&&(E=E.updateQueue,m===E)){var M=null,j=null;if(m=m.firstBaseUpdate,m!==null){do{var Q={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};j===null?M=j=Q:j=j.next=Q,m=m.next}while(m!==null);j===null?M=j=d:j=j.next=d}else M=j=d;m={baseState:E.baseState,firstBaseUpdate:M,lastBaseUpdate:j,shared:E.shared,effects:E.effects},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=d}function Vh(l,d,m,E){var M=l.updateQueue;pa=!1;var j=M.firstBaseUpdate,Q=M.lastBaseUpdate,be=M.shared.pending;if(be!==null){M.shared.pending=null;var xe=be,ze=xe.next;xe.next=null,Q===null?j=ze:Q.next=ze,Q=xe;var et=l.alternate;et!==null&&(et=et.updateQueue,be=et.lastBaseUpdate,be!==Q&&(be===null?et.firstBaseUpdate=ze:be.next=ze,et.lastBaseUpdate=xe))}if(j!==null){var tt=M.baseState;Q=0,et=ze=xe=null,be=j;do{var Je=be.lane,ht=be.eventTime;if((E&Je)===Je){et!==null&&(et=et.next={eventTime:ht,lane:0,tag:be.tag,payload:be.payload,callback:be.callback,next:null});e:{var bt=l,wt=be;switch(Je=d,ht=m,wt.tag){case 1:if(bt=wt.payload,typeof bt=="function"){tt=bt.call(ht,tt,Je);break e}tt=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=wt.payload,Je=typeof bt=="function"?bt.call(ht,tt,Je):bt,Je==null)break e;tt=Y({},tt,Je);break e;case 2:pa=!0}}be.callback!==null&&be.lane!==0&&(l.flags|=64,Je=M.effects,Je===null?M.effects=[be]:Je.push(be))}else ht={eventTime:ht,lane:Je,tag:be.tag,payload:be.payload,callback:be.callback,next:null},et===null?(ze=et=ht,xe=tt):et=et.next=ht,Q|=Je;if(be=be.next,be===null){if(be=M.shared.pending,be===null)break;Je=be,be=Je.next,Je.next=null,M.lastBaseUpdate=Je,M.shared.pending=null}}while(!0);if(et===null&&(xe=tt),M.baseState=xe,M.firstBaseUpdate=ze,M.lastBaseUpdate=et,d=M.shared.interleaved,d!==null){M=d;do Q|=M.lane,M=M.next;while(M!==d)}else j===null&&(M.shared.lanes=0);bl|=Q,l.lanes=Q,l.memoizedState=tt}}function Bx(l,d,m){if(l=d.effects,d.effects=null,l!==null)for(d=0;dm?m:4,l(!0);var E=s0.transition;s0.transition={};try{l(!1),d()}finally{Yt=m,s0.transition=E}}function Yx(){return no().memoizedState}function cM(l,d,m){var E=va(l);if(m={lane:E,action:m,hasEagerState:!1,eagerState:null,next:null},Qx(l))Xx(d,m);else if(m=_x(l,d,m,E),m!==null){var M=ls();ko(m,l,E,M),Jx(m,d,E)}}function uM(l,d,m){var E=va(l),M={lane:E,action:m,hasEagerState:!1,eagerState:null,next:null};if(Qx(l))Xx(d,M);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var Q=d.lastRenderedState,be=j(Q,m);if(M.hasEagerState=!0,M.eagerState=be,Cn(be,Q)){var xe=d.interleaved;xe===null?(M.next=M,Jy(d)):(M.next=xe.next,xe.next=M),d.interleaved=M;return}}catch{}finally{}m=_x(l,d,M,E),m!==null&&(M=ls(),ko(m,l,E,M),Jx(m,d,E))}}function Qx(l){var d=l.alternate;return l===Vn||d!==null&&d===Vn}function Xx(l,d){dd=qh=!0;var m=l.pending;m===null?d.next=d:(d.next=m.next,m.next=d),l.pending=d}function Jx(l,d,m){if((m&4194240)!==0){var E=d.lanes;E&=l.pendingLanes,m|=E,d.lanes=m,Zi(l,m)}}var Yh={readContext:to,useCallback:Wr,useContext:Wr,useEffect:Wr,useImperativeHandle:Wr,useInsertionEffect:Wr,useLayoutEffect:Wr,useMemo:Wr,useReducer:Wr,useRef:Wr,useState:Wr,useDebugValue:Wr,useDeferredValue:Wr,useTransition:Wr,useMutableSource:Wr,useSyncExternalStore:Wr,useId:Wr,unstable_isNewReconciler:!1},dM={readContext:to,useCallback:function(l,d){return qo().memoizedState=[l,d===void 0?null:d],l},useContext:to,useEffect:Ux,useImperativeHandle:function(l,d,m){return m=m!=null?m.concat([l]):null,Gh(4194308,4,Hx.bind(null,d,l),m)},useLayoutEffect:function(l,d){return Gh(4194308,4,l,d)},useInsertionEffect:function(l,d){return Gh(4,2,l,d)},useMemo:function(l,d){var m=qo();return d=d===void 0?null:d,l=l(),m.memoizedState=[l,d],l},useReducer:function(l,d,m){var E=qo();return d=m!==void 0?m(d):d,E.memoizedState=E.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},E.queue=l,l=l.dispatch=cM.bind(null,Vn,l),[E.memoizedState,l]},useRef:function(l){var d=qo();return l={current:l},d.memoizedState=l},useState:Ox,useDebugValue:d0,useDeferredValue:function(l){return qo().memoizedState=l},useTransition:function(){var l=Ox(!1),d=l[0];return l=lM.bind(null,l[1]),qo().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,m){var E=Vn,M=qo();if(Rn){if(m===void 0)throw Error(n(407));m=m()}else{if(m=d(),Ar===null)throw Error(n(349));(yl&30)!==0||Rx(E,d,m)}M.memoizedState=m;var j={value:m,getSnapshot:d};return M.queue=j,Ux(Lx.bind(null,E,j,l),[l]),E.flags|=2048,pd(9,Ix.bind(null,E,j,m,d),void 0,null),m},useId:function(){var l=qo(),d=Ar.identifierPrefix;if(Rn){var m=Ci,E=Ei;m=(E&~(1<<32-ts(E)-1)).toString(32)+m,d=":"+d+"R"+m,m=fd++,0")&&(xe=xe.replace("",l.displayName)),xe}while(1<=Q&&0<=be);break}}}finally{G=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?V(l):""}function ee(l){switch(l.tag){case 5:return V(l.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return l=ye(l.type,!1),l;case 11:return l=ye(l.type.render,!1),l;case 1:return l=ye(l.type,!0),l;default:return""}}function ke(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case k:return"Portal";case D:return"Profiler";case A:return"StrictMode";case U:return"Suspense";case $:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case N:return(l.displayName||"Context")+".Consumer";case R:return(l._context.displayName||"Context")+".Provider";case L:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case z:return d=l.displayName||null,d!==null?d:ke(l.type)||"Memo";case Z:d=l._payload,l=l._init;try{return ke(l(d))}catch{}}return null}function ne(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(d);case 8:return d===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function te(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ae(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function re(l){var d=ae(l)?"checked":"value",m=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),E=""+l[d];if(!l.hasOwnProperty(d)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var M=m.get,j=m.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return M.call(this)},set:function(Q){E=""+Q,j.call(this,Q)}}),Object.defineProperty(l,d,{enumerable:m.enumerable}),{getValue:function(){return E},setValue:function(Q){E=""+Q},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function he(l){l._valueTracker||(l._valueTracker=re(l))}function Ee(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var m=d.getValue(),E="";return l&&(E=ae(l)?l.checked?"true":"false":l.value),l=E,l!==m?(d.setValue(l),!0):!1}function Be(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function _e(l,d){var m=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??l._wrapperState.initialChecked})}function ie(l,d){var m=d.defaultValue==null?"":d.defaultValue,E=d.checked!=null?d.checked:d.defaultChecked;m=te(d.value!=null?d.value:m),l._wrapperState={initialChecked:E,initialValue:m,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function me(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Te(l,d){me(l,d);var m=te(d.value),E=d.type;if(m!=null)E==="number"?(m===0&&l.value===""||l.value!=m)&&(l.value=""+m):l.value!==""+m&&(l.value=""+m);else if(E==="submit"||E==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Le(l,d.type,m):d.hasOwnProperty("defaultValue")&&Le(l,d.type,te(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Ne(l,d,m){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var E=d.type;if(!(E!=="submit"&&E!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,m||d===l.value||(l.value=d),l.defaultValue=d}m=l.name,m!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,m!==""&&(l.name=m)}function Le(l,d,m){(d!=="number"||Be(l.ownerDocument)!==l)&&(m==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+m&&(l.defaultValue=""+m))}var Ue=Array.isArray;function ve(l,d,m,E){if(l=l.options,d){d={};for(var M=0;M"+d.valueOf().toString()+"",d=O.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ue(l,d){if(d){var m=l.firstChild;if(m&&m===l.lastChild&&m.nodeType===3){m.nodeValue=d;return}}l.textContent=d}var ce={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ce=["Webkit","ms","Moz","O"];Object.keys(ce).forEach(function(l){Ce.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),ce[d]=ce[l]})});function fe(l,d,m){return d==null||typeof d=="boolean"||d===""?"":m||typeof d!="number"||d===0||ce.hasOwnProperty(l)&&ce[l]?(""+d).trim():d+"px"}function we(l,d){l=l.style;for(var m in d)if(d.hasOwnProperty(m)){var E=m.indexOf("--")===0,M=fe(m,d[m],E);m==="float"&&(m="cssFloat"),E?l.setProperty(m,M):l[m]=M}}var Qe=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nt(l,d){if(d){if(Qe[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function it(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mt=null;function zt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var an=null,xt=null,Vt=null;function kt(l){if(l=id(l)){if(typeof an!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Mh(d),an(l.stateNode,l.type,d))}}function Ht(l){xt?Vt?Vt.push(l):Vt=[l]:xt=l}function Xt(){if(xt){var l=xt,d=Vt;if(Vt=xt=null,kt(l),d)for(l=0;l>>=0,l===0?32:31-(Hu(l)/Ur|0)|0}var tl=64,Qi=4194304;function Xi(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function uc(l,d){var m=l.pendingLanes;if(m===0)return 0;var E=0,M=l.suspendedLanes,j=l.pingedLanes,Q=m&268435455;if(Q!==0){var be=Q&~M;be!==0?E=Xi(be):(j&=Q,j!==0&&(E=Xi(j)))}else Q=m&~M,Q!==0?E=Xi(Q):j!==0&&(E=Xi(j));if(E===0)return 0;if(d!==0&&d!==E&&(d&M)===0&&(M=E&-E,j=d&-d,M>=j||M===16&&(j&4194240)!==0))return d;if((E&4)!==0&&(E|=m&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=E;0m;m++)d.push(l);return d}function Ji(l,d,m){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-ts(d),l[d]=m}function Gu(l,d){var m=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var E=l.eventTimes;for(l=l.expirationTimes;0=bi),Ah=" ",wc=!1;function H(l,d){switch(l){case"keyup":return Xn.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var le=!1;function pe(l,d){switch(l){case"compositionend":return X(d);case"keypress":return d.which!==32?null:(wc=!0,Ah);case"textInput":return l=d.data,l===Ah&&wc?null:l;default:return null}}function Ae(l,d){if(le)return l==="compositionend"||!vc&&H(l,d)?(l=Is(),Rs=Xu=Ms=null,le=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:m,offset:d-l};l=E}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=Es(m)}}function Vr(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Vr(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function os(){for(var l=window,d=Be();d instanceof l.HTMLIFrameElement;){try{var m=typeof d.contentWindow.location.href=="string"}catch{m=!1}if(m)l=d.contentWindow;else break;d=Be(l.document)}return d}function is(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function Js(l){var d=os(),m=l.focusedElem,E=l.selectionRange;if(d!==m&&m&&m.ownerDocument&&Vr(m.ownerDocument.documentElement,m)){if(E!==null&&is(m)){if(d=E.start,l=E.end,l===void 0&&(l=d),"selectionStart"in m)m.selectionStart=d,m.selectionEnd=Math.min(l,m.value.length);else if(l=(d=m.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var M=m.textContent.length,j=Math.min(E.start,M);E=E.end===void 0?j:Math.min(E.end,M),!l.extend&&j>E&&(M=E,E=j,j=M),M=Ns(m,j);var Q=Ns(m,E);M&&Q&&(l.rangeCount!==1||l.anchorNode!==M.node||l.anchorOffset!==M.offset||l.focusNode!==Q.node||l.focusOffset!==Q.offset)&&(d=d.createRange(),d.setStart(M.node,M.offset),l.removeAllRanges(),j>E?(l.addRange(d),l.extend(Q.node,Q.offset)):(d.setEnd(Q.node,Q.offset),l.addRange(d)))}}for(d=[],l=m;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m=document.documentMode,lr=null,vo=null,rr=null,Ec=!1;function ZC(l,d,m){var E=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Ec||lr==null||lr!==Be(E)||(E=lr,"selectionStart"in E&&is(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),rr&&kr(rr,E)||(rr=E,E=Bh(vo,"onSelect"),0Ac||(l.current=Uy[Ac],Uy[Ac]=null,Ac--)}function Sn(l,d){Ac++,Uy[Ac]=l.current,l.current=d}var fa={},Hr=da(fa),Cs=da(!1),fl=fa;function _c(l,d){var m=l.type.contextTypes;if(!m)return fa;var E=l.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===d)return E.__reactInternalMemoizedMaskedChildContext;var M={},j;for(j in m)M[j]=d[j];return E&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=M),M}function xs(l){return l=l.childContextTypes,l!=null}function Rh(){Dn(Cs),Dn(Hr)}function px(l,d,m){if(Hr.current!==fa)throw Error(n(168));Sn(Hr,d),Sn(Cs,m)}function mx(l,d,m){var E=l.stateNode;if(d=d.childContextTypes,typeof E.getChildContext!="function")return m;E=E.getChildContext();for(var M in E)if(!(M in d))throw Error(n(108,ne(l)||"Unknown",M));return Y({},m,E)}function Ih(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||fa,fl=Hr.current,Sn(Hr,l),Sn(Cs,Cs.current),!0}function gx(l,d,m){var E=l.stateNode;if(!E)throw Error(n(169));m?(l=mx(l,d,fl),E.__reactInternalMemoizedMergedChildContext=l,Dn(Cs),Dn(Hr),Sn(Hr,l)):Dn(Cs),Sn(Cs,m)}var wi=null,Lh=!1,zy=!1;function yx(l){wi===null?wi=[l]:wi.push(l)}function iM(l){Lh=!0,yx(l)}function ha(){if(!zy&&wi!==null){zy=!0;var l=0,d=Yt;try{var m=wi;for(Yt=1;l>=Q,M-=Q,Ei=1<<32-ts(d)+M|m<Rt?(_r=Dt,Dt=null):_r=Dt.sibling;var nn=Je(Me,Dt,je[Rt],ot);if(nn===null){Dt===null&&(Dt=_r);break}l&&Dt&&nn.alternate===null&&d(Me,Dt),Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn,Dt=_r}if(Rt===je.length)return m(Me,Dt),Rn&&pl(Me,Rt),Ct;if(Dt===null){for(;RtRt?(_r=Dt,Dt=null):_r=Dt.sibling;var Ca=Je(Me,Dt,nn.value,ot);if(Ca===null){Dt===null&&(Dt=_r);break}l&&Dt&&Ca.alternate===null&&d(Me,Dt),Fe=j(Ca,Fe,Rt),_t===null?Ct=Ca:_t.sibling=Ca,_t=Ca,Dt=_r}if(nn.done)return m(Me,Dt),Rn&&pl(Me,Rt),Ct;if(Dt===null){for(;!nn.done;Rt++,nn=je.next())nn=tt(Me,nn.value,ot),nn!==null&&(Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn);return Rn&&pl(Me,Rt),Ct}for(Dt=E(Me,Dt);!nn.done;Rt++,nn=je.next())nn=ht(Dt,Me,Rt,nn.value,ot),nn!==null&&(l&&nn.alternate!==null&&Dt.delete(nn.key===null?Rt:nn.key),Fe=j(nn,Fe,Rt),_t===null?Ct=nn:_t.sibling=nn,_t=nn);return l&&Dt.forEach(function($M){return d(Me,$M)}),Rn&&pl(Me,Rt),Ct}function sr(Me,Fe,je,ot){if(typeof je=="object"&&je!==null&&je.type===P&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case S:e:{for(var Ct=je.key,_t=Fe;_t!==null;){if(_t.key===Ct){if(Ct=je.type,Ct===P){if(_t.tag===7){m(Me,_t.sibling),Fe=M(_t,je.props.children),Fe.return=Me,Me=Fe;break e}}else if(_t.elementType===Ct||typeof Ct=="object"&&Ct!==null&&Ct.$$typeof===Z&&kx(Ct)===_t.type){m(Me,_t.sibling),Fe=M(_t,je.props),Fe.ref=ad(Me,_t,je),Fe.return=Me,Me=Fe;break e}m(Me,_t);break}else d(Me,_t);_t=_t.sibling}je.type===P?(Fe=Cl(je.props.children,Me.mode,ot,je.key),Fe.return=Me,Me=Fe):(ot=up(je.type,je.key,je.props,null,Me.mode,ot),ot.ref=ad(Me,Fe,je),ot.return=Me,Me=ot)}return Q(Me);case k:e:{for(_t=je.key;Fe!==null;){if(Fe.key===_t)if(Fe.tag===4&&Fe.stateNode.containerInfo===je.containerInfo&&Fe.stateNode.implementation===je.implementation){m(Me,Fe.sibling),Fe=M(Fe,je.children||[]),Fe.return=Me,Me=Fe;break e}else{m(Me,Fe);break}else d(Me,Fe);Fe=Fe.sibling}Fe=O0(je,Me.mode,ot),Fe.return=Me,Me=Fe}return Q(Me);case Z:return _t=je._init,sr(Me,Fe,_t(je._payload),ot)}if(Ue(je))return bt(Me,Fe,je,ot);if(se(je))return wt(Me,Fe,je,ot);$h(Me,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,Fe!==null&&Fe.tag===6?(m(Me,Fe.sibling),Fe=M(Fe,je),Fe.return=Me,Me=Fe):(m(Me,Fe),Fe=j0(je,Me.mode,ot),Fe.return=Me,Me=Fe),Q(Me)):m(Me,Fe)}return sr}var Fc=Sx(!0),Ax=Sx(!1),Uh=da(null),zh=null,Pc=null,Ky=null;function Yy(){Ky=Pc=zh=null}function Qy(l){var d=Uh.current;Dn(Uh),l._currentValue=d}function Xy(l,d,m){for(;l!==null;){var E=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,E!==null&&(E.childLanes|=d)):E!==null&&(E.childLanes&d)!==d&&(E.childLanes|=d),l===m)break;l=l.return}}function Mc(l,d){zh=l,Ky=Pc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ks=!0),l.firstContext=null)}function to(l){var d=l._currentValue;if(Ky!==l)if(l={context:l,memoizedValue:d,next:null},Pc===null){if(zh===null)throw Error(n(308));Pc=l,zh.dependencies={lanes:0,firstContext:l}}else Pc=Pc.next=l;return d}var ml=null;function Jy(l){ml===null?ml=[l]:ml.push(l)}function _x(l,d,m,E){var M=d.interleaved;return M===null?(m.next=m,Jy(d)):(m.next=M.next,M.next=m),d.interleaved=m,xi(l,E)}function xi(l,d){l.lanes|=d;var m=l.alternate;for(m!==null&&(m.lanes|=d),m=l,l=l.return;l!==null;)l.childLanes|=d,m=l.alternate,m!==null&&(m.childLanes|=d),m=l,l=l.return;return m.tag===3?m.stateNode:null}var pa=!1;function Zy(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dx(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function ki(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function ma(l,d,m){var E=l.updateQueue;if(E===null)return null;if(E=E.shared,(Jt&2)!==0){var M=E.pending;return M===null?d.next=d:(d.next=M.next,M.next=d),E.pending=d,xi(l,m)}return M=E.interleaved,M===null?(d.next=d,Jy(E)):(d.next=M.next,M.next=d),E.interleaved=d,xi(l,m)}function Vh(l,d,m){if(d=d.updateQueue,d!==null&&(d=d.shared,(m&4194240)!==0)){var E=d.lanes;E&=l.pendingLanes,m|=E,d.lanes=m,Zi(l,m)}}function Tx(l,d){var m=l.updateQueue,E=l.alternate;if(E!==null&&(E=E.updateQueue,m===E)){var M=null,j=null;if(m=m.firstBaseUpdate,m!==null){do{var Q={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};j===null?M=j=Q:j=j.next=Q,m=m.next}while(m!==null);j===null?M=j=d:j=j.next=d}else M=j=d;m={baseState:E.baseState,firstBaseUpdate:M,lastBaseUpdate:j,shared:E.shared,effects:E.effects},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=d}function Hh(l,d,m,E){var M=l.updateQueue;pa=!1;var j=M.firstBaseUpdate,Q=M.lastBaseUpdate,be=M.shared.pending;if(be!==null){M.shared.pending=null;var xe=be,ze=xe.next;xe.next=null,Q===null?j=ze:Q.next=ze,Q=xe;var et=l.alternate;et!==null&&(et=et.updateQueue,be=et.lastBaseUpdate,be!==Q&&(be===null?et.firstBaseUpdate=ze:be.next=ze,et.lastBaseUpdate=xe))}if(j!==null){var tt=M.baseState;Q=0,et=ze=xe=null,be=j;do{var Je=be.lane,ht=be.eventTime;if((E&Je)===Je){et!==null&&(et=et.next={eventTime:ht,lane:0,tag:be.tag,payload:be.payload,callback:be.callback,next:null});e:{var bt=l,wt=be;switch(Je=d,ht=m,wt.tag){case 1:if(bt=wt.payload,typeof bt=="function"){tt=bt.call(ht,tt,Je);break e}tt=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=wt.payload,Je=typeof bt=="function"?bt.call(ht,tt,Je):bt,Je==null)break e;tt=Y({},tt,Je);break e;case 2:pa=!0}}be.callback!==null&&be.lane!==0&&(l.flags|=64,Je=M.effects,Je===null?M.effects=[be]:Je.push(be))}else ht={eventTime:ht,lane:Je,tag:be.tag,payload:be.payload,callback:be.callback,next:null},et===null?(ze=et=ht,xe=tt):et=et.next=ht,Q|=Je;if(be=be.next,be===null){if(be=M.shared.pending,be===null)break;Je=be,be=Je.next,Je.next=null,M.lastBaseUpdate=Je,M.shared.pending=null}}while(!0);if(et===null&&(xe=tt),M.baseState=xe,M.firstBaseUpdate=ze,M.lastBaseUpdate=et,d=M.shared.interleaved,d!==null){M=d;do Q|=M.lane,M=M.next;while(M!==d)}else j===null&&(M.shared.lanes=0);bl|=Q,l.lanes=Q,l.memoizedState=tt}}function Bx(l,d,m){if(l=d.effects,d.effects=null,l!==null)for(d=0;dm?m:4,l(!0);var E=s0.transition;s0.transition={};try{l(!1),d()}finally{Yt=m,s0.transition=E}}function Yx(){return no().memoizedState}function uM(l,d,m){var E=va(l);if(m={lane:E,action:m,hasEagerState:!1,eagerState:null,next:null},Qx(l))Xx(d,m);else if(m=_x(l,d,m,E),m!==null){var M=ls();ko(m,l,E,M),Jx(m,d,E)}}function dM(l,d,m){var E=va(l),M={lane:E,action:m,hasEagerState:!1,eagerState:null,next:null};if(Qx(l))Xx(d,M);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var Q=d.lastRenderedState,be=j(Q,m);if(M.hasEagerState=!0,M.eagerState=be,Cn(be,Q)){var xe=d.interleaved;xe===null?(M.next=M,Jy(d)):(M.next=xe.next,xe.next=M),d.interleaved=M;return}}catch{}finally{}m=_x(l,d,M,E),m!==null&&(M=ls(),ko(m,l,E,M),Jx(m,d,E))}}function Qx(l){var d=l.alternate;return l===Vn||d!==null&&d===Vn}function Xx(l,d){dd=Gh=!0;var m=l.pending;m===null?d.next=d:(d.next=m.next,m.next=d),l.pending=d}function Jx(l,d,m){if((m&4194240)!==0){var E=d.lanes;E&=l.pendingLanes,m|=E,d.lanes=m,Zi(l,m)}}var Qh={readContext:to,useCallback:Wr,useContext:Wr,useEffect:Wr,useImperativeHandle:Wr,useInsertionEffect:Wr,useLayoutEffect:Wr,useMemo:Wr,useReducer:Wr,useRef:Wr,useState:Wr,useDebugValue:Wr,useDeferredValue:Wr,useTransition:Wr,useMutableSource:Wr,useSyncExternalStore:Wr,useId:Wr,unstable_isNewReconciler:!1},fM={readContext:to,useCallback:function(l,d){return qo().memoizedState=[l,d===void 0?null:d],l},useContext:to,useEffect:Ux,useImperativeHandle:function(l,d,m){return m=m!=null?m.concat([l]):null,Kh(4194308,4,Hx.bind(null,d,l),m)},useLayoutEffect:function(l,d){return Kh(4194308,4,l,d)},useInsertionEffect:function(l,d){return Kh(4,2,l,d)},useMemo:function(l,d){var m=qo();return d=d===void 0?null:d,l=l(),m.memoizedState=[l,d],l},useReducer:function(l,d,m){var E=qo();return d=m!==void 0?m(d):d,E.memoizedState=E.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},E.queue=l,l=l.dispatch=uM.bind(null,Vn,l),[E.memoizedState,l]},useRef:function(l){var d=qo();return l={current:l},d.memoizedState=l},useState:Ox,useDebugValue:d0,useDeferredValue:function(l){return qo().memoizedState=l},useTransition:function(){var l=Ox(!1),d=l[0];return l=cM.bind(null,l[1]),qo().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,m){var E=Vn,M=qo();if(Rn){if(m===void 0)throw Error(n(407));m=m()}else{if(m=d(),Ar===null)throw Error(n(349));(yl&30)!==0||Rx(E,d,m)}M.memoizedState=m;var j={value:m,getSnapshot:d};return M.queue=j,Ux(Lx.bind(null,E,j,l),[l]),E.flags|=2048,pd(9,Ix.bind(null,E,j,m,d),void 0,null),m},useId:function(){var l=qo(),d=Ar.identifierPrefix;if(Rn){var m=Ci,E=Ei;m=(E&~(1<<32-ts(E)-1)).toString(32)+m,d=":"+d+"R"+m,m=fd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof E.is=="string"?l=Q.createElement(m,{is:E.is}):(l=Q.createElement(m),m==="select"&&(Q=l,E.multiple?Q.multiple=!0:E.size&&(Q.size=E.size))):l=Q.createElementNS(l,m),l[Ho]=d,l[od]=E,bk(l,d,!1,!1),d.stateNode=l;e:{switch(Q=it(m,E),m){case"dialog":_n("cancel",l),_n("close",l),M=E;break;case"iframe":case"object":case"embed":_n("load",l),M=E;break;case"video":case"audio":for(M=0;Mjc&&(d.flags|=128,E=!0,md(j,!1),d.lanes=4194304)}else{if(!E)if(l=Hh(Q),l!==null){if(d.flags|=128,E=!0,m=l.updateQueue,m!==null&&(d.updateQueue=m,d.flags|=4),md(j,!0),j.tail===null&&j.tailMode==="hidden"&&!Q.alternate&&!Rn)return qr(d),null}else 2*En()-j.renderingStartTime>jc&&m!==1073741824&&(d.flags|=128,E=!0,md(j,!1),d.lanes=4194304);j.isBackwards?(Q.sibling=d.child,d.child=Q):(m=j.last,m!==null?m.sibling=Q:d.child=Q,j.last=Q)}return j.tail!==null?(d=j.tail,j.rendering=d,j.tail=d.sibling,j.renderingStartTime=En(),d.sibling=null,m=zn.current,Sn(zn,E?m&1|2:m&1),d):(qr(d),null);case 22:case 23:return I0(),E=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==E&&(d.flags|=8192),E&&(d.mode&1)!==0?($s&1073741824)!==0&&(qr(d),d.subtreeFlags&6&&(d.flags|=8192)):qr(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function vM(l,d){switch(Hy(d),d.tag){case 1:return xs(d.type)&&Mh(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Rc(),Dn(Cs),Dn(Hr),r0(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return t0(d),null;case 13:if(Dn(zn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Bc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Dn(zn),null;case 4:return Rc(),null;case 10:return Qy(d.type._context),null;case 22:case 23:return I0(),null;case 24:return null;default:return null}}var Zh=!1,Gr=!1,wM=typeof WeakSet=="function"?WeakSet:Set,gt=null;function Lc(l,d){var m=l.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(E){Jn(l,d,E)}else m.current=null}function x0(l,d,m){try{m()}catch(E){Jn(l,d,E)}}var Ek=!1;function EM(l,d){if(Iy=hn,l=os(),is(l)){if("selectionStart"in l)var m={start:l.selectionStart,end:l.selectionEnd};else e:{m=(m=l.ownerDocument)&&m.defaultView||window;var E=m.getSelection&&m.getSelection();if(E&&E.rangeCount!==0){m=E.anchorNode;var M=E.anchorOffset,j=E.focusNode;E=E.focusOffset;try{m.nodeType,j.nodeType}catch{m=null;break e}var Q=0,be=-1,xe=-1,ze=0,et=0,tt=l,Je=null;t:for(;;){for(var ht;tt!==m||M!==0&&tt.nodeType!==3||(be=Q+M),tt!==j||E!==0&&tt.nodeType!==3||(xe=Q+E),tt.nodeType===3&&(Q+=tt.nodeValue.length),(ht=tt.firstChild)!==null;)Je=tt,tt=ht;for(;;){if(tt===l)break t;if(Je===m&&++ze===M&&(be=Q),Je===j&&++et===E&&(xe=Q),(ht=tt.nextSibling)!==null)break;tt=Je,Je=tt.parentNode}tt=ht}m=be===-1||xe===-1?null:{start:be,end:xe}}else m=null}m=m||{start:0,end:0}}else m=null;for(Ly={focusedElem:l,selectionRange:m},hn=!1,gt=d;gt!==null;)if(d=gt,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,gt=l;else for(;gt!==null;){d=gt;try{var bt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(bt!==null){var wt=bt.memoizedProps,sr=bt.memoizedState,Me=d.stateNode,Fe=Me.getSnapshotBeforeUpdate(d.elementType===d.type?wt:Eo(d.type,wt),sr);Me.__reactInternalSnapshotBeforeUpdate=Fe}break;case 3:var je=d.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){Jn(d,d.return,ot)}if(l=d.sibling,l!==null){l.return=d.return,gt=l;break}gt=d.return}return bt=Ek,Ek=!1,bt}function gd(l,d,m){var E=d.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var M=E=E.next;do{if((M.tag&l)===l){var j=M.destroy;M.destroy=void 0,j!==void 0&&x0(d,m,j)}M=M.next}while(M!==E)}}function ep(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var m=d=d.next;do{if((m.tag&l)===l){var E=m.create;m.destroy=E()}m=m.next}while(m!==d)}}function k0(l){var d=l.ref;if(d!==null){var m=l.stateNode;switch(l.tag){case 5:l=m;break;default:l=m}typeof d=="function"?d(l):d.current=l}}function Ck(l){var d=l.alternate;d!==null&&(l.alternate=null,Ck(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ho],delete d[od],delete d[$y],delete d[rM],delete d[sM])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function xk(l){return l.tag===5||l.tag===3||l.tag===4}function kk(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||xk(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function S0(l,d,m){var E=l.tag;if(E===5||E===6)l=l.stateNode,d?m.nodeType===8?m.parentNode.insertBefore(l,d):m.insertBefore(l,d):(m.nodeType===8?(d=m.parentNode,d.insertBefore(l,m)):(d=m,d.appendChild(l)),m=m._reactRootContainer,m!=null||d.onclick!==null||(d.onclick=Fh));else if(E!==4&&(l=l.child,l!==null))for(S0(l,d,m),l=l.sibling;l!==null;)S0(l,d,m),l=l.sibling}function A0(l,d,m){var E=l.tag;if(E===5||E===6)l=l.stateNode,d?m.insertBefore(l,d):m.appendChild(l);else if(E!==4&&(l=l.child,l!==null))for(A0(l,d,m),l=l.sibling;l!==null;)A0(l,d,m),l=l.sibling}var Ir=null,Co=!1;function ga(l,d,m){for(m=m.child;m!==null;)Sk(l,d,m),m=m.sibling}function Sk(l,d,m){if(bs&&typeof bs.onCommitFiberUnmount=="function")try{bs.onCommitFiberUnmount(Yi,m)}catch{}switch(m.tag){case 5:Gr||Lc(m,d);case 6:var E=Ir,M=Co;Ir=null,ga(l,d,m),Ir=E,Co=M,Ir!==null&&(Co?(l=Ir,m=m.stateNode,l.nodeType===8?l.parentNode.removeChild(m):l.removeChild(m)):Ir.removeChild(m.stateNode));break;case 18:Ir!==null&&(Co?(l=Ir,m=m.stateNode,l.nodeType===8?Oy(l.parentNode,m):l.nodeType===1&&Oy(l,m),ia(l)):Oy(Ir,m.stateNode));break;case 4:E=Ir,M=Co,Ir=m.stateNode.containerInfo,Co=!0,ga(l,d,m),Ir=E,Co=M;break;case 0:case 11:case 14:case 15:if(!Gr&&(E=m.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){M=E=E.next;do{var j=M,Q=j.destroy;j=j.tag,Q!==void 0&&((j&2)!==0||(j&4)!==0)&&x0(m,d,Q),M=M.next}while(M!==E)}ga(l,d,m);break;case 1:if(!Gr&&(Lc(m,d),E=m.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=m.memoizedProps,E.state=m.memoizedState,E.componentWillUnmount()}catch(be){Jn(m,d,be)}ga(l,d,m);break;case 21:ga(l,d,m);break;case 22:m.mode&1?(Gr=(E=Gr)||m.memoizedState!==null,ga(l,d,m),Gr=E):ga(l,d,m);break;default:ga(l,d,m)}}function Ak(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var m=l.stateNode;m===null&&(m=l.stateNode=new wM),d.forEach(function(E){var M=BM.bind(null,l,E);m.has(E)||(m.add(E),E.then(M,M))})}}function xo(l,d){var m=d.deletions;if(m!==null)for(var E=0;EM&&(M=Q),E&=~j}if(E=M,E=En()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*xM(E/1960))-E,10l?16:l,ba===null)var E=!1;else{if(l=ba,ba=null,op=0,(Jt&6)!==0)throw Error(n(331));var M=Jt;for(Jt|=4,gt=l.current;gt!==null;){var j=gt,Q=j.child;if((gt.flags&16)!==0){var be=j.deletions;if(be!==null){for(var xe=0;xeEn()-T0?wl(l,0):D0|=m),As(l,d)}function Ok(l,d){d===0&&((l.mode&1)===0?d=1:(d=Qi,Qi<<=1,(Qi&130023424)===0&&(Qi=4194304)));var m=ls();l=xi(l,d),l!==null&&(Ji(l,d,m),As(l,m))}function TM(l){var d=l.memoizedState,m=0;d!==null&&(m=d.retryLane),Ok(l,m)}function BM(l,d){var m=0;switch(l.tag){case 13:var E=l.stateNode,M=l.memoizedState;M!==null&&(m=M.retryLane);break;case 19:E=l.stateNode;break;default:throw Error(n(314))}E!==null&&E.delete(d),Ok(l,m)}var $k;$k=function(l,d,m){if(l!==null)if(l.memoizedProps!==d.pendingProps||Cs.current)ks=!0;else{if((l.lanes&m)===0&&(d.flags&128)===0)return ks=!1,yM(l,d,m);ks=(l.flags&131072)!==0}else ks=!1,Rn&&(d.flags&1048576)!==0&&bx(d,Nh,d.index);switch(d.lanes=0,d.tag){case 2:var E=d.type;Jh(l,d),l=d.pendingProps;var M=_c(d,Hr.current);Mc(d,m),M=i0(null,d,E,l,M,m);var j=a0();return d.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,xs(E)?(j=!0,Rh(d)):j=!1,d.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,Zy(d),M.updater=Qh,d.stateNode=M,M._reactInternals=d,h0(d,E,l,m),d=y0(null,d,E,!0,j,m)):(d.tag=0,Rn&&j&&Vy(d),as(null,d,M,m),d=d.child),d;case 16:E=d.elementType;e:{switch(Jh(l,d),l=d.pendingProps,M=E._init,E=M(E._payload),d.type=E,M=d.tag=PM(E),l=Eo(E,l),M){case 0:d=g0(null,d,E,l,m);break e;case 1:d=fk(null,d,E,l,m);break e;case 11:d=ak(null,d,E,l,m);break e;case 14:d=lk(null,d,E,Eo(E.type,l),m);break e}throw Error(n(306,E,""))}return d;case 0:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),g0(l,d,E,M,m);case 1:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),fk(l,d,E,M,m);case 3:e:{if(hk(d),l===null)throw Error(n(387));E=d.pendingProps,j=d.memoizedState,M=j.element,Dx(l,d),Vh(d,E,null,m);var Q=d.memoizedState;if(E=Q.element,j.isDehydrated)if(j={element:E,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},d.updateQueue.baseState=j,d.memoizedState=j,d.flags&256){M=Ic(Error(n(423)),d),d=pk(l,d,E,m,M);break e}else if(E!==M){M=Ic(Error(n(424)),d),d=pk(l,d,E,m,M);break e}else for(Os=ua(d.stateNode.containerInfo.firstChild),js=d,Rn=!0,wo=null,m=Ax(d,null,E,m),d.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Bc(),E===M){d=Si(l,d,m);break e}as(l,d,E,m)}d=d.child}return d;case 5:return Fx(d),l===null&&qy(d),E=d.type,M=d.pendingProps,j=l!==null?l.memoizedProps:null,Q=M.children,Ny(E,M)?Q=null:j!==null&&Ny(E,j)&&(d.flags|=32),dk(l,d),as(l,d,Q,m),d.child;case 6:return l===null&&qy(d),null;case 13:return mk(l,d,m);case 4:return e0(d,d.stateNode.containerInfo),E=d.pendingProps,l===null?d.child=Fc(d,null,E,m):as(l,d,E,m),d.child;case 11:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),ak(l,d,E,M,m);case 7:return as(l,d,d.pendingProps,m),d.child;case 8:return as(l,d,d.pendingProps.children,m),d.child;case 12:return as(l,d,d.pendingProps.children,m),d.child;case 10:e:{if(E=d.type._context,M=d.pendingProps,j=d.memoizedProps,Q=M.value,Sn($h,E._currentValue),E._currentValue=Q,j!==null)if(Cn(j.value,Q)){if(j.children===M.children&&!Cs.current){d=Si(l,d,m);break e}}else for(j=d.child,j!==null&&(j.return=d);j!==null;){var be=j.dependencies;if(be!==null){Q=j.child;for(var xe=be.firstContext;xe!==null;){if(xe.context===E){if(j.tag===1){xe=ki(-1,m&-m),xe.tag=2;var ze=j.updateQueue;if(ze!==null){ze=ze.shared;var et=ze.pending;et===null?xe.next=xe:(xe.next=et.next,et.next=xe),ze.pending=xe}}j.lanes|=m,xe=j.alternate,xe!==null&&(xe.lanes|=m),Xy(j.return,m,d),be.lanes|=m;break}xe=xe.next}}else if(j.tag===10)Q=j.type===d.type?null:j.child;else if(j.tag===18){if(Q=j.return,Q===null)throw Error(n(341));Q.lanes|=m,be=Q.alternate,be!==null&&(be.lanes|=m),Xy(Q,m,d),Q=j.sibling}else Q=j.child;if(Q!==null)Q.return=j;else for(Q=j;Q!==null;){if(Q===d){Q=null;break}if(j=Q.sibling,j!==null){j.return=Q.return,Q=j;break}Q=Q.return}j=Q}as(l,d,M.children,m),d=d.child}return d;case 9:return M=d.type,E=d.pendingProps.children,Mc(d,m),M=to(M),E=E(M),d.flags|=1,as(l,d,E,m),d.child;case 14:return E=d.type,M=Eo(E,d.pendingProps),M=Eo(E.type,M),lk(l,d,E,M,m);case 15:return ck(l,d,d.type,d.pendingProps,m);case 17:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),Jh(l,d),d.tag=1,xs(E)?(l=!0,Rh(d)):l=!1,Mc(d,m),ek(d,E,M),h0(d,E,M,m),y0(null,d,E,!0,l,m);case 19:return yk(l,d,m);case 22:return uk(l,d,m)}throw Error(n(156,d.tag))};function Uk(l,d){return tr(l,d)}function FM(l,d,m,E){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function so(l,d,m,E){return new FM(l,d,m,E)}function N0(l){return l=l.prototype,!(!l||!l.isReactComponent)}function PM(l){if(typeof l=="function")return N0(l)?1:0;if(l!=null){if(l=l.$$typeof,l===L)return 11;if(l===z)return 14}return 2}function Ea(l,d){var m=l.alternate;return m===null?(m=so(l.tag,d,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=d,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&14680064,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,d=l.dependencies,m.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m}function cp(l,d,m,E,M,j){var Q=2;if(E=l,typeof l=="function")N0(l)&&(Q=1);else if(typeof l=="string")Q=5;else e:switch(l){case P:return Cl(m.children,M,j,d);case A:Q=8,M|=8;break;case D:return l=so(12,m,d,M|2),l.elementType=D,l.lanes=j,l;case U:return l=so(13,m,d,M),l.elementType=U,l.lanes=j,l;case $:return l=so(19,m,d,M),l.elementType=$,l.lanes=j,l;case W:return up(m,M,j,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case R:Q=10;break e;case N:Q=9;break e;case L:Q=11;break e;case z:Q=14;break e;case Z:Q=16,E=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=so(Q,m,d,M),d.elementType=l,d.type=E,d.lanes=j,d}function Cl(l,d,m,E){return l=so(7,l,E,d),l.lanes=m,l}function up(l,d,m,E){return l=so(22,l,E,d),l.elementType=W,l.lanes=m,l.stateNode={isHidden:!1},l}function j0(l,d,m){return l=so(6,l,null,d),l.lanes=m,l}function O0(l,d,m){return d=so(4,l.children!==null?l.children:[],l.key,d),d.lanes=m,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function MM(l,d,m,E,M){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qu(0),this.expirationTimes=qu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qu(0),this.identifierPrefix=E,this.onRecoverableError=M,this.mutableSourceEagerHydrationData=null}function $0(l,d,m,E,M,j,Q,be,xe){return l=new MM(l,d,m,be,xe),d===1?(d=1,j===!0&&(d|=8)):d=0,j=so(3,null,null,d),l.current=j,j.stateNode=l,j.memoizedState={element:E,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zy(j),l}function RM(l,d,m){var E=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),G0.exports=YM(),G0.exports}var rS;function QM(){if(rS)return bp;rS=1;var e=UD();return bp.createRoot=e.createRoot,bp.hydrateRoot=e.hydrateRoot,bp}var XM=QM();/** +`+j.stack}return{value:l,source:d,stack:M,digest:null}}function p0(l,d,m){return{value:l,source:null,stack:m??null,digest:d??null}}function m0(l,d){try{console.error(d.value)}catch(m){setTimeout(function(){throw m})}}var mM=typeof WeakMap=="function"?WeakMap:Map;function nk(l,d,m){m=ki(-1,m),m.tag=3,m.payload={element:null};var E=d.value;return m.callback=function(){sp||(sp=!0,B0=E),m0(l,d)},m}function rk(l,d,m){m=ki(-1,m),m.tag=3;var E=l.type.getDerivedStateFromError;if(typeof E=="function"){var M=d.value;m.payload=function(){return E(M)},m.callback=function(){m0(l,d)}}var j=l.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(m.callback=function(){m0(l,d),typeof E!="function"&&(ya===null?ya=new Set([this]):ya.add(this));var Q=d.stack;this.componentDidCatch(d.value,{componentStack:Q!==null?Q:""})}),m}function sk(l,d,m){var E=l.pingCache;if(E===null){E=l.pingCache=new mM;var M=new Set;E.set(d,M)}else M=E.get(d),M===void 0&&(M=new Set,E.set(d,M));M.has(m)||(M.add(m),l=TM.bind(null,l,d,m),d.then(l,l))}function ok(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function ik(l,d,m,E,M){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(d=ki(-1,1),d.tag=2,ma(m,d,1))),m.lanes|=1),l):(l.flags|=65536,l.lanes=M,l)}var gM=_.ReactCurrentOwner,ks=!1;function as(l,d,m,E){d.child=l===null?Ax(d,null,m,E):Fc(d,l.child,m,E)}function ak(l,d,m,E,M){m=m.render;var j=d.ref;return Mc(d,M),E=i0(l,d,m,E,j,M),m=a0(),l!==null&&!ks?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~M,Si(l,d,M)):(Rn&&m&&Vy(d),d.flags|=1,as(l,d,E,M),d.child)}function lk(l,d,m,E,M){if(l===null){var j=m.type;return typeof j=="function"&&!N0(j)&&j.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(d.tag=15,d.type=j,ck(l,d,j,E,M)):(l=up(m.type,null,E,d,d.mode,M),l.ref=d.ref,l.return=d,d.child=l)}if(j=l.child,(l.lanes&M)===0){var Q=j.memoizedProps;if(m=m.compare,m=m!==null?m:kr,m(Q,E)&&l.ref===d.ref)return Si(l,d,M)}return d.flags|=1,l=Ea(j,E),l.ref=d.ref,l.return=d,d.child=l}function ck(l,d,m,E,M){if(l!==null){var j=l.memoizedProps;if(kr(j,E)&&l.ref===d.ref)if(ks=!1,d.pendingProps=E=j,(l.lanes&M)!==0)(l.flags&131072)!==0&&(ks=!0);else return d.lanes=l.lanes,Si(l,d,M)}return g0(l,d,m,E,M)}function uk(l,d,m){var E=d.pendingProps,M=E.children,j=l!==null?l.memoizedState:null;if(E.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Sn(Nc,$s),$s|=m;else{if((m&1073741824)===0)return l=j!==null?j.baseLanes|m:m,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,Sn(Nc,$s),$s|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},E=j!==null?j.baseLanes:m,Sn(Nc,$s),$s|=E}else j!==null?(E=j.baseLanes|m,d.memoizedState=null):E=m,Sn(Nc,$s),$s|=E;return as(l,d,M,m),d.child}function dk(l,d){var m=d.ref;(l===null&&m!==null||l!==null&&l.ref!==m)&&(d.flags|=512,d.flags|=2097152)}function g0(l,d,m,E,M){var j=xs(m)?fl:Hr.current;return j=_c(d,j),Mc(d,M),m=i0(l,d,m,E,j,M),E=a0(),l!==null&&!ks?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~M,Si(l,d,M)):(Rn&&E&&Vy(d),d.flags|=1,as(l,d,m,M),d.child)}function fk(l,d,m,E,M){if(xs(m)){var j=!0;Ih(d)}else j=!1;if(Mc(d,M),d.stateNode===null)Zh(l,d),ek(d,m,E),h0(d,m,E,M),E=!0;else if(l===null){var Q=d.stateNode,be=d.memoizedProps;Q.props=be;var xe=Q.context,ze=m.contextType;typeof ze=="object"&&ze!==null?ze=to(ze):(ze=xs(m)?fl:Hr.current,ze=_c(d,ze));var et=m.getDerivedStateFromProps,tt=typeof et=="function"||typeof Q.getSnapshotBeforeUpdate=="function";tt||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(be!==E||xe!==ze)&&tk(d,Q,E,ze),pa=!1;var Je=d.memoizedState;Q.state=Je,Hh(d,E,Q,M),xe=d.memoizedState,be!==E||Je!==xe||Cs.current||pa?(typeof et=="function"&&(f0(d,m,et,E),xe=d.memoizedState),(be=pa||Zx(d,m,be,E,Je,xe,ze))?(tt||typeof Q.UNSAFE_componentWillMount!="function"&&typeof Q.componentWillMount!="function"||(typeof Q.componentWillMount=="function"&&Q.componentWillMount(),typeof Q.UNSAFE_componentWillMount=="function"&&Q.UNSAFE_componentWillMount()),typeof Q.componentDidMount=="function"&&(d.flags|=4194308)):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=E,d.memoizedState=xe),Q.props=E,Q.state=xe,Q.context=ze,E=be):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),E=!1)}else{Q=d.stateNode,Dx(l,d),be=d.memoizedProps,ze=d.type===d.elementType?be:Eo(d.type,be),Q.props=ze,tt=d.pendingProps,Je=Q.context,xe=m.contextType,typeof xe=="object"&&xe!==null?xe=to(xe):(xe=xs(m)?fl:Hr.current,xe=_c(d,xe));var ht=m.getDerivedStateFromProps;(et=typeof ht=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(be!==tt||Je!==xe)&&tk(d,Q,E,xe),pa=!1,Je=d.memoizedState,Q.state=Je,Hh(d,E,Q,M);var bt=d.memoizedState;be!==tt||Je!==bt||Cs.current||pa?(typeof ht=="function"&&(f0(d,m,ht,E),bt=d.memoizedState),(ze=pa||Zx(d,m,ze,E,Je,bt,xe)||!1)?(et||typeof Q.UNSAFE_componentWillUpdate!="function"&&typeof Q.componentWillUpdate!="function"||(typeof Q.componentWillUpdate=="function"&&Q.componentWillUpdate(E,bt,xe),typeof Q.UNSAFE_componentWillUpdate=="function"&&Q.UNSAFE_componentWillUpdate(E,bt,xe)),typeof Q.componentDidUpdate=="function"&&(d.flags|=4),typeof Q.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof Q.componentDidUpdate!="function"||be===l.memoizedProps&&Je===l.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||be===l.memoizedProps&&Je===l.memoizedState||(d.flags|=1024),d.memoizedProps=E,d.memoizedState=bt),Q.props=E,Q.state=bt,Q.context=xe,E=ze):(typeof Q.componentDidUpdate!="function"||be===l.memoizedProps&&Je===l.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||be===l.memoizedProps&&Je===l.memoizedState||(d.flags|=1024),E=!1)}return y0(l,d,m,E,j,M)}function y0(l,d,m,E,M,j){dk(l,d);var Q=(d.flags&128)!==0;if(!E&&!Q)return M&&gx(d,m,!1),Si(l,d,j);E=d.stateNode,gM.current=d;var be=Q&&typeof m.getDerivedStateFromError!="function"?null:E.render();return d.flags|=1,l!==null&&Q?(d.child=Fc(d,l.child,null,j),d.child=Fc(d,null,be,j)):as(l,d,be,j),d.memoizedState=E.state,M&&gx(d,m,!0),d.child}function hk(l){var d=l.stateNode;d.pendingContext?px(l,d.pendingContext,d.pendingContext!==d.context):d.context&&px(l,d.context,!1),e0(l,d.containerInfo)}function pk(l,d,m,E,M){return Bc(),Gy(M),d.flags|=256,as(l,d,m,E),d.child}var b0={dehydrated:null,treeContext:null,retryLane:0};function v0(l){return{baseLanes:l,cachePool:null,transitions:null}}function mk(l,d,m){var E=d.pendingProps,M=zn.current,j=!1,Q=(d.flags&128)!==0,be;if((be=Q)||(be=l!==null&&l.memoizedState===null?!1:(M&2)!==0),be?(j=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(M|=1),Sn(zn,M&1),l===null)return qy(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(Q=E.children,l=E.fallback,j?(E=d.mode,j=d.child,Q={mode:"hidden",children:Q},(E&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=Q):j=dp(Q,E,0,null),l=Cl(l,E,m,null),j.return=d,l.return=d,j.sibling=l,d.child=j,d.child.memoizedState=v0(m),d.memoizedState=b0,l):w0(d,Q));if(M=l.memoizedState,M!==null&&(be=M.dehydrated,be!==null))return yM(l,d,Q,E,be,M,m);if(j){j=E.fallback,Q=d.mode,M=l.child,be=M.sibling;var xe={mode:"hidden",children:E.children};return(Q&1)===0&&d.child!==M?(E=d.child,E.childLanes=0,E.pendingProps=xe,d.deletions=null):(E=Ea(M,xe),E.subtreeFlags=M.subtreeFlags&14680064),be!==null?j=Ea(be,j):(j=Cl(j,Q,m,null),j.flags|=2),j.return=d,E.return=d,E.sibling=j,d.child=E,E=j,j=d.child,Q=l.child.memoizedState,Q=Q===null?v0(m):{baseLanes:Q.baseLanes|m,cachePool:null,transitions:Q.transitions},j.memoizedState=Q,j.childLanes=l.childLanes&~m,d.memoizedState=b0,E}return j=l.child,l=j.sibling,E=Ea(j,{mode:"visible",children:E.children}),(d.mode&1)===0&&(E.lanes=m),E.return=d,E.sibling=null,l!==null&&(m=d.deletions,m===null?(d.deletions=[l],d.flags|=16):m.push(l)),d.child=E,d.memoizedState=null,E}function w0(l,d){return d=dp({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function Jh(l,d,m,E){return E!==null&&Gy(E),Fc(d,l.child,null,m),l=w0(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function yM(l,d,m,E,M,j,Q){if(m)return d.flags&256?(d.flags&=-257,E=p0(Error(n(422))),Jh(l,d,Q,E)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(j=E.fallback,M=d.mode,E=dp({mode:"visible",children:E.children},M,0,null),j=Cl(j,M,Q,null),j.flags|=2,E.return=d,j.return=d,E.sibling=j,d.child=E,(d.mode&1)!==0&&Fc(d,l.child,null,Q),d.child.memoizedState=v0(Q),d.memoizedState=b0,j);if((d.mode&1)===0)return Jh(l,d,Q,null);if(M.data==="$!"){if(E=M.nextSibling&&M.nextSibling.dataset,E)var be=E.dgst;return E=be,j=Error(n(419)),E=p0(j,E,void 0),Jh(l,d,Q,E)}if(be=(Q&l.childLanes)!==0,ks||be){if(E=Ar,E!==null){switch(Q&-Q){case 4:M=2;break;case 16:M=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:M=32;break;case 536870912:M=268435456;break;default:M=0}M=(M&(E.suspendedLanes|Q))!==0?0:M,M!==0&&M!==j.retryLane&&(j.retryLane=M,xi(l,M),ko(E,l,M,-1))}return L0(),E=p0(Error(n(421))),Jh(l,d,Q,E)}return M.data==="$?"?(d.flags|=128,d.child=l.child,d=BM.bind(null,l),M._reactRetry=d,null):(l=j.treeContext,Os=ua(M.nextSibling),js=d,Rn=!0,wo=null,l!==null&&(Zs[eo++]=Ei,Zs[eo++]=Ci,Zs[eo++]=hl,Ei=l.id,Ci=l.overflow,hl=d),d=w0(d,E.children),d.flags|=4096,d)}function gk(l,d,m){l.lanes|=d;var E=l.alternate;E!==null&&(E.lanes|=d),Xy(l.return,d,m)}function E0(l,d,m,E,M){var j=l.memoizedState;j===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:E,tail:m,tailMode:M}:(j.isBackwards=d,j.rendering=null,j.renderingStartTime=0,j.last=E,j.tail=m,j.tailMode=M)}function yk(l,d,m){var E=d.pendingProps,M=E.revealOrder,j=E.tail;if(as(l,d,E.children,m),E=zn.current,(E&2)!==0)E=E&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&gk(l,m,d);else if(l.tag===19)gk(l,m,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}E&=1}if(Sn(zn,E),(d.mode&1)===0)d.memoizedState=null;else switch(M){case"forwards":for(m=d.child,M=null;m!==null;)l=m.alternate,l!==null&&Wh(l)===null&&(M=m),m=m.sibling;m=M,m===null?(M=d.child,d.child=null):(M=m.sibling,m.sibling=null),E0(d,!1,M,m,j);break;case"backwards":for(m=null,M=d.child,d.child=null;M!==null;){if(l=M.alternate,l!==null&&Wh(l)===null){d.child=M;break}l=M.sibling,M.sibling=m,m=M,M=l}E0(d,!0,m,null,j);break;case"together":E0(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Zh(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function Si(l,d,m){if(l!==null&&(d.dependencies=l.dependencies),bl|=d.lanes,(m&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,m=Ea(l,l.pendingProps),d.child=m,m.return=d;l.sibling!==null;)l=l.sibling,m=m.sibling=Ea(l,l.pendingProps),m.return=d;m.sibling=null}return d.child}function bM(l,d,m){switch(d.tag){case 3:hk(d),Bc();break;case 5:Fx(d);break;case 1:xs(d.type)&&Ih(d);break;case 4:e0(d,d.stateNode.containerInfo);break;case 10:var E=d.type._context,M=d.memoizedProps.value;Sn(Uh,E._currentValue),E._currentValue=M;break;case 13:if(E=d.memoizedState,E!==null)return E.dehydrated!==null?(Sn(zn,zn.current&1),d.flags|=128,null):(m&d.child.childLanes)!==0?mk(l,d,m):(Sn(zn,zn.current&1),l=Si(l,d,m),l!==null?l.sibling:null);Sn(zn,zn.current&1);break;case 19:if(E=(m&d.childLanes)!==0,(l.flags&128)!==0){if(E)return yk(l,d,m);d.flags|=128}if(M=d.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),Sn(zn,zn.current),E)break;return null;case 22:case 23:return d.lanes=0,uk(l,d,m)}return Si(l,d,m)}var bk,C0,vk,wk;bk=function(l,d){for(var m=d.child;m!==null;){if(m.tag===5||m.tag===6)l.appendChild(m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===d)break;for(;m.sibling===null;){if(m.return===null||m.return===d)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},C0=function(){},vk=function(l,d,m,E){var M=l.memoizedProps;if(M!==E){l=d.stateNode,gl(Wo.current);var j=null;switch(m){case"input":M=_e(l,M),E=_e(l,E),j=[];break;case"select":M=Y({},M,{value:void 0}),E=Y({},E,{value:void 0}),j=[];break;case"textarea":M=Se(l,M),E=Se(l,E),j=[];break;default:typeof M.onClick!="function"&&typeof E.onClick=="function"&&(l.onclick=Ph)}nt(m,E);var Q;m=null;for(ze in M)if(!E.hasOwnProperty(ze)&&M.hasOwnProperty(ze)&&M[ze]!=null)if(ze==="style"){var be=M[ze];for(Q in be)be.hasOwnProperty(Q)&&(m||(m={}),m[Q]="")}else ze!=="dangerouslySetInnerHTML"&&ze!=="children"&&ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&ze!=="autoFocus"&&(s.hasOwnProperty(ze)?j||(j=[]):(j=j||[]).push(ze,null));for(ze in E){var xe=E[ze];if(be=M!=null?M[ze]:void 0,E.hasOwnProperty(ze)&&xe!==be&&(xe!=null||be!=null))if(ze==="style")if(be){for(Q in be)!be.hasOwnProperty(Q)||xe&&xe.hasOwnProperty(Q)||(m||(m={}),m[Q]="");for(Q in xe)xe.hasOwnProperty(Q)&&be[Q]!==xe[Q]&&(m||(m={}),m[Q]=xe[Q])}else m||(j||(j=[]),j.push(ze,m)),m=xe;else ze==="dangerouslySetInnerHTML"?(xe=xe?xe.__html:void 0,be=be?be.__html:void 0,xe!=null&&be!==xe&&(j=j||[]).push(ze,xe)):ze==="children"?typeof xe!="string"&&typeof xe!="number"||(j=j||[]).push(ze,""+xe):ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&(s.hasOwnProperty(ze)?(xe!=null&&ze==="onScroll"&&_n("scroll",l),j||be===xe||(j=[])):(j=j||[]).push(ze,xe))}m&&(j=j||[]).push("style",m);var ze=j;(d.updateQueue=ze)&&(d.flags|=4)}},wk=function(l,d,m,E){m!==E&&(d.flags|=4)};function md(l,d){if(!Rn)switch(l.tailMode){case"hidden":d=l.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var E=null;m!==null;)m.alternate!==null&&(E=m),m=m.sibling;E===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:E.sibling=null}}function qr(l){var d=l.alternate!==null&&l.alternate.child===l.child,m=0,E=0;if(d)for(var M=l.child;M!==null;)m|=M.lanes|M.childLanes,E|=M.subtreeFlags&14680064,E|=M.flags&14680064,M.return=l,M=M.sibling;else for(M=l.child;M!==null;)m|=M.lanes|M.childLanes,E|=M.subtreeFlags,E|=M.flags,M.return=l,M=M.sibling;return l.subtreeFlags|=E,l.childLanes=m,d}function vM(l,d,m){var E=d.pendingProps;switch(Hy(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qr(d),null;case 1:return xs(d.type)&&Rh(),qr(d),null;case 3:return E=d.stateNode,Rc(),Dn(Cs),Dn(Hr),r0(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(l===null||l.child===null)&&(Oh(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,wo!==null&&(M0(wo),wo=null))),C0(l,d),qr(d),null;case 5:t0(d);var M=gl(ud.current);if(m=d.type,l!==null&&d.stateNode!=null)vk(l,d,m,E,M),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!E){if(d.stateNode===null)throw Error(n(166));return qr(d),null}if(l=gl(Wo.current),Oh(d)){E=d.stateNode,m=d.type;var j=d.memoizedProps;switch(E[Ho]=d,E[od]=j,l=(d.mode&1)!==0,m){case"dialog":_n("cancel",E),_n("close",E);break;case"iframe":case"object":case"embed":_n("load",E);break;case"video":case"audio":for(M=0;M<\/script>",l=l.removeChild(l.firstChild)):typeof E.is=="string"?l=Q.createElement(m,{is:E.is}):(l=Q.createElement(m),m==="select"&&(Q=l,E.multiple?Q.multiple=!0:E.size&&(Q.size=E.size))):l=Q.createElementNS(l,m),l[Ho]=d,l[od]=E,bk(l,d,!1,!1),d.stateNode=l;e:{switch(Q=it(m,E),m){case"dialog":_n("cancel",l),_n("close",l),M=E;break;case"iframe":case"object":case"embed":_n("load",l),M=E;break;case"video":case"audio":for(M=0;Mjc&&(d.flags|=128,E=!0,md(j,!1),d.lanes=4194304)}else{if(!E)if(l=Wh(Q),l!==null){if(d.flags|=128,E=!0,m=l.updateQueue,m!==null&&(d.updateQueue=m,d.flags|=4),md(j,!0),j.tail===null&&j.tailMode==="hidden"&&!Q.alternate&&!Rn)return qr(d),null}else 2*En()-j.renderingStartTime>jc&&m!==1073741824&&(d.flags|=128,E=!0,md(j,!1),d.lanes=4194304);j.isBackwards?(Q.sibling=d.child,d.child=Q):(m=j.last,m!==null?m.sibling=Q:d.child=Q,j.last=Q)}return j.tail!==null?(d=j.tail,j.rendering=d,j.tail=d.sibling,j.renderingStartTime=En(),d.sibling=null,m=zn.current,Sn(zn,E?m&1|2:m&1),d):(qr(d),null);case 22:case 23:return I0(),E=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==E&&(d.flags|=8192),E&&(d.mode&1)!==0?($s&1073741824)!==0&&(qr(d),d.subtreeFlags&6&&(d.flags|=8192)):qr(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function wM(l,d){switch(Hy(d),d.tag){case 1:return xs(d.type)&&Rh(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Rc(),Dn(Cs),Dn(Hr),r0(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return t0(d),null;case 13:if(Dn(zn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Bc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Dn(zn),null;case 4:return Rc(),null;case 10:return Qy(d.type._context),null;case 22:case 23:return I0(),null;case 24:return null;default:return null}}var ep=!1,Gr=!1,EM=typeof WeakSet=="function"?WeakSet:Set,gt=null;function Lc(l,d){var m=l.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(E){Jn(l,d,E)}else m.current=null}function x0(l,d,m){try{m()}catch(E){Jn(l,d,E)}}var Ek=!1;function CM(l,d){if(Iy=hn,l=os(),is(l)){if("selectionStart"in l)var m={start:l.selectionStart,end:l.selectionEnd};else e:{m=(m=l.ownerDocument)&&m.defaultView||window;var E=m.getSelection&&m.getSelection();if(E&&E.rangeCount!==0){m=E.anchorNode;var M=E.anchorOffset,j=E.focusNode;E=E.focusOffset;try{m.nodeType,j.nodeType}catch{m=null;break e}var Q=0,be=-1,xe=-1,ze=0,et=0,tt=l,Je=null;t:for(;;){for(var ht;tt!==m||M!==0&&tt.nodeType!==3||(be=Q+M),tt!==j||E!==0&&tt.nodeType!==3||(xe=Q+E),tt.nodeType===3&&(Q+=tt.nodeValue.length),(ht=tt.firstChild)!==null;)Je=tt,tt=ht;for(;;){if(tt===l)break t;if(Je===m&&++ze===M&&(be=Q),Je===j&&++et===E&&(xe=Q),(ht=tt.nextSibling)!==null)break;tt=Je,Je=tt.parentNode}tt=ht}m=be===-1||xe===-1?null:{start:be,end:xe}}else m=null}m=m||{start:0,end:0}}else m=null;for(Ly={focusedElem:l,selectionRange:m},hn=!1,gt=d;gt!==null;)if(d=gt,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,gt=l;else for(;gt!==null;){d=gt;try{var bt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(bt!==null){var wt=bt.memoizedProps,sr=bt.memoizedState,Me=d.stateNode,Fe=Me.getSnapshotBeforeUpdate(d.elementType===d.type?wt:Eo(d.type,wt),sr);Me.__reactInternalSnapshotBeforeUpdate=Fe}break;case 3:var je=d.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){Jn(d,d.return,ot)}if(l=d.sibling,l!==null){l.return=d.return,gt=l;break}gt=d.return}return bt=Ek,Ek=!1,bt}function gd(l,d,m){var E=d.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var M=E=E.next;do{if((M.tag&l)===l){var j=M.destroy;M.destroy=void 0,j!==void 0&&x0(d,m,j)}M=M.next}while(M!==E)}}function tp(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var m=d=d.next;do{if((m.tag&l)===l){var E=m.create;m.destroy=E()}m=m.next}while(m!==d)}}function k0(l){var d=l.ref;if(d!==null){var m=l.stateNode;switch(l.tag){case 5:l=m;break;default:l=m}typeof d=="function"?d(l):d.current=l}}function Ck(l){var d=l.alternate;d!==null&&(l.alternate=null,Ck(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ho],delete d[od],delete d[$y],delete d[sM],delete d[oM])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function xk(l){return l.tag===5||l.tag===3||l.tag===4}function kk(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||xk(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function S0(l,d,m){var E=l.tag;if(E===5||E===6)l=l.stateNode,d?m.nodeType===8?m.parentNode.insertBefore(l,d):m.insertBefore(l,d):(m.nodeType===8?(d=m.parentNode,d.insertBefore(l,m)):(d=m,d.appendChild(l)),m=m._reactRootContainer,m!=null||d.onclick!==null||(d.onclick=Ph));else if(E!==4&&(l=l.child,l!==null))for(S0(l,d,m),l=l.sibling;l!==null;)S0(l,d,m),l=l.sibling}function A0(l,d,m){var E=l.tag;if(E===5||E===6)l=l.stateNode,d?m.insertBefore(l,d):m.appendChild(l);else if(E!==4&&(l=l.child,l!==null))for(A0(l,d,m),l=l.sibling;l!==null;)A0(l,d,m),l=l.sibling}var Ir=null,Co=!1;function ga(l,d,m){for(m=m.child;m!==null;)Sk(l,d,m),m=m.sibling}function Sk(l,d,m){if(bs&&typeof bs.onCommitFiberUnmount=="function")try{bs.onCommitFiberUnmount(Yi,m)}catch{}switch(m.tag){case 5:Gr||Lc(m,d);case 6:var E=Ir,M=Co;Ir=null,ga(l,d,m),Ir=E,Co=M,Ir!==null&&(Co?(l=Ir,m=m.stateNode,l.nodeType===8?l.parentNode.removeChild(m):l.removeChild(m)):Ir.removeChild(m.stateNode));break;case 18:Ir!==null&&(Co?(l=Ir,m=m.stateNode,l.nodeType===8?Oy(l.parentNode,m):l.nodeType===1&&Oy(l,m),ia(l)):Oy(Ir,m.stateNode));break;case 4:E=Ir,M=Co,Ir=m.stateNode.containerInfo,Co=!0,ga(l,d,m),Ir=E,Co=M;break;case 0:case 11:case 14:case 15:if(!Gr&&(E=m.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){M=E=E.next;do{var j=M,Q=j.destroy;j=j.tag,Q!==void 0&&((j&2)!==0||(j&4)!==0)&&x0(m,d,Q),M=M.next}while(M!==E)}ga(l,d,m);break;case 1:if(!Gr&&(Lc(m,d),E=m.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=m.memoizedProps,E.state=m.memoizedState,E.componentWillUnmount()}catch(be){Jn(m,d,be)}ga(l,d,m);break;case 21:ga(l,d,m);break;case 22:m.mode&1?(Gr=(E=Gr)||m.memoizedState!==null,ga(l,d,m),Gr=E):ga(l,d,m);break;default:ga(l,d,m)}}function Ak(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var m=l.stateNode;m===null&&(m=l.stateNode=new EM),d.forEach(function(E){var M=FM.bind(null,l,E);m.has(E)||(m.add(E),E.then(M,M))})}}function xo(l,d){var m=d.deletions;if(m!==null)for(var E=0;EM&&(M=Q),E&=~j}if(E=M,E=En()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*kM(E/1960))-E,10l?16:l,ba===null)var E=!1;else{if(l=ba,ba=null,ip=0,(Jt&6)!==0)throw Error(n(331));var M=Jt;for(Jt|=4,gt=l.current;gt!==null;){var j=gt,Q=j.child;if((gt.flags&16)!==0){var be=j.deletions;if(be!==null){for(var xe=0;xeEn()-T0?wl(l,0):D0|=m),As(l,d)}function Ok(l,d){d===0&&((l.mode&1)===0?d=1:(d=Qi,Qi<<=1,(Qi&130023424)===0&&(Qi=4194304)));var m=ls();l=xi(l,d),l!==null&&(Ji(l,d,m),As(l,m))}function BM(l){var d=l.memoizedState,m=0;d!==null&&(m=d.retryLane),Ok(l,m)}function FM(l,d){var m=0;switch(l.tag){case 13:var E=l.stateNode,M=l.memoizedState;M!==null&&(m=M.retryLane);break;case 19:E=l.stateNode;break;default:throw Error(n(314))}E!==null&&E.delete(d),Ok(l,m)}var $k;$k=function(l,d,m){if(l!==null)if(l.memoizedProps!==d.pendingProps||Cs.current)ks=!0;else{if((l.lanes&m)===0&&(d.flags&128)===0)return ks=!1,bM(l,d,m);ks=(l.flags&131072)!==0}else ks=!1,Rn&&(d.flags&1048576)!==0&&bx(d,jh,d.index);switch(d.lanes=0,d.tag){case 2:var E=d.type;Zh(l,d),l=d.pendingProps;var M=_c(d,Hr.current);Mc(d,m),M=i0(null,d,E,l,M,m);var j=a0();return d.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,xs(E)?(j=!0,Ih(d)):j=!1,d.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,Zy(d),M.updater=Xh,d.stateNode=M,M._reactInternals=d,h0(d,E,l,m),d=y0(null,d,E,!0,j,m)):(d.tag=0,Rn&&j&&Vy(d),as(null,d,M,m),d=d.child),d;case 16:E=d.elementType;e:{switch(Zh(l,d),l=d.pendingProps,M=E._init,E=M(E._payload),d.type=E,M=d.tag=MM(E),l=Eo(E,l),M){case 0:d=g0(null,d,E,l,m);break e;case 1:d=fk(null,d,E,l,m);break e;case 11:d=ak(null,d,E,l,m);break e;case 14:d=lk(null,d,E,Eo(E.type,l),m);break e}throw Error(n(306,E,""))}return d;case 0:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),g0(l,d,E,M,m);case 1:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),fk(l,d,E,M,m);case 3:e:{if(hk(d),l===null)throw Error(n(387));E=d.pendingProps,j=d.memoizedState,M=j.element,Dx(l,d),Hh(d,E,null,m);var Q=d.memoizedState;if(E=Q.element,j.isDehydrated)if(j={element:E,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},d.updateQueue.baseState=j,d.memoizedState=j,d.flags&256){M=Ic(Error(n(423)),d),d=pk(l,d,E,m,M);break e}else if(E!==M){M=Ic(Error(n(424)),d),d=pk(l,d,E,m,M);break e}else for(Os=ua(d.stateNode.containerInfo.firstChild),js=d,Rn=!0,wo=null,m=Ax(d,null,E,m),d.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Bc(),E===M){d=Si(l,d,m);break e}as(l,d,E,m)}d=d.child}return d;case 5:return Fx(d),l===null&&qy(d),E=d.type,M=d.pendingProps,j=l!==null?l.memoizedProps:null,Q=M.children,Ny(E,M)?Q=null:j!==null&&Ny(E,j)&&(d.flags|=32),dk(l,d),as(l,d,Q,m),d.child;case 6:return l===null&&qy(d),null;case 13:return mk(l,d,m);case 4:return e0(d,d.stateNode.containerInfo),E=d.pendingProps,l===null?d.child=Fc(d,null,E,m):as(l,d,E,m),d.child;case 11:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),ak(l,d,E,M,m);case 7:return as(l,d,d.pendingProps,m),d.child;case 8:return as(l,d,d.pendingProps.children,m),d.child;case 12:return as(l,d,d.pendingProps.children,m),d.child;case 10:e:{if(E=d.type._context,M=d.pendingProps,j=d.memoizedProps,Q=M.value,Sn(Uh,E._currentValue),E._currentValue=Q,j!==null)if(Cn(j.value,Q)){if(j.children===M.children&&!Cs.current){d=Si(l,d,m);break e}}else for(j=d.child,j!==null&&(j.return=d);j!==null;){var be=j.dependencies;if(be!==null){Q=j.child;for(var xe=be.firstContext;xe!==null;){if(xe.context===E){if(j.tag===1){xe=ki(-1,m&-m),xe.tag=2;var ze=j.updateQueue;if(ze!==null){ze=ze.shared;var et=ze.pending;et===null?xe.next=xe:(xe.next=et.next,et.next=xe),ze.pending=xe}}j.lanes|=m,xe=j.alternate,xe!==null&&(xe.lanes|=m),Xy(j.return,m,d),be.lanes|=m;break}xe=xe.next}}else if(j.tag===10)Q=j.type===d.type?null:j.child;else if(j.tag===18){if(Q=j.return,Q===null)throw Error(n(341));Q.lanes|=m,be=Q.alternate,be!==null&&(be.lanes|=m),Xy(Q,m,d),Q=j.sibling}else Q=j.child;if(Q!==null)Q.return=j;else for(Q=j;Q!==null;){if(Q===d){Q=null;break}if(j=Q.sibling,j!==null){j.return=Q.return,Q=j;break}Q=Q.return}j=Q}as(l,d,M.children,m),d=d.child}return d;case 9:return M=d.type,E=d.pendingProps.children,Mc(d,m),M=to(M),E=E(M),d.flags|=1,as(l,d,E,m),d.child;case 14:return E=d.type,M=Eo(E,d.pendingProps),M=Eo(E.type,M),lk(l,d,E,M,m);case 15:return ck(l,d,d.type,d.pendingProps,m);case 17:return E=d.type,M=d.pendingProps,M=d.elementType===E?M:Eo(E,M),Zh(l,d),d.tag=1,xs(E)?(l=!0,Ih(d)):l=!1,Mc(d,m),ek(d,E,M),h0(d,E,M,m),y0(null,d,E,!0,l,m);case 19:return yk(l,d,m);case 22:return uk(l,d,m)}throw Error(n(156,d.tag))};function Uk(l,d){return tr(l,d)}function PM(l,d,m,E){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function so(l,d,m,E){return new PM(l,d,m,E)}function N0(l){return l=l.prototype,!(!l||!l.isReactComponent)}function MM(l){if(typeof l=="function")return N0(l)?1:0;if(l!=null){if(l=l.$$typeof,l===L)return 11;if(l===z)return 14}return 2}function Ea(l,d){var m=l.alternate;return m===null?(m=so(l.tag,d,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=d,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&14680064,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,d=l.dependencies,m.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m}function up(l,d,m,E,M,j){var Q=2;if(E=l,typeof l=="function")N0(l)&&(Q=1);else if(typeof l=="string")Q=5;else e:switch(l){case P:return Cl(m.children,M,j,d);case A:Q=8,M|=8;break;case D:return l=so(12,m,d,M|2),l.elementType=D,l.lanes=j,l;case U:return l=so(13,m,d,M),l.elementType=U,l.lanes=j,l;case $:return l=so(19,m,d,M),l.elementType=$,l.lanes=j,l;case W:return dp(m,M,j,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case R:Q=10;break e;case N:Q=9;break e;case L:Q=11;break e;case z:Q=14;break e;case Z:Q=16,E=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=so(Q,m,d,M),d.elementType=l,d.type=E,d.lanes=j,d}function Cl(l,d,m,E){return l=so(7,l,E,d),l.lanes=m,l}function dp(l,d,m,E){return l=so(22,l,E,d),l.elementType=W,l.lanes=m,l.stateNode={isHidden:!1},l}function j0(l,d,m){return l=so(6,l,null,d),l.lanes=m,l}function O0(l,d,m){return d=so(4,l.children!==null?l.children:[],l.key,d),d.lanes=m,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function RM(l,d,m,E,M){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qu(0),this.expirationTimes=qu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qu(0),this.identifierPrefix=E,this.onRecoverableError=M,this.mutableSourceEagerHydrationData=null}function $0(l,d,m,E,M,j,Q,be,xe){return l=new RM(l,d,m,be,xe),d===1?(d=1,j===!0&&(d|=8)):d=0,j=so(3,null,null,d),l.current=j,j.stateNode=l,j.memoizedState={element:E,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zy(j),l}function IM(l,d,m){var E=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),G0.exports=QM(),G0.exports}var rS;function XM(){if(rS)return vp;rS=1;var e=zD();return vp.createRoot=e.createRoot,vp.hydrateRoot=e.hydrateRoot,vp}var JM=XM();/** * react-router v7.10.1 * * Copyright (c) Remix Software Inc. @@ -47,19 +47,19 @@ Error generating stack: `+j.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */var sS="popstate";function JM(e={}){function t(r,s){let{pathname:o,search:i,hash:a}=r.location;return x1("",{pathname:o,search:i,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:wf(s)}return eR(t,n,null,e)}function Ln(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ws(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ZM(){return Math.random().toString(36).substring(2,10)}function oS(e,t){return{usr:e.state,key:e.key,idx:t}}function x1(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xu(t):t,state:n,key:t&&t.key||r||ZM()}}function wf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function xu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function eR(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,a="POP",c=null,u=f();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function f(){return(i.state||{idx:null}).idx}function h(){a="POP";let w=f(),x=w==null?null:w-u;u=w,c&&c({action:a,location:b.location,delta:x})}function p(w,x){a="PUSH";let v=x1(b.location,w,x);u=f()+1;let C=oS(v,u),_=b.createHref(v);try{i.pushState(C,"",_)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(_)}o&&c&&c({action:a,location:b.location,delta:1})}function g(w,x){a="REPLACE";let v=x1(b.location,w,x);u=f();let C=oS(v,u),_=b.createHref(v);i.replaceState(C,"",_),o&&c&&c({action:a,location:b.location,delta:0})}function y(w){return tR(w)}let b={get action(){return a},get location(){return e(s,i)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(sS,h),c=w,()=>{s.removeEventListener(sS,h),c=null}},createHref(w){return t(s,w)},createURL:y,encodeLocation(w){let x=y(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:p,replace:g,go(w){return i.go(w)}};return b}function tR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Ln(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:wf(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function zD(e,t,n="/"){return nR(e,t,n,!1)}function nR(e,t,n,r){let s=typeof t=="string"?xu(t):t,o=$i(s.pathname||"/",n);if(o==null)return null;let i=VD(e);rR(i);let a=null;for(let c=0;a==null&&c{let f={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;Ln(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let h=Ri([r,f.relativePath]),p=n.concat(f);i.children&&i.children.length>0&&(Ln(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),VD(i.children,t,p,h,c)),!(i.path==null&&!i.index)&&t.push({path:h,score:uR(h,i.index),routesMeta:p})};return e.forEach((i,a)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,a);else for(let u of HD(i.path))o(i,a,!0,u)}),t}function HD(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=HD(r.join("/")),a=[];return a.push(...i.map(c=>c===""?o:[o,c].join("/"))),s&&a.push(...i),a.map(c=>e.startsWith("/")&&c===""?"/":c)}function rR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:dR(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var sR=/^:[\w-]+$/,oR=3,iR=2,aR=1,lR=10,cR=-2,iS=e=>e==="*";function uR(e,t){let n=e.split("/"),r=n.length;return n.some(iS)&&(r+=cR),t&&(r+=iR),n.filter(s=>!iS(s)).reduce((s,o)=>s+(sR.test(o)?oR:o===""?aR:lR),r)}function dR(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function fR(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let a=0;a{if(f==="*"){let y=a[p]||"";i=o.slice(0,o.length-y.length).replace(/(.)\/+$/,"$1")}const g=a[p];return h&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function hR(e,t=!1,n=!0){Ws(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,c)=>(r.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function pR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ws(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $i(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var mR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gR=e=>mR.test(e);function yR(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?xu(e):e,o;if(n)if(gR(n))o=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Ws(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?o=aS(n.substring(1),"/"):o=aS(n,t)}else o=t;return{pathname:o,search:wR(r),hash:ER(s)}}function aS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Q0(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function bR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function O2(e){let t=bR(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function $2(e,t,n,r=!1){let s;typeof e=="string"?s=xu(e):(s={...e},Ln(!s.pathname||!s.pathname.includes("?"),Q0("?","pathname","search",s)),Ln(!s.pathname||!s.pathname.includes("#"),Q0("#","pathname","hash",s)),Ln(!s.search||!s.search.includes("#"),Q0("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),h-=1;s.pathname=p.join("/")}a=h>=0?t[h]:"/"}let c=yR(s,a),u=i&&i!=="/"&&i.endsWith("/"),f=(o||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}var Ri=e=>e.join("/").replace(/\/\/+/g,"/"),vR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),wR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ER=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function CR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function xR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var WD=["POST","PUT","PATCH","DELETE"];new Set(WD);var kR=["GET",...WD];new Set(kR);var ku=B.createContext(null);ku.displayName="DataRouter";var Ig=B.createContext(null);Ig.displayName="DataRouterState";B.createContext(!1);var qD=B.createContext({isTransitioning:!1});qD.displayName="ViewTransition";var SR=B.createContext(new Map);SR.displayName="Fetchers";var AR=B.createContext(null);AR.displayName="Await";var go=B.createContext(null);go.displayName="Navigation";var If=B.createContext(null);If.displayName="Location";var di=B.createContext({outlet:null,matches:[],isDataRoute:!1});di.displayName="Route";var U2=B.createContext(null);U2.displayName="RouteError";function _R(e,{relative:t}={}){Ln(Su(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=B.useContext(go),{hash:s,pathname:o,search:i}=Nf(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:Ri([n,o])),r.createHref({pathname:a,search:i,hash:s})}function Su(){return B.useContext(If)!=null}function yo(){return Ln(Su(),"useLocation() may be used only in the context of a component."),B.useContext(If).location}var GD="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function KD(e){B.useContext(go).static||B.useLayoutEffect(e)}function Lf(){let{isDataRoute:e}=B.useContext(di);return e?$R():DR()}function DR(){Ln(Su(),"useNavigate() may be used only in the context of a component.");let e=B.useContext(ku),{basename:t,navigator:n}=B.useContext(go),{matches:r}=B.useContext(di),{pathname:s}=yo(),o=JSON.stringify(O2(r)),i=B.useRef(!1);return KD(()=>{i.current=!0}),B.useCallback((c,u={})=>{if(Ws(i.current,GD),!i.current)return;if(typeof c=="number"){n.go(c);return}let f=$2(c,JSON.parse(o),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ri([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,o,s,e])}B.createContext(null);function Nf(e,{relative:t}={}){let{matches:n}=B.useContext(di),{pathname:r}=yo(),s=JSON.stringify(O2(n));return B.useMemo(()=>$2(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function TR(e,t){return YD(e,t)}function YD(e,t,n,r,s){var v;Ln(Su(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=B.useContext(go),{matches:i}=B.useContext(di),a=i[i.length-1],c=a?a.params:{},u=a?a.pathname:"/",f=a?a.pathnameBase:"/",h=a&&a.route;{let C=h&&h.path||"";QD(u,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + */var sS="popstate";function ZM(e={}){function t(r,s){let{pathname:o,search:i,hash:a}=r.location;return x1("",{pathname:o,search:i,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:wf(s)}return tR(t,n,null,e)}function Ln(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ws(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function eR(){return Math.random().toString(36).substring(2,10)}function oS(e,t){return{usr:e.state,key:e.key,idx:t}}function x1(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xu(t):t,state:n,key:t&&t.key||r||eR()}}function wf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function xu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function tR(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,a="POP",c=null,u=f();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function f(){return(i.state||{idx:null}).idx}function h(){a="POP";let w=f(),x=w==null?null:w-u;u=w,c&&c({action:a,location:b.location,delta:x})}function p(w,x){a="PUSH";let v=x1(b.location,w,x);u=f()+1;let C=oS(v,u),_=b.createHref(v);try{i.pushState(C,"",_)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(_)}o&&c&&c({action:a,location:b.location,delta:1})}function g(w,x){a="REPLACE";let v=x1(b.location,w,x);u=f();let C=oS(v,u),_=b.createHref(v);i.replaceState(C,"",_),o&&c&&c({action:a,location:b.location,delta:0})}function y(w){return nR(w)}let b={get action(){return a},get location(){return e(s,i)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(sS,h),c=w,()=>{s.removeEventListener(sS,h),c=null}},createHref(w){return t(s,w)},createURL:y,encodeLocation(w){let x=y(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:p,replace:g,go(w){return i.go(w)}};return b}function nR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Ln(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:wf(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function VD(e,t,n="/"){return rR(e,t,n,!1)}function rR(e,t,n,r){let s=typeof t=="string"?xu(t):t,o=$i(s.pathname||"/",n);if(o==null)return null;let i=HD(e);sR(i);let a=null;for(let c=0;a==null&&c{let f={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;Ln(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let h=Ri([r,f.relativePath]),p=n.concat(f);i.children&&i.children.length>0&&(Ln(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),HD(i.children,t,p,h,c)),!(i.path==null&&!i.index)&&t.push({path:h,score:dR(h,i.index),routesMeta:p})};return e.forEach((i,a)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,a);else for(let u of WD(i.path))o(i,a,!0,u)}),t}function WD(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=WD(r.join("/")),a=[];return a.push(...i.map(c=>c===""?o:[o,c].join("/"))),s&&a.push(...i),a.map(c=>e.startsWith("/")&&c===""?"/":c)}function sR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fR(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var oR=/^:[\w-]+$/,iR=3,aR=2,lR=1,cR=10,uR=-2,iS=e=>e==="*";function dR(e,t){let n=e.split("/"),r=n.length;return n.some(iS)&&(r+=uR),t&&(r+=aR),n.filter(s=>!iS(s)).reduce((s,o)=>s+(oR.test(o)?iR:o===""?lR:cR),r)}function fR(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function hR(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let a=0;a{if(f==="*"){let y=a[p]||"";i=o.slice(0,o.length-y.length).replace(/(.)\/+$/,"$1")}const g=a[p];return h&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function pR(e,t=!1,n=!0){Ws(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,c)=>(r.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function mR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ws(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $i(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var gR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yR=e=>gR.test(e);function bR(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?xu(e):e,o;if(n)if(yR(n))o=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Ws(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?o=aS(n.substring(1),"/"):o=aS(n,t)}else o=t;return{pathname:o,search:ER(r),hash:CR(s)}}function aS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Q0(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function vR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function O2(e){let t=vR(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function $2(e,t,n,r=!1){let s;typeof e=="string"?s=xu(e):(s={...e},Ln(!s.pathname||!s.pathname.includes("?"),Q0("?","pathname","search",s)),Ln(!s.pathname||!s.pathname.includes("#"),Q0("#","pathname","hash",s)),Ln(!s.search||!s.search.includes("#"),Q0("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),h-=1;s.pathname=p.join("/")}a=h>=0?t[h]:"/"}let c=bR(s,a),u=i&&i!=="/"&&i.endsWith("/"),f=(o||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}var Ri=e=>e.join("/").replace(/\/\/+/g,"/"),wR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ER=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function xR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var qD=["POST","PUT","PATCH","DELETE"];new Set(qD);var SR=["GET",...qD];new Set(SR);var ku=B.createContext(null);ku.displayName="DataRouter";var Ig=B.createContext(null);Ig.displayName="DataRouterState";B.createContext(!1);var GD=B.createContext({isTransitioning:!1});GD.displayName="ViewTransition";var AR=B.createContext(new Map);AR.displayName="Fetchers";var _R=B.createContext(null);_R.displayName="Await";var go=B.createContext(null);go.displayName="Navigation";var Lf=B.createContext(null);Lf.displayName="Location";var di=B.createContext({outlet:null,matches:[],isDataRoute:!1});di.displayName="Route";var U2=B.createContext(null);U2.displayName="RouteError";function DR(e,{relative:t}={}){Ln(Su(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=B.useContext(go),{hash:s,pathname:o,search:i}=jf(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:Ri([n,o])),r.createHref({pathname:a,search:i,hash:s})}function Su(){return B.useContext(Lf)!=null}function yo(){return Ln(Su(),"useLocation() may be used only in the context of a component."),B.useContext(Lf).location}var KD="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function YD(e){B.useContext(go).static||B.useLayoutEffect(e)}function Nf(){let{isDataRoute:e}=B.useContext(di);return e?UR():TR()}function TR(){Ln(Su(),"useNavigate() may be used only in the context of a component.");let e=B.useContext(ku),{basename:t,navigator:n}=B.useContext(go),{matches:r}=B.useContext(di),{pathname:s}=yo(),o=JSON.stringify(O2(r)),i=B.useRef(!1);return YD(()=>{i.current=!0}),B.useCallback((c,u={})=>{if(Ws(i.current,KD),!i.current)return;if(typeof c=="number"){n.go(c);return}let f=$2(c,JSON.parse(o),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ri([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,o,s,e])}B.createContext(null);function jf(e,{relative:t}={}){let{matches:n}=B.useContext(di),{pathname:r}=yo(),s=JSON.stringify(O2(n));return B.useMemo(()=>$2(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function BR(e,t){return QD(e,t)}function QD(e,t,n,r,s){var v;Ln(Su(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=B.useContext(go),{matches:i}=B.useContext(di),a=i[i.length-1],c=a?a.params:{},u=a?a.pathname:"/",f=a?a.pathnameBase:"/",h=a&&a.route;{let C=h&&h.path||"";XD(u,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let p=yo(),g;if(t){let C=typeof t=="string"?xu(t):t;Ln(f==="/"||((v=C.pathname)==null?void 0:v.startsWith(f)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let y=g.pathname||"/",b=y;if(f!=="/"){let C=f.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=zD(e,{pathname:b});Ws(h||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ws(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let x=RR(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Ri([f,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:Ri([f,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,n,r,s);return t&&x?B.createElement(If.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},x):x}function BR(){let e=OR(),t=CR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=B.createElement(B.Fragment,null,B.createElement("p",null,"💿 Hey developer 👋"),B.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",B.createElement("code",{style:o},"ErrorBoundary")," or"," ",B.createElement("code",{style:o},"errorElement")," prop on your route.")),B.createElement(B.Fragment,null,B.createElement("h2",null,"Unexpected Application Error!"),B.createElement("h3",{style:{fontStyle:"italic"}},t),n?B.createElement("pre",{style:s},n):null,i)}var FR=B.createElement(BR,null),PR=class extends B.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?B.createElement(di.Provider,{value:this.props.routeContext},B.createElement(U2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function MR({routeContext:e,match:t,children:n}){let r=B.useContext(ku);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),B.createElement(di.Provider,{value:e},n)}function RR(e,t=[],n=null,r=null,s=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let f=o.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);Ln(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,f+1))}let a=!1,c=-1;if(n)for(let f=0;f=0?o=o.slice(0,c+1):o=[o[0]];break}}}let u=n&&r?(f,h)=>{var p,g;r(f,{location:n.location,params:((g=(p=n.matches)==null?void 0:p[0])==null?void 0:g.params)??{},unstable_pattern:xR(n.matches),errorInfo:h})}:void 0;return o.reduceRight((f,h,p)=>{let g,y=!1,b=null,w=null;n&&(g=i&&h.route.id?i[h.route.id]:void 0,b=h.route.errorElement||FR,a&&(c<0&&p===0?(QD("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,w=null):c===p&&(y=!0,w=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,p+1)),v=()=>{let C;return g?C=b:y?C=w:h.route.Component?C=B.createElement(h.route.Component,null):h.route.element?C=h.route.element:C=f,B.createElement(MR,{match:h,routeContext:{outlet:f,matches:x,isDataRoute:n!=null},children:C})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?B.createElement(PR,{location:n.location,revalidation:n.revalidation,component:b,error:g,children:v(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:u}):v()},null)}function z2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function IR(e){let t=B.useContext(ku);return Ln(t,z2(e)),t}function LR(e){let t=B.useContext(Ig);return Ln(t,z2(e)),t}function NR(e){let t=B.useContext(di);return Ln(t,z2(e)),t}function V2(e){let t=NR(e),n=t.matches[t.matches.length-1];return Ln(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function jR(){return V2("useRouteId")}function OR(){var r;let e=B.useContext(U2),t=LR("useRouteError"),n=V2("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function $R(){let{router:e}=IR("useNavigate"),t=V2("useNavigate"),n=B.useRef(!1);return KD(()=>{n.current=!0}),B.useCallback(async(s,o={})=>{Ws(n.current,GD),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var lS={};function QD(e,t,n){!t&&!lS[e]&&(lS[e]=!0,Ws(!1,n))}B.memo(UR);function UR({routes:e,future:t,state:n,unstable_onError:r}){return YD(e,void 0,n,r,t)}function zR({to:e,replace:t,state:n,relative:r}){Ln(Su()," may be used only in the context of a component.");let{static:s}=B.useContext(go);Ws(!s," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:o}=B.useContext(di),{pathname:i}=yo(),a=Lf(),c=$2(e,O2(o),i,r==="path"),u=JSON.stringify(c);return B.useEffect(()=>{a(JSON.parse(u),{replace:t,state:n,relative:r})},[a,u,r,t,n]),null}function Dr(e){Ln(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function VR({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,unstable_useTransitions:i}){Ln(!Su(),"You cannot render a inside another . You should never have more than one in your app.");let a=e.replace(/^\/*/,"/"),c=B.useMemo(()=>({basename:a,navigator:s,static:o,unstable_useTransitions:i,future:{}}),[a,s,o,i]);typeof n=="string"&&(n=xu(n));let{pathname:u="/",search:f="",hash:h="",state:p=null,key:g="default"}=n,y=B.useMemo(()=>{let b=$i(u,a);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:g},navigationType:r}},[a,u,f,h,p,g,r]);return Ws(y!=null,` is not able to match the URL "${u}${f}${h}" because it does not start with the basename, so the won't render anything.`),y==null?null:B.createElement(go.Provider,{value:c},B.createElement(If.Provider,{children:t,value:y}))}function cS({children:e,location:t}){return TR(k1(e),t)}function k1(e,t=[]){let n=[];return B.Children.forEach(e,(r,s)=>{if(!B.isValidElement(r))return;let o=[...t,s];if(r.type===B.Fragment){n.push.apply(n,k1(r.props.children,o));return}Ln(r.type===Dr,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),Ln(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=k1(r.props.children,o)),n.push(i)}),n}var mm="get",gm="application/x-www-form-urlencoded";function Lg(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function HR(e){return Lg(e)&&e.tagName.toLowerCase()==="button"}function WR(e){return Lg(e)&&e.tagName.toLowerCase()==="form"}function qR(e){return Lg(e)&&e.tagName.toLowerCase()==="input"}function GR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function KR(e,t){return e.button===0&&(!t||t==="_self")&&!GR(e)}function S1(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function YR(e,t){let n=S1(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var vp=null;function QR(){if(vp===null)try{new FormData(document.createElement("form"),0),vp=!1}catch{vp=!0}return vp}var XR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function X0(e){return e!=null&&!XR.has(e)?(Ws(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${gm}"`),null):e}function JR(e,t){let n,r,s,o,i;if(WR(e)){let a=e.getAttribute("action");r=a?$i(a,t):null,n=e.getAttribute("method")||mm,s=X0(e.getAttribute("enctype"))||gm,o=new FormData(e)}else if(HR(e)||qR(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a