Add packet cleanup

This commit is contained in:
Jack Kingsman committed 2026-01-13 12:49:27 -08:00
1 parent 3ea98e309c
commit 547a2adb94
14 files changed
+573 -44

No files matched your search

+11
View File
@@ -522,3 +522,14 @@ class RawPacketRepository:
(int(time.time()), packet_id),
)
await db.conn.commit()
@staticmethod
async def prune_old_undecrypted(max_age_days: int) -> int:
"""Delete undecrypted packets older than max_age_days. Returns count deleted."""
cutoff = int(time.time()) - (max_age_days * 86400)
cursor = await db.conn.execute(
"DELETE FROM raw_packets WHERE decrypted = 0 AND timestamp < ?",
(cutoff,),
)
await db.conn.commit()
return cursor.rowcount
+13
View File
@@ -1,6 +1,9 @@
import os
from fastapi import APIRouter
from pydantic import BaseModel
from app.config import settings
from app.radio import radio_manager
@@ -11,13 +14,23 @@ class HealthResponse(BaseModel):
status: str
radio_connected: bool
serial_port: str | None
database_size_mb: float
@router.get("/health", response_model=HealthResponse)
async def healthcheck() -> HealthResponse:
"""Check if the API is running and if the radio is connected."""
# Get database file size in MB
db_size_mb = 0.0
try:
db_size_bytes = os.path.getsize(settings.database_path)
db_size_mb = round(db_size_bytes / (1024 * 1024), 2)
except OSError:
pass
return HealthResponse(
status="ok" if radio_manager.is_connected else "degraded",
radio_connected=radio_manager.is_connected,
serial_port=radio_manager.port,
database_size_mb=db_size_mb,
)
+165 -1
View File
@@ -4,7 +4,8 @@ from hashlib import sha256
from fastapi import APIRouter, BackgroundTasks
from pydantic import BaseModel, Field
from app.decoder import try_decrypt_packet_with_channel_key
from app.database import db
from app.decoder import extract_payload, try_decrypt_packet_with_channel_key
from app.packet_processor import create_message_from_decrypted
from app.repository import RawPacketRepository
@@ -174,3 +175,166 @@ async def decrypt_historical_packets(
async def get_decrypt_progress() -> DecryptProgress | None:
"""Get the current progress of historical decryption."""
return _decrypt_progress
class MaintenanceRequest(BaseModel):
prune_undecrypted_days: int = Field(
ge=1,
description="Delete undecrypted packets older than this many days"
)
class MaintenanceResult(BaseModel):
packets_deleted: int
vacuumed: bool
@router.post("/maintenance", response_model=MaintenanceResult)
async def run_maintenance(request: MaintenanceRequest) -> MaintenanceResult:
"""
Clean up old undecrypted packets and reclaim disk space.
- Deletes undecrypted packets older than the specified number of days
- Runs VACUUM to reclaim disk space
"""
logger.info("Running maintenance: pruning packets older than %d days", request.prune_undecrypted_days)
# Prune old undecrypted packets
deleted = await RawPacketRepository.prune_old_undecrypted(request.prune_undecrypted_days)
logger.info("Deleted %d old undecrypted packets", deleted)
# Run VACUUM to reclaim space
await db.conn.execute("VACUUM")
logger.info("Database vacuumed")
return MaintenanceResult(packets_deleted=deleted, vacuumed=True)
class DedupProgress(BaseModel):
total: int
processed: int
duplicates_removed: int
in_progress: bool
class DedupResult(BaseModel):
started: bool
total_packets: int
message: str
# Global state for tracking dedup progress
_dedup_progress: DedupProgress | None = None
async def _run_payload_dedup() -> None:
"""Background task to remove duplicate-payload packets."""
global _dedup_progress
# Get all undecrypted packets
packets = await RawPacketRepository.get_all_undecrypted()
total = len(packets)
_dedup_progress = DedupProgress(
total=total, processed=0, duplicates_removed=0, in_progress=True
)
logger.info("Starting payload deduplication of %d packets", total)
# Group packets by payload hash
payload_groups: dict[str, list[int]] = {} # hash -> list of packet IDs
for packet_id, packet_data, _timestamp in packets:
payload = extract_payload(packet_data)
if payload is None:
continue
payload_hash = sha256(payload).hexdigest()
if payload_hash not in payload_groups:
payload_groups[payload_hash] = []
payload_groups[payload_hash].append(packet_id)
_dedup_progress = DedupProgress(
total=total,
processed=_dedup_progress.processed + 1,
duplicates_removed=_dedup_progress.duplicates_removed,
in_progress=True,
)
# Delete duplicates (keep the first/oldest packet in each group)
duplicates_removed = 0
for payload_hash, packet_ids in payload_groups.items():
if len(packet_ids) > 1:
# Keep the first one, delete the rest
ids_to_delete = packet_ids[1:]
for packet_id in ids_to_delete:
await db.conn.execute(
"DELETE FROM raw_packets WHERE id = ?", (packet_id,)
)
duplicates_removed += 1
_dedup_progress = DedupProgress(
total=total,
processed=_dedup_progress.processed,
duplicates_removed=duplicates_removed,
in_progress=True,
)
await db.conn.commit()
# Run VACUUM to reclaim space
await db.conn.execute("VACUUM")
_dedup_progress = DedupProgress(
total=total,
processed=total,
duplicates_removed=duplicates_removed,
in_progress=False,
)
logger.info("Payload deduplication complete: removed %d duplicates", duplicates_removed)
@router.post("/dedup", response_model=DedupResult)
async def deduplicate_packets(background_tasks: BackgroundTasks) -> DedupResult:
"""
Remove packets with duplicate payloads (keeps one copy of each unique payload).
This operation runs in the background and may take a long time for large databases.
Use GET /packets/dedup/progress to check status.
Note: This only affects undecrypted packets. Packets that arrive through different
repeater paths have different full data but the same payload - this removes those duplicates.
"""
global _dedup_progress
# Check if dedup is already in progress
if _dedup_progress and _dedup_progress.in_progress:
return DedupResult(
started=False,
total_packets=_dedup_progress.total,
message=f"Deduplication already in progress: {_dedup_progress.processed}/{_dedup_progress.total}",
)
# Get count of undecrypted packets
count = await RawPacketRepository.get_undecrypted_count()
if count == 0:
return DedupResult(
started=False, total_packets=0, message="No undecrypted packets to process"
)
# Start background dedup
background_tasks.add_task(_run_payload_dedup)
return DedupResult(
started=True,
total_packets=count,
message=f"Started deduplication of {count} packets in background. This may take a while.",
)
@router.get("/dedup/progress", response_model=DedupProgress | None)
async def get_dedup_progress() -> DedupProgress | None:
"""Get the current progress of payload deduplication."""
return _dedup_progress
+11
View File
@@ -1,9 +1,11 @@
"""WebSocket router for real-time updates."""
import logging
import os
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
from app.config import settings
from app.radio import radio_manager
from app.repository import ChannelRepository, ContactRepository
from app.websocket import ws_manager
@@ -20,9 +22,18 @@ async def websocket_endpoint(websocket: WebSocket) -> None:
# Send initial state
try:
# Health status
db_size_mb = 0.0
try:
db_size_bytes = os.path.getsize(settings.database_path)
db_size_mb = round(db_size_bytes / (1024 * 1024), 2)
except OSError:
pass
health_data = {
"status": "ok" if radio_manager.is_connected else "degraded",
"radio_connected": radio_manager.is_connected,
"serial_port": radio_manager.port,
"database_size_mb": db_size_mb,
}
await ws_manager.send_personal(websocket, "health", health_data)
+12
View File
@@ -3,10 +3,13 @@
import asyncio
import json
import logging
import os
from typing import Any
from fastapi import WebSocket
from app.config import settings
logger = logging.getLogger(__name__)
@@ -85,8 +88,17 @@ def broadcast_error(message: str, details: str | None = None) -> None:
def broadcast_health(radio_connected: bool, serial_port: str | None = None) -> None:
"""Broadcast health status change to all connected clients."""
# Get database file size in MB
db_size_mb = 0.0
try:
db_size_bytes = os.path.getsize(settings.database_path)
db_size_mb = round(db_size_bytes / (1024 * 1024), 2)
except OSError:
pass
asyncio.create_task(ws_manager.broadcast("health", {
"status": "ok" if radio_connected else "degraded",
"radio_connected": radio_connected,
"serial_port": serial_port,
"database_size_mb": db_size_mb,
}))
@@ -1,4 +1,4 @@
var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[o]=r;var Hn=(a,o,r)=>Jv(a,typeof o!="symbol"?o+"":o,r);function ek(a,o){for(var r=0;r<o.length;r++){const s=o[r];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in a)){const l=Object.getOwnPropertyDescriptor(s,u);l&&Object.defineProperty(a,u,l.get?l:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const l of u)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(u){const l={};return u.integrity&&(l.integrity=u.integrity),u.referrerPolicy&&(l.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?l.credentials="include":u.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(u){if(u.ep)return;u.ep=!0;const l=r(u);fetch(u.href,l)}})();var Xc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rr(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function Ug(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var o=a.default;if(typeof o=="function"){var r=function s(){return this instanceof s?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};r.prototype=o.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(a).forEach(function(s){var u=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(r,s,u.get?u:{enumerable:!0,get:function(){return a[s]}})}),r}var Jc={exports:{}},vo={},eu={exports:{}},Ie={};/**
var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[o]=r;var Hn=(a,o,r)=>Jv(a,typeof o!="symbol"?o+"":o,r);function ek(a,o){for(var r=0;r<o.length;r++){const s=o[r];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in a)){const l=Object.getOwnPropertyDescriptor(s,c);l&&Object.defineProperty(a,c,l.get?l:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const l of c)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const l={};return c.integrity&&(l.integrity=c.integrity),c.referrerPolicy&&(l.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?l.credentials="include":c.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(c){if(c.ep)return;c.ep=!0;const l=r(c);fetch(c.href,l)}})();var Xc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rr(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function Ug(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var o=a.default;if(typeof o=="function"){var r=function s(){return this instanceof s?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};r.prototype=o.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(a).forEach(function(s){var c=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(r,s,c.get?c:{enumerable:!0,get:function(){return a[s]}})}),r}var Jc={exports:{}},vo={},eu={exports:{}},Oe={};/**
* @license React
* react.production.min.js
*
@@ -6,7 +6,7 @@ var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Mm;function ik(){if(Mm)return Ie;Mm=1;var a=Symbol.for("react.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),m=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function f(A){return A===null||typeof A!="object"?null:(A=y&&A[y]||A["@@iterator"],typeof A=="function"?A:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function v(A,I,L){this.props=A,this.context=I,this.refs=k,this.updater=L||z}v.prototype.isReactComponent={},v.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},v.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function j(){}j.prototype=v.prototype;function q(A,I,L){this.props=A,this.context=I,this.refs=k,this.updater=L||z}var x=q.prototype=new j;x.constructor=q,w(x,v.prototype),x.isPureReactComponent=!0;var _=Array.isArray,C=Object.prototype.hasOwnProperty,D={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function F(A,I,L){var $,le={},pe=null,me=null;if(I!=null)for($ in I.ref!==void 0&&(me=I.ref),I.key!==void 0&&(pe=""+I.key),I)C.call(I,$)&&!R.hasOwnProperty($)&&(le[$]=I[$]);var re=arguments.length-2;if(re===1)le.children=L;else if(1<re){for(var Ae=Array(re),Me=0;Me<re;Me++)Ae[Me]=arguments[Me+2];le.children=Ae}if(A&&A.defaultProps)for($ in re=A.defaultProps,re)le[$]===void 0&&(le[$]=re[$]);return{$$typeof:a,type:A,key:pe,ref:me,props:le,_owner:D.current}}function M(A,I){return{$$typeof:a,type:A.type,key:I,ref:A.ref,props:A.props,_owner:A._owner}}function P(A){return typeof A=="object"&&A!==null&&A.$$typeof===a}function T(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(L){return I[L]})}var U=/\/+/g;function H(A,I){return typeof A=="object"&&A!==null&&A.key!=null?T(""+A.key):I.toString(36)}function K(A,I,L,$,le){var pe=typeof A;(pe==="undefined"||pe==="boolean")&&(A=null);var me=!1;if(A===null)me=!0;else switch(pe){case"string":case"number":me=!0;break;case"object":switch(A.$$typeof){case a:case o:me=!0}}if(me)return me=A,le=le(me),A=$===""?"."+H(me,0):$,_(le)?(L="",A!=null&&(L=A.replace(U,"$&/")+"/"),K(le,I,L,"",function(Me){return Me})):le!=null&&(P(le)&&(le=M(le,L+(!le.key||me&&me.key===le.key?"":(""+le.key).replace(U,"$&/")+"/")+A)),I.push(le)),1;if(me=0,$=$===""?".":$+":",_(A))for(var re=0;re<A.length;re++){pe=A[re];var Ae=$+H(pe,re);me+=K(pe,I,L,Ae,le)}else if(Ae=f(A),typeof Ae=="function")for(A=Ae.call(A),re=0;!(pe=A.next()).done;)pe=pe.value,Ae=$+H(pe,re++),me+=K(pe,I,L,Ae,le);else if(pe==="object")throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.");return me}function ie(A,I,L){if(A==null)return A;var $=[],le=0;return K(A,$,"","",function(pe){return I.call(L,pe,le++)}),$}function Z(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(L){(A._status===0||A._status===-1)&&(A._status=1,A._result=L)},function(L){(A._status===0||A._status===-1)&&(A._status=2,A._result=L)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var ae={current:null},W={transition:null},ne={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:W,ReactCurrentOwner:D};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ie.Children={map:ie,forEach:function(A,I,L){ie(A,function(){I.apply(this,arguments)},L)},count:function(A){var I=0;return ie(A,function(){I++}),I},toArray:function(A){return ie(A,function(I){return I})||[]},only:function(A){if(!P(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},Ie.Component=v,Ie.Fragment=r,Ie.Profiler=u,Ie.PureComponent=q,Ie.StrictMode=s,Ie.Suspense=h,Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,Ie.act=J,Ie.cloneElement=function(A,I,L){if(A==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+A+".");var $=w({},A.props),le=A.key,pe=A.ref,me=A._owner;if(I!=null){if(I.ref!==void 0&&(pe=I.ref,me=D.current),I.key!==void 0&&(le=""+I.key),A.type&&A.type.defaultProps)var re=A.type.defaultProps;for(Ae in I)C.call(I,Ae)&&!R.hasOwnProperty(Ae)&&($[Ae]=I[Ae]===void 0&&re!==void 0?re[Ae]:I[Ae])}var Ae=arguments.length-2;if(Ae===1)$.children=L;else if(1<Ae){re=Array(Ae);for(var Me=0;Me<Ae;Me++)re[Me]=arguments[Me+2];$.children=re}return{$$typeof:a,type:A.type,key:le,ref:pe,props:$,_owner:me}},Ie.createContexLine truncated
*/var Mm;function ik(){if(Mm)return Oe;Mm=1;var a=Symbol.for("react.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),m=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function f(E){return E===null||typeof E!="object"?null:(E=y&&E[y]||E["@@iterator"],typeof E=="function"?E:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function v(E,I,L){this.props=E,this.context=I,this.refs=k,this.updater=L||z}v.prototype.isReactComponent={},v.prototype.setState=function(E,I){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,I,"setState")},v.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function j(){}j.prototype=v.prototype;function q(E,I,L){this.props=E,this.context=I,this.refs=k,this.updater=L||z}var x=q.prototype=new j;x.constructor=q,w(x,v.prototype),x.isPureReactComponent=!0;var _=Array.isArray,A=Object.prototype.hasOwnProperty,D={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function F(E,I,L){var $,re={},pe=null,he=null;if(I!=null)for($ in I.ref!==void 0&&(he=I.ref),I.key!==void 0&&(pe=""+I.key),I)A.call(I,$)&&!R.hasOwnProperty($)&&(re[$]=I[$]);var oe=arguments.length-2;if(oe===1)re.children=L;else if(1<oe){for(var Ae=Array(oe),Ne=0;Ne<oe;Ne++)Ae[Ne]=arguments[Ne+2];re.children=Ae}if(E&&E.defaultProps)for($ in oe=E.defaultProps,oe)re[$]===void 0&&(re[$]=oe[$]);return{$$typeof:a,type:E,key:pe,ref:he,props:re,_owner:D.current}}function M(E,I){return{$$typeof:a,type:E.type,key:I,ref:E.ref,props:E.props,_owner:E._owner}}function P(E){return typeof E=="object"&&E!==null&&E.$$typeof===a}function T(E){var I={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(L){return I[L]})}var W=/\/+/g;function H(E,I){return typeof E=="object"&&E!==null&&E.key!=null?T(""+E.key):I.toString(36)}function K(E,I,L,$,re){var pe=typeof E;(pe==="undefined"||pe==="boolean")&&(E=null);var he=!1;if(E===null)he=!0;else switch(pe){case"string":case"number":he=!0;break;case"object":switch(E.$$typeof){case a:case o:he=!0}}if(he)return he=E,re=re(he),E=$===""?"."+H(he,0):$,_(re)?(L="",E!=null&&(L=E.replace(W,"$&/")+"/"),K(re,I,L,"",function(Ne){return Ne})):re!=null&&(P(re)&&(re=M(re,L+(!re.key||he&&he.key===re.key?"":(""+re.key).replace(W,"$&/")+"/")+E)),I.push(re)),1;if(he=0,$=$===""?".":$+":",_(E))for(var oe=0;oe<E.length;oe++){pe=E[oe];var Ae=$+H(pe,oe);he+=K(pe,I,L,Ae,re)}else if(Ae=f(E),typeof Ae=="function")for(E=Ae.call(E),oe=0;!(pe=E.next()).done;)pe=pe.value,Ae=$+H(pe,oe++),he+=K(pe,I,L,Ae,re);else if(pe==="object")throw I=String(E),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.");return he}function ie(E,I,L){if(E==null)return E;var $=[],re=0;return K(E,$,"","",function(pe){return I.call(L,pe,re++)}),$}function Y(E){if(E._status===-1){var I=E._result;I=I(),I.then(function(L){(E._status===0||E._status===-1)&&(E._status=1,E._result=L)},function(L){(E._status===0||E._status===-1)&&(E._status=2,E._result=L)}),E._status===-1&&(E._status=0,E._result=I)}if(E._status===1)return E._result.default;throw E._result}var ne={current:null},U={transition:null},ae={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:U,ReactCurrentOwner:D};function J(){throw Error("act(...) is not supported in production builds of React.")}return Oe.Children={map:ie,forEach:function(E,I,L){ie(E,function(){I.apply(this,arguments)},L)},count:function(E){var I=0;return ie(E,function(){I++}),I},toArray:function(E){return ie(E,function(I){return I})||[]},only:function(E){if(!P(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},Oe.Component=v,Oe.Fragment=r,Oe.Profiler=c,Oe.PureComponent=q,Oe.StrictMode=s,Oe.Suspense=h,Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,Oe.act=J,Oe.cloneElement=function(E,I,L){if(E==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+E+".");var $=w({},E.props),re=E.key,pe=E.ref,he=E._owner;if(I!=null){if(I.ref!==void 0&&(pe=I.ref,he=D.current),I.key!==void 0&&(re=""+I.key),E.type&&E.type.defaultProps)var oe=E.type.defaultProps;for(Ae in I)A.call(I,Ae)&&!R.hasOwnProperty(Ae)&&($[Ae]=I[Ae]===void 0&&oe!==void 0?oe[Ae]:I[Ae])}var Ae=arguments.length-2;if(Ae===1)$.children=L;else if(1<Ae){oe=Array(Ae);for(var Ne=0;Ne<Ae;Ne++)oe[Ne]=arguments[Ne+2];$.children=oe}return{$$typeof:a,type:E.type,key:re,ref:pe,props:$,_owner:he}},Oe.createContexLine truncated
* @license React
* react-jsx-runtime.production.min.js
*
@@ -14,7 +14,7 @@ var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Lm;function ak(){if(Lm)return vo;Lm=1;var a=Tu(),o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,u=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(c,h,d){var g,y={},f=null,z=null;d!==void 0&&(f=""+d),h.key!==void 0&&(f=""+h.key),h.ref!==void 0&&(z=h.ref);for(g in h)s.call(h,g)&&!l.hasOwnProperty(g)&&(y[g]=h[g]);if(c&&c.defaultProps)for(g in h=c.defaultProps,h)y[g]===void 0&&(y[g]=h[g]);return{$$typeof:o,type:c,key:f,ref:z,props:y,_owner:u.current}}return vo.Fragment=r,vo.jsx=m,vo.jsxs=m,vo}var Hm;function nk(){return Hm||(Hm=1,Jc.exports=ak()),Jc.exports}var B=nk(),E=Tu();const de=Rr(E),Pu=ek({__proto__:null,default:de},[E]);var Ys={},iu={exports:{}},na={},au={exports:{}},nu={};/**
*/var Lm;function ak(){if(Lm)return vo;Lm=1;var a=Tu(),o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,c=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(u,h,d){var g,y={},f=null,z=null;d!==void 0&&(f=""+d),h.key!==void 0&&(f=""+h.key),h.ref!==void 0&&(z=h.ref);for(g in h)s.call(h,g)&&!l.hasOwnProperty(g)&&(y[g]=h[g]);if(u&&u.defaultProps)for(g in h=u.defaultProps,h)y[g]===void 0&&(y[g]=h[g]);return{$$typeof:o,type:u,key:f,ref:z,props:y,_owner:c.current}}return vo.Fragment=r,vo.jsx=m,vo.jsxs=m,vo}var Hm;function nk(){return Hm||(Hm=1,Jc.exports=ak()),Jc.exports}var S=nk(),C=Tu();const de=Rr(C),Pu=ek({__proto__:null,default:de},[C]);var Zs={},iu={exports:{}},na={},au={exports:{}},nu={};/**
* @license React
* scheduler.production.min.js
*
@@ -22,7 +22,7 @@ var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Vm;function rk(){return Vm||(Vm=1,(function(a){function o(W,ne){var J=W.length;W.push(ne);e:for(;0<J;){var A=J-1>>>1,I=W[A];if(0<u(I,ne))W[A]=ne,W[J]=I,J=A;else break e}}function r(W){return W.length===0?null:W[0]}function s(W){if(W.length===0)return null;var ne=W[0],J=W.pop();if(J!==ne){W[0]=J;e:for(var A=0,I=W.length,L=I>>>1;A<L;){var $=2*(A+1)-1,le=W[$],pe=$+1,me=W[pe];if(0>u(le,J))pe<I&&0>u(me,le)?(W[A]=me,W[pe]=J,A=pe):(W[A]=le,W[$]=J,A=$);else if(pe<I&&0>u(me,J))W[A]=me,W[pe]=J,A=pe;else break e}}return ne}function u(W,ne){var J=W.sortIndex-ne.sortIndex;return J!==0?J:W.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;a.unstable_now=function(){return l.now()}}else{var m=Date,c=m.now();a.unstable_now=function(){return m.now()-c}}var h=[],d=[],g=1,y=null,f=3,z=!1,w=!1,k=!1,v=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(W){for(var ne=r(d);ne!==null;){if(ne.callback===null)s(d);else if(ne.startTime<=W)s(d),ne.sortIndex=ne.expirationTime,o(h,ne);else break;ne=r(d)}}function _(W){if(k=!1,x(W),!w)if(r(h)!==null)w=!0,Z(C);else{var ne=r(d);ne!==null&&ae(_,ne.startTime-W)}}function C(W,ne){w=!1,k&&(k=!1,j(F),F=-1),z=!0;var J=f;try{for(x(ne),y=r(h);y!==null&&(!(y.expirationTime>ne)||W&&!T());){var A=y.callback;if(typeof A=="function"){y.callback=null,f=y.priorityLevel;var I=A(y.expirationTime<=ne);ne=a.unstable_now(),typeof I=="function"?y.callback=I:y===r(h)&&s(h),x(ne)}else s(h);y=r(h)}if(y!==null)var L=!0;else{var $=r(d);$!==null&&ae(_,$.startTime-ne),L=!1}return L}finally{y=null,f=J,z=!1}}var D=!1,R=null,F=-1,M=5,P=-1;function T(){return!(a.unstable_now()-P<M)}function U(){if(R!==null){var W=a.unstable_now();P=W;var ne=!0;try{ne=R(!0,W)}finally{ne?H():(D=!1,R=null)}}else D=!1}var H;if(typeof q=="function")H=function(){q(U)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ie=K.port2;K.port1.onmessage=U,H=function(){ie.postMessage(null)}}else H=function(){v(U,0)};function Z(W){R=W,D||(D=!0,H())}function ae(W,ne){F=v(function(){W(a.unstable_now())},ne)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(W){W.callback=null},a.unstable_continueExecution=function(){w||z||(w=!0,Z(C))},a.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<W?Math.floor(1e3/W):5},a.unstable_getCurrentPriorityLevel=function(){return f},a.unstable_getFirstCallbackNode=function(){return r(h)},a.unstable_next=function(W){switch(f){case 1:case 2:case 3:var ne=3;break;default:ne=f}var J=f;f=ne;try{return W()}finally{f=J}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(W,ne){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var J=f;f=W;try{return ne()}finally{f=J}},a.unstable_scheduleCallback=function(W,ne,J){var A=a.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?A+J:A):J=A,W){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=J+I,W={id:g++,callback:ne,priorityLevel:W,startTime:J,expirationTime:I,sortIndex:-1},J>A?(W.sortIndex=J,o(d,W),r(h)===null&&W===r(d)&&(k?(j(F),F=-1):k=!0,ae(_,J-A))):(W.sortIndex=I,o(h,W),w||z||(w=!0,Z(C))),W},a.unstable_shouldYield=T,a.unstable_wrapCallback=function(W){var ne=f;return function(){var J=f;f=ne;try{return W.apply(this,arguments)}finally{f=J}}}})(nu)),nu}var Um;function ok(){return Um||(Um=1,au.exports=rk()),au.exports}/**
*/var Vm;function rk(){return Vm||(Vm=1,(function(a){function o(U,ae){var J=U.length;U.push(ae);e:for(;0<J;){var E=J-1>>>1,I=U[E];if(0<c(I,ae))U[E]=ae,U[J]=I,J=E;else break e}}function r(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var ae=U[0],J=U.pop();if(J!==ae){U[0]=J;e:for(var E=0,I=U.length,L=I>>>1;E<L;){var $=2*(E+1)-1,re=U[$],pe=$+1,he=U[pe];if(0>c(re,J))pe<I&&0>c(he,re)?(U[E]=he,U[pe]=J,E=pe):(U[E]=re,U[$]=J,E=$);else if(pe<I&&0>c(he,J))U[E]=he,U[pe]=J,E=pe;else break e}}return ae}function c(U,ae){var J=U.sortIndex-ae.sortIndex;return J!==0?J:U.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;a.unstable_now=function(){return l.now()}}else{var m=Date,u=m.now();a.unstable_now=function(){return m.now()-u}}var h=[],d=[],g=1,y=null,f=3,z=!1,w=!1,k=!1,v=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(U){for(var ae=r(d);ae!==null;){if(ae.callback===null)s(d);else if(ae.startTime<=U)s(d),ae.sortIndex=ae.expirationTime,o(h,ae);else break;ae=r(d)}}function _(U){if(k=!1,x(U),!w)if(r(h)!==null)w=!0,Y(A);else{var ae=r(d);ae!==null&&ne(_,ae.startTime-U)}}function A(U,ae){w=!1,k&&(k=!1,j(F),F=-1),z=!0;var J=f;try{for(x(ae),y=r(h);y!==null&&(!(y.expirationTime>ae)||U&&!T());){var E=y.callback;if(typeof E=="function"){y.callback=null,f=y.priorityLevel;var I=E(y.expirationTime<=ae);ae=a.unstable_now(),typeof I=="function"?y.callback=I:y===r(h)&&s(h),x(ae)}else s(h);y=r(h)}if(y!==null)var L=!0;else{var $=r(d);$!==null&&ne(_,$.startTime-ae),L=!1}return L}finally{y=null,f=J,z=!1}}var D=!1,R=null,F=-1,M=5,P=-1;function T(){return!(a.unstable_now()-P<M)}function W(){if(R!==null){var U=a.unstable_now();P=U;var ae=!0;try{ae=R(!0,U)}finally{ae?H():(D=!1,R=null)}}else D=!1}var H;if(typeof q=="function")H=function(){q(W)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ie=K.port2;K.port1.onmessage=W,H=function(){ie.postMessage(null)}}else H=function(){v(W,0)};function Y(U){R=U,D||(D=!0,H())}function ne(U,ae){F=v(function(){U(a.unstable_now())},ae)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(U){U.callback=null},a.unstable_continueExecution=function(){w||z||(w=!0,Y(A))},a.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<U?Math.floor(1e3/U):5},a.unstable_getCurrentPriorityLevel=function(){return f},a.unstable_getFirstCallbackNode=function(){return r(h)},a.unstable_next=function(U){switch(f){case 1:case 2:case 3:var ae=3;break;default:ae=f}var J=f;f=ae;try{return U()}finally{f=J}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(U,ae){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var J=f;f=U;try{return ae()}finally{f=J}},a.unstable_scheduleCallback=function(U,ae,J){var E=a.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?E+J:E):J=E,U){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=J+I,U={id:g++,callback:ae,priorityLevel:U,startTime:J,expirationTime:I,sortIndex:-1},J>E?(U.sortIndex=J,o(d,U),r(h)===null&&U===r(d)&&(k?(j(F),F=-1):k=!0,ne(_,J-E))):(U.sortIndex=I,o(h,U),w||z||(w=!0,Y(A))),U},a.unstable_shouldYield=T,a.unstable_wrapCallback=function(U){var ae=f;return function(){var J=f;f=ae;try{return U.apply(this,arguments)}finally{f=J}}}})(nu)),nu}var Um;function ok(){return Um||(Um=1,au.exports=rk()),au.exports}/**
* @license React
* react-dom.production.min.js
*
@@ -30,19 +30,19 @@ var Xv=Object.defineProperty;var Jv=(a,o,r)=>o in a?Xv(a,o,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Wm;function sk(){if(Wm)return na;Wm=1;var a=Tu(),o=ok();function r(e){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)i+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,u={};function l(e,i){m(e,i),m(e+"Capture",i)}function m(e,i){for(u[e]=i,e=0;e<i.length;e++)s.add(i[e])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,d=/^[: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]*$/,g={},y={};function f(e){return h.call(y,e)?!0:h.call(g,e)?!1:d.test(e)?y[e]=!0:(g[e]=!0,!1)}function z(e,i,n,t){if(n!==null&&n.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return t?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function w(e,i,n,t){if(i===null||typeof i>"u"||z(e,i,n,t))return!0;if(t)return!1;if(n!==null)switch(n.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function k(e,i,n,t,p,b,S){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=t,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=e,this.type=i,this.sanitizeURL=b,this.removeEmptyString=S}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var i=e[0];v[i]=new k(i,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new k(e,2,!1,e,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(e){v[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function q(e){return e[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(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,i,n,t){var p=v.hasOwnProperty(i)?v[i]:null;(p!==null?p.type!==0:t||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!= Line truncated
`+A+e}var L=!1;function $(e,i){if(!e||L)return"";L=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(Y){var t=Y}Reflect.construct(e,[],i)}else{try{i.call()}catch(Y){t=Y}e.call(i.prototype)}else{try{throw Error()}catch(Y){t=Y}e()}}catch(Y){if(Y&&t&&typeof Y.stack=="string"){for(var p=Y.stack.split(`
*/var Wm;function sk(){if(Wm)return na;Wm=1;var a=Tu(),o=ok();function r(e){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)i+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,c={};function l(e,i){m(e,i),m(e+"Capture",i)}function m(e,i){for(c[e]=i,e=0;e<i.length;e++)s.add(i[e])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,d=/^[: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]*$/,g={},y={};function f(e){return h.call(y,e)?!0:h.call(g,e)?!1:d.test(e)?y[e]=!0:(g[e]=!0,!1)}function z(e,i,n,t){if(n!==null&&n.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return t?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function w(e,i,n,t){if(i===null||typeof i>"u"||z(e,i,n,t))return!0;if(t)return!1;if(n!==null)switch(n.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function k(e,i,n,t,p,b,B){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=t,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=e,this.type=i,this.sanitizeURL=b,this.removeEmptyString=B}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var i=e[0];v[i]=new k(i,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new k(e,2,!1,e,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(e){v[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function q(e){return e[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(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var i=e.replace(j,q);v[i]=new k(i,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,i,n,t){var p=v.hasOwnProperty(i)?v[i]:null;(p!==null?p.type!==0:t||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!= Line truncated
`+E+e}var L=!1;function $(e,i){if(!e||L)return"";L=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(Z){var t=Z}Reflect.construct(e,[],i)}else{try{i.call()}catch(Z){t=Z}e.call(i.prototype)}else{try{throw Error()}catch(Z){t=Z}e()}}catch(Z){if(Z&&t&&typeof Z.stack=="string"){for(var p=Z.stack.split(`
`),b=t.stack.split(`
`),S=p.length-1,N=b.length-1;1<=S&&0<=N&&p[S]!==b[N];)N--;for(;1<=S&&0<=N;S--,N--)if(p[S]!==b[N]){if(S!==1||N!==1)do if(S--,N--,0>N||p[S]!==b[N]){var O=`
`+p[S].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),O}while(1<=S&&0<=N);break}}}finally{L=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function le(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function pe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case D:return"Portal";case M:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case K:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case P:return(e._context.displayName||"Context")+".Provider";case U:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return i=e.displayName||null,i!==null?i:pe(e.type)||"Memo";case Z:i=e._payload,e=e._init;try{return pe(e(i))}catch{}}return null}function me(e){var i=e.type;switch(e.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=i.render,e=e.displayName||e.name||"",i.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pe(i);case 8:return i===F?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function re(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ae(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Me(e){var i=Ae(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),t=""+e[i];if(!e.hasOwnProperty(i)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,b=n.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return p.call(this)},set:function(S){t=""+S,b.call(this,S)}}),Object.defineProperty(e,i,{enumerable:n.enumerable}),{getValue:function(){return t},setValue:function(S){t=""+S},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function mi(e){e._valueTracker||(e._valueTracker=Me(e))}function ge(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var n=i.getValue(),t="";return e&&(t=Ae(e)?e.checked?"true":"false":e.value),e=t,e!==n?(i.setValue(e),!0):!1}function Ce(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Be(e,i){var n=i.checked;return J({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ci(e,i){var n=i.defaultValue==null?"":i.defaultValue,t=i.checked!=null?i.checked:i.defaultChecked;n=re(i.value!=null?i.value:n),e._wrapperState={initialChecked:t,initialValue:n,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function ui(e,i){i=i.checked,i!=null&&x(e,"checked",i,!1)}function Ye(e,i){ui(e,i);var n=re(i.value),t=i.type;if(n!=null)t==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(t==="submit"||t==="reset"){e.removeAttribute("value");return}i.hasOwnProperty("value")?Te(e,i.type,n):i.hasOwnProperty("defaultValue")&&Te(e,i.type,re(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(e.defaultChecked=!!i.defaultChecked)}function Ue(e,i,n){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var t=i.type;if(!(t!=="submit"&&t!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+e._wrapperState.initialValue,n||i===e.value||(e.value=i),e.defaultValue=i}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Te(e,i,n){(i!=="number"||Ce(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ii=Array.isArray;function Fe(e,i,n,t){if(e=e.options,i){i={};for(var p=0;p<n.length;p++)i["$"+n[p]]=!0;for(n=0;n<e.length;n++)p=i.hasOwnProperty("$"+e[n].value),e[n].selected!==p&&(e[n].selected=p),p&&t&&(e[n].defaultSelected=!0)}else{for(n=""+re(n),i=null,p=0;p<e.length;p++){if(e[p].value===n){e[p].selected=!0,t&&(e[p].defaultSelected=!0);return}i!==null||e[p].disabled||(i=e[p])}i!==null&&(i.selected=!0)}}function Ne(e,i){if(i.dangerouslySetInnerHTML!= Line truncated
`).replace(dv,"")}function cs(e,i,n){if(i=rp(i),rp(e)!==i&&n)throw Error(r(425))}function us(){}var Vl=null,Ul=null;function Wl(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var $l=typeof setTimeout=="function"?setTimeout:void 0,pv=typeof clearTimeout=="function"?clearTimeout:void 0,op=typeof Promise=="function"?Promise:void 0,mv=typeof queueMicrotask=="function"?queueMicrotask:typeof op<"u"?function(e){return op.resolve(null).then(e).catch(hv)}:$l;function hv(e){setTimeout(function(){throw e})}function Gl(e,i){var n=i,t=0;do{var p=n.nextSibling;if(e.removeChild(n),p&&p.nodeType===8)if(n=p.data,n==="/$"){if(t===0){e.removeChild(p),Wr(i);return}t--}else n!=="$"&&n!=="$?"&&n!=="$!"||t++;n=p}while(n);Wr(i)}function dn(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return e}function sp(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(i===0)return e;i--}else n==="/$"&&i++}e=e.previousSibling}return null}var lr=Math.random().toString(36).slice(2),Ra="__reactFiber$"+lr,ao="__reactProps$"+lr,Wa="__reactContainer$"+lr,Ql="__reactEvents$"+lr,gv="__reactListeners$"+lr,yv="__reactHandles$"+lr;function Bn(e){var i=e[Ra];if(i)return i;for(var n=e.parentNode;n;){if(i=n[Wa]||n[Ra]){if(n=i.alternate,i.child!==null||n!==null&&n.child!==null)for(e=sp(e);e!==null;){if(n=e[Ra])return n;e=sp(e)}return i}e=n,n=e.parentNode}return null}function no(e){return e=e[Ra]||e[Wa],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function cr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function ds(e){return e[ao]||null}var Kl=[],ur=-1;function pn(e){return{current:e}}function li(e){0>ur||(e.current=Kl[ur],Kl[ur]=null,ur--)}function oi(e,i){ur++,Kl[ur]=e.current,e.current=i}var mn={},Li=pn(mn),Xi=pn(!1),_n=mn;function dr(e,i){var n=e.type.contextTypes;if(!n)return mn;var t=e.stateNode;if(t&&t.__reactInternalMemoizedUnmaskedChildContext===i)return t.__reactInternalMemoizedMaskedChildContext;var p={},b;for(b in n)p[b]=i[b];return t&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=p),p}function Ji(e){return e=e.childContextTypes,e!=null}function ps(){li(Xi),li(Li)}function tp(e,i,n){if(Li.current!==mn)throw Error(r(168));oi(Li,i),oi(Xi,n)}function lp(e,i,n){var t=e.stateNode;if(i=i.childContextTypes,typeof t.getChildContext!="function")return n;t=t.getChildContext();for(var p in t)if(!(p in i))throw Error(r(108,me(e)||"Unknown",p));return J({},n,t)}function ms(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mn,_n=Li.current,oi(Li,e),oi(Xi,Xi.current),!0}function cp(e,i,n){var t=e.stateNode;if(!t)throw Error(r(169));n?(e=lp(e,i,_n),t.__reactInternalMemoizedMergedChildContext=e,li(Xi),li(Li),oi(Li,e)):li(Xi),oi(Xi,n)}var $a=null,hs=!1,Yl=!1;function up(e){$a===null?$a=[e]:$a.push(e)}function bv(e){hs=!0,up(e)}function hn(){if(!Yl&&$a!==null){Yl=!0;var e=0,i=ai;try{var n=$a;for(ai=1;e<n.length;e++){var t=n[e];do t=t(!0);while(t!==null)}$a=null,hs=!1}catch(p){throw $a!==null&&($a=$a.slice(e+1)),pd(fl,hn),p}finally{ai=i,Yl=!1}}return null}var pr=[],mr=0,gs=null,ys=0,ma=[],ha=0,Dn=null,Ga=1,Qa="";function Fn(e,i){pr[mr++]=ys,pr[mr++]=gs,gs=e,ys=i}function dp(e,i,n){ma[ha++]=Ga,ma[ha++]=Qa,ma[ha++]=Dn,Dn=e;var t=Ga;e=Qa;var p=32-xa(t)-1;t&=~(1<<p),n+=1;var b=32-xa(i)+p;if(30<b){var S=p-p%5;b=(t&(1<<S)-1).toString(32),t>>=S,p-=S,Ga=1<<32-xa(i)+p|n<<p|t,Qa=b+e}else Ga=1<<b|n<<p|t,Qa=e}function Zl(e){e.return!==null&&(Fn(e,1),dp(e,1,0))}function Xl(e){for(;e===gs;)gs=pr[--mr],pr[mr]=null,ys=pr[--mr],pr[mr]=null;for(;e===Dn;)Dn=ma[--ha],ma[ha]=null,Qa=ma[--ha],ma[ha]=null,Ga=ma[--ha],ma[ha]=null}var ta=null,la=null,pi=!1,qa=null;function pp(e,i){var n=fa(5,null,null,0);n.elementType="DELETED",n.stateNode=i,n.return=e,i=e.deletions,i===null?(e.deletions=[n],e.flags|=16):i.push(n)}function mp(e,i){switch(e.tag){case 5:var n=e.type;return i=i.nodeType!==1||n.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(e.stateNode=i,ta=e,la=dn(i.firstChild),!0):!1;case 6:return i=e.pendingProps===""||i.nodeType!==3?null:i,i!==null?(e.stateNode=i,ta=e,la=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(n=Dn!==null?{id:Ga,overflow:Qa}:null,e.memoizedState={dehydrated:i,treeContext:n,retryLane:1073741824},n=fa(18,null,null,0),n.stateNode=i,n.return=e,e.child=n,ta=e,la=null,!0):!1;default:return!1}}function Jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ec(e){if(pi){var i=la;if(i){var n=i;if(!mp(e,i)){if(Jl(e))throw Error(r(418));i=dn(n.nextSibling);var t=ta;i&&mp(e,i)?pp(t,n):(e.flags=e.flags&-4097|2,pi=!1,ta=e)}}else{if(Jl(e))throw Error(r(418));e.flags=e.flags&-4097|2,pi=!1,ta=e}}}function hp(e){for(e=e. Line truncated
`),B=p.length-1,N=b.length-1;1<=B&&0<=N&&p[B]!==b[N];)N--;for(;1<=B&&0<=N;B--,N--)if(p[B]!==b[N]){if(B!==1||N!==1)do if(B--,N--,0>N||p[B]!==b[N]){var O=`
`+p[B].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),O}while(1<=B&&0<=N);break}}}finally{L=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function re(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function pe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case D:return"Portal";case M:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case K:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case P:return(e._context.displayName||"Context")+".Provider";case W:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return i=e.displayName||null,i!==null?i:pe(e.type)||"Memo";case Y:i=e._payload,e=e._init;try{return pe(e(i))}catch{}}return null}function he(e){var i=e.type;switch(e.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=i.render,e=e.displayName||e.name||"",i.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pe(i);case 8:return i===F?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function oe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ae(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Ne(e){var i=Ae(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),t=""+e[i];if(!e.hasOwnProperty(i)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,b=n.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return p.call(this)},set:function(B){t=""+B,b.call(this,B)}}),Object.defineProperty(e,i,{enumerable:n.enumerable}),{getValue:function(){return t},setValue:function(B){t=""+B},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function ye(e){e._valueTracker||(e._valueTracker=Ne(e))}function me(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var n=i.getValue(),t="";return e&&(t=Ae(e)?e.checked?"true":"false":e.value),e=t,e!==n?(i.setValue(e),!0):!1}function Ee(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function _e(e,i){var n=i.checked;return J({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ui(e,i){var n=i.defaultValue==null?"":i.defaultValue,t=i.checked!=null?i.checked:i.defaultChecked;n=oe(i.value!=null?i.value:n),e._wrapperState={initialChecked:t,initialValue:n,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function di(e,i){i=i.checked,i!=null&&x(e,"checked",i,!1)}function Xe(e,i){di(e,i);var n=oe(i.value),t=i.type;if(n!=null)t==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(t==="submit"||t==="reset"){e.removeAttribute("value");return}i.hasOwnProperty("value")?Pe(e,i.type,n):i.hasOwnProperty("defaultValue")&&Pe(e,i.type,oe(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(e.defaultChecked=!!i.defaultChecked)}function $e(e,i,n){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var t=i.type;if(!(t!=="submit"&&t!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+e._wrapperState.initialValue,n||i===e.value||(e.value=i),e.defaultValue=i}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Pe(e,i,n){(i!=="number"||Ee(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ai=Array.isArray;function Re(e,i,n,t){if(e=e.options,i){i={};for(var p=0;p<n.length;p++)i["$"+n[p]]=!0;for(n=0;n<e.length;n++)p=i.hasOwnProperty("$"+e[n].value),e[n].selected!==p&&(e[n].selected=p),p&&t&&(e[n].defaultSelected=!0)}else{for(n=""+oe(n),i=null,p=0;p<e.length;p++){if(e[p].value===n){e[p].selected=!0,t&&(e[p].defaultSelected=!0);return}i!==null||e[p].disabled||(i=e[p])}i!==null&&(i.selected=!0)}}function Me(e,i){if(i.dangerouslySetInnerHTML!= Line truncated
`).replace(dv,"")}function us(e,i,n){if(i=rp(i),rp(e)!==i&&n)throw Error(r(425))}function ds(){}var Vl=null,Ul=null;function Wl(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var $l=typeof setTimeout=="function"?setTimeout:void 0,pv=typeof clearTimeout=="function"?clearTimeout:void 0,op=typeof Promise=="function"?Promise:void 0,mv=typeof queueMicrotask=="function"?queueMicrotask:typeof op<"u"?function(e){return op.resolve(null).then(e).catch(hv)}:$l;function hv(e){setTimeout(function(){throw e})}function Gl(e,i){var n=i,t=0;do{var p=n.nextSibling;if(e.removeChild(n),p&&p.nodeType===8)if(n=p.data,n==="/$"){if(t===0){e.removeChild(p),Wr(i);return}t--}else n!=="$"&&n!=="$?"&&n!=="$!"||t++;n=p}while(n);Wr(i)}function dn(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return e}function sp(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(i===0)return e;i--}else n==="/$"&&i++}e=e.previousSibling}return null}var lr=Math.random().toString(36).slice(2),Ta="__reactFiber$"+lr,ao="__reactProps$"+lr,Wa="__reactContainer$"+lr,Ql="__reactEvents$"+lr,gv="__reactListeners$"+lr,yv="__reactHandles$"+lr;function Bn(e){var i=e[Ta];if(i)return i;for(var n=e.parentNode;n;){if(i=n[Wa]||n[Ta]){if(n=i.alternate,i.child!==null||n!==null&&n.child!==null)for(e=sp(e);e!==null;){if(n=e[Ta])return n;e=sp(e)}return i}e=n,n=e.parentNode}return null}function no(e){return e=e[Ta]||e[Wa],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function cr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function ps(e){return e[ao]||null}var Kl=[],ur=-1;function pn(e){return{current:e}}function ci(e){0>ur||(e.current=Kl[ur],Kl[ur]=null,ur--)}function si(e,i){ur++,Kl[ur]=e.current,e.current=i}var mn={},Li=pn(mn),Xi=pn(!1),_n=mn;function dr(e,i){var n=e.type.contextTypes;if(!n)return mn;var t=e.stateNode;if(t&&t.__reactInternalMemoizedUnmaskedChildContext===i)return t.__reactInternalMemoizedMaskedChildContext;var p={},b;for(b in n)p[b]=i[b];return t&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=p),p}function Ji(e){return e=e.childContextTypes,e!=null}function ms(){ci(Xi),ci(Li)}function tp(e,i,n){if(Li.current!==mn)throw Error(r(168));si(Li,i),si(Xi,n)}function lp(e,i,n){var t=e.stateNode;if(i=i.childContextTypes,typeof t.getChildContext!="function")return n;t=t.getChildContext();for(var p in t)if(!(p in i))throw Error(r(108,he(e)||"Unknown",p));return J({},n,t)}function hs(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mn,_n=Li.current,si(Li,e),si(Xi,Xi.current),!0}function cp(e,i,n){var t=e.stateNode;if(!t)throw Error(r(169));n?(e=lp(e,i,_n),t.__reactInternalMemoizedMergedChildContext=e,ci(Xi),ci(Li),si(Li,e)):ci(Xi),si(Xi,n)}var $a=null,gs=!1,Yl=!1;function up(e){$a===null?$a=[e]:$a.push(e)}function bv(e){gs=!0,up(e)}function hn(){if(!Yl&&$a!==null){Yl=!0;var e=0,i=ni;try{var n=$a;for(ni=1;e<n.length;e++){var t=n[e];do t=t(!0);while(t!==null)}$a=null,gs=!1}catch(p){throw $a!==null&&($a=$a.slice(e+1)),pd(fl,hn),p}finally{ni=i,Yl=!1}}return null}var pr=[],mr=0,ys=null,bs=0,ma=[],ha=0,Dn=null,Ga=1,Qa="";function Fn(e,i){pr[mr++]=bs,pr[mr++]=ys,ys=e,bs=i}function dp(e,i,n){ma[ha++]=Ga,ma[ha++]=Qa,ma[ha++]=Dn,Dn=e;var t=Ga;e=Qa;var p=32-ja(t)-1;t&=~(1<<p),n+=1;var b=32-ja(i)+p;if(30<b){var B=p-p%5;b=(t&(1<<B)-1).toString(32),t>>=B,p-=B,Ga=1<<32-ja(i)+p|n<<p|t,Qa=b+e}else Ga=1<<b|n<<p|t,Qa=e}function Zl(e){e.return!==null&&(Fn(e,1),dp(e,1,0))}function Xl(e){for(;e===ys;)ys=pr[--mr],pr[mr]=null,bs=pr[--mr],pr[mr]=null;for(;e===Dn;)Dn=ma[--ha],ma[ha]=null,Qa=ma[--ha],ma[ha]=null,Ga=ma[--ha],ma[ha]=null}var ta=null,la=null,mi=!1,Aa=null;function pp(e,i){var n=fa(5,null,null,0);n.elementType="DELETED",n.stateNode=i,n.return=e,i=e.deletions,i===null?(e.deletions=[n],e.flags|=16):i.push(n)}function mp(e,i){switch(e.tag){case 5:var n=e.type;return i=i.nodeType!==1||n.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(e.stateNode=i,ta=e,la=dn(i.firstChild),!0):!1;case 6:return i=e.pendingProps===""||i.nodeType!==3?null:i,i!==null?(e.stateNode=i,ta=e,la=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(n=Dn!==null?{id:Ga,overflow:Qa}:null,e.memoizedState={dehydrated:i,treeContext:n,retryLane:1073741824},n=fa(18,null,null,0),n.stateNode=i,n.return=e,e.child=n,ta=e,la=null,!0):!1;default:return!1}}function Jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ec(e){if(mi){var i=la;if(i){var n=i;if(!mp(e,i)){if(Jl(e))throw Error(r(418));i=dn(n.nextSibling);var t=ta;i&&mp(e,i)?pp(t,n):(e.flags=e.flags&-4097|2,mi=!1,ta=e)}}else{if(Jl(e))throw Error(r(418));e.flags=e.flags&-4097|2,mi=!1,ta=e}}}function hp(e){for(e=e. Line truncated
Error generating stack: `+b.message+`
`+b.stack}return{value:e,source:i,stack:p,digest:null}}function zc(e,i,n){return{value:e,source:null,stack:n??null,digest:i??null}}function xc(e,i){try{console.error(i.value)}catch(n){setTimeout(function(){throw n})}}var Av=typeof WeakMap=="function"?WeakMap:Map;function Qp(e,i,n){n=Ya(-1,n),n.tag=3,n.payload={element:null};var t=i.value;return n.callback=function(){Ps||(Ps=!0,Ic=t),xc(e,i)},n}function Kp(e,i,n){n=Ya(-1,n),n.tag=3;var t=e.type.getDerivedStateFromError;if(typeof t=="function"){var p=i.value;n.payload=function(){return t(p)},n.callback=function(){xc(e,i)}}var b=e.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){xc(e,i),typeof t!="function"&&(fn===null?fn=new Set([this]):fn.add(this));var S=i.stack;this.componentDidCatch(i.value,{componentStack:S!==null?S:""})}),n}function Yp(e,i,n){var t=e.pingCache;if(t===null){t=e.pingCache=new Av;var p=new Set;t.set(i,p)}else p=t.get(i),p===void 0&&(p=new Set,t.set(i,p));p.has(n)||(p.add(n),e=Ov.bind(null,e,i,n),i.then(e,e))}function Zp(e){do{var i;if((i=e.tag===13)&&(i=e.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return e;e=e.return}while(e!==null);return null}function Xp(e,i,n,t,p){return(e.mode&1)===0?(e===i?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(i=Ya(-1,1),i.tag=2,yn(n,i,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=p,e)}var Cv=_.ReactCurrentOwner,ea=!1;function Gi(e,i,n,t){i.child=e===null?fp(i,null,n,t):gr(i,e.child,n,t)}function Jp(e,i,n,t,p){n=n.render;var b=i.ref;return br(i,p),t=hc(e,i,n,t,b,p),n=gc(),e!==null&&!ea?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Za(e,i,p)):(pi&&n&&Zl(i),i.flags|=1,Gi(e,i,t,p),i.child)}function em(e,i,n,t,p){if(e===null){var b=n.type;return typeof b=="function"&&!Wc(b)&&b.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(i.tag=15,i.type=b,im(e,i,b,t,p)):(e=Hs(n.type,null,t,i,i.mode,p),e.ref=i.ref,e.return=i,i.child=e)}if(b=e.child,(e.lanes&p)===0){var S=b.memoizedProps;if(n=n.compare,n=n!==null?n:Zr,n(S,t)&&e.ref===i.ref)return Za(e,i,p)}return i.flags|=1,e=zn(b,t),e.ref=i.ref,e.return=i,i.child=e}function im(e,i,n,t,p){if(e!==null){var b=e.memoizedProps;if(Zr(b,t)&&e.ref===i.ref)if(ea=!1,i.pendingProps=t=b,(e.lanes&p)!==0)(e.flags&131072)!==0&&(ea=!0);else return i.lanes=e.lanes,Za(e,i,p)}return jc(e,i,n,t,p)}function am(e,i,n){var t=i.pendingProps,p=t.children,b=e!==null?e.memoizedState:null;if(t.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},oi(wr,ca),ca|=n;else{if((n&1073741824)===0)return e=b!==null?b.baseLanes|n:n,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:e,cachePool:null,transitions:null},i.updateQueue=null,oi(wr,ca),ca|=e,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},t=b!==null?b.baseLanes:n,oi(wr,ca),ca|=t}else b!==null?(t=b.baseLanes|n,i.memoizedState=null):t=n,oi(wr,ca),ca|=t;return Gi(e,i,p,n),i.child}function nm(e,i){var n=i.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(i.flags|=512,i.flags|=2097152)}function jc(e,i,n,t,p){var b=Ji(n)?_n:Li.current;return b=dr(i,b),br(i,p),n=hc(e,i,n,t,b,p),t=gc(),e!==null&&!ea?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Za(e,i,p)):(pi&&t&&Zl(i),i.flags|=1,Gi(e,i,n,p),i.child)}function rm(e,i,n,t,p){if(Ji(n)){var b=!0;ms(i)}else b=!1;if(br(i,p),i.stateNode===null)_s(e,i),$p(i,n,t),wc(i,n,t,p),t=!0;else if(e===null){var S=i.stateNode,N=i.memoizedProps;S.props=N;var O=S.context,Y=n.contextType;typeof Y=="object"&&Y!==null?Y=ga(Y):(Y=Ji(n)?_n:Li.current,Y=dr(i,Y));var te=n.getDerivedStateFromProps,ce=typeof te=="function"||typeof S.getSnapshotBeforeUpdate=="function";ce||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==t||O!==Y)&&Gp(i,S,t,Y),gn=!1;var se=i.memoizedState;S.state=se,zs(i,t,S,p),O=i.memoizedState,N!==t||se!==O||Xi.current||gn?(typeof te=="function"&&(kc(i,n,te,t),O=i.memoizedState),(N=gn||Wp(i,n,N,t,se,O,Y))?(ce||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(i.flags|=4194308)):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=t,i.memoizedState=O),S.props=t,S.state=O,S.context=Y,t=N):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),t=!1)}else{S=i.stateNode,kp(e,i),N=i.memoizedProps,Y=i.type===i.elementType?N:Aa(i.type,N),S.props=Y,ce=i.pendingProps,se=S.context,O=n.contextType,typeof O=="object"&&O!==null?O=ga(O):(O=Ji(n)?_n:Li.current,O=dr(i,O));var ye=n.getDerivedStateFromProps;(te=typeof ye=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==ce||se!==O)&&Gp(i,S,t,O),gn=!1,se=i.memoizedState,S Line truncated
`+b.stack}return{value:e,source:i,stack:p,digest:null}}function zc(e,i,n){return{value:e,source:null,stack:n??null,digest:i??null}}function xc(e,i){try{console.error(i.value)}catch(n){setTimeout(function(){throw n})}}var Av=typeof WeakMap=="function"?WeakMap:Map;function Qp(e,i,n){n=Ya(-1,n),n.tag=3,n.payload={element:null};var t=i.value;return n.callback=function(){Ns||(Ns=!0,Ic=t),xc(e,i)},n}function Kp(e,i,n){n=Ya(-1,n),n.tag=3;var t=e.type.getDerivedStateFromError;if(typeof t=="function"){var p=i.value;n.payload=function(){return t(p)},n.callback=function(){xc(e,i)}}var b=e.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){xc(e,i),typeof t!="function"&&(fn===null?fn=new Set([this]):fn.add(this));var B=i.stack;this.componentDidCatch(i.value,{componentStack:B!==null?B:""})}),n}function Yp(e,i,n){var t=e.pingCache;if(t===null){t=e.pingCache=new Av;var p=new Set;t.set(i,p)}else p=t.get(i),p===void 0&&(p=new Set,t.set(i,p));p.has(n)||(p.add(n),e=Ov.bind(null,e,i,n),i.then(e,e))}function Zp(e){do{var i;if((i=e.tag===13)&&(i=e.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return e;e=e.return}while(e!==null);return null}function Xp(e,i,n,t,p){return(e.mode&1)===0?(e===i?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(i=Ya(-1,1),i.tag=2,yn(n,i,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=p,e)}var Cv=_.ReactCurrentOwner,ea=!1;function Gi(e,i,n,t){i.child=e===null?fp(i,null,n,t):gr(i,e.child,n,t)}function Jp(e,i,n,t,p){n=n.render;var b=i.ref;return br(i,p),t=hc(e,i,n,t,b,p),n=gc(),e!==null&&!ea?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Za(e,i,p)):(mi&&n&&Zl(i),i.flags|=1,Gi(e,i,t,p),i.child)}function em(e,i,n,t,p){if(e===null){var b=n.type;return typeof b=="function"&&!Wc(b)&&b.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(i.tag=15,i.type=b,im(e,i,b,t,p)):(e=Vs(n.type,null,t,i,i.mode,p),e.ref=i.ref,e.return=i,i.child=e)}if(b=e.child,(e.lanes&p)===0){var B=b.memoizedProps;if(n=n.compare,n=n!==null?n:Zr,n(B,t)&&e.ref===i.ref)return Za(e,i,p)}return i.flags|=1,e=zn(b,t),e.ref=i.ref,e.return=i,i.child=e}function im(e,i,n,t,p){if(e!==null){var b=e.memoizedProps;if(Zr(b,t)&&e.ref===i.ref)if(ea=!1,i.pendingProps=t=b,(e.lanes&p)!==0)(e.flags&131072)!==0&&(ea=!0);else return i.lanes=e.lanes,Za(e,i,p)}return jc(e,i,n,t,p)}function am(e,i,n){var t=i.pendingProps,p=t.children,b=e!==null?e.memoizedState:null;if(t.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},si(wr,ca),ca|=n;else{if((n&1073741824)===0)return e=b!==null?b.baseLanes|n:n,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:e,cachePool:null,transitions:null},i.updateQueue=null,si(wr,ca),ca|=e,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},t=b!==null?b.baseLanes:n,si(wr,ca),ca|=t}else b!==null?(t=b.baseLanes|n,i.memoizedState=null):t=n,si(wr,ca),ca|=t;return Gi(e,i,p,n),i.child}function nm(e,i){var n=i.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(i.flags|=512,i.flags|=2097152)}function jc(e,i,n,t,p){var b=Ji(n)?_n:Li.current;return b=dr(i,b),br(i,p),n=hc(e,i,n,t,b,p),t=gc(),e!==null&&!ea?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Za(e,i,p)):(mi&&t&&Zl(i),i.flags|=1,Gi(e,i,n,p),i.child)}function rm(e,i,n,t,p){if(Ji(n)){var b=!0;hs(i)}else b=!1;if(br(i,p),i.stateNode===null)Ds(e,i),$p(i,n,t),wc(i,n,t,p),t=!0;else if(e===null){var B=i.stateNode,N=i.memoizedProps;B.props=N;var O=B.context,Z=n.contextType;typeof Z=="object"&&Z!==null?Z=ga(Z):(Z=Ji(n)?_n:Li.current,Z=dr(i,Z));var le=n.getDerivedStateFromProps,ce=typeof le=="function"||typeof B.getSnapshotBeforeUpdate=="function";ce||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(N!==t||O!==Z)&&Gp(i,B,t,Z),gn=!1;var te=i.memoizedState;B.state=te,xs(i,t,B,p),O=i.memoizedState,N!==t||te!==O||Xi.current||gn?(typeof le=="function"&&(kc(i,n,le,t),O=i.memoizedState),(N=gn||Wp(i,n,N,t,te,O,Z))?(ce||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(i.flags|=4194308)):(typeof B.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=t,i.memoizedState=O),B.props=t,B.state=O,B.context=Z,t=N):(typeof B.componentDidMount=="function"&&(i.flags|=4194308),t=!1)}else{B=i.stateNode,kp(e,i),N=i.memoizedProps,Z=i.type===i.elementType?N:Ca(i.type,N),B.props=Z,ce=i.pendingProps,te=B.context,O=n.contextType,typeof O=="object"&&O!==null?O=ga(O):(O=Ji(n)?_n:Li.current,O=dr(i,O));var be=n.getDerivedStateFromProps;(le=typeof be=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(N!==ce||te!==O)&&Gp(i,B,t,O),gn=!1,te=i.memoizedState,B Line truncated
`)}function pk(a){if(a.length===0)return`Neighbors
No neighbors reported`;const o=[...a].sort((s,u)=>u.snr-s.snr),r=[`Neighbors (${o.length})`];for(const s of o){const u=s.name||s.pubkey_prefix,l=s.snr>=0?`+${s.snr.toFixed(1)}`:s.snr.toFixed(1);r.push(`${u}, ${l} dB [${st(s.last_heard_seconds)} ago]`)}return r.join(`
No neighbors reported`;const o=[...a].sort((s,c)=>c.snr-s.snr),r=[`Neighbors (${o.length})`];for(const s of o){const c=s.name||s.pubkey_prefix,l=s.snr>=0?`+${s.snr.toFixed(1)}`:s.snr.toFixed(1);r.push(`${c}, ${l} dB [${tt(s.last_heard_seconds)} ago]`)}return r.join(`
`)}function mk(a){if(a.length===0)return`ACL
No ACL entries`;const o=[`ACL (${a.length})`];for(const r of a){const s=r.name||r.pubkey_prefix;o.push(`${s}: ${r.permission_name}`)}return o.join(`
`)}function Vn(a,o,r,s=0){const u=Math.floor(Date.now()/1e3);return{id:-Date.now()-s,type:"PRIV",conversation_key:a,text:o,sender_timestamp:u,received_at:u,path_len:null,txt_type:0,signature:null,outgoing:r,acked:1}}function hk(a,o,r){const[s,u]=E.useState(!1);E.useEffect(()=>{u(!1)},[a==null?void 0:a.id]);const l=E.useMemo(()=>{if(!a||a.type!=="contact")return!1;const h=o.find(d=>d.public_key===a.id);return(h==null?void 0:h.type)===$g},[a,o]),m=E.useCallback(async h=>{if(!(!a||a.type!=="contact")&&l)try{const d=await We.requestTelemetry(a.id,h),g=Vn(a.id,dk(d),!1,0),y=Vn(a.id,pk(d.neighbors),!1,1),f=Vn(a.id,mk(d.acl),!1,2);r(z=>[...z,g,y,f]),u(!0)}catch(d){const g=Vn(a.id,`Telemetry request failed: ${d instanceof Error?d.message:"Unknown error"}`,!1,0);r(y=>[...y,g])}},[a,l,r]),c=E.useCallback(async h=>{if(!a||a.type!=="contact"||!l||!s)return;const d=Vn(a.id,`> ${h}`,!0,0);r(g=>[...g,d]);try{const g=await We.sendRepeaterCommand(a.id,h),y=Vn(a.id,g.response,!1,1);g.sender_timestamp&&(y.sender_timestamp=g.sender_timestamp),r(f=>[...f,y])}catch(g){const y=Vn(a.id,`Command failed: ${g instanceof Error?g.message:"Unknown error"}`,!1,1);r(f=>[...f,y])}},[a,l,s,r]);return{repeaterLoggedIn:s,activeContactIsRepeater:l,handleTelemetryRequest:m,handleRepeaterCommand:c}}const gk=12;function _r(a){return a.slice(0,gk)}function Gg(a,o){return!a||!o?!1:_r(a)===_r(o)}function Zn(a,o){return a||_r(o)}const wu="remoteterm-lastMessageTime";function Qg(a){try{const o=localStorage.getItem(a);return o?JSON.parse(o):{}}catch{return{}}}function yk(a,o){try{localStorage.setItem(a,JSON.stringify(o))}catch{}}function Qm(){return Qg(wu)}function ru(a,o){const r=Qg(wu);return(!r[a]||o>r[a])&&(r[a]=o,yk(wu,r)),r}function La(a,o){return a==="channel"?`channel-${o}`:`contact-${_r(o)}`}function bk(a,o,r){const[s,u]=E.useState({}),[l,m]=E.useState(Qm),c=E.useRef(new Set),h=E.useRef(new Set);E.useEffect(()=>{const z=a.filter(v=>!c.current.has(v.key)),w=o.filter(v=>v.public_key&&!h.current.has(v.public_key));if(z.length===0&&w.length===0)return;z.forEach(v=>c.current.add(v.key)),w.forEach(v=>h.current.add(v.public_key)),(async()=>{const v=[...z.map(j=>({type:"CHAN",conversation_key:j.key})),...w.map(j=>({type:"PRIV",conversation_key:j.public_key}))];if(v.length!==0)try{const j=await We.getMessagesBulk(v,100),q={},x={};for(const _ of z){const C=j[`CHAN:${_.key}`]||[];if(C.length>0){const D=La("channel",_.key),R=_.last_read_at||0,F=C.filter(P=>!P.outgoing&&P.received_at>R).length;F>0&&(q[D]=F);const M=Math.max(...C.map(P=>P.received_at));x[D]=M,ru(D,M)}}for(const _ of w){const C=j[`PRIV:${_.public_key}`]||[];if(C.length>0){const D=La("contact",_.public_key),R=_.last_read_at||0,F=C.filter(P=>!P.outgoing&&P.received_at>R).length;F>0&&(q[D]=F);const M=Math.max(...C.map(P=>P.received_at));x[D]=M,ru(D,M)}}Object.keys(q).length>0&&u(_=>({..._,...q})),m(Qm())}catch(j){console.error("Failed to fetch messages bulk:",j)}})()},[a,o]),E.useEffect(()=>{if(r&&r.type!=="raw"){const z=La(r.type,r.id);u(w=>{if(w[z]){const k={...w};return delete k[z],k}return w}),r.type==="channel"?We.markChannelRead(r.id).catch(w=>{console.error("Failed to mark channel as read on server:",w)}):r.type==="contact"&&We.markContactRead(r.id).catch(w=>{console.error("Failed to mark contact as read on server:",w)})}},[r]);const d=E.useCallback(z=>{u(w=>({...w,[z]:(w[z]||0)+1}))},[]),g=E.useCallback(()=>{u({}),We.markAllRead().catch(z=>{console.error("Failed to mark all as read on server:",z)})},[]),y=E.useCallback(z=>{if(z.type==="raw")return;const w=La(z.type,z.id);u(k=>{if(k[w]){const v={...k};return delete v[w],v}return k}),z.type==="channel"?We.markChannelRead(z.id).catch(k=>{console.error("Failed to mark channel as read on server:",k)}):z.type==="contact"&&We.markContactRead(z.id).catch(k=>{console.error("Failed to mark contact as read on server:",k)})},[]),f=E.useCallback(z=>{let w=null;if(z.type==="CHAN"&&z.conversation_key?w=La("channel",z.conversation_key):z.type==="PRIV"&&z.conversation_key&&(w=La("contact",z.conversation_key)),w){const k=z.received_at||Math.floor(Date.now()/1e3),v=ru(w,k);m(v)}},[]);return{unreadCounts:s,lastMessageTimes:l,incrementUnread:d,markAllRead:g,markConversationRead:y,trackNewMessage:f}}var Kg=Wg();const Yg=Rr(Kg);function fk(a){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",o.appendChild(r),r.styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a))}const vk=a=>{switch(a){case"success":return zk;case"info":return jk;case"warning":return xk;case"error":return qk;default:return null}},kk=Array(12).fill(0),wk=({visible:a,className:o})=>de.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":a},de.createElement("div",{className:"sonner-spinner"},kk.map((r,s)=>de.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),zk=de.createElement("svg",{xmlns:"http://www.w3 Line truncated
`)}function Vn(a,o,r,s=0){const c=Math.floor(Date.now()/1e3);return{id:-Date.now()-s,type:"PRIV",conversation_key:a,text:o,sender_timestamp:c,received_at:c,path_len:null,txt_type:0,signature:null,outgoing:r,acked:1}}function hk(a,o,r){const[s,c]=C.useState(!1);C.useEffect(()=>{c(!1)},[a==null?void 0:a.id]);const l=C.useMemo(()=>{if(!a||a.type!=="contact")return!1;const h=o.find(d=>d.public_key===a.id);return(h==null?void 0:h.type)===$g},[a,o]),m=C.useCallback(async h=>{if(!(!a||a.type!=="contact")&&l)try{const d=await Le.requestTelemetry(a.id,h),g=Vn(a.id,dk(d),!1,0),y=Vn(a.id,pk(d.neighbors),!1,1),f=Vn(a.id,mk(d.acl),!1,2);r(z=>[...z,g,y,f]),c(!0)}catch(d){const g=Vn(a.id,`Telemetry request failed: ${d instanceof Error?d.message:"Unknown error"}`,!1,0);r(y=>[...y,g])}},[a,l,r]),u=C.useCallback(async h=>{if(!a||a.type!=="contact"||!l||!s)return;const d=Vn(a.id,`> ${h}`,!0,0);r(g=>[...g,d]);try{const g=await Le.sendRepeaterCommand(a.id,h),y=Vn(a.id,g.response,!1,1);g.sender_timestamp&&(y.sender_timestamp=g.sender_timestamp),r(f=>[...f,y])}catch(g){const y=Vn(a.id,`Command failed: ${g instanceof Error?g.message:"Unknown error"}`,!1,1);r(f=>[...f,y])}},[a,l,s,r]);return{repeaterLoggedIn:s,activeContactIsRepeater:l,handleTelemetryRequest:m,handleRepeaterCommand:u}}const gk=12;function _r(a){return a.slice(0,gk)}function Gg(a,o){return!a||!o?!1:_r(a)===_r(o)}function Zn(a,o){return a||_r(o)}const wu="remoteterm-lastMessageTime";function Qg(a){try{const o=localStorage.getItem(a);return o?JSON.parse(o):{}}catch{return{}}}function yk(a,o){try{localStorage.setItem(a,JSON.stringify(o))}catch{}}function Qm(){return Qg(wu)}function ru(a,o){const r=Qg(wu);return(!r[a]||o>r[a])&&(r[a]=o,yk(wu,r)),r}function Ha(a,o){return a==="channel"?`channel-${o}`:`contact-${_r(o)}`}function bk(a,o,r){const[s,c]=C.useState({}),[l,m]=C.useState(Qm),u=C.useRef(new Set),h=C.useRef(new Set);C.useEffect(()=>{const z=a.filter(v=>!u.current.has(v.key)),w=o.filter(v=>v.public_key&&!h.current.has(v.public_key));if(z.length===0&&w.length===0)return;z.forEach(v=>u.current.add(v.key)),w.forEach(v=>h.current.add(v.public_key)),(async()=>{const v=[...z.map(j=>({type:"CHAN",conversation_key:j.key})),...w.map(j=>({type:"PRIV",conversation_key:j.public_key}))];if(v.length!==0)try{const j=await Le.getMessagesBulk(v,100),q={},x={};for(const _ of z){const A=j[`CHAN:${_.key}`]||[];if(A.length>0){const D=Ha("channel",_.key),R=_.last_read_at||0,F=A.filter(P=>!P.outgoing&&P.received_at>R).length;F>0&&(q[D]=F);const M=Math.max(...A.map(P=>P.received_at));x[D]=M,ru(D,M)}}for(const _ of w){const A=j[`PRIV:${_.public_key}`]||[];if(A.length>0){const D=Ha("contact",_.public_key),R=_.last_read_at||0,F=A.filter(P=>!P.outgoing&&P.received_at>R).length;F>0&&(q[D]=F);const M=Math.max(...A.map(P=>P.received_at));x[D]=M,ru(D,M)}}Object.keys(q).length>0&&c(_=>({..._,...q})),m(Qm())}catch(j){console.error("Failed to fetch messages bulk:",j)}})()},[a,o]),C.useEffect(()=>{if(r&&r.type!=="raw"){const z=Ha(r.type,r.id);c(w=>{if(w[z]){const k={...w};return delete k[z],k}return w}),r.type==="channel"?Le.markChannelRead(r.id).catch(w=>{console.error("Failed to mark channel as read on server:",w)}):r.type==="contact"&&Le.markContactRead(r.id).catch(w=>{console.error("Failed to mark contact as read on server:",w)})}},[r]);const d=C.useCallback(z=>{c(w=>({...w,[z]:(w[z]||0)+1}))},[]),g=C.useCallback(()=>{c({}),Le.markAllRead().catch(z=>{console.error("Failed to mark all as read on server:",z)})},[]),y=C.useCallback(z=>{if(z.type==="raw")return;const w=Ha(z.type,z.id);c(k=>{if(k[w]){const v={...k};return delete v[w],v}return k}),z.type==="channel"?Le.markChannelRead(z.id).catch(k=>{console.error("Failed to mark channel as read on server:",k)}):z.type==="contact"&&Le.markContactRead(z.id).catch(k=>{console.error("Failed to mark contact as read on server:",k)})},[]),f=C.useCallback(z=>{let w=null;if(z.type==="CHAN"&&z.conversation_key?w=Ha("channel",z.conversation_key):z.type==="PRIV"&&z.conversation_key&&(w=Ha("contact",z.conversation_key)),w){const k=z.received_at||Math.floor(Date.now()/1e3),v=ru(w,k);m(v)}},[]);return{unreadCounts:s,lastMessageTimes:l,incrementUnread:d,markAllRead:g,markConversationRead:y,trackNewMessage:f}}var Kg=Wg();const Yg=Rr(Kg);function fk(a){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",o.appendChild(r),r.styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a))}const vk=a=>{switch(a){case"success":return zk;case"info":return jk;case"warning":return xk;case"error":return qk;default:return null}},kk=Array(12).fill(0),wk=({visible:a,className:o})=>de.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":a},de.createElement("div",{className:"sonner-spinner"},kk.map((r,s)=>de.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),zk=de.createElement("svg",{xmlns:"http://www.w3 Line truncated
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -57,12 +57,12 @@ No ACL entries`;const o=[`ACL (${a.length})`];for(const r of a){const s=r.name||
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zk=E.forwardRef(({color:a="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:u="",children:l,iconNode:m,...c},h)=>E.createElement("svg",{ref:h,...Yk,width:o,height:o,stroke:a,strokeWidth:s?Number(r)*24/Number(o):r,className:Zg("lucide",u),...!l&&!Kk(c)&&{"aria-hidden":"true"},...c},[...m.map(([d,g])=>E.createElement(d,g)),...Array.isArray(l)?l:[l]]));/**
*/const Zk=C.forwardRef(({color:a="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:c="",children:l,iconNode:m,...u},h)=>C.createElement("svg",{ref:h,...Yk,width:o,height:o,stroke:a,strokeWidth:s?Number(r)*24/Number(o):r,className:Zg("lucide",c),...!l&&!Kk(u)&&{"aria-hidden":"true"},...u},[...m.map(([d,g])=>C.createElement(d,g)),...Array.isArray(l)?l:[l]]));/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nu=(a,o)=>{const r=E.forwardRef(({className:s,...u},l)=>E.createElement(Zk,{ref:l,iconNode:o,className:Zg(`lucide-${Gk(Zm(a))}`,`lucide-${a}`,s),...u}));return r.displayName=Zm(a),r};/**
*/const Nu=(a,o)=>{const r=C.forwardRef(({className:s,...c},l)=>C.createElement(Zk,{ref:l,iconNode:o,className:Zg(`lucide-${Gk(Zm(a))}`,`lucide-${a}`,s),...c}));return r.displayName=Zm(a),r};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -77,52 +77,52 @@ No ACL entries`;const o=[`ACL (${a.length})`];for(const r of a){const s=r.name||
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Nu("x",aw);function nw({health:a,config:o,onConfigClick:r,onAdvertise:s,onMenuClick:u}){const l=(a==null?void 0:a.radio_connected)??!1,[m,c]=E.useState(!1),h=async()=>{c(!0);try{const d=await We.reconnectRadio();d.connected&&Ii.success("Reconnected",{description:d.message})}catch(d){Ii.error("Reconnection failed",{description:d instanceof Error?d.message:"Check radio connection and power"})}finally{c(!1)}};return B.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[u&&B.jsx("button",{onClick:u,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:B.jsx(iw,{className:"h-5 w-5"})}),B.jsx("h1",{className:"hidden lg:block text-base font-semibold mr-auto",children:"RemoteTerm"}),B.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[B.jsx("div",{className:`w-2 h-2 rounded-full ${l?"bg-[#4caf50]":"bg-[#666]"}`}),B.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:l?"Connected":"Disconnected"})]}),(a==null?void 0:a.serial_port)&&B.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:["Port: ",B.jsx("span",{className:"text-[#e0e0e0]",children:a.serial_port})]}),o&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"hidden lg:flex items-center gap-1 text-[#888]",children:B.jsx("span",{className:"text-[#e0e0e0]",children:o.name||"Unnamed"})}),B.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:[o.radio.freq," MHz/SF",o.radio.sf,"/CR",o.radio.cr,"/",o.tx_power,"dBm"]})]}),B.jsx("div",{className:"flex-1 lg:hidden"}),!l&&B.jsx("button",{onClick:h,disabled:m,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:m?"Reconnecting...":"Reconnect"}),B.jsx("button",{onClick:s,disabled:!l,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444] disabled:bg-[#333] disabled:text-[#666] disabled:cursor-not-allowed",children:"Advertise"}),B.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:"Config"})]})}const xu=2,rw={text:"🛜",background:"#444444",textColor:"#ffffff"};function ow(a){let o=0;for(let r=0;r<a.length;r++){const s=a.charCodeAt(r);o=(o<<5)-o+s,o=o&o}return Math.abs(o)}const sw=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function tw(a,o){if(!a)return o.slice(0,2).toUpperCase();const r=a.match(sw);if(r)return r[0];const s=a.match(/[a-zA-Z]/g);if(!s||s.length===0)return o.slice(0,2).toUpperCase();const u=a.indexOf(" ");if(u!==-1){const l=s[0],m=a.slice(u+1).match(/[a-zA-Z]/);if(m)return(l+m[0]).toUpperCase()}return s[0].toUpperCase()}function lw(a){const o=ow(a),r=o%360,s=50+(o>>8)%30,u=35+(o>>16)%20,l=`hsl(${r}, ${s}%, ${u}%)`,m=u<45?"#ffffff":"#000000";return{background:l,text:m}}function cw(a,o,r){if(r===xu)return rw;const s=tw(a,o),u=lw(o);return{text:s,background:u.background,textColor:u.text}}function Jg({name:a,publicKey:o,size:r=28,contactType:s}){const u=cw(a,o,s);return B.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:u.background,color:u.textColor,width:r,height:r,fontSize:r*.45},children:u.text})}function ey(a){var o,r,s="";if(typeof a=="string"||typeof a=="number")s+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(o=0;o<u;o++)a[o]&&(r=ey(a[o]))&&(s&&(s+=" "),s+=r)}else for(r in a)a[r]&&(s&&(s+=" "),s+=r);return s}function iy(){for(var a,o,r=0,s="",u=arguments.length;r<u;r++)(a=arguments[r])&&(o=ey(a))&&(s&&(s+=" "),s+=o);return s}const uw=(a,o)=>{const r=new Array(a.length+o.length);for(let s=0;s<a.length;s++)r[s]=a[s];for(let s=0;s<o.length;s++)r[a.length+s]=o[s];return r},dw=(a,o)=>({classGroupId:a,validator:o}),ay=(a=new Map,o=null,r)=>({nextPart:a,validators:o,classGroupId:r}),Yt="-",Xm=[],pw="arbitrary..",mw=a=>{const o=gw(a),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return hw(m);const c=m.split(Yt),h=c[0]===""&&c.length>1?1:0;return ny(c,h,o)},getConflictingClassGroupIds:(m,c)=>{if(c){const h=s[m],d=r[m];return h?d?uw(d,h):h:d||Xm}return r[m]||Xm}}},ny=(a,o,r)=>{if(a.length-o===0)return r.classGroupId;const u=a[o],l=r.nextPart.get(u);if(l){const d=ny(a,o+1,l);if(d)return d}const m=r.validators;if(m===null)return;const c=o===0?a.join(Yt):a.slice(o).join(Yt),h=m.length;for(let d=0;d<h;d++){const g=m[d];if(g.validator(c))return g.classGroupId}},hw=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=a.slice(1,-1),r=o.indexOf(":"),s=o.slice(0,r);returnLine truncated
`).map((A,I,L)=>B.jsxs("span",{children:[uz(A,c),I<L.length-1&&B.jsx("br",{})]},I)),!Z&&B.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:th(C.sender_timestamp||C.received_at)}),C.outgoing&&(C.acked>0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:k,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const lh=156,pz=140,mz=156,hz=120,gz=8,yz=E.forwardRef(function({onSend:o,disabled:r,placeholder:s,isRepeaterMode:u,conversationType:l,senderName:m},c){const[h,d]=E.useState(""),[g,y]=E.useState(!1),f=E.useRef(null);E.useImperativeHandle(c,()=>({appendText:C=>{var D;d(R=>R+C),(D=f.current)==null||D.focus()}}));const z=E.useMemo(()=>{if(l==="contact")return{warningAt:pz,dangerAt:lh,hardLimit:lh};if(l==="channel"){const C=(m==null?void 0:m.length)??10,D=Math.max(1,mz-C-2);return{warningAt:hz,dangerAt:Math.max(1,D-gz),hardLimit:D}}return null},[l,m]),{limitState:w,warningMessage:k}=E.useMemo(()=>{if(!z)return{limitState:"normal",warningMessage:null};const C=h.length;return C>=z.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:C>=z.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:C>=z.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[h.length,z]),v=z?z.hardLimit-h.length:0,j=E.useCallback(async C=>{C.preventDefault();const D=h.trim();if(u){if(g||r)return;const R=D==="."?"":D;y(!0);try{await o(R),d("")}catch(F){console.error("Failed to request telemetry:",F),Ii.error("Failed to request telemetry",{description:F instanceof Error?F.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var F;return(F=f.current)==null?void 0:F.focus()},0)}else{if(!D||g||r)return;y(!0);try{await o(D),d("")}catch(R){console.error("Failed to send message:",R),Ii.error("Failed to send message",{description:R instanceof Error?R.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var R;return(R=f.current)==null?void 0:R.focus()},0)}},[h,g,r,o,u]),q=E.useCallback(C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),j(C))},[j]),x=u?h.trim().length>0||h===".":h.trim().length>0,_=!u&&z!==null;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:j,children:[B.jsxs("div",{className:"flex gap-2",children:[B.jsx(xi,{ref:f,type:u?"password":"text",value:h,onChange:C=>d(C.target.value),onKeyDown:q,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:r||g,className:"flex-1 min-w-0"}),B.jsx(Va,{type:"submit",disabled:r||g||!x,className:"flex-shrink-0",children:g?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]}),_&&B.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[B.jsxs("span",{className:$e("tabular-nums",w==="error"||w==="danger"?"text-red-500 font-medium":w==="warning"?"text-yellow-500":"text-muted-foreground"),children:[h.length,"/",z.hardLimit,v<0&&` (${v})`]}),k&&B.jsxs("span",{className:$e(w==="error"?"text-red-500":"text-yellow-500"),children:["— ",k]})]})]})});function Si(a,o,{checkForDefaultPrevented:r=!0}={}){return function(u){if(a==null||a(u),r===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function bz(a,o){const r=E.createContext(o),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(r.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(r);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Ho(a,o=[]){let r=[];function s(l,m){const c=E.createContext(m),h=r.length;r=[...r,m];const d=y=>{var j;const{scope:f,children:z,...w}=y,k=((j=f==null?void 0:f[a])==null?void 0:j[h])||c,v=E.useMemo(()=>w,Object.values(w));return B.jsx(k.Provider,{value:v,children:z})};d.displayName=l+"Provider";function g(y,f){var k;const z=((k=f==null?void 0:f[a])==null?void 0:k[h])||c,w=E.useContext(z);if(w)return w;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=r.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,fz(u,...o)]}function fz(...a){const o=a[0];if(a.length===1)return o;const r=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=Line truncated
*/const aw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Nu("x",aw);function nw({health:a,config:o,onConfigClick:r,onAdvertise:s,onMenuClick:c}){const l=(a==null?void 0:a.radio_connected)??!1,[m,u]=C.useState(!1),h=async()=>{u(!0);try{const d=await Le.reconnectRadio();d.connected&&ki.success("Reconnected",{description:d.message})}catch(d){ki.error("Reconnection failed",{description:d instanceof Error?d.message:"Check radio connection and power"})}finally{u(!1)}};return S.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[c&&S.jsx("button",{onClick:c,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:S.jsx(iw,{className:"h-5 w-5"})}),S.jsx("h1",{className:"hidden lg:block text-base font-semibold mr-auto",children:"RemoteTerm"}),S.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[S.jsx("div",{className:`w-2 h-2 rounded-full ${l?"bg-[#4caf50]":"bg-[#666]"}`}),S.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:l?"Connected":"Disconnected"})]}),(a==null?void 0:a.serial_port)&&S.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:["Port: ",S.jsx("span",{className:"text-[#e0e0e0]",children:a.serial_port})]}),o&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"hidden lg:flex items-center gap-1 text-[#888]",children:S.jsx("span",{className:"text-[#e0e0e0]",children:o.name||"Unnamed"})}),S.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:[o.radio.freq," MHz/SF",o.radio.sf,"/CR",o.radio.cr,"/",o.tx_power,"dBm"]})]}),S.jsx("div",{className:"flex-1 lg:hidden"}),!l&&S.jsx("button",{onClick:h,disabled:m,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:m?"Reconnecting...":"Reconnect"}),S.jsx("button",{onClick:s,disabled:!l,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444] disabled:bg-[#333] disabled:text-[#666] disabled:cursor-not-allowed",children:"Advertise"}),S.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:"Config"})]})}const xu=2,rw={text:"🛜",background:"#444444",textColor:"#ffffff"};function ow(a){let o=0;for(let r=0;r<a.length;r++){const s=a.charCodeAt(r);o=(o<<5)-o+s,o=o&o}return Math.abs(o)}const sw=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function tw(a,o){if(!a)return o.slice(0,2).toUpperCase();const r=a.match(sw);if(r)return r[0];const s=a.match(/[a-zA-Z]/g);if(!s||s.length===0)return o.slice(0,2).toUpperCase();const c=a.indexOf(" ");if(c!==-1){const l=s[0],m=a.slice(c+1).match(/[a-zA-Z]/);if(m)return(l+m[0]).toUpperCase()}return s[0].toUpperCase()}function lw(a){const o=ow(a),r=o%360,s=50+(o>>8)%30,c=35+(o>>16)%20,l=`hsl(${r}, ${s}%, ${c}%)`,m=c<45?"#ffffff":"#000000";return{background:l,text:m}}function cw(a,o,r){if(r===xu)return rw;const s=tw(a,o),c=lw(o);return{text:s,background:c.background,textColor:c.text}}function Jg({name:a,publicKey:o,size:r=28,contactType:s}){const c=cw(a,o,s);return S.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:c.background,color:c.textColor,width:r,height:r,fontSize:r*.45},children:c.text})}function ey(a){var o,r,s="";if(typeof a=="string"||typeof a=="number")s+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(o=0;o<c;o++)a[o]&&(r=ey(a[o]))&&(s&&(s+=" "),s+=r)}else for(r in a)a[r]&&(s&&(s+=" "),s+=r);return s}function iy(){for(var a,o,r=0,s="",c=arguments.length;r<c;r++)(a=arguments[r])&&(o=ey(a))&&(s&&(s+=" "),s+=o);return s}const uw=(a,o)=>{const r=new Array(a.length+o.length);for(let s=0;s<a.length;s++)r[s]=a[s];for(let s=0;s<o.length;s++)r[a.length+s]=o[s];return r},dw=(a,o)=>({classGroupId:a,validator:o}),ay=(a=new Map,o=null,r)=>({nextPart:a,validators:o,classGroupId:r}),Yt="-",Xm=[],pw="arbitrary..",mw=a=>{const o=gw(a),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return hw(m);const u=m.split(Yt),h=u[0]===""&&u.length>1?1:0;return ny(u,h,o)},getConflictingClassGroupIds:(m,u)=>{if(u){const h=s[m],d=r[m];return h?d?uw(d,h):h:d||Xm}return r[m]||Xm}}},ny=(a,o,r)=>{if(a.length-o===0)return r.classGroupId;const c=a[o],l=r.nextPart.get(c);if(l){const d=ny(a,o+1,l);if(d)return d}const m=r.validators;if(m===null)return;const u=o===0?a.join(Yt):a.slice(o).join(Yt),h=m.length;for(let d=0;d<h;d++){const g=m[d];if(g.validator(u))return g.classGroupId}},hw=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=a.slice(1,-1),r=o.indexOf(":"),s=o.slice(0,r);returnLine truncated
`).map((E,I,L)=>S.jsxs("span",{children:[uz(E,u),I<L.length-1&&S.jsx("br",{})]},I)),!Y&&S.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:th(A.sender_timestamp||A.received_at)}),A.outgoing&&(A.acked>0?` ✓${A.acked>1?A.acked:""}`:" ?")]})]})]},A.id)})]}),y&&S.jsx("button",{onClick:k,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:S.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const lh=156,pz=140,mz=156,hz=120,gz=8,yz=C.forwardRef(function({onSend:o,disabled:r,placeholder:s,isRepeaterMode:c,conversationType:l,senderName:m},u){const[h,d]=C.useState(""),[g,y]=C.useState(!1),f=C.useRef(null);C.useImperativeHandle(u,()=>({appendText:A=>{var D;d(R=>R+A),(D=f.current)==null||D.focus()}}));const z=C.useMemo(()=>{if(l==="contact")return{warningAt:pz,dangerAt:lh,hardLimit:lh};if(l==="channel"){const A=(m==null?void 0:m.length)??10,D=Math.max(1,mz-A-2);return{warningAt:hz,dangerAt:Math.max(1,D-gz),hardLimit:D}}return null},[l,m]),{limitState:w,warningMessage:k}=C.useMemo(()=>{if(!z)return{limitState:"normal",warningMessage:null};const A=h.length;return A>=z.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:A>=z.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:A>=z.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[h.length,z]),v=z?z.hardLimit-h.length:0,j=C.useCallback(async A=>{A.preventDefault();const D=h.trim();if(c){if(g||r)return;const R=D==="."?"":D;y(!0);try{await o(R),d("")}catch(F){console.error("Failed to request telemetry:",F),ki.error("Failed to request telemetry",{description:F instanceof Error?F.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var F;return(F=f.current)==null?void 0:F.focus()},0)}else{if(!D||g||r)return;y(!0);try{await o(D),d("")}catch(R){console.error("Failed to send message:",R),ki.error("Failed to send message",{description:R instanceof Error?R.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var R;return(R=f.current)==null?void 0:R.focus()},0)}},[h,g,r,o,c]),q=C.useCallback(A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),j(A))},[j]),x=c?h.trim().length>0||h===".":h.trim().length>0,_=!c&&z!==null;return S.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:j,children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx(xi,{ref:f,type:c?"password":"text",value:h,onChange:A=>d(A.target.value),onKeyDown:q,placeholder:s||(c?"Enter password (or . for none)...":"Type a message..."),disabled:r||g,className:"flex-1 min-w-0"}),S.jsx(va,{type:"submit",disabled:r||g||!x,className:"flex-shrink-0",children:g?c?"Fetching...":"Sending...":c?"Fetch":"Send"})]}),_&&S.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[S.jsxs("span",{className:Ge("tabular-nums",w==="error"||w==="danger"?"text-red-500 font-medium":w==="warning"?"text-yellow-500":"text-muted-foreground"),children:[h.length,"/",z.hardLimit,v<0&&` (${v})`]}),k&&S.jsxs("span",{className:Ge(w==="error"?"text-red-500":"text-yellow-500"),children:["— ",k]})]})]})});function Bi(a,o,{checkForDefaultPrevented:r=!0}={}){return function(c){if(a==null||a(c),r===!1||!c.defaultPrevented)return o==null?void 0:o(c)}}function bz(a,o){const r=C.createContext(o),s=l=>{const{children:m,...u}=l,h=C.useMemo(()=>u,Object.values(u));return S.jsx(r.Provider,{value:h,children:m})};s.displayName=a+"Provider";function c(l){const m=C.useContext(r);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,c]}function Vo(a,o=[]){let r=[];function s(l,m){const u=C.createContext(m),h=r.length;r=[...r,m];const d=y=>{var j;const{scope:f,children:z,...w}=y,k=((j=f==null?void 0:f[a])==null?void 0:j[h])||u,v=C.useMemo(()=>w,Object.values(w));return S.jsx(k.Provider,{value:v,children:z})};d.displayName=l+"Provider";function g(y,f){var k;const z=((k=f==null?void 0:f[a])==null?void 0:k[h])||u,w=C.useContext(z);if(w)return w;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const c=()=>{const l=r.map(m=>C.createContext(m));return function(u){const h=(u==null?void 0:u[a])||l;return C.useMemo(()=>({[`__scope${a}`]:{...u,[a]:h}}),[u,h])}};return c.scopeName=a,[s,fz(c,...o)]}function fz(...a){const o=a[0];if(a.length===1)return o;const r=()=>{const s=a.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(l){const m=s.reduce((u,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...u,...y}},{});return C.useMemo(()=Line truncated
.`.concat(Jz,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(c,"px ").concat(s,`;
padding-right: `).concat(u,"px ").concat(s,`;
}
body[`).concat(Sr,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([o&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(u,`px;
padding-left: `.concat(c,`px;
padding-top: `).concat(l,`px;
padding-right: `).concat(m,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(c,"px ").concat(s,`;
`),r==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(tt,` {
right: `).concat(c,"px ").concat(s,`;
margin-right: `).concat(u,"px ").concat(s,`;
`),r==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(lt,` {
margin-right: `).concat(c,"px ").concat(s,`;
right: `).concat(u,"px ").concat(s,`;
}
.`).concat(tt," .").concat(tt,` {
right: 0 `).concat(s,`;
.`).concat(ct,` {
margin-right: `).concat(u,"px ").concat(s,`;
}
.`).concat(lt," .").concat(lt,` {
right: 0 `).concat(s,`;
}
.`).concat(ct," .").concat(ct,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(Sr,`] {
`).concat(ex,": ").concat(c,`px;
`).concat(ex,": ").concat(u,`px;
}
`)},bh=function(){var a=parseInt(document.body.getAttribute(Sr)||"0",10);return isFinite(a)?a:0},vx=function(){E.useEffect(function(){return document.body.setAttribute(Sr,(bh()+1).toString()),function(){var a=bh()-1;a<=0?document.body.removeAttribute(Sr):document.body.setAttribute(Sr,a.toString())}},[])},kx=function(a){var o=a.noRelative,r=a.noImportant,s=a.gapMode,u=s===void 0?"margin":s;vx();var l=E.useMemo(function(){return yx(u)},[u]);return E.createElement(bx,{styles:fx(l,!o,u,r?"":"!important")})},Au=!1;if(typeof window<"u")try{var at=Object.defineProperty({},"passive",{get:function(){return Au=!0,!0}});window.addEventListener("test",at,at),window.removeEventListener("test",at,at)}catch{Au=!1}var qr=Au?{passive:!1}:!1,wx=function(a){return a.tagName==="TEXTAREA"},qy=function(a,o){if(!(a instanceof Element))return!1;var r=window.getComputedStyle(a);return r[o]!=="hidden"&&!(r.overflowY===r.overflowX&&!wx(a)&&r[o]==="visible")},zx=function(a){return qy(a,"overflowY")},xx=function(a){return qy(a,"overflowX")},fh=function(a,o){var r=o.ownerDocument,s=o;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var u=Ay(a,s);if(u){var l=Cy(a,s),m=l[1],c=l[2];if(m>c)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},jx=function(a){var o=a.scrollTop,r=a.scrollHeight,s=a.clientHeight;return[o,r,s]},qx=function(a){var o=a.scrollLeft,r=a.scrollWidth,s=a.clientWidth;return[o,r,s]},Ay=function(a,o){return a==="v"?zx(o):xx(o)},Cy=function(a,o){return a==="v"?jx(o):qx(o)},Ax=function(a,o){return a==="h"&&o==="rtl"?-1:1},Cx=function(a,o,r,s,u){var l=Ax(a,window.getComputedStyle(o).direction),m=l*s,c=r.target,h=o.contains(c),d=!1,g=m>0,y=0,f=0;do{if(!c)break;var z=Cy(a,c),w=z[0],k=z[1],v=z[2],j=k-v-l*w;(w||j)&&Ay(a,c)&&(y+=j,f+=w);var q=c.parentNode;c=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!h&&c!==document.body||h&&(o.contains(c)||o===c));return(g&&Math.abs(y)<1||!g&&Math.abs(f)<1)&&(d=!0),d},nt=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},vh=function(a){return[a.deltaX,a.deltaY]},kh=function(a){return a&&"current"in a?a.current:a},Ex=function(a,o){return a[0]===o[0]&&a[1]===o[1]},Sx=function(a){return`
`)},bh=function(){var a=parseInt(document.body.getAttribute(Sr)||"0",10);return isFinite(a)?a:0},vx=function(){C.useEffect(function(){return document.body.setAttribute(Sr,(bh()+1).toString()),function(){var a=bh()-1;a<=0?document.body.removeAttribute(Sr):document.body.setAttribute(Sr,a.toString())}},[])},kx=function(a){var o=a.noRelative,r=a.noImportant,s=a.gapMode,c=s===void 0?"margin":s;vx();var l=C.useMemo(function(){return yx(c)},[c]);return C.createElement(bx,{styles:fx(l,!o,c,r?"":"!important")})},Au=!1;if(typeof window<"u")try{var nt=Object.defineProperty({},"passive",{get:function(){return Au=!0,!0}});window.addEventListener("test",nt,nt),window.removeEventListener("test",nt,nt)}catch{Au=!1}var qr=Au?{passive:!1}:!1,wx=function(a){return a.tagName==="TEXTAREA"},qy=function(a,o){if(!(a instanceof Element))return!1;var r=window.getComputedStyle(a);return r[o]!=="hidden"&&!(r.overflowY===r.overflowX&&!wx(a)&&r[o]==="visible")},zx=function(a){return qy(a,"overflowY")},xx=function(a){return qy(a,"overflowX")},fh=function(a,o){var r=o.ownerDocument,s=o;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var c=Ay(a,s);if(c){var l=Cy(a,s),m=l[1],u=l[2];if(m>u)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},jx=function(a){var o=a.scrollTop,r=a.scrollHeight,s=a.clientHeight;return[o,r,s]},qx=function(a){var o=a.scrollLeft,r=a.scrollWidth,s=a.clientWidth;return[o,r,s]},Ay=function(a,o){return a==="v"?zx(o):xx(o)},Cy=function(a,o){return a==="v"?jx(o):qx(o)},Ax=function(a,o){return a==="h"&&o==="rtl"?-1:1},Cx=function(a,o,r,s,c){var l=Ax(a,window.getComputedStyle(o).direction),m=l*s,u=r.target,h=o.contains(u),d=!1,g=m>0,y=0,f=0;do{if(!u)break;var z=Cy(a,u),w=z[0],k=z[1],v=z[2],j=k-v-l*w;(w||j)&&Ay(a,u)&&(y+=j,f+=w);var q=u.parentNode;u=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!h&&u!==document.body||h&&(o.contains(u)||o===u));return(g&&Math.abs(y)<1||!g&&Math.abs(f)<1)&&(d=!0),d},rt=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},vh=function(a){return[a.deltaX,a.deltaY]},kh=function(a){return a&&"current"in a?a.current:a},Ex=function(a,o){return a[0]===o[0]&&a[1]===o[1]},Sx=function(a){return`
.block-interactivity-`.concat(a,` {pointer-events: none;}
.allow-interactivity-`).concat(a,` {pointer-events: all;}
`)},Bx=0,Ar=[];function _x(a){var o=E.useRef([]),r=E.useRef([0,0]),s=E.useRef(),u=E.useState(Bx++)[0],l=E.useState(jy)[0],m=E.useRef(a);E.useEffect(function(){m.current=a},[a]),E.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(u));var k=Xz([a.lockRef.current],(a.shards||[]).map(kh),!0).filter(Boolean);return k.forEach(function(v){return v.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),k.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(u))})}}},[a.inert,a.lockRef.current,a.shards]);var c=E.useCallback(function(k,v){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!m.current.allowPinchZoom;var j=nt(k),q=r.current,x="deltaX"in k?k.deltaX:q[0]-j[0],_="deltaY"in k?k.deltaY:q[1]-j[1],C,D=k.target,R=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in k&&R==="h"&&D.type==="range")return!1;var F=window.getSelection(),M=F&&F.anchorNode,P=M?M===D||M.contains(D):!1;if(P)return!1;var T=fh(R,D);if(!T)return!0;if(T?C=R:(C=R==="v"?"h":"v",T=fh(R,D)),!T)return!1;if(!s.current&&"changedTouches"in k&&(x||_)&&(s.current=C),!C)return!0;var U=s.current||C;return Cx(U,v,k,U==="h"?x:_)},[]),h=E.useCallback(function(k){var v=k;if(!(!Ar.length||Ar[Ar.length-1]!==l)){var j="deltaY"in v?vh(v):nt(v),q=o.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Ex(C.delta,j)})[0];if(q&&q.should){v.cancelable&&v.preventDefault();return}if(!q){var x=(m.current.shards||[]).map(kh).filter(Boolean).filter(function(C){return C.contains(v.target)}),_=x.length>0?c(v,x[0]):!m.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),d=E.useCallback(function(k,v,j,q){var x={name:k,delta:v,target:j,should:q,shadowParent:Dx(j)};o.current.push(x),setTimeout(function(){o.current=o.current.filter(function(_){return _!==x})},1)},[]),g=E.useCallback(function(k){r.current=nt(k),s.current=void 0},[]),y=E.useCallback(function(k){d(k.type,vh(k),k.target,c(k,a.lockRef.current))},[]),f=E.useCallback(function(k){d(k.type,nt(k),k.target,c(k,a.lockRef.current))},[]);E.useEffect(function(){return Ar.push(l),a.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:f}),document.addEventListener("wheel",h,qr),document.addEventListener("touchmove",h,qr),document.addEventListener("touchstart",g,qr),function(){Ar=Ar.filter(function(k){return k!==l}),document.removeEventListener("wheel",h,qr),document.removeEventListener("touchmove",h,qr),document.removeEventListener("touchstart",g,qr)}},[]);var z=a.removeScrollBar,w=a.inert;return E.createElement(E.Fragment,null,w?E.createElement(l,{styles:Sx(u)}):null,z?E.createElement(kx,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function Dx(a){for(var o=null;a!==null;)a instanceof ShadowRoot&&(o=a.host,a=a.host),a=a.parentNode;return o}const Fx=tx(xy,_x);var Ey=E.forwardRef(function(a,o){return E.createElement(ol,Ha({},a,{ref:o,sideCar:Fx}))});Ey.classNames=ol.classNames;var Rx=function(a){if(typeof document>"u")return null;var o=Array.isArray(a)?a[0]:a;return o.ownerDocument.body},Cr=new WeakMap,rt=new WeakMap,ot={},hu=0,Sy=function(a){return a&&(a.host||Sy(a.parentNode))},Tx=function(a,o){return o.map(function(r){if(a.contains(r))return r;var s=Sy(r);return s&&a.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",a,". Doing nothing"),null)}).filter(function(r){return!!r})},Px=function(a,o,r,s){var u=Tx(o,Array.isArray(a)?a:[a]);ot[r]||(ot[r]=new WeakMap);var l=ot[r],m=[],c=new Set,h=new Set(u),d=function(y){!y||c.has(y)||(c.add(y),d(y.parentNode))};u.forEach(d);var g=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(f){if(c.has(f))g(f);else try{var z=f.getAttribute(s),w=z!==null&&z!=="false",k=(Cr.get(f)||0)+1,v=(l.get(f)||0)+1;Cr.set(f,k),l.set(f,v),m.push(f),k===1&&w&&rt.set(f,!0),v===1&&f.setAttribute(r,"true"),w||f.setAttribute(s,"true")}catch(j){console.error("aria-hidden: cannot operate on ",f,j)}})};return g(o),c.clear(),hu++,function(){m.forEach(function(y){var f=Cr.get(y)-1,z=l.get(y)-1;Cr.set(y,f),l.set(y,z),f||(rt.has(y)||y.removeAttribute(s),rt.delete(y)),z||y.removeAttribute(r)}),hu--,hu||(Cr=new WeakMap,Cr=new WeakMap,rt=new WeakMap,ot={})}},Nx=function(a,o,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(a)?a:[a]),u=Rx(a);return u?(s.push.apply(s,Array.from(u.querySelectorAll("[aria-live], script"))),Px(s,u,r,"aria-hidden")):function(){return null}};function Ix(a){const o=Mx(a),r=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(Lx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(o,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(o,{...m,ref:u,children:l})});return r.displayName=`${a}.Slot`,r}function Mx(a){const o=E.forwardRef((r,s)=>{const{children:u Line truncated
`)},Bx=0,Ar=[];function _x(a){var o=C.useRef([]),r=C.useRef([0,0]),s=C.useRef(),c=C.useState(Bx++)[0],l=C.useState(jy)[0],m=C.useRef(a);C.useEffect(function(){m.current=a},[a]),C.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(c));var k=Xz([a.lockRef.current],(a.shards||[]).map(kh),!0).filter(Boolean);return k.forEach(function(v){return v.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),k.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(c))})}}},[a.inert,a.lockRef.current,a.shards]);var u=C.useCallback(function(k,v){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!m.current.allowPinchZoom;var j=rt(k),q=r.current,x="deltaX"in k?k.deltaX:q[0]-j[0],_="deltaY"in k?k.deltaY:q[1]-j[1],A,D=k.target,R=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in k&&R==="h"&&D.type==="range")return!1;var F=window.getSelection(),M=F&&F.anchorNode,P=M?M===D||M.contains(D):!1;if(P)return!1;var T=fh(R,D);if(!T)return!0;if(T?A=R:(A=R==="v"?"h":"v",T=fh(R,D)),!T)return!1;if(!s.current&&"changedTouches"in k&&(x||_)&&(s.current=A),!A)return!0;var W=s.current||A;return Cx(W,v,k,W==="h"?x:_)},[]),h=C.useCallback(function(k){var v=k;if(!(!Ar.length||Ar[Ar.length-1]!==l)){var j="deltaY"in v?vh(v):rt(v),q=o.current.filter(function(A){return A.name===v.type&&(A.target===v.target||v.target===A.shadowParent)&&Ex(A.delta,j)})[0];if(q&&q.should){v.cancelable&&v.preventDefault();return}if(!q){var x=(m.current.shards||[]).map(kh).filter(Boolean).filter(function(A){return A.contains(v.target)}),_=x.length>0?u(v,x[0]):!m.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),d=C.useCallback(function(k,v,j,q){var x={name:k,delta:v,target:j,should:q,shadowParent:Dx(j)};o.current.push(x),setTimeout(function(){o.current=o.current.filter(function(_){return _!==x})},1)},[]),g=C.useCallback(function(k){r.current=rt(k),s.current=void 0},[]),y=C.useCallback(function(k){d(k.type,vh(k),k.target,u(k,a.lockRef.current))},[]),f=C.useCallback(function(k){d(k.type,rt(k),k.target,u(k,a.lockRef.current))},[]);C.useEffect(function(){return Ar.push(l),a.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:f}),document.addEventListener("wheel",h,qr),document.addEventListener("touchmove",h,qr),document.addEventListener("touchstart",g,qr),function(){Ar=Ar.filter(function(k){return k!==l}),document.removeEventListener("wheel",h,qr),document.removeEventListener("touchmove",h,qr),document.removeEventListener("touchstart",g,qr)}},[]);var z=a.removeScrollBar,w=a.inert;return C.createElement(C.Fragment,null,w?C.createElement(l,{styles:Sx(c)}):null,z?C.createElement(kx,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function Dx(a){for(var o=null;a!==null;)a instanceof ShadowRoot&&(o=a.host,a=a.host),a=a.parentNode;return o}const Fx=tx(xy,_x);var Ey=C.forwardRef(function(a,o){return C.createElement(ol,Va({},a,{ref:o,sideCar:Fx}))});Ey.classNames=ol.classNames;var Rx=function(a){if(typeof document>"u")return null;var o=Array.isArray(a)?a[0]:a;return o.ownerDocument.body},Cr=new WeakMap,ot=new WeakMap,st={},hu=0,Sy=function(a){return a&&(a.host||Sy(a.parentNode))},Tx=function(a,o){return o.map(function(r){if(a.contains(r))return r;var s=Sy(r);return s&&a.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",a,". Doing nothing"),null)}).filter(function(r){return!!r})},Px=function(a,o,r,s){var c=Tx(o,Array.isArray(a)?a:[a]);st[r]||(st[r]=new WeakMap);var l=st[r],m=[],u=new Set,h=new Set(c),d=function(y){!y||u.has(y)||(u.add(y),d(y.parentNode))};c.forEach(d);var g=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(f){if(u.has(f))g(f);else try{var z=f.getAttribute(s),w=z!==null&&z!=="false",k=(Cr.get(f)||0)+1,v=(l.get(f)||0)+1;Cr.set(f,k),l.set(f,v),m.push(f),k===1&&w&&ot.set(f,!0),v===1&&f.setAttribute(r,"true"),w||f.setAttribute(s,"true")}catch(j){console.error("aria-hidden: cannot operate on ",f,j)}})};return g(o),u.clear(),hu++,function(){m.forEach(function(y){var f=Cr.get(y)-1,z=l.get(y)-1;Cr.set(y,f),l.set(y,z),f||(ot.has(y)||y.removeAttribute(s),ot.delete(y)),z||y.removeAttribute(r)}),hu--,hu||(Cr=new WeakMap,Cr=new WeakMap,ot=new WeakMap,st={})}},Nx=function(a,o,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(a)?a:[a]),c=Rx(a);return c?(s.push.apply(s,Array.from(c.querySelectorAll("[aria-live], script"))),Px(s,c,r,"aria-hidden")):function(){return null}};function Ix(a){const o=Mx(a),r=C.forwardRef((s,c)=>{const{children:l,...m}=s,u=C.Children.toArray(l),h=u.find(Lx);if(h){const d=h.props.children,g=u.map(y=>y===h?C.Children.count(d)>1?C.Children.only(null):C.isValidElement(d)?d.props.children:null:y);return S.jsx(o,{...m,ref:c,children:C.isValidElement(d)?C.cloneElement(d,void 0,g):null})}return S.jsx(o,{...m,ref:c,children:l})});return r.displayName=`${a}.Slot`,r}function Mx(a){const o=C.forwardRef((r,s)=>{const{children:c Line truncated
If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return E.useEffect(()=>{a&&(document.getElementById(a)||console.error(r))},[r,a]),null},Xx="DialogDescriptionWarning",Jx=({contentRef:a,descriptionId:o})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Uy(Xx).contentName}}.`;return E.useEffect(()=>{var l;const u=(l=a.current)==null?void 0:l.getAttribute("aria-describedby");o&&u&&(document.getElementById(o)||console.warn(s))},[s,a,o]),null},Wy=_y,$y=Ry,tl=Ty,ll=Py,cl=Iy,ul=Oy,Gy=Hy;const Qy=Wy,e0=$y,Ky=E.forwardRef(({className:a,...o},r)=>B.jsx(tl,{ref:r,className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...o}));Ky.displayName=tl.displayName;const Vu=E.forwardRef(({className:a,children:o,...r},s)=>B.jsxs(e0,{children:[B.jsx(Ky,{}),B.jsxs(ll,{ref:s,className:$e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...r,children:[o,B.jsxs(Gy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[B.jsx(Xg,{className:"h-4 w-4"}),B.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Vu.displayName=ll.displayName;const Uu=({className:a,...o})=>B.jsx("div",{className:$e("flex flex-col space-y-1.5 text-center sm:text-left",a),...o});Uu.displayName="DialogHeader";const Wu=({className:a,...o})=>B.jsx("div",{className:$e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...o});Wu.displayName="DialogFooter";const $u=E.forwardRef(({className:a,...o},r)=>B.jsx(cl,{ref:r,className:$e("text-lg font-semibold leading-none tracking-tight",a),...o}));$u.displayName=cl.displayName;const i0=E.forwardRef(({className:a,...o},r)=>B.jsx(ul,{ref:r,className:$e("text-sm text-muted-foreground",a),...o}));i0.displayName=ul.displayName;function wh(a){const o=a0(a),r=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(r0);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(o,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(o,{...m,ref:u,children:l})});return r.displayName=`${a}.Slot`,r}function a0(a){const o=E.forwardRef((r,s)=>{const{children:u,...l}=r;if(E.isValidElement(u)){const m=s0(u),c=o0(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lo(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return o.displayName=`${a}.SlotClone`,o}var n0=Symbol("radix.slottable");function r0(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===n0}function o0(a,o){const r={...o};for(const s in o){const u=a[s],l=o[s];/^on[A-Z]/.test(s)?u&&l?r[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(r[s]=u):s==="style"?r[s]={...u,...l}:s==="className"&&(r[s]=[u,l].filter(Boolean).join(" "))}return{...a,...r}}function s0(a){var s,u;let o=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,r=o&&"isReactWarning"in o&&o.isReactWarning;return r?a.ref:(o=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r?a.props.ref:a.props.ref||a.ref)}function t0(a){const o=a+"CollectionProvider",[r,s]=Ho(o),[u,l]=r(o,{collectionRef:{current:null},itemMap:new Map}),m=k=>{const{scope:v,children:j}=k,q=de.useRef(null),x=de.useRef(new Map).current;return B.jsx(u,{scope:v,itemMap:x,collectionRef:q,children:j})};m.displayName=o;const c=a+"CollectionSlot",h=wh(c),d=de.forwardRef((k,v)=>{const{scope:j,children:q}=k,x=l(c,j),_=va(v,x.collectionRef);return B.jsx(h,{ref:_,children:q})});d.displayName=c;const g=a+"CollectionItemSlot",y="data-radix-collection-item",f=wh(g),z=de.forwardRef((k,v)=>{const{scope:j,children:q,...x}=k,_=de.useRef(null),C=va(v,_),D=l(g,j);return de.useEffect(()=>(D.itemMap.set(_,{ref:_,...x}),()=>void D.itemMap.delete(_))),B.jsx(f,{[y]:"",ref:C,children:q})});z.displayName=g;function w(k){const v=l(a+"CollectionConsumer",k);return de.useCallback(()=>{const q=v.collectionRef.current;if(!q)return[];const x=Array.from(q.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((D,R)=>x.indexOf(D.ref.current)-x.indexOf(R.ref.current))},[v.coll Line truncated
For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return C.useEffect(()=>{a&&(document.getElementById(a)||console.error(r))},[r,a]),null},Xx="DialogDescriptionWarning",Jx=({contentRef:a,descriptionId:o})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Uy(Xx).contentName}}.`;return C.useEffect(()=>{var l;const c=(l=a.current)==null?void 0:l.getAttribute("aria-describedby");o&&c&&(document.getElementById(o)||console.warn(s))},[s,a,o]),null},Wy=_y,$y=Ry,tl=Ty,ll=Py,cl=Iy,ul=Oy,Gy=Hy;const Qy=Wy,e0=$y,Ky=C.forwardRef(({className:a,...o},r)=>S.jsx(tl,{ref:r,className:Ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...o}));Ky.displayName=tl.displayName;const Vu=C.forwardRef(({className:a,children:o,...r},s)=>S.jsxs(e0,{children:[S.jsx(Ky,{}),S.jsxs(ll,{ref:s,className:Ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...r,children:[o,S.jsxs(Gy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[S.jsx(Xg,{className:"h-4 w-4"}),S.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Vu.displayName=ll.displayName;const Uu=({className:a,...o})=>S.jsx("div",{className:Ge("flex flex-col space-y-1.5 text-center sm:text-left",a),...o});Uu.displayName="DialogHeader";const Wu=({className:a,...o})=>S.jsx("div",{className:Ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...o});Wu.displayName="DialogFooter";const $u=C.forwardRef(({className:a,...o},r)=>S.jsx(cl,{ref:r,className:Ge("text-lg font-semibold leading-none tracking-tight",a),...o}));$u.displayName=cl.displayName;const i0=C.forwardRef(({className:a,...o},r)=>S.jsx(ul,{ref:r,className:Ge("text-sm text-muted-foreground",a),...o}));i0.displayName=ul.displayName;function wh(a){const o=a0(a),r=C.forwardRef((s,c)=>{const{children:l,...m}=s,u=C.Children.toArray(l),h=u.find(r0);if(h){const d=h.props.children,g=u.map(y=>y===h?C.Children.count(d)>1?C.Children.only(null):C.isValidElement(d)?d.props.children:null:y);return S.jsx(o,{...m,ref:c,children:C.isValidElement(d)?C.cloneElement(d,void 0,g):null})}return S.jsx(o,{...m,ref:c,children:l})});return r.displayName=`${a}.Slot`,r}function a0(a){const o=C.forwardRef((r,s)=>{const{children:c,...l}=r;if(C.isValidElement(c)){const m=s0(c),u=o0(l,c.props);return c.type!==C.Fragment&&(u.ref=s?Ho(s,m):m),C.cloneElement(c,u)}return C.Children.count(c)>1?C.Children.only(null):null});return o.displayName=`${a}.SlotClone`,o}var n0=Symbol("radix.slottable");function r0(a){return C.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===n0}function o0(a,o){const r={...o};for(const s in o){const c=a[s],l=o[s];/^on[A-Z]/.test(s)?c&&l?r[s]=(...u)=>{const h=l(...u);return c(...u),h}:c&&(r[s]=c):s==="style"?r[s]={...c,...l}:s==="className"&&(r[s]=[c,l].filter(Boolean).join(" "))}return{...a,...r}}function s0(a){var s,c;let o=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,r=o&&"isReactWarning"in o&&o.isReactWarning;return r?a.ref:(o=(c=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:c.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r?a.props.ref:a.props.ref||a.ref)}function t0(a){const o=a+"CollectionProvider",[r,s]=Vo(o),[c,l]=r(o,{collectionRef:{current:null},itemMap:new Map}),m=k=>{const{scope:v,children:j}=k,q=de.useRef(null),x=de.useRef(new Map).current;return S.jsx(c,{scope:v,itemMap:x,collectionRef:q,children:j})};m.displayName=o;const u=a+"CollectionSlot",h=wh(u),d=de.forwardRef((k,v)=>{const{scope:j,children:q}=k,x=l(u,j),_=ka(v,x.collectionRef);return S.jsx(h,{ref:_,children:q})});d.displayName=u;const g=a+"CollectionItemSlot",y="data-radix-collection-item",f=wh(g),z=de.forwardRef((k,v)=>{const{scope:j,children:q,...x}=k,_=de.useRef(null),A=ka(v,_),D=l(g,j);return de.useEffect(()=>(D.itemMap.set(_,{ref:_,...x}),()=>void D.itemMap.delete(_))),S.jsx(f,{[y]:"",ref:A,children:q})});z.displayName=g;function w(k){const v=l(a+"CollectionConsumer",k);return de.useCallback(()=>{const q=v.collectionRef.current;if(!q)return[];const x=Array.from(q.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((D,R)=>x.indexOf(D.ref.current)-x.indexOf(R.ref.current))},[v.coll Line truncated
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -131,17 +131,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${o.do
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/return(function(s){var u=r,l=u.lib,m=l.WordArray,c=l.Hasher,h=u.algo,d=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),g=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),z=m.create([0,1518500249,1859775393,2400959708,2840853838]),w=m.create([1352829926,1548603684,1836072691,2053994217,0]),k=h.RIPEMD160=c.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(D,R){for(var F=0;F<16;F++){var M=R+F,P=D[M];D[M]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var T=this._hash.words,U=z.words,H=w.words,K=d.words,ie=g.words,Z=y.words,ae=f.words,W,ne,J,A,I,L,$,le,pe,me;L=W=T[0],$=ne=T[1],le=J=T[2],pe=A=T[3],me=I=T[4];for(var re,F=0;F<80;F+=1)re=W+D[R+K[F]]|0,F<16?re+=v(ne,J,A)+U[0]:F<32?re+=j(ne,J,A)+U[1]:F<48?re+=q(ne,J,A)+U[2]:F<64?re+=x(ne,J,A)+U[3]:re+=_(ne,J,A)+U[4],re=re|0,re=C(re,Z[F]),re=re+I|0,W=I,I=A,A=C(J,10),J=ne,ne=re,re=L+D[R+ie[F]]|0,F<16?re+=_($,le,pe)+H[0]:F<32?re+=x($,le,pe)+H[1]:F<48?re+=q($,le,pe)+H[2]:F<64?re+=j($,le,pe)+H[3]:re+=v($,le,pe)+H[4],re=re|0,re=C(re,ae[F]),re=re+me|0,L=me,me=pe,pe=C(le,10),le=$,$=re;re=T[1]+J+pe|0,T[1]=T[2]+A+me|0,T[2]=T[3]+I+L|0,T[3]=T[4]+W+$|0,T[4]=T[0]+ne+le|0,T[0]=re},_doFinalize:function(){var D=this._data,R=D.words,F=this._nDataBytes*8,M=D.sigBytes*8;R[M>>>5]|=128<<24-M%32,R[(M+64>>>9<<4)+14]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,D.sigBytes=(R.length+1)*4,this._process();for(var P=this._hash,T=P.words,U=0;U<5;U++){var H=T[U];T[U]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}return P},clone:function(){var D=c.clone.call(this);return D._hash=this._hash.clone(),D}});function v(D,R,F){return D^R^F}function j(D,R,F){return D&R|~D&F}function q(D,R,F){return(D|~R)^F}function x(D,R,F){return D&F|R&~F}function _(D,R,F){return D^(R|~F)}function C(D,R){return D<<R|D>>>32-R}u.RIPEMD160=c._createHelper(k),u.HmacRIPEMD160=c._createHmacHelper(k)})(),r.RIPEMD160})})(jt)),jt.exports}var qt={exports:{}},bj=qt.exports,Lh;function hl(){return Lh||(Lh=1,(function(a,o){(function(r,s){a.exports=s(He())})(bj,function(r){(function(){var s=r,u=s.lib,l=u.Base,m=s.enc,c=m.Utf8,h=s.algo;h.HMAC=l.extend({init:function(d,g){d=this._hasher=new d.init,typeof g=="string"&&(g=c.parse(g));var y=d.blockSize,f=y*4;g.sigBytes>f&&(g=d.finalize(g)),g.clamp();for(var z=this._oKey=g.clone(),w=this._iKey=g.clone(),k=z.words,v=w.words,j=0;j<y;j++)k[j]^=1549556828,v[j]^=909522486;z.sigBytes=w.sigBytes=f,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var g=this._hasher,y=g.finalize(d);g.reset();var f=g.finalize(this._oKey.clone().concat(y));return f}})})()})})(qt)),qt.exports}var At={exports:{}},fj=At.exports,Hh;function vj(){return Hh||(Hh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Uo(),hl())})(fj,function(r){return(function(){var s=r,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.SHA256,d=c.HMAC,g=c.PBKDF2=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,f){for(var z=this.cfg,w=d.create(z.hasher,y),k=m.create(),v=m.create([1]),j=k.words,q=v.words,x=z.keySize,_=z.iterations;j.length<x;){var C=w.update(f).finalize(v);w.reset();for(var D=C.words,R=D.length,F=C,M=1;M<_;M++){F=w.finalize(F),w.reset();for(var P=F.words,T=0;T<R;T++)D[T]^=P[T]}k.concat(C),q[0]++}return k.sigBytes=x*4,k}});s.PBKDF2=function(y,f,z){return g.create(z).compute(y,f)}})(),r.PBKDF2})})(At)),At.exports}var Ct={exports:{}},kj=Ct.exports,Vh;function En(){return Vh||(Vh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),_b(),hl())})(kj,function(r){return(function(){var s=r,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.MD5,d=c.EvpKDF=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:1}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,y){for(var f,z=this.cfg,w=z.hasher.create(),k=m.create(),v=k.words,j=z.keySize,q=z.iterations;v.length<j;){f&&w.update(f),f=w.update(g).finalize(y),w.reset();for(var x=1;x<q;x++)f=w.finalize(f),w.reset();k.concat(f)}return k.sigBytes=j*4,k}});s.EvpKDF=function(g,y,f){return d.create(f).compute(g,y)}})(),r.EvpKDF})})(Ct)),Ct.exports}var Et={exports:{}},wj=Et.exports,Uh;function Ri(Line truncated
*/return(function(s){var c=r,l=c.lib,m=l.WordArray,u=l.Hasher,h=c.algo,d=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),g=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),z=m.create([0,1518500249,1859775393,2400959708,2840853838]),w=m.create([1352829926,1548603684,1836072691,2053994217,0]),k=h.RIPEMD160=u.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(D,R){for(var F=0;F<16;F++){var M=R+F,P=D[M];D[M]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var T=this._hash.words,W=z.words,H=w.words,K=d.words,ie=g.words,Y=y.words,ne=f.words,U,ae,J,E,I,L,$,re,pe,he;L=U=T[0],$=ae=T[1],re=J=T[2],pe=E=T[3],he=I=T[4];for(var oe,F=0;F<80;F+=1)oe=U+D[R+K[F]]|0,F<16?oe+=v(ae,J,E)+W[0]:F<32?oe+=j(ae,J,E)+W[1]:F<48?oe+=q(ae,J,E)+W[2]:F<64?oe+=x(ae,J,E)+W[3]:oe+=_(ae,J,E)+W[4],oe=oe|0,oe=A(oe,Y[F]),oe=oe+I|0,U=I,I=E,E=A(J,10),J=ae,ae=oe,oe=L+D[R+ie[F]]|0,F<16?oe+=_($,re,pe)+H[0]:F<32?oe+=x($,re,pe)+H[1]:F<48?oe+=q($,re,pe)+H[2]:F<64?oe+=j($,re,pe)+H[3]:oe+=v($,re,pe)+H[4],oe=oe|0,oe=A(oe,ne[F]),oe=oe+he|0,L=he,he=pe,pe=A(re,10),re=$,$=oe;oe=T[1]+J+pe|0,T[1]=T[2]+E+he|0,T[2]=T[3]+I+L|0,T[3]=T[4]+U+$|0,T[4]=T[0]+ae+re|0,T[0]=oe},_doFinalize:function(){var D=this._data,R=D.words,F=this._nDataBytes*8,M=D.sigBytes*8;R[M>>>5]|=128<<24-M%32,R[(M+64>>>9<<4)+14]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,D.sigBytes=(R.length+1)*4,this._process();for(var P=this._hash,T=P.words,W=0;W<5;W++){var H=T[W];T[W]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}return P},clone:function(){var D=u.clone.call(this);return D._hash=this._hash.clone(),D}});function v(D,R,F){return D^R^F}function j(D,R,F){return D&R|~D&F}function q(D,R,F){return(D|~R)^F}function x(D,R,F){return D&F|R&~F}function _(D,R,F){return D^(R|~F)}function A(D,R){return D<<R|D>>>32-R}c.RIPEMD160=u._createHelper(k),c.HmacRIPEMD160=u._createHmacHelper(k)})(),r.RIPEMD160})})(jt)),jt.exports}var qt={exports:{}},bj=qt.exports,Lh;function hl(){return Lh||(Lh=1,(function(a,o){(function(r,s){a.exports=s(Ue())})(bj,function(r){(function(){var s=r,c=s.lib,l=c.Base,m=s.enc,u=m.Utf8,h=s.algo;h.HMAC=l.extend({init:function(d,g){d=this._hasher=new d.init,typeof g=="string"&&(g=u.parse(g));var y=d.blockSize,f=y*4;g.sigBytes>f&&(g=d.finalize(g)),g.clamp();for(var z=this._oKey=g.clone(),w=this._iKey=g.clone(),k=z.words,v=w.words,j=0;j<y;j++)k[j]^=1549556828,v[j]^=909522486;z.sigBytes=w.sigBytes=f,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var g=this._hasher,y=g.finalize(d);g.reset();var f=g.finalize(this._oKey.clone().concat(y));return f}})})()})})(qt)),qt.exports}var At={exports:{}},fj=At.exports,Hh;function vj(){return Hh||(Hh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Wo(),hl())})(fj,function(r){return(function(){var s=r,c=s.lib,l=c.Base,m=c.WordArray,u=s.algo,h=u.SHA256,d=u.HMAC,g=u.PBKDF2=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,f){for(var z=this.cfg,w=d.create(z.hasher,y),k=m.create(),v=m.create([1]),j=k.words,q=v.words,x=z.keySize,_=z.iterations;j.length<x;){var A=w.update(f).finalize(v);w.reset();for(var D=A.words,R=D.length,F=A,M=1;M<_;M++){F=w.finalize(F),w.reset();for(var P=F.words,T=0;T<R;T++)D[T]^=P[T]}k.concat(A),q[0]++}return k.sigBytes=x*4,k}});s.PBKDF2=function(y,f,z){return g.create(z).compute(y,f)}})(),r.PBKDF2})})(At)),At.exports}var Ct={exports:{}},kj=Ct.exports,Vh;function En(){return Vh||(Vh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),_b(),hl())})(kj,function(r){return(function(){var s=r,c=s.lib,l=c.Base,m=c.WordArray,u=s.algo,h=u.MD5,d=u.EvpKDF=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:1}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,y){for(var f,z=this.cfg,w=z.hasher.create(),k=m.create(),v=k.words,j=z.keySize,q=z.iterations;v.length<j;){f&&w.update(f),f=w.update(g).finalize(y),w.reset();for(var x=1;x<q;x++)f=w.finalize(f),w.reset();k.concat(f)}return k.sigBytes=j*4,k}});s.EvpKDF=function(g,y,f){return d.create(f).compute(g,y)}})(),r.EvpKDF})})(Ct)),Ct.exports}var Et={exports:{}},wj=Et.exports,Uh;function Ti(Line truncated
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/return r.mode.CTRGladman=(function(){var s=r.lib.BlockCipherMode.extend();function u(c){if((c>>24&255)===255){var h=c>>16&255,d=c>>8&255,g=c&255;h===255?(h=0,d===255?(d=0,g===255?g=0:++g):++d):++h,c=0,c+=h<<16,c+=d<<8,c+=g}else c+=1<<24;return c}function l(c){return(c[0]=u(c[0]))===0&&(c[1]=u(c[1])),c}var m=s.Encryptor=s.extend({processBlock:function(c,h){var d=this._cipher,g=d.blockSize,y=this._iv,f=this._counter;y&&(f=this._counter=y.slice(0),this._iv=void 0),l(f);var z=f.slice(0);d.encryptBlock(z,0);for(var w=0;w<g;w++)c[h+w]^=z[w]}});return s.Decryptor=m,s})(),r.mode.CTRGladman})})(_t)),_t.exports}var Dt={exports:{}},Ej=Dt.exports,Qh;function Sj(){return Qh||(Qh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Ej,function(r){return r.mode.OFB=(function(){var s=r.lib.BlockCipherMode.extend(),u=s.Encryptor=s.extend({processBlock:function(l,m){var c=this._cipher,h=c.blockSize,d=this._iv,g=this._keystream;d&&(g=this._keystream=d.slice(0),this._iv=void 0),c.encryptBlock(g,0);for(var y=0;y<h;y++)l[m+y]^=g[y]}});return s.Decryptor=u,s})(),r.mode.OFB})})(Dt)),Dt.exports}var Ft={exports:{}},Bj=Ft.exports,Kh;function _j(){return Kh||(Kh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Bj,function(r){return r.mode.ECB=(function(){var s=r.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(u,l){this._cipher.encryptBlock(u,l)}}),s.Decryptor=s.extend({processBlock:function(u,l){this._cipher.decryptBlock(u,l)}}),s})(),r.mode.ECB})})(Ft)),Ft.exports}var Rt={exports:{}},Dj=Rt.exports,Yh;function Fj(){return Yh||(Yh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Dj,function(r){return r.pad.AnsiX923={pad:function(s,u){var l=s.sigBytes,m=u*4,c=m-l%m,h=l+c-1;s.clamp(),s.words[h>>>2]|=c<<24-h%4*8,s.sigBytes+=c},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},r.pad.Ansix923})})(Rt)),Rt.exports}var Tt={exports:{}},Rj=Tt.exports,Zh;function Tj(){return Zh||(Zh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Rj,function(r){return r.pad.Iso10126={pad:function(s,u){var l=u*4,m=l-s.sigBytes%l;s.concat(r.lib.WordArray.random(m-1)).concat(r.lib.WordArray.create([m<<24],1))},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},r.pad.Iso10126})})(Tt)),Tt.exports}var Pt={exports:{}},Pj=Pt.exports,Xh;function Nj(){return Xh||(Xh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Pj,function(r){return r.pad.Iso97971={pad:function(s,u){s.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(s,u)},unpad:function(s){r.pad.ZeroPadding.unpad(s),s.sigBytes--}},r.pad.Iso97971})})(Pt)),Pt.exports}var Nt={exports:{}},Ij=Nt.exports,Jh;function Mj(){return Jh||(Jh=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Ij,function(r){return r.pad.ZeroPadding={pad:function(s,u){var l=u*4;s.clamp(),s.sigBytes+=l-(s.sigBytes%l||l)},unpad:function(s){for(var u=s.words,l=s.sigBytes-1,l=s.sigBytes-1;l>=0;l--)if(u[l>>>2]>>>24-l%4*8&255){s.sigBytes=l+1;break}}},r.pad.ZeroPadding})})(Nt)),Nt.exports}var It={exports:{}},Oj=It.exports,eg;function Lj(){return eg||(eg=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Oj,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})})(It)),It.exports}var Mt={exports:{}},Hj=Mt.exports,ig;function Vj(){return ig||(ig=1,(function(a,o){(function(r,s,u){a.exports=s(He(),Ri())})(Hj,function(r){return(function(s){var u=r,l=u.lib,m=l.CipherParams,c=u.enc,h=c.Hex,d=u.format;d.Hex={stringify:function(g){return g.ciphertext.toString(h)},parse:function(g){var y=h.parse(g);return m.create({ciphertext:y})}}})(),r.format.Hex})})(Mt)),Mt.exports}var Ot={exports:{}},Uj=Ot.exports,ag;function Wj(){return ag||(ag=1,(function(a,o){(function(r,s,u){a.exports=s(He(),er(),ir(),En(),Ri())})(Uj,function(r){return(function(){var s=r,u=s.lib,l=u.BlockCipher,m=s.algo,c=[],h=[],d=[],g=[],y=[],f=[],z=[],w=[],k=[],v=[];(function(){for(var x=[],_=0;_<256;_++)_<128?x[_]=_<<1:x[_]=_<<1^283;for(var C=0,D=0,_=0;_<256;_++){var R=D^D<<1^D<<2^D<<3^D<<4;R=R>>>8^R&255^99,c[C]=R,h[R]=C;var F=x[C],M=x[F],P=x[M],T=x[R]*257^R*16843008;d[C]=T<<24|T>>>8,g[C]=T<<16|T>>>16,y[C]=T<<8|T>>>24,f[C]=T;var T=P*16843009^M*65537^F*257^C*16843008;z[R]=T<<24|T>>>8,w[R]=T<<16|T>>>16,k[R]=T<<8|T>>>24,v[R]=T,C?(C=F^x[x[x[P^F]]],D^=x[x[D]]):C=D=1}})();var j=[0,1,2,4,8,16,32,64,128,27,54],q=m.AES=l.extend({_doReset:function(){var x;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,C=_.words,D=_.sigBytes/4,R=this._nRounds=D+6,F=(R+1)*4,M=this._keySchedule=[],P=0;P<F;P++)P<D?M[P]=C[P]:(x=M[P-1],P%D?D>6&&P%D==4&&(x=c[x>>>24]<<24|c[x>>>16&255]<<16|c[x>>>8&255]<<8|c[x&255]):(x=x<<8|x>>>24,x=c[x>>>24]<<24|c[x>>>16&255]<<16|c[x>>>8&255]<<8|c[x&255],x^=j[P/D|0]<<24),M[P]=M[P-D]^x);for(var T=this._invKeySchedule=[],U=0;U<F;U++){var P=F-U;if(U%4)var x=M[P];else var x=M[P-4];U<4||P<=4?T[U]=x:T[U]=z[c[x>>>24]]^w[c[x>>>16&255]]^k[c[x>>>8&255]]^v[c[x&255]]}}},encryptBlock:Line truncated
*/return r.mode.CTRGladman=(function(){var s=r.lib.BlockCipherMode.extend();function c(u){if((u>>24&255)===255){var h=u>>16&255,d=u>>8&255,g=u&255;h===255?(h=0,d===255?(d=0,g===255?g=0:++g):++d):++h,u=0,u+=h<<16,u+=d<<8,u+=g}else u+=1<<24;return u}function l(u){return(u[0]=c(u[0]))===0&&(u[1]=c(u[1])),u}var m=s.Encryptor=s.extend({processBlock:function(u,h){var d=this._cipher,g=d.blockSize,y=this._iv,f=this._counter;y&&(f=this._counter=y.slice(0),this._iv=void 0),l(f);var z=f.slice(0);d.encryptBlock(z,0);for(var w=0;w<g;w++)u[h+w]^=z[w]}});return s.Decryptor=m,s})(),r.mode.CTRGladman})})(_t)),_t.exports}var Dt={exports:{}},Ej=Dt.exports,Qh;function Sj(){return Qh||(Qh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Ej,function(r){return r.mode.OFB=(function(){var s=r.lib.BlockCipherMode.extend(),c=s.Encryptor=s.extend({processBlock:function(l,m){var u=this._cipher,h=u.blockSize,d=this._iv,g=this._keystream;d&&(g=this._keystream=d.slice(0),this._iv=void 0),u.encryptBlock(g,0);for(var y=0;y<h;y++)l[m+y]^=g[y]}});return s.Decryptor=c,s})(),r.mode.OFB})})(Dt)),Dt.exports}var Ft={exports:{}},Bj=Ft.exports,Kh;function _j(){return Kh||(Kh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Bj,function(r){return r.mode.ECB=(function(){var s=r.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(c,l){this._cipher.encryptBlock(c,l)}}),s.Decryptor=s.extend({processBlock:function(c,l){this._cipher.decryptBlock(c,l)}}),s})(),r.mode.ECB})})(Ft)),Ft.exports}var Rt={exports:{}},Dj=Rt.exports,Yh;function Fj(){return Yh||(Yh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Dj,function(r){return r.pad.AnsiX923={pad:function(s,c){var l=s.sigBytes,m=c*4,u=m-l%m,h=l+u-1;s.clamp(),s.words[h>>>2]|=u<<24-h%4*8,s.sigBytes+=u},unpad:function(s){var c=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=c}},r.pad.Ansix923})})(Rt)),Rt.exports}var Tt={exports:{}},Rj=Tt.exports,Zh;function Tj(){return Zh||(Zh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Rj,function(r){return r.pad.Iso10126={pad:function(s,c){var l=c*4,m=l-s.sigBytes%l;s.concat(r.lib.WordArray.random(m-1)).concat(r.lib.WordArray.create([m<<24],1))},unpad:function(s){var c=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=c}},r.pad.Iso10126})})(Tt)),Tt.exports}var Pt={exports:{}},Pj=Pt.exports,Xh;function Nj(){return Xh||(Xh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Pj,function(r){return r.pad.Iso97971={pad:function(s,c){s.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(s,c)},unpad:function(s){r.pad.ZeroPadding.unpad(s),s.sigBytes--}},r.pad.Iso97971})})(Pt)),Pt.exports}var Nt={exports:{}},Ij=Nt.exports,Jh;function Mj(){return Jh||(Jh=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Ij,function(r){return r.pad.ZeroPadding={pad:function(s,c){var l=c*4;s.clamp(),s.sigBytes+=l-(s.sigBytes%l||l)},unpad:function(s){for(var c=s.words,l=s.sigBytes-1,l=s.sigBytes-1;l>=0;l--)if(c[l>>>2]>>>24-l%4*8&255){s.sigBytes=l+1;break}}},r.pad.ZeroPadding})})(Nt)),Nt.exports}var It={exports:{}},Oj=It.exports,eg;function Lj(){return eg||(eg=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Oj,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})})(It)),It.exports}var Mt={exports:{}},Hj=Mt.exports,ig;function Vj(){return ig||(ig=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),Ti())})(Hj,function(r){return(function(s){var c=r,l=c.lib,m=l.CipherParams,u=c.enc,h=u.Hex,d=c.format;d.Hex={stringify:function(g){return g.ciphertext.toString(h)},parse:function(g){var y=h.parse(g);return m.create({ciphertext:y})}}})(),r.format.Hex})})(Mt)),Mt.exports}var Ot={exports:{}},Uj=Ot.exports,ag;function Wj(){return ag||(ag=1,(function(a,o){(function(r,s,c){a.exports=s(Ue(),er(),ir(),En(),Ti())})(Uj,function(r){return(function(){var s=r,c=s.lib,l=c.BlockCipher,m=s.algo,u=[],h=[],d=[],g=[],y=[],f=[],z=[],w=[],k=[],v=[];(function(){for(var x=[],_=0;_<256;_++)_<128?x[_]=_<<1:x[_]=_<<1^283;for(var A=0,D=0,_=0;_<256;_++){var R=D^D<<1^D<<2^D<<3^D<<4;R=R>>>8^R&255^99,u[A]=R,h[R]=A;var F=x[A],M=x[F],P=x[M],T=x[R]*257^R*16843008;d[A]=T<<24|T>>>8,g[A]=T<<16|T>>>16,y[A]=T<<8|T>>>24,f[A]=T;var T=P*16843009^M*65537^F*257^A*16843008;z[R]=T<<24|T>>>8,w[R]=T<<16|T>>>16,k[R]=T<<8|T>>>24,v[R]=T,A?(A=F^x[x[x[P^F]]],D^=x[x[D]]):A=D=1}})();var j=[0,1,2,4,8,16,32,64,128,27,54],q=m.AES=l.extend({_doReset:function(){var x;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,A=_.words,D=_.sigBytes/4,R=this._nRounds=D+6,F=(R+1)*4,M=this._keySchedule=[],P=0;P<F;P++)P<D?M[P]=A[P]:(x=M[P-1],P%D?D>6&&P%D==4&&(x=u[x>>>24]<<24|u[x>>>16&255]<<16|u[x>>>8&255]<<8|u[x&255]):(x=x<<8|x>>>24,x=u[x>>>24]<<24|u[x>>>16&255]<<16|u[x>>>8&255]<<8|u[x&255],x^=j[P/D|0]<<24),M[P]=M[P-D]^x);for(var T=this._invKeySchedule=[],W=0;W<F;W++){var P=F-W;if(W%4)var x=M[P];else var x=M[P-4];W<4||P<=4?T[W]=x:T[W]=z[u[x>>>24]]^w[u[x>>>16&255]]^k[u[x>>>8&255]]^v[u[x&255]]}}},encryptBlock:Line truncated
• Timestamp (4 bytes) - send time as unix timestamp
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
• Request Data (remaining bytes) - additional request-specific data`,startByte:c+h,endByte:c+u.length-1,value:f});const z={type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Co.RequestPayloadDecoder=r,Co}var Eo={},qg;function Cq(){if(qg)return Eo;qg=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.ResponsePayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(u,l){try{if(u.length<4){const w={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),w}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,o.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:c+h,endByte:c+u.length-1,value:f});const z={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Eo.ResponsePayloadDecoder=r,Eo}var So={},Ag;function Eq(){if(Ag)return So;Ag=1,Object.defineProperty(So,"__esModule",{value:!0}),So.AnonRequestPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(u,l){try{if(u.length<35){const w={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),w}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[0]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${d}`,startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.bytesToHex)(u.subarray(1,33));l!=null&&l.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:c+h,endByte:c+h+31,value:g}),h+=32;const y=(0,o.bytesToHex)(u.subarray(33,35));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(35));l!=null&&l.includeSegments&&u.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${u.length-35} bytes). Contains encrypted plaintext with this structure:
• Request Data (remaining bytes) - additional request-specific data`,startByte:u+h,endByte:u+c.length-1,value:f});const z={type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Co.RequestPayloadDecoder=r,Co}var Eo={},qg;function Cq(){if(qg)return Eo;qg=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.ResponsePayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(c,l){try{if(c.length<4){const w={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+c.length-1,value:(0,o.bytesToHex)(c)}]),w}const m=[],u=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(c[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:u+h,endByte:u+h,value:d}),h+=1;const g=(0,o.byteToHex)(c[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:u+h,endByte:u+h,value:g}),h+=1;const y=(0,o.bytesToHex)(c.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:u+h,endByte:u+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(c.subarray(h));l!=null&&l.includeSegments&&c.length>h&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:u+h,endByte:u+c.length-1,value:f});const z={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:c.length-4};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Eo.ResponsePayloadDecoder=r,Eo}var So={},Ag;function Eq(){if(Ag)return So;Ag=1,Object.defineProperty(So,"__esModule",{value:!0}),So.AnonRequestPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(c,l){try{if(c.length<35){const w={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+c.length-1,value:(0,o.bytesToHex)(c)}]),w}const m=[],u=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(c[0]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${d}`,startByte:u+h,endByte:u+h,value:d}),h+=1;const g=(0,o.bytesToHex)(c.subarray(1,33));l!=null&&l.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:u+h,endByte:u+h+31,value:g}),h+=32;const y=(0,o.bytesToHex)(c.subarray(33,35));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:u+h,endByte:u+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(c.subarray(35));l!=null&&l.includeSegments&&c.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${c.length-35} bytes). Contains encrypted plaintext with this structure:
• Timestamp (4 bytes) - send time as unix timestamp
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
• Password (remaining bytes) - password for repeater/room`,startByte:c+h,endByte:c+u.length-1,value:f});const z={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,senderPublicKey:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-35};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return So.AnonRequestPayloadDecoder=r,So}var Bo={},Cg;function Sq(){if(Cg)return Bo;Cg=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.AckPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(u,l){try{if(u.length<4){const g={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return l!=null&&l.includeSegments&&(g.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),g}const m=[],c=(l==null?void 0:l.segmentOffset)||0,h=(0,o.bytesToHex)(u.subarray(0,4));l!=null&&l.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${h}`,startByte:c,endByte:c+3,value:h}),l!=null&&l.includeSegments&&u.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:c+4,endByte:c+u.length-1,value:(0,o.bytesToHex)(u.subarray(4))});const d={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!0,checksum:h};return l!=null&&l.includeSegments&&(d.segments=m),d}catch(m){return{type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return Bo.AckPayloadDecoder=r,Bo}var _o={},Eg;function Bq(){if(Eg)return _o;Eg=1,Object.defineProperty(_o,"__esModule",{value:!0}),_o.PathPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(u){try{if(u.length<2)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const l=u[0];if(u.length<1+l+1)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+l+1} bytes for path length + path + extra type)`],pathLength:l,pathHashes:[],extraType:0,extraData:""};const m=[];for(let d=0;d<l;d++)m.push((0,o.byteToHex)(u[1+d]));const c=u[1+l];let h="";return u.length>1+l+1&&(h=(0,o.bytesToHex)(u.subarray(1+l+1))),{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!0,pathLength:l,pathHashes:m,extraType:c,extraData:h}}catch(l){return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[l instanceof Error?l.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return _o.PathPayloadDecoder=r,_o}var Do={},Sg;function _q(){if(Sg)return Do;Sg=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.TextMessagePayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(u,l){try{if(u.length<4){const w={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),w}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,o.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:c+h,endByte:c+u.length-1,value:f});const z={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,i Line truncated
• Password (remaining bytes) - password for repeater/room`,startByte:u+h,endByte:u+c.length-1,value:f});const z={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,senderPublicKey:g,cipherMac:y,ciphertext:f,ciphertextLength:c.length-35};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return So.AnonRequestPayloadDecoder=r,So}var Bo={},Cg;function Sq(){if(Cg)return Bo;Cg=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.AckPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(c,l){try{if(c.length<4){const g={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return l!=null&&l.includeSegments&&(g.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+c.length-1,value:(0,o.bytesToHex)(c)}]),g}const m=[],u=(l==null?void 0:l.segmentOffset)||0,h=(0,o.bytesToHex)(c.subarray(0,4));l!=null&&l.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${h}`,startByte:u,endByte:u+3,value:h}),l!=null&&l.includeSegments&&c.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:u+4,endByte:u+c.length-1,value:(0,o.bytesToHex)(c.subarray(4))});const d={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!0,checksum:h};return l!=null&&l.includeSegments&&(d.segments=m),d}catch(m){return{type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return Bo.AckPayloadDecoder=r,Bo}var _o={},Eg;function Bq(){if(Eg)return _o;Eg=1,Object.defineProperty(_o,"__esModule",{value:!0}),_o.PathPayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(c){try{if(c.length<2)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const l=c[0];if(c.length<1+l+1)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+l+1} bytes for path length + path + extra type)`],pathLength:l,pathHashes:[],extraType:0,extraData:""};const m=[];for(let d=0;d<l;d++)m.push((0,o.byteToHex)(c[1+d]));const u=c[1+l];let h="";return c.length>1+l+1&&(h=(0,o.bytesToHex)(c.subarray(1+l+1))),{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!0,pathLength:l,pathHashes:m,extraType:u,extraData:h}}catch(l){return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[l instanceof Error?l.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return _o.PathPayloadDecoder=r,_o}var Do={},Sg;function _q(){if(Sg)return Do;Sg=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.TextMessagePayloadDecoder=void 0;const a=da(),o=Mi();class r{static decode(c,l){try{if(c.length<4){const w={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(w.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+c.length-1,value:(0,o.bytesToHex)(c)}]),w}const m=[],u=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(c[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:u+h,endByte:u+h,value:d}),h+=1;const g=(0,o.byteToHex)(c[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:u+h,endByte:u+h,value:g}),h+=1;const y=(0,o.bytesToHex)(c.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:u+h,endByte:u+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(c.subarray(h));l!=null&&l.includeSegments&&c.length>h&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:u+h,endByte:u+c.length-1,value:f});const z={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:c.length-4};return l!=null&&l.includeSegments&&(z.segments=m),z}catch(m){return{type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,i Line truncated
// SHA256 round constants
const K: array<u32, 64> = array<u32, 64>(
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
@@ -527,11 +527,11 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
process_candidate(name_idx);
}
}
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const o=await navigator.gpu.requestAdapter();if(!o)return console.warn("No GPU adapter found"),!1;this.device=await o.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let u=0;u<2;u++)this.matchCountReadBuffers[u]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[u]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const r=this.device.createShaderModule({code:this.shaderCode}),s=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:s,compute:{module:r,entryPoint:"main"}}),!0}catch(o){return console.error("WebGPU initialization failed:",o),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(o,r){return Yn(r,o)}countNamesForLength(o){return Po(o)}async runBatch(o,r,s,u,l,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const c=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const h=this.matchCountReadBuffers[c],d=this.matchIndicesReadBuffers[c],g=l&&m?1:0;let y,f=0,z=0;if(g){const C=new Uint8Array(l.length/2);for(let P=0;P<C.length;P++)C[P]=parseInt(l.substr(P*2,2),16);f=C.length*8;const D=Math.ceil(C.length/4)*4,R=new Uint8Array(D);R.set(C),y=new Uint32Array(D/4);for(let P=0;P<y.length;P++)y[P]=R[P*4]<<24|R[P*4+1]<<16|R[P*4+2]<<8|R[P*4+3];const F=parseInt(m.substr(0,2),16),M=parseInt(m.substr(2,2),16);z=F<<24|M<<16}else y=new Uint32Array([0]);const w=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<w)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:w,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=w,this.bindGroupDirty=!0);const k=new Uint32Array([o,s,r,u,z,y.length,f,g]);this.device.queue.writeBuffer(this.paramsBuffer,0,k),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,yl.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const v=this.device.createCommandEncoder(),j=v.beginComputePass();j.setPipeline(this.pipeline),j.setBindGroup(0,this.bindGroup),j.dispatchWorkgroups(Math.ceil(u/(256*16))),j.end(),v.copyBufferToBuffer(this.matchCountBuffer,0,h,0,4),v.copyBufferToBuffer(this.matchIndicesBuffer,0,d,0,1024*4),this.device.queue.submit([v.finish()]),await h.mapAsync(GPUMapMode.READ);const x=new Uint32Array(h.getMappedRange())[0];h.unmap();const _=[];if(x>0){await d.mapAsync(GPUMapMode.READ);const C=new Uint32Array(d.getMappedRange());for(let D=0;D<Math.min(x,1024);D++)_.push(C[D]);d.unmap()}return _}destroy(){var o,r,s,u,l,m,c,h;(o=this.paramsBuffer)==null||o.destroy(),(r=this.matchCountBuffer)==null||r.destroy(),(s=this.matchIndicesBuffer)==null||s.destroy(),(u=this.ciphertextBuffer)==null||u.destroy(),(l=this.matchCountReadBuffers[0])==null||l.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(c=this.matchIndicesReadBuffers[0])==null||c.destroy(),(h=this.matchIndicesReadBuffers[1])==null||h.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}yl.ZERO_DATA=new Uint32Array([0]);function Wq(){return typeof navigator<"u"&&"gpu"in navigator}class Mg{runBatch(o,r,s,u,l,m){const c=[],h=o.toString(16).padStart(2,"0") Line truncated
`).map(l=>l.trim().toLowerCase()).filter(l=>l.length>0);this.wordlist=u.filter(Og)}setWordlist(o){this.wordlist=o.map(r=>r.trim().toLowerCase()).filter(Og)}abort(){this.abortFlag=!0}isGpuAvailable(){return Wq()}async decodePacket(o){var s;const r=o.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!r||!/^[0-9a-fA-F]+$/.test(r))return null;try{const l=(s=(await Pg.MeshCorePacketDecoder.decodeWithVerification(r,{})).payload)==null?void 0:s.decoded;return!(l!=null&&l.channelHash)||!(l!=null&&l.ciphertext)||!(l!=null&&l.cipherMac)?null:{channelHash:l.channelHash,ciphertext:l.ciphertext,cipherMac:l.cipherMac,isGroupText:!0}}catch{return null}}async crack(o,r,s){this.abortFlag=!1,this.useTimestampFilter=(r==null?void 0:r.useTimestampFilter)??!0,this.useUtf8Filter=(r==null?void 0:r.useUtf8Filter)??!0,this.validSeconds=(r==null?void 0:r.validSeconds)??Du,this.useCpu=(r==null?void 0:r.forceCpu)??!1;const u=(r==null?void 0:r.maxLength)??8,l=(r==null?void 0:r.startingLength)??1,m=(r==null?void 0:r.useDictionary)??!0,c=(r==null?void 0:r.startFromType)??"bruteforce",h=o.toLowerCase(),d=await this.decodePacket(h);if(!d)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:g,ciphertext:y,cipherMac:f}=d,z=parseInt(g,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Mg):this.gpuInstance||(this.gpuInstance=new yl,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Mg));const w=performance.now();let k=0,v=performance.now(),j=l,q=0,x=0,_=!1;if(r!=null&&r.startFrom){const H=r.startFrom.toLowerCase();if(c==="dictionary"){const K=this.wordlist.indexOf(H);K>=0&&(x=K+1)}else{_=!0;const K=Hq(H);K&&(j=Math.max(l,K.length),q=K.index+1,q>=Po(j)&&(j++,q=0))}}let C=0;m&&!_&&this.wordlist.length>0&&(C+=this.wordlist.length-x);for(let H=j;H<=u;H++)C+=Po(H);C-=q;const D=(H,K,ie)=>{if(!s)return;const ae=(performance.now()-w)/1e3,W=ae>0?Math.round(k/ae):0,ne=C-k,J=W>0?ne/W:0;s({checked:k,total:C,percent:C>0?Math.min(100,k/C*100):0,rateKeysPerSec:W,etaSeconds:J,elapsedSeconds:ae,currentLength:K,currentPosition:ie,phase:H})},R=H=>{if(!Jb(y,f,H))return{valid:!1};const K=Pg.ChannelCrypto.decryptGroupTextMessage(y,f,H);return!K.success||!K.data?{valid:!1}:this.useTimestampFilter&&!Vq(K.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!Uq(K.data.message)?{valid:!1}:{valid:!0,message:K.data.message}};if(!_&&x===0&&j===l&&q===0){D("public-key",0,_u);const H=Ru(Kt);if(g===H){const K=R(Kt);if(K.valid)return{found:!0,roomName:_u,key:Kt,decryptedMessage:K.message}}}if(m&&!_&&this.wordlist.length>0)for(let H=x;H<this.wordlist.length;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[H],resumeType:"dictionary"};const K=this.wordlist[H],ie=Fu("#"+K),Z=Ru(ie);if(parseInt(Z,16)===z){const W=R(ie);if(W.valid)return{found:!0,roomName:K,key:ie,decryptedMessage:W.message,resumeFrom:K,resumeType:"dictionary"}}k++;const ae=performance.now();ae-v>=200&&(D("wordlist",K.length,K),v=ae,await new Promise(W=>setTimeout(W,0)))}const F=this.useCpu?1024:32768,M=(r==null?void 0:r.gpuDispatchMs)??1e3;let P=F,T=!1;for(let H=j;H<=u;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Yn(H,0)||void 0,resumeType:"bruteforce"};const K=Po(H);let ie=H===j?q:0;for(;ie<K;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Yn(H,ie)||void 0,resumeType:"bruteforce"};const Z=Math.min(P,K-ie),ae=performance.now();let W;this.useCpu?W=this.cpuInstance.runBatch(z,H,ie,Z,y,f):W=await this.gpuInstance.runBatch(z,H,ie,Z,y,f);const ne=performance.now()-ae;if(k+=Z,!this.useCpu&&!T&&Z>=F&&ne>0){const A=M/ne,I=Math.round(Z*A),L=Math.pow(2,Math.round(Math.log2(Math.max(F,I))));P=Math.max(F,L),T=!0}for(const A of W){const I=Yn(H,A);if(!I)continue;const L=Fu("#"+I),$=R(L);if($.valid)return{found:!0,roomName:I,key:L,decryptedMessage:$.message,resumeFrom:I,resumeType:"bruteforce"}}ie+=Z;const J=performance.now();if(J-v>=200){const A=Yn(H,Math.min(ie,K-1))||"";D("bruteforce",H,A),v=J,await new Promise(I=>setTimeout(I,0))}}}return{found:!1,resumeFrom:Yn(u,Po(u)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}const Yq=["2","1080","10-point","10th","11-point","12-point","16-point","18-point","1st","20-point","2d","2nd","30-30","3d","3-d","3m","3rd","48-point","4-d","4gl","4h","4th","5-point","5-t","5th","6-point","6th","7-point","7th","8-point","8th","9-point","9th","a","a1","a-1","a4","a5","aa","aaa","aaaa","aaaaaa","aaal","aaas","aaberg","aachen","aae","aaee","aaf","aag","aah","aahed","aahing","aahs","aaii","aal","aalborg","aalesund","aalii","aaliis","aals","aalst","aalto","aam","aamsi","aandahl","a-and-r","aani","aao","aap","aapss","aaqbiye","aar","aara","aarau","aarc","aardvark","aardvarks","aardwolf","aardwolves","aaren","aargau","aargh","aarhus","aarika","aaron","aaronic","aaronical","aaronite","aaronitic","aaronsburg","aaronson","aarp","aarrgh","aarrghh","aaru","a Line truncated
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const o=await navigator.gpu.requestAdapter();if(!o)return console.warn("No GPU adapter found"),!1;this.device=await o.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let c=0;c<2;c++)this.matchCountReadBuffers[c]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[c]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const r=this.device.createShaderModule({code:this.shaderCode}),s=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:s,compute:{module:r,entryPoint:"main"}}),!0}catch(o){return console.error("WebGPU initialization failed:",o),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(o,r){return Yn(r,o)}countNamesForLength(o){return No(o)}async runBatch(o,r,s,c,l,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const u=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const h=this.matchCountReadBuffers[u],d=this.matchIndicesReadBuffers[u],g=l&&m?1:0;let y,f=0,z=0;if(g){const A=new Uint8Array(l.length/2);for(let P=0;P<A.length;P++)A[P]=parseInt(l.substr(P*2,2),16);f=A.length*8;const D=Math.ceil(A.length/4)*4,R=new Uint8Array(D);R.set(A),y=new Uint32Array(D/4);for(let P=0;P<y.length;P++)y[P]=R[P*4]<<24|R[P*4+1]<<16|R[P*4+2]<<8|R[P*4+3];const F=parseInt(m.substr(0,2),16),M=parseInt(m.substr(2,2),16);z=F<<24|M<<16}else y=new Uint32Array([0]);const w=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<w)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:w,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=w,this.bindGroupDirty=!0);const k=new Uint32Array([o,s,r,c,z,y.length,f,g]);this.device.queue.writeBuffer(this.paramsBuffer,0,k),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,yl.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const v=this.device.createCommandEncoder(),j=v.beginComputePass();j.setPipeline(this.pipeline),j.setBindGroup(0,this.bindGroup),j.dispatchWorkgroups(Math.ceil(c/(256*16))),j.end(),v.copyBufferToBuffer(this.matchCountBuffer,0,h,0,4),v.copyBufferToBuffer(this.matchIndicesBuffer,0,d,0,1024*4),this.device.queue.submit([v.finish()]),await h.mapAsync(GPUMapMode.READ);const x=new Uint32Array(h.getMappedRange())[0];h.unmap();const _=[];if(x>0){await d.mapAsync(GPUMapMode.READ);const A=new Uint32Array(d.getMappedRange());for(let D=0;D<Math.min(x,1024);D++)_.push(A[D]);d.unmap()}return _}destroy(){var o,r,s,c,l,m,u,h;(o=this.paramsBuffer)==null||o.destroy(),(r=this.matchCountBuffer)==null||r.destroy(),(s=this.matchIndicesBuffer)==null||s.destroy(),(c=this.ciphertextBuffer)==null||c.destroy(),(l=this.matchCountReadBuffers[0])==null||l.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(u=this.matchIndicesReadBuffers[0])==null||u.destroy(),(h=this.matchIndicesReadBuffers[1])==null||h.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}yl.ZERO_DATA=new Uint32Array([0]);function Wq(){return typeof navigator<"u"&&"gpu"in navigator}class Mg{runBatch(o,r,s,c,l,m){const u=[],h=o.toString(16).padStart(2,"0") Line truncated
`).map(l=>l.trim().toLowerCase()).filter(l=>l.length>0);this.wordlist=c.filter(Og)}setWordlist(o){this.wordlist=o.map(r=>r.trim().toLowerCase()).filter(Og)}abort(){this.abortFlag=!0}isGpuAvailable(){return Wq()}async decodePacket(o){var s;const r=o.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!r||!/^[0-9a-fA-F]+$/.test(r))return null;try{const l=(s=(await Pg.MeshCorePacketDecoder.decodeWithVerification(r,{})).payload)==null?void 0:s.decoded;return!(l!=null&&l.channelHash)||!(l!=null&&l.ciphertext)||!(l!=null&&l.cipherMac)?null:{channelHash:l.channelHash,ciphertext:l.ciphertext,cipherMac:l.cipherMac,isGroupText:!0}}catch{return null}}async crack(o,r,s){this.abortFlag=!1,this.useTimestampFilter=(r==null?void 0:r.useTimestampFilter)??!0,this.useUtf8Filter=(r==null?void 0:r.useUtf8Filter)??!0,this.validSeconds=(r==null?void 0:r.validSeconds)??Du,this.useCpu=(r==null?void 0:r.forceCpu)??!1;const c=(r==null?void 0:r.maxLength)??8,l=(r==null?void 0:r.startingLength)??1,m=(r==null?void 0:r.useDictionary)??!0,u=(r==null?void 0:r.startFromType)??"bruteforce",h=o.toLowerCase(),d=await this.decodePacket(h);if(!d)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:g,ciphertext:y,cipherMac:f}=d,z=parseInt(g,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Mg):this.gpuInstance||(this.gpuInstance=new yl,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Mg));const w=performance.now();let k=0,v=performance.now(),j=l,q=0,x=0,_=!1;if(r!=null&&r.startFrom){const H=r.startFrom.toLowerCase();if(u==="dictionary"){const K=this.wordlist.indexOf(H);K>=0&&(x=K+1)}else{_=!0;const K=Hq(H);K&&(j=Math.max(l,K.length),q=K.index+1,q>=No(j)&&(j++,q=0))}}let A=0;m&&!_&&this.wordlist.length>0&&(A+=this.wordlist.length-x);for(let H=j;H<=c;H++)A+=No(H);A-=q;const D=(H,K,ie)=>{if(!s)return;const ne=(performance.now()-w)/1e3,U=ne>0?Math.round(k/ne):0,ae=A-k,J=U>0?ae/U:0;s({checked:k,total:A,percent:A>0?Math.min(100,k/A*100):0,rateKeysPerSec:U,etaSeconds:J,elapsedSeconds:ne,currentLength:K,currentPosition:ie,phase:H})},R=H=>{if(!Jb(y,f,H))return{valid:!1};const K=Pg.ChannelCrypto.decryptGroupTextMessage(y,f,H);return!K.success||!K.data?{valid:!1}:this.useTimestampFilter&&!Vq(K.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!Uq(K.data.message)?{valid:!1}:{valid:!0,message:K.data.message}};if(!_&&x===0&&j===l&&q===0){D("public-key",0,_u);const H=Ru(Kt);if(g===H){const K=R(Kt);if(K.valid)return{found:!0,roomName:_u,key:Kt,decryptedMessage:K.message}}}if(m&&!_&&this.wordlist.length>0)for(let H=x;H<this.wordlist.length;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[H],resumeType:"dictionary"};const K=this.wordlist[H],ie=Fu("#"+K),Y=Ru(ie);if(parseInt(Y,16)===z){const U=R(ie);if(U.valid)return{found:!0,roomName:K,key:ie,decryptedMessage:U.message,resumeFrom:K,resumeType:"dictionary"}}k++;const ne=performance.now();ne-v>=200&&(D("wordlist",K.length,K),v=ne,await new Promise(U=>setTimeout(U,0)))}const F=this.useCpu?1024:32768,M=(r==null?void 0:r.gpuDispatchMs)??1e3;let P=F,T=!1;for(let H=j;H<=c;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Yn(H,0)||void 0,resumeType:"bruteforce"};const K=No(H);let ie=H===j?q:0;for(;ie<K;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Yn(H,ie)||void 0,resumeType:"bruteforce"};const Y=Math.min(P,K-ie),ne=performance.now();let U;this.useCpu?U=this.cpuInstance.runBatch(z,H,ie,Y,y,f):U=await this.gpuInstance.runBatch(z,H,ie,Y,y,f);const ae=performance.now()-ne;if(k+=Y,!this.useCpu&&!T&&Y>=F&&ae>0){const E=M/ae,I=Math.round(Y*E),L=Math.pow(2,Math.round(Math.log2(Math.max(F,I))));P=Math.max(F,L),T=!0}for(const E of U){const I=Yn(H,E);if(!I)continue;const L=Fu("#"+I),$=R(L);if($.valid)return{found:!0,roomName:I,key:L,decryptedMessage:$.message,resumeFrom:I,resumeType:"bruteforce"}}ie+=Y;const J=performance.now();if(J-v>=200){const E=Yn(H,Math.min(ie,K-1))||"";D("bruteforce",H,E),v=J,await new Promise(I=>setTimeout(I,0))}}}return{found:!1,resumeFrom:Yn(c,No(c)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}const Yq=["2","1080","10-point","10th","11-point","12-point","16-point","18-point","1st","20-point","2d","2nd","30-30","3d","3-d","3m","3rd","48-point","4-d","4gl","4h","4th","5-point","5-t","5th","6-point","6th","7-point","7th","8-point","8th","9-point","9th","a","a1","a-1","a4","a5","aa","aaa","aaaa","aaaaaa","aaal","aaas","aaberg","aachen","aae","aaee","aaf","aag","aah","aahed","aahing","aahs","aaii","aal","aalborg","aalesund","aalii","aaliis","aals","aalst","aalto","aam","aamsi","aandahl","a-and-r","aani","aao","aap","aapss","aaqbiye","aar","aara","aarau","aarc","aardvark","aardvarks","aardwolf","aardwolves","aaren","aargau","aargh","aarhus","aarika","aaron","aaronic","aaronical","aaronite","aaronitic","aaronsburg","aaronson","aarp","aarrgh","aarrghh","aaru","a Line truncated
NoSleep enabled for older iOS devices. This can interrupt
active or long-running network requests from completing successfully.
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(c=>(this.enabled=!0,c)).catch(c=>{throw this.enabled=!1,c})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):r()?this.noSleepTimer&&(console.warn(`
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(u=>(this.enabled=!0,u)).catch(u=>{throw this.enabled=!1,u})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):r()?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return ku=u,ku}var Jq=Xq();const eA=Rr(Jq);function iA(a){if(a.length<4)return null;try{const r=parseInt(a.slice(0,2),16)&3;let s=2;if(r===0||r===3){if(a.length<s+8)return null;s+=8}if(a.length<s+2)return null;const u=parseInt(a.slice(s,s+2),16);s+=2;const l=u*2;return a.length<s+l?null:(s+=l,a.slice(s))}catch{return null}}function aA({packets:a,channels:o,onChannelCreate:r,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,z]=E.useState(!1),[w,k]=E.useState(null),[v,j]=E.useState(new Map),[q,x]=E.useState([]),[_,C]=E.useState(!1),[D,R]=E.useState(null),[F,M]=E.useState(null),[P,T]=E.useState(0),U=E.useRef(null),H=E.useRef(null),K=E.useRef(!1),ie=E.useRef(!1),Z=E.useRef(!1),ae=E.useRef(new Map),W=E.useRef(!1),ne=E.useRef(6),J=E.useRef(!0),A=E.useRef(!1),I=E.useRef(new Set),L=E.useRef(new Set);E.useEffect(()=>{const ge=new Kq;U.current=ge,R(ge.isGpuAvailable());const Ce=new eA;return H.current=Ce,ge.setWordlist(Yq),C(!0),()=>{ge.destroy(),U.current=null,Ce.disable(),H.current=null}},[]),E.useEffect(()=>{const ge=()=>{We.getUndecryptedPacketCount().then(({count:Be})=>M(Be)).catch(()=>M(null))};ge();const Ce=setInterval(ge,3e4);return()=>clearInterval(Ce)},[]);const $=new Set(o.map(ge=>ge.key.toUpperCase())),le=a.filter(ge=>ge.payload_type==="GROUP_TEXT"&&!ge.decrypted);E.useEffect(()=>{let ge=0;j(Ce=>{const Be=new Map(Ce);let ci=!1;for(const ui of le)if(!Be.has(ui.id)){const Ye=iA(ui.data);if(Ye&&L.current.has(Ye)){ge++;continue}Ye&&L.current.add(Ye),Be.set(ui.id,{packet:ui,attempts:0,lastAttemptLength:0,status:"pending"}),ci=!0}return ci?(ae.current=Be,Be):Ce}),ge>0&&T(Ce=>Ce+ge)},[le.length]),E.useEffect(()=>{ae.current=v},[v]),E.useEffect(()=>{W.current=h},[h]),E.useEffect(()=>{ne.current=m},[m]),E.useEffect(()=>{J.current=g},[g]),E.useEffect(()=>{A.current=f},[f]),E.useEffect(()=>{I.current=new Set(le.map(ge=>ge.id))},[le]),E.useEffect(()=>{s==null||s(u)},[u,s]);const pe=Array.from(v.values()).filter(ge=>ge.status==="pending").length,me=Array.from(v.values()).filter(ge=>ge.status==="cracked").length,re=Array.from(v.values()).filter(ge=>ge.status==="failed").length,Ae=E.useCallback(async()=>{if(Z.current||!U.current||!K.current)return;const ge=ae.current;let Ce=null,Be=null;for(const[Ue,Te]of ge.entries())if(Te.status==="pending"){Ce=Te,Be=Ue;break}if(!Ce&&W.current){const Ue=Array.from(ge.entries()).filter(([,Te])=>Te.status==="failed"&&Te.lastAttemptLength<10);Ue.length>0&&(Ue.sort((Te,ii)=>Te[1].lastAttemptLength-ii[1].lastAttemptLength),[Be,Ce]=Ue[0])}if(!Ce||Be===null){K.current&&setTimeout(()=>Ae(),1e3);return}if(!I.current.has(Be)){j(Ue=>{const Te=new Map(Ue);return Te.delete(Be),Te}),K.current&&setTimeout(()=>Ae(),10);return}Z.current=!0;const ci=ne.current,ui=Ce.lastAttemptLength>0,Ye=ui?Ce.lastAttemptLength+1:ci;try{const Ue=await U.current.crack(Ce.packet.data,{maxLength:Ye,useTimestampFilter:!0,useUtf8Filter:!0,...A.current&&{gpuDispatchMs:1e4},...ui&&{useDictionary:!1,startingLength:Ye}},Te=>{k(Te)});if(ie.current){ie.current=!1,Z.current=!1,k(null);return}if(Ue.found&&Ue.roomName&&Ue.key){j(Fe=>{const Ne=new Map(Fe),ni=Ne.get(Be);return ni&&Ne.set(Be,{...ni,status:"cracked",attempts:ni.attempts+1,lastAttemptLength:Ye}),Ne});const Te={roomName:Ue.roomName,key:Ue.key,packetId:Be,message:Ue.decryptedMessage||"",crackedAt:Date.now()};x(Fe=>[...Fe,Te]);const ii=Ue.key.toUpperCase();if(!$.has(ii))try{const Fe="#"+Ue.roomName;await r(Fe,Ue.key),J.current&&await We.decryptHistoricalPackets({key_type:"channel",channel_name:Fe})}catch(Fe){console.error("Failed to create channel or decrypt historical:",Fe),Ii.error("Failed to save cracked channel",{description:Fe instanceof Error?Fe.message:"Channel discovered but could not be saved"})}}else j(Te=>{const ii=new Map(Te),Fe=ii.get(Be);return Fe&&ii.set(Be,{...Fe,status:"failed",attempts:Fe.attempts+1,lastAttemptLength:Ye}),ii})}catch(Ue){console.error("Cracking error:",Ue),j(Te=>{const ii=new Map(Te),Fe=ii.get(Be);return Fe&&ii.set(Be,{...Fe,status:"failed",attempts:Fe.attempts+1,lastAttemptLength:Ye}),ii})}Z.current=!1,k(null),K.current&&setTimeout(()=>Ae(),100)},[$,r]),Me=()=>{var ge;if(!D){Ii.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}l(!0),K.current=!0,ie.current=!1,(ge=H.current)==null||ge.enable(),Ae()},mi=()=>{var ge,Ce;l(!1),K.current=!1,ie.current=!0,(ge=U.current)==null||ge.abort(),(Ce=H.current)==null||Ce.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will Line truncated
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return ku=c,ku}var Jq=Xq();const eA=Rr(Jq);function iA(a){if(a.length<4)return null;try{const r=parseInt(a.slice(0,2),16)&3;let s=2;if(r===0||r===3){if(a.length<s+8)return null;s+=8}if(a.length<s+2)return null;const c=parseInt(a.slice(s,s+2),16);s+=2;const l=c*2;return a.length<s+l?null:(s+=l,a.slice(s))}catch{return null}}function aA({packets:a,channels:o,onChannelCreate:r,onRunningChange:s}){const[c,l]=C.useState(!1),[m,u]=C.useState(6),[h,d]=C.useState(!1),[g,y]=C.useState(!0),[f,z]=C.useState(!1),[w,k]=C.useState(null),[v,j]=C.useState(new Map),[q,x]=C.useState([]),[_,A]=C.useState(!1),[D,R]=C.useState(null),[F,M]=C.useState(null),[P,T]=C.useState(0),W=C.useRef(null),H=C.useRef(null),K=C.useRef(!1),ie=C.useRef(!1),Y=C.useRef(!1),ne=C.useRef(new Map),U=C.useRef(!1),ae=C.useRef(6),J=C.useRef(!0),E=C.useRef(!1),I=C.useRef(new Set),L=C.useRef(new Set);C.useEffect(()=>{const me=new Kq;W.current=me,R(me.isGpuAvailable());const Ee=new eA;return H.current=Ee,me.setWordlist(Yq),A(!0),()=>{me.destroy(),W.current=null,Ee.disable(),H.current=null}},[]),C.useEffect(()=>{const me=()=>{Le.getUndecryptedPacketCount().then(({count:_e})=>M(_e)).catch(()=>M(null))};me();const Ee=setInterval(me,3e4);return()=>clearInterval(Ee)},[]);const $=new Set(o.map(me=>me.key.toUpperCase())),re=a.filter(me=>me.payload_type==="GROUP_TEXT"&&!me.decrypted);C.useEffect(()=>{let me=0;j(Ee=>{const _e=new Map(Ee);let ui=!1;for(const di of re)if(!_e.has(di.id)){const Xe=iA(di.data);if(Xe&&L.current.has(Xe)){me++;continue}Xe&&L.current.add(Xe),_e.set(di.id,{packet:di,attempts:0,lastAttemptLength:0,status:"pending"}),ui=!0}return ui?(ne.current=_e,_e):Ee}),me>0&&T(Ee=>Ee+me)},[re.length]),C.useEffect(()=>{ne.current=v},[v]),C.useEffect(()=>{U.current=h},[h]),C.useEffect(()=>{ae.current=m},[m]),C.useEffect(()=>{J.current=g},[g]),C.useEffect(()=>{E.current=f},[f]),C.useEffect(()=>{I.current=new Set(re.map(me=>me.id))},[re]),C.useEffect(()=>{s==null||s(c)},[c,s]);const pe=Array.from(v.values()).filter(me=>me.status==="pending").length,he=Array.from(v.values()).filter(me=>me.status==="cracked").length,oe=Array.from(v.values()).filter(me=>me.status==="failed").length,Ae=C.useCallback(async()=>{if(Y.current||!W.current||!K.current)return;const me=ne.current;let Ee=null,_e=null;for(const[$e,Pe]of me.entries())if(Pe.status==="pending"){Ee=Pe,_e=$e;break}if(!Ee&&U.current){const $e=Array.from(me.entries()).filter(([,Pe])=>Pe.status==="failed"&&Pe.lastAttemptLength<10);$e.length>0&&($e.sort((Pe,ai)=>Pe[1].lastAttemptLength-ai[1].lastAttemptLength),[_e,Ee]=$e[0])}if(!Ee||_e===null){K.current&&setTimeout(()=>Ae(),1e3);return}if(!I.current.has(_e)){j($e=>{const Pe=new Map($e);return Pe.delete(_e),Pe}),K.current&&setTimeout(()=>Ae(),10);return}Y.current=!0;const ui=ae.current,di=Ee.lastAttemptLength>0,Xe=di?Ee.lastAttemptLength+1:ui;try{const $e=await W.current.crack(Ee.packet.data,{maxLength:Xe,useTimestampFilter:!0,useUtf8Filter:!0,...E.current&&{gpuDispatchMs:1e4},...di&&{useDictionary:!1,startingLength:Xe}},Pe=>{k(Pe)});if(ie.current){ie.current=!1,Y.current=!1,k(null);return}if($e.found&&$e.roomName&&$e.key){j(Re=>{const Me=new Map(Re),ri=Me.get(_e);return ri&&Me.set(_e,{...ri,status:"cracked",attempts:ri.attempts+1,lastAttemptLength:Xe}),Me});const Pe={roomName:$e.roomName,key:$e.key,packetId:_e,message:$e.decryptedMessage||"",crackedAt:Date.now()};x(Re=>[...Re,Pe]);const ai=$e.key.toUpperCase();if(!$.has(ai))try{const Re="#"+$e.roomName;await r(Re,$e.key),J.current&&await Le.decryptHistoricalPackets({key_type:"channel",channel_name:Re})}catch(Re){console.error("Failed to create channel or decrypt historical:",Re),ki.error("Failed to save cracked channel",{description:Re instanceof Error?Re.message:"Channel discovered but could not be saved"})}}else j(Pe=>{const ai=new Map(Pe),Re=ai.get(_e);return Re&&ai.set(_e,{...Re,status:"failed",attempts:Re.attempts+1,lastAttemptLength:Xe}),ai})}catch($e){console.error("Cracking error:",$e),j(Pe=>{const ai=new Map(Pe),Re=ai.get(_e);return Re&&ai.set(_e,{...Re,status:"failed",attempts:Re.attempts+1,lastAttemptLength:Xe}),ai})}Y.current=!1,k(null),K.current&&setTimeout(()=>Ae(),100)},[$,r]),Ne=()=>{var me;if(!D){ki.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}l(!0),K.current=!0,ie.current=!1,(me=H.current)==null||me.enable(),Ae()},ye=()=>{var me,Ee;l(!1),K.current=!1,ie.current=!0,(me=W.current)==null||me.abort(),(Ee=H.current)==null||Ee.disable()};return S.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[S.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",S.jsx("strong",{children:" Retry failed at n+1"})," will Line truncated
-1
View File
@@ -1 +0,0 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 10%;--foreground: 0 0% 88%;--card: 0 0% 14%;--card-foreground: 0 0% 88%;--popover: 0 0% 14%;--popover-foreground: 0 0% 88%;--primary: 122 39% 49%;--primary-foreground: 0 0% 100%;--secondary: 0 0% 20%;--secondaLine truncated
+1
View File
@@ -0,0 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 10%;--foreground: 0 0% 88%;--card: 0 0% 14%;--card-foreground: 0 0% 88%;--popover: 0 0% 14%;--popover-foreground: 0 0% 88%;--primary: 122 39% 49%;--primary-foreground: 0 0% 100%;--secondary: 0 0% 20%;--secondaLine truncated
+2 -2
View File
@@ -13,8 +13,8 @@
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<script type="module" crossorigin src="/assets/index-CTjJAYeA.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DaLCXB8p.css">
<script type="module" crossorigin src="/assets/index-BW3IACj-.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-URSnSHtR.css">
</head>
<body>
<div id="root"></div>
+5
View File
@@ -653,11 +653,16 @@ export function App() {
open={showConfig}
config={config}
appSettings={appSettings}
health={health}
onClose={() => setShowConfig(false)}
onSave={handleSaveConfig}
onSaveAppSettings={handleSaveAppSettings}
onSetPrivateKey={handleSetPrivateKey}
onReboot={handleReboot}
onHealthRefresh={async () => {
const data = await api.getHealth();
setHealth(data);
}}
/>
<Toaster position="top-right" />
+9
View File
@@ -4,7 +4,9 @@ import type {
Channel,
CommandResponse,
Contact,
DedupResult,
HealthStatus,
MaintenanceResult,
Message,
RadioConfig,
RadioConfigUpdate,
@@ -164,6 +166,13 @@ export const api = {
method: 'POST',
body: JSON.stringify(params),
}),
runMaintenance: (pruneUndecryptedDays: number) =>
fetchJson<MaintenanceResult>('/packets/maintenance', {
method: 'POST',
body: JSON.stringify({ prune_undecrypted_days: pruneUndecryptedDays }),
}),
deduplicatePackets: () =>
fetchJson<DedupResult>('/packets/dedup', { method: 'POST' }),
// Read State
markAllRead: () =>
+108 -1
View File
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import type { AppSettings, AppSettingsUpdate, RadioConfig, RadioConfigUpdate } from '../types';
import type { AppSettings, AppSettingsUpdate, HealthStatus, RadioConfig, RadioConfigUpdate } from '../types';
import {
Dialog,
DialogContent,
@@ -12,27 +12,33 @@ import { Label } from './ui/label';
import { Button } from './ui/button';
import { Separator } from './ui/separator';
import { Alert, AlertDescription } from './ui/alert';
import { toast } from './ui/sonner';
import { api } from '../api';
interface ConfigModalProps {
open: boolean;
config: RadioConfig | null;
appSettings: AppSettings | null;
health: HealthStatus | null;
onClose: () => void;
onSave: (update: RadioConfigUpdate) => Promise<void>;
onSaveAppSettings: (update: AppSettingsUpdate) => Promise<void>;
onSetPrivateKey: (key: string) => Promise<void>;
onReboot: () => Promise<void>;
onHealthRefresh: () => Promise<void>;
}
export function ConfigModal({
open,
config,
appSettings,
health,
onClose,
onSave,
onSaveAppSettings,
onSetPrivateKey,
onReboot,
onHealthRefresh,
}: ConfigModalProps) {
const [name, setName] = useState('');
const [lat, setLat] = useState('');
@@ -44,8 +50,11 @@ export function ConfigModal({
const [cr, setCr] = useState('');
const [privateKey, setPrivateKey] = useState('');
const [maxRadioContacts, setMaxRadioContacts] = useState('');
const [retentionDays, setRetentionDays] = useState('14');
const [loading, setLoading] = useState(false);
const [rebooting, setRebooting] = useState(false);
const [cleaning, setCleaning] = useState(false);
const [deduping, setDeduping] = useState(false);
const [error, setError] = useState('');
useEffect(() => {
@@ -135,6 +144,58 @@ export function ConfigModal({
}
};
const handleCleanup = async () => {
const days = parseInt(retentionDays, 10);
if (isNaN(days) || days < 1) {
setError('Retention days must be at least 1');
return;
}
setError('');
setCleaning(true);
try {
const result = await api.runMaintenance(days);
toast.success('Database cleanup complete', {
description: `Deleted ${result.packets_deleted} old packet${result.packets_deleted === 1 ? '' : 's'}`,
});
// Refresh health to get updated database size
await onHealthRefresh();
} catch (err) {
console.error('Failed to run maintenance:', err);
toast.error('Database cleanup failed', {
description: err instanceof Error ? err.message : 'Unknown error',
});
} finally {
setCleaning(false);
}
};
const handleDedup = async () => {
setError('');
setDeduping(true);
try {
const result = await api.deduplicatePackets();
if (result.started) {
toast.success('Deduplication started', {
description: result.message,
});
} else {
toast.info('Deduplication', {
description: result.message,
});
}
} catch (err) {
console.error('Failed to start deduplication:', err);
toast.error('Deduplication failed', {
description: err instanceof Error ? err.message : 'Unknown error',
});
} finally {
setDeduping(false);
}
};
return (
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
<DialogContent className="sm:max-w-[500px] max-h-[90vh] overflow-y-auto">
@@ -308,6 +369,52 @@ export function ConfigModal({
</Button>
</div>
<Separator className="my-4" />
<div className="space-y-3">
<Label>Database Maintenance</Label>
<p className="text-xs text-muted-foreground">
Current database size: <span className="font-medium">{health?.database_size_mb ?? '?'} MB</span>
</p>
<p className="text-xs text-muted-foreground">
Delete undecrypted packets older than the specified days. This helps manage storage
for packets that couldn't be decrypted (unknown channel keys).
</p>
<div className="flex gap-2 items-end">
<div className="space-y-1">
<Label htmlFor="retention-days" className="text-xs">Days to retain</Label>
<Input
id="retention-days"
type="number"
min="1"
max="365"
value={retentionDays}
onChange={(e) => setRetentionDays(e.target.value)}
className="w-20"
/>
</div>
<Button
variant="outline"
onClick={handleCleanup}
disabled={cleaning || loading}
>
{cleaning ? 'Cleaning...' : 'Cleanup'}
</Button>
</div>
<p className="text-xs text-muted-foreground mt-4">
Remove packets with duplicate payloads (same message received via different paths).
Runs in background and may take a long time.
</p>
<Button
variant="outline"
onClick={handleDedup}
disabled={deduping || loading}
>
{deduping ? 'Starting...' : 'Remove Duplicates'}
</Button>
</div>
{error && (
<div className="text-sm text-destructive">{error}</div>
)}
+12
View File
@@ -41,6 +41,18 @@ export interface HealthStatus {
status: string;
radio_connected: boolean;
serial_port: string | null;
database_size_mb: number;
}
export interface MaintenanceResult {
packets_deleted: number;
vacuumed: boolean;
}
export interface DedupResult {
started: boolean;
total_packets: number;
message: string;
}
export interface Contact {
+185
View File
@@ -563,3 +563,188 @@ class TestRawPacketRepository:
finally:
db._connection = original_conn
await conn.close()
@pytest.mark.asyncio
async def test_prune_old_undecrypted_deletes_old_packets(self):
"""Prune deletes undecrypted packets older than specified days."""
import aiosqlite
import time
from app.repository import RawPacketRepository
from app.database import db
conn = await aiosqlite.connect(":memory:")
conn.row_factory = aiosqlite.Row
await conn.execute("""
CREATE TABLE raw_packets (
id INTEGER PRIMARY KEY,
timestamp INTEGER NOT NULL,
data BLOB NOT NULL UNIQUE,
decrypted INTEGER DEFAULT 0,
message_id INTEGER,
decrypt_attempts INTEGER DEFAULT 0,
last_attempt INTEGER
)
""")
now = int(time.time())
old_timestamp = now - (15 * 86400) # 15 days ago
recent_timestamp = now - (5 * 86400) # 5 days ago
# Insert old undecrypted packet
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 0)",
(old_timestamp, b"\x01\x02\x03")
)
# Insert recent undecrypted packet
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 0)",
(recent_timestamp, b"\x04\x05\x06")
)
# Insert old but decrypted packet (should NOT be deleted)
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 1)",
(old_timestamp, b"\x07\x08\x09")
)
await conn.commit()
original_conn = db._connection
db._connection = conn
try:
# Prune packets older than 10 days
deleted = await RawPacketRepository.prune_old_undecrypted(10)
assert deleted == 1 # Only the old undecrypted packet
# Verify remaining packets
cursor = await conn.execute("SELECT COUNT(*) as count FROM raw_packets")
row = await cursor.fetchone()
assert row["count"] == 2 # Recent undecrypted + old decrypted
finally:
db._connection = original_conn
await conn.close()
@pytest.mark.asyncio
async def test_prune_old_undecrypted_returns_zero_when_nothing_to_delete(self):
"""Prune returns 0 when no packets match criteria."""
import aiosqlite
import time
from app.repository import RawPacketRepository
from app.database import db
conn = await aiosqlite.connect(":memory:")
conn.row_factory = aiosqlite.Row
await conn.execute("""
CREATE TABLE raw_packets (
id INTEGER PRIMARY KEY,
timestamp INTEGER NOT NULL,
data BLOB NOT NULL UNIQUE,
decrypted INTEGER DEFAULT 0,
message_id INTEGER,
decrypt_attempts INTEGER DEFAULT 0,
last_attempt INTEGER
)
""")
now = int(time.time())
recent_timestamp = now - (5 * 86400) # 5 days ago
# Insert only recent packet
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 0)",
(recent_timestamp, b"\x01\x02\x03")
)
await conn.commit()
original_conn = db._connection
db._connection = conn
try:
# Prune packets older than 10 days (none should match)
deleted = await RawPacketRepository.prune_old_undecrypted(10)
assert deleted == 0
finally:
db._connection = original_conn
await conn.close()
class TestMaintenanceEndpoint:
"""Test database maintenance endpoint."""
@pytest.mark.asyncio
async def test_maintenance_prunes_and_vacuums(self):
"""Maintenance endpoint prunes old packets and runs vacuum."""
import aiosqlite
import time
from app.repository import RawPacketRepository
from app.database import db
from app.routers.packets import run_maintenance, MaintenanceRequest
conn = await aiosqlite.connect(":memory:")
conn.row_factory = aiosqlite.Row
await conn.execute("""
CREATE TABLE raw_packets (
id INTEGER PRIMARY KEY,
timestamp INTEGER NOT NULL,
data BLOB NOT NULL UNIQUE,
decrypted INTEGER DEFAULT 0,
message_id INTEGER,
decrypt_attempts INTEGER DEFAULT 0,
last_attempt INTEGER
)
""")
now = int(time.time())
old_timestamp = now - (20 * 86400) # 20 days ago
# Insert old undecrypted packets
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 0)",
(old_timestamp, b"\x01\x02\x03")
)
await conn.execute(
"INSERT INTO raw_packets (timestamp, data, decrypted) VALUES (?, ?, 0)",
(old_timestamp, b"\x04\x05\x06")
)
await conn.commit()
original_conn = db._connection
db._connection = conn
try:
request = MaintenanceRequest(prune_undecrypted_days=14)
result = await run_maintenance(request)
assert result.packets_deleted == 2
assert result.vacuumed is True
finally:
db._connection = original_conn
await conn.close()
class TestHealthEndpointDatabaseSize:
"""Test database size reporting in health endpoint."""
def test_health_includes_database_size(self):
"""Health endpoint includes database_size_mb field."""
from fastapi.testclient import TestClient
from unittest.mock import patch
with patch("app.routers.health.radio_manager") as mock_rm, \
patch("app.routers.health.os.path.getsize") as mock_getsize:
mock_rm.is_connected = True
mock_rm.port = "/dev/ttyUSB0"
mock_getsize.return_value = 10 * 1024 * 1024 # 10 MB
from app.main import app
client = TestClient(app)
response = client.get("/api/health")
assert response.status_code == 200
data = response.json()
assert "database_size_mb" in data
assert data["database_size_mb"] == 10.0