diff --git a/manage.sh b/manage.sh index 64b5957..db90bac 100755 --- a/manage.sh +++ b/manage.sh @@ -236,6 +236,13 @@ install_repeater() { echo " Generated version: $GENERATED_VERSION" fi + echo "29"; echo "# Cleaning old installation files..." + # Remove old repeater directory to ensure clean install + rm -rf "$INSTALL_DIR/repeater" 2>/dev/null || true + # Clean up old Python bytecode + find "$INSTALL_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true + find "$INSTALL_DIR" -type f -name '*.pyc' -delete 2>/dev/null || true + echo "30"; echo "# Installing files..." cp -r "$SCRIPT_DIR/repeater" "$INSTALL_DIR/" cp "$SCRIPT_DIR/pyproject.toml" "$INSTALL_DIR/" @@ -411,6 +418,14 @@ upgrade_repeater() { fi echo " ✓ Version file generated" + echo "[3.8/9] Cleaning old installation files..." + # Remove old repeater directory to ensure clean upgrade + rm -rf "$INSTALL_DIR/repeater" 2>/dev/null || true + # Clean up old Python bytecode + find "$INSTALL_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true + find "$INSTALL_DIR" -type f -name '*.pyc' -delete 2>/dev/null || true + echo " ✓ Old files cleaned" + echo "[4/9] Installing new files..." cp -r repeater "$INSTALL_DIR/" 2>/dev/null || true cp pyproject.toml "$INSTALL_DIR/" 2>/dev/null || true @@ -465,8 +480,18 @@ EOF # Suppress pip root user warnings export PIP_ROOT_USER_ACTION=ignore - # First, upgrade the package and dependencies (only updates what needs updating) - if python3 -m pip install --break-system-packages --upgrade --no-cache-dir .; then + # Calculate version from git for setuptools_scm + if [ -d .git ]; then + git fetch --tags 2>/dev/null || true + GIT_VERSION=$(python3 -m setuptools_scm 2>/dev/null || echo "1.0.5") + export SETUPTOOLS_SCM_PRETEND_VERSION="$GIT_VERSION" + echo "Upgrading to version: $GIT_VERSION" + else + export SETUPTOOLS_SCM_PRETEND_VERSION="1.0.5" + fi + + # Force reinstall the package and all dependencies for clean upgrade + if python3 -m pip install --break-system-packages --force-reinstall --no-cache-dir --ignore-installed .; then echo "" echo "✓ Package and dependencies updated successfully!" else @@ -474,28 +499,10 @@ EOF echo "⚠ Package update failed, but continuing..." fi - # Force reinstall pymc_core to ensure it's always updated - # Extract the pymc_core dependency from pyproject.toml + # Note: pymc_core is already reinstalled as part of the full --force-reinstall above echo "" - echo "Ensuring pymc_core is up to date..." - PYMC_CORE_DEP=$(grep -oP '"pymc_core\[hardware\][^"]*"' pyproject.toml 2>/dev/null | tr -d '"' || echo "") - if [ -n "$PYMC_CORE_DEP" ]; then - # Check if it's a Git URL (contains @) - if [[ "$PYMC_CORE_DEP" == *" @ "* ]]; then - # Extract just the URL part after " @ " - PYMC_CORE_SPEC="${PYMC_CORE_DEP#* @ }" - else - # Just the package name, use as-is - PYMC_CORE_SPEC="$PYMC_CORE_DEP" - fi - if python3 -m pip install --break-system-packages --force-reinstall --no-cache-dir --no-deps "$PYMC_CORE_SPEC"; then - echo "✓ pymc_core updated successfully!" - else - echo "⚠ pymc_core update failed, but continuing..." - fi - else - echo "⚠ Could not find pymc_core dependency in pyproject.toml" - fi + echo "✓ All packages including pymc_core reinstalled successfully" + echo "[8/9] Starting service..." systemctl daemon-reload diff --git a/pyproject.toml b/pyproject.toml index 9c82445..075c7e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ dependencies = [ "cherrypy-cors==1.7.0", "psutil>=5.9.0", "pyjwt>=2.8.0", + "ws4py>=0.6.0", ] diff --git a/repeater/data_acquisition/letsmesh_handler.py b/repeater/data_acquisition/letsmesh_handler.py index bcb2dd7..ce8ef79 100644 --- a/repeater/data_acquisition/letsmesh_handler.py +++ b/repeater/data_acquisition/letsmesh_handler.py @@ -72,6 +72,9 @@ class _BrokerConnection: self._connect_time = None self._tls_verified = False self._running = False + self._reconnect_attempts = 0 + self._reconnect_timer = None + self._max_reconnect_delay = 300 # 5 minutes max # MQTT WebSocket client - unique client ID per broker client_id = f"meshcore_{self.public_key}_{broker['host']}" @@ -118,18 +121,52 @@ class _BrokerConnection: if rc == 0: logging.info(f"Connected to {self.broker['name']}") self._running = True + self._reconnect_attempts = 0 # Reset counter on success if self._on_connect_callback: self._on_connect_callback(self.broker["name"]) else: logging.error(f"Failed to connect to {self.broker['name']} (rc={rc})") + self._schedule_reconnect() def _on_disconnect(self, client, userdata, rc): """MQTT disconnection callback""" - logging.warning(f"Disconnected from {self.broker['name']} (rc={rc})") + was_running = self._running self._running = False + + if rc != 0: # Unexpected disconnect + logging.warning(f"Disconnected from {self.broker['name']} (rc={rc})") + if was_running: # Only reconnect if we were intentionally connected + self._schedule_reconnect() + else: + logging.info(f"Clean disconnect from {self.broker['name']}") + if self._on_disconnect_callback: self._on_disconnect_callback(self.broker["name"]) + def _schedule_reconnect(self): + """Schedule reconnection with exponential backoff""" + if self._reconnect_timer: + self._reconnect_timer.cancel() + + # Exponential backoff: 5s, 10s, 20s, 40s, 80s, up to max + delay = min(5 * (2 ** self._reconnect_attempts), self._max_reconnect_delay) + self._reconnect_attempts += 1 + + logging.info(f"Scheduling reconnect to {self.broker['name']} in {delay}s (attempt {self._reconnect_attempts})") + self._reconnect_timer = threading.Timer(delay, self._attempt_reconnect) + self._reconnect_timer.daemon = True + self._reconnect_timer.start() + + def _attempt_reconnect(self): + """Attempt to reconnect to broker""" + try: + logging.info(f"Attempting reconnection to {self.broker['name']}...") + self.refresh_jwt_token() # Refresh token before reconnecting + self.client.reconnect() + except Exception as e: + logging.error(f"Reconnection failed for {self.broker['name']}: {e}") + self._schedule_reconnect() # Try again later + def refresh_jwt_token(self): """Refresh JWT token for MQTT authentication""" token = self._generate_jwt() @@ -165,6 +202,12 @@ class _BrokerConnection: def disconnect(self): """Disconnect from broker""" self._running = False + + # Cancel any pending reconnection + if self._reconnect_timer: + self._reconnect_timer.cancel() + self._reconnect_timer = None + self.client.loop_stop() self.client.disconnect() logging.info(f"Disconnected from {self.broker['name']}") diff --git a/repeater/data_acquisition/sqlite_handler.py b/repeater/data_acquisition/sqlite_handler.py index 524f180..205b43d 100644 --- a/repeater/data_acquisition/sqlite_handler.py +++ b/repeater/data_acquisition/sqlite_handler.py @@ -766,22 +766,31 @@ class SQLiteHandler: logger.error(f"Failed to get neighbors: {e}") return {} - def get_noise_floor_history(self, hours: int = 24) -> list: + def get_noise_floor_history(self, hours: int = 24, limit: int = None) -> list: try: cutoff = time.time() - (hours * 3600) with sqlite3.connect(self.sqlite_path) as conn: conn.row_factory = sqlite3.Row - measurements = conn.execute(""" + # Build query with optional limit + query = """ SELECT timestamp, noise_floor_dbm FROM noise_floor WHERE timestamp > ? - ORDER BY timestamp ASC - """, (cutoff,)).fetchall() + ORDER BY timestamp DESC + """ - return [{"timestamp": row["timestamp"], "noise_floor_dbm": row["noise_floor_dbm"]} - for row in measurements] + if limit: + query += f" LIMIT {int(limit)}" + + measurements = conn.execute(query, (cutoff,)).fetchall() + + # Reverse to get chronological order (oldest to newest) + result = [{"timestamp": row["timestamp"], "noise_floor_dbm": row["noise_floor_dbm"]} + for row in reversed(measurements)] + + return result except Exception as e: logger.error(f"Failed to get noise floor history: {e}") diff --git a/repeater/data_acquisition/storage_collector.py b/repeater/data_acquisition/storage_collector.py index ec092fc..a2ccee2 100644 --- a/repeater/data_acquisition/storage_collector.py +++ b/repeater/data_acquisition/storage_collector.py @@ -66,18 +66,62 @@ class StorageCollector: from .hardware_stats import HardwareStatsCollector self.hardware_stats = HardwareStatsCollector() logger.info("Hardware stats collector initialized") + + # Initialize WebSocket handler for real-time updates + self.websocket_available = False + try: + from .websocket_handler import broadcast_packet, broadcast_stats + self.websocket_broadcast_packet = broadcast_packet + self.websocket_broadcast_stats = broadcast_stats + self.websocket_available = True + logger.info("WebSocket handler initialized for real-time updates") + except ImportError: + logger.debug("WebSocket handler not available") def _get_live_stats(self) -> dict: """Get live stats from RepeaterHandler""" if not self.repeater_handler: - return {"uptime_secs": 0, "packets_sent": 0, "packets_received": 0} + return { + "uptime_secs": 0, + "packets_sent": 0, + "packets_received": 0, + "errors": 0, + "queue_len": 0 + } uptime_secs = int(time.time() - self.repeater_handler.start_time) - return { + + # Get airtime stats + airtime_stats = self.repeater_handler.airtime_mgr.get_stats() + + # Get latest noise floor from database + noise_floor = None + try: + recent_noise = self.sqlite_handler.get_noise_floor_history(hours=0.5, limit=1) + if recent_noise and len(recent_noise) > 0: + noise_floor = recent_noise[-1].get('noise_floor_dbm') + except Exception as e: + logger.debug(f"Could not fetch noise floor: {e}") + + stats = { "uptime_secs": uptime_secs, "packets_sent": self.repeater_handler.forwarded_count, "packets_received": self.repeater_handler.rx_count, + "errors": 0, + "queue_len": 0, # N/A for Python repeater } + + # Add airtime stats + if airtime_stats: + stats["tx_air_secs"] = airtime_stats["total_airtime_ms"] / 1000 + stats["current_airtime_ms"] = airtime_stats["current_airtime_ms"] + stats["utilization_percent"] = airtime_stats["utilization_percent"] + + # Add noise floor if available + if noise_floor is not None: + stats["noise_floor"] = noise_floor + + return stats def record_packet(self, packet_record: dict, skip_letsmesh_if_invalid: bool = True): """Record packet to storage and publish to MQTT/LetsMesh @@ -96,6 +140,26 @@ class StorageCollector: cumulative_counts = self.sqlite_handler.get_cumulative_counts() self.rrd_handler.update_packet_metrics(packet_record, cumulative_counts) self.mqtt_handler.publish(packet_record, "packet") + + # Broadcast to WebSocket clients for real-time updates + if self.websocket_available: + try: + self.websocket_broadcast_packet(packet_record) + + # Also broadcast lightweight stats update + uptime_seconds = time.time() - self.repeater_handler.start_time if self.repeater_handler else 0 + self.websocket_broadcast_stats({ + "packet_stats": { + "total_packets": cumulative_counts.get("rx_total", 0), + "transmitted_packets": cumulative_counts.get("tx_total", 0), + "dropped_packets": cumulative_counts.get("drop_total", 0), + }, + "system_stats": { + "uptime_seconds": uptime_seconds, + } + }) + except Exception as e: + logger.debug(f"WebSocket broadcast failed: {e}") # Publish to LetsMesh if enabled (skip invalid packets if requested) if skip_letsmesh_if_invalid and packet_record.get('drop_reason'): @@ -209,8 +273,8 @@ class StorageCollector: def cleanup_old_data(self, days: int = 7): self.sqlite_handler.cleanup_old_data(days) - def get_noise_floor_history(self, hours: int = 24) -> list: - return self.sqlite_handler.get_noise_floor_history(hours) + def get_noise_floor_history(self, hours: int = 24, limit: int = None) -> list: + return self.sqlite_handler.get_noise_floor_history(hours, limit) def get_noise_floor_stats(self, hours: int = 24) -> dict: return self.sqlite_handler.get_noise_floor_stats(hours) diff --git a/repeater/data_acquisition/websocket_handler.py b/repeater/data_acquisition/websocket_handler.py new file mode 100644 index 0000000..49a2806 --- /dev/null +++ b/repeater/data_acquisition/websocket_handler.py @@ -0,0 +1,115 @@ +""" +WebSocket handler for real-time packet updates - simple ws4py implementation +""" +import json +import logging +import threading +import time +import cherrypy +from ws4py.websocket import WebSocket +from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool + +logger = logging.getLogger("WebSocket") + +# Suppress noisy ws4py error logs for normal disconnections (ConnectionResetError, etc.) +logging.getLogger('ws4py').setLevel(logging.CRITICAL) + +# Global set of connected clients +_connected_clients = set() + +# Heartbeat configuration +PING_INTERVAL = 30 # seconds +_heartbeat_thread = None +_heartbeat_running = False + + +class PacketWebSocket(WebSocket): + + def opened(self): + """Called when a WebSocket connection is established""" + _connected_clients.add(self) + logger.info(f"WebSocket connected. Total clients: {len(_connected_clients)}") + + def closed(self, code, reason=None): + """Called when a WebSocket connection is closed""" + _connected_clients.discard(self) + logger.info(f"WebSocket disconnected. Total clients: {len(_connected_clients)}") + + def received_message(self, message): + """Handle messages from client""" + try: + data = json.loads(str(message)) + if data.get("type") == "ping": + self.send(json.dumps({"type": "pong"})) + elif data.get("type") == "pong": + # Client responded to our ping + pass + except Exception: + pass + + +def broadcast_packet(packet_data: dict): + + if not _connected_clients: + return + + message = json.dumps({"type": "packet", "data": packet_data}) + + for client in list(_connected_clients): + try: + client.send(message) + except Exception as e: + logger.error(f"WebSocket send error: {e}") + _connected_clients.discard(client) + + +def broadcast_stats(stats_data: dict): + + if not _connected_clients: + return + + message = json.dumps({"type": "stats", "data": stats_data}) + + for client in list(_connected_clients): + try: + client.send(message) + except Exception as e: + logger.error(f"WebSocket send error: {e}") + _connected_clients.discard(client) + + +def _heartbeat_loop(): + """Background thread to send periodic pings to all connected clients""" + global _heartbeat_running + + while _heartbeat_running: + time.sleep(PING_INTERVAL) + + if not _connected_clients: + continue + + ping_message = json.dumps({"type": "ping"}) + + for client in list(_connected_clients): + try: + client.send(ping_message) + except Exception as e: + logger.debug(f"Heartbeat ping failed: {e}") + _connected_clients.discard(client) + + +def init_websocket(): + """Initialize WebSocket plugin and start heartbeat""" + global _heartbeat_thread, _heartbeat_running + + WebSocketPlugin(cherrypy.engine).subscribe() + cherrypy.tools.websocket = WebSocketTool() + + # Start heartbeat thread + if not _heartbeat_running: + _heartbeat_running = True + _heartbeat_thread = threading.Thread(target=_heartbeat_loop, daemon=True) + _heartbeat_thread.start() + logger.info(f"WebSocket initialized with {PING_INTERVAL}s heartbeat") + else: + logger.info("WebSocket initialized") diff --git a/repeater/web/api_endpoints.py b/repeater/web/api_endpoints.py index 42db631..4de7a65 100644 --- a/repeater/web/api_endpoints.py +++ b/repeater/web/api_endpoints.py @@ -1270,12 +1270,13 @@ class APIEndpoints: @cherrypy.expose @cherrypy.tools.json_out() - def noise_floor_history(self, hours: int = 24): + def noise_floor_history(self, hours: int = 24, limit: int = None): try: storage = self._get_storage() hours = int(hours) - history = storage.get_noise_floor_history(hours=hours) + limit = int(limit) if limit else None + history = storage.get_noise_floor_history(hours=hours, limit=limit) return self._success({ "history": history, diff --git a/repeater/web/auth/cherrypy_tool.py b/repeater/web/auth/cherrypy_tool.py index bbe646f..c6894df 100644 --- a/repeater/web/auth/cherrypy_tool.py +++ b/repeater/web/auth/cherrypy_tool.py @@ -8,7 +8,8 @@ def check_auth(): """ CherryPy tool to check authentication before processing request. - Checks for either JWT in Authorization header or API token in X-API-Key header. + Checks for either JWT in Authorization header, API token in X-API-Key header, + or JWT token in query parameter (for EventSource/SSE connections). Sets cherrypy.request.user on success. Returns 401 JSON response on failure. """ @@ -29,7 +30,7 @@ def check_auth(): cherrypy.response.status = 500 return {"success": False, "error": "Authentication system not configured"} - # Check for JWT token first + # Check for JWT token in Authorization header first auth_header = cherrypy.request.headers.get("Authorization", "") if auth_header.startswith("Bearer "): token = auth_header[7:] # Remove "Bearer " prefix @@ -43,7 +44,23 @@ def check_auth(): } return - # Check for API token + # Check for JWT token in query parameter (for EventSource/SSE) + # EventSource doesn't support custom headers, so we use query param + query_token = cherrypy.request.params.get("token") + if query_token: + payload = jwt_handler.verify_jwt(query_token) + + if payload: + cherrypy.request.user = { + "username": payload.get("sub"), + "client_id": payload.get("client_id"), + "auth_type": "jwt_query" + } + # Remove token from params to avoid exposing it in logs + del cherrypy.request.params["token"] + return + + # Check for API token in X-API-Key header api_key = cherrypy.request.headers.get("X-API-Key", "") if api_key: token_info = token_manager.verify_token(api_key) diff --git a/repeater/web/html/assets/CADCalibration-DnmufMQ0.css b/repeater/web/html/assets/CADCalibration-DnmufMQ0.css new file mode 100644 index 0000000..d158fa0 --- /dev/null +++ b/repeater/web/html/assets/CADCalibration-DnmufMQ0.css @@ -0,0 +1 @@ +.glass-card[data-v-c30e5f38]{background:var(--color-glass-bg);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--color-glass-border);box-shadow:var(--color-glass-shadow)} diff --git a/repeater/web/html/assets/CADCalibration-sfiSWhAM.js b/repeater/web/html/assets/CADCalibration-sfiSWhAM.js new file mode 100644 index 0000000..a7cd9ca --- /dev/null +++ b/repeater/web/html/assets/CADCalibration-sfiSWhAM.js @@ -0,0 +1 @@ +import{a as G,M as K,c as W,r as o,o as X,Q as Y,b as g,e as a,g as k,i as F,t as l,k as h,n as ee,L as T,Z as te,$ as ae,p as f,x as se}from"./index-C2DY4pTz.js";import{P as M}from"./plotly.min-DO11Gp-n.js";import"./_commonjsHelpers-CqkleIqs.js";const oe={class:"p-6 space-y-6"},re={class:"glass-card rounded-[15px] p-6"},le={class:"flex justify-center"},ne={class:"flex gap-4"},ie=["disabled"],ce=["disabled"],de={class:"glass-card rounded-[15px] p-6 space-y-4"},ue={class:"text-content-primary dark:text-content-primary"},ve={key:0,class:"p-4 bg-primary/10 border border-primary/30 rounded-lg"},pe={class:"text-content-primary dark:text-primary"},me={class:"space-y-2"},be={class:"w-full bg-white/10 rounded-full h-2"},ge={class:"text-content-secondary dark:text-content-muted text-sm"},fe={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},xe={class:"glass-card rounded-[15px] p-4 text-center"},ye={class:"text-2xl font-bold text-primary"},_e={class:"glass-card rounded-[15px] p-4 text-center"},ke={class:"text-2xl font-bold text-primary"},he={class:"glass-card rounded-[15px] p-4 text-center"},Ce={class:"text-2xl font-bold text-primary"},we={class:"glass-card rounded-[15px] p-4 text-center"},Re={class:"text-2xl font-bold text-primary"},Se={key:0,class:"glass-card rounded-[15px] p-6 space-y-4"},De={key:0,class:"p-4 bg-accent-green/10 border border-accent-green/30 rounded-lg"},Ae={class:"text-content-primary dark:text-content-primary mb-4"},Be={key:1,class:"p-4 bg-secondary/20 border border-secondary/40 rounded-lg"},Ee=G({name:"CADCalibrationView",__name:"CADCalibration",setup(Fe){const m=K(),$=W(()=>document.documentElement.classList.contains("dark")),I=()=>{const e=$.value;return{title:e?"#F9FAFB":"#111827",subtitle:e?"#9CA3AF":"#6B7280",axis:e?"#D1D5DB":"#374151",tick:e?"#9CA3AF":"#6B7280",grid:e?"rgba(148, 163, 184, 0.1)":"rgba(107, 114, 128, 0.15)",zeroline:e?"rgba(148, 163, 184, 0.2)":"rgba(107, 114, 128, 0.25)",line:e?"rgba(148, 163, 184, 0.3)":"rgba(107, 114, 128, 0.35)",colorbarBorder:e?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.15)",markerLine:e?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.15)"}},u=o(!1),C=o(null),r=o(null),v=o({}),n=o(null),P=o([]),N=o({}),d=o("Ready to start calibration"),x=o(0),b=o(0),w=o(0),R=o(0),S=o(0),D=o(0),i=o(null),A=o(!1),B=o(!1),y=o(!1),_=o(!1);let c=null;const O={responsive:!0,displayModeBar:!0,modeBarButtonsToRemove:["pan2d","select2d","lasso2d","autoScale2d"],displaylogo:!1,toImageButtonOptions:{format:"png",filename:"cad-calibration-heatmap",height:600,width:800,scale:2}};function V(){const e=I(),t=[{x:[],y:[],z:[],mode:"markers",type:"scatter",marker:{size:12,color:[],colorscale:[[0,"rgba(75, 85, 99, 0.4)"],[.1,"rgba(6, 182, 212, 0.3)"],[.5,"rgba(6, 182, 212, 0.6)"],[1,"rgba(16, 185, 129, 0.9)"]],showscale:!0,colorbar:{title:{text:"Detection Rate (%)",font:{color:e.axis,size:14}},tickfont:{color:e.tick},bgcolor:"rgba(0,0,0,0)",bordercolor:e.colorbarBorder,borderwidth:1,thickness:15},line:{color:e.markerLine,width:1}},hovertemplate:"Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
",name:"Test Results"}],s={title:{text:`CAD Detection Rate
Channel Activity Detection Calibration`,font:{color:e.title,size:18},x:.5},xaxis:{title:{text:"CAD Peak Threshold",font:{color:e.axis,size:14}},tickfont:{color:e.tick},gridcolor:e.grid,zerolinecolor:e.zeroline,linecolor:e.line},yaxis:{title:{text:"CAD Min Threshold",font:{color:e.axis,size:14}},tickfont:{color:e.tick},gridcolor:e.grid,zerolinecolor:e.zeroline,linecolor:e.line},plot_bgcolor:"rgba(0, 0, 0, 0)",paper_bgcolor:"rgba(0, 0, 0, 0)",font:{color:e.title,family:"Inter, system-ui, sans-serif"},margin:{l:80,r:80,t:100,b:80},showlegend:!1};M.newPlot("plotly-chart",t,s,O)}function j(){if(Object.keys(v.value).length===0)return;const e=Object.values(v.value),t=[],s=[],p=[];for(const E of e)t.push(E.det_peak),s.push(E.det_min),p.push(E.detection_rate);const q={x:[t],y:[s],"marker.color":[p],hovertemplate:"Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
Status: Tested
"};M.restyle("plotly-chart",q,[0])}async function U(){try{const s=await T.post("/cad-calibration-start",{samples:10,delay_ms:50});if(s.success)u.value=!0,C.value=Date.now(),m.setCadCalibrationRunning(!0),v.value={},P.value=[],N.value={},n.value=null,A.value=!1,B.value=!1,y.value=!1,_.value=!1,w.value=0,R.value=0,S.value=0,D.value=0,x.value=0,b.value=0,c=setInterval(()=>{C.value&&(D.value=Math.floor((Date.now()-C.value)/1e3))},1e3),L();else throw new Error(s.error||"Failed to start calibration")}catch(s){d.value=`Error: ${s instanceof Error?s.message:"Unknown error"}`}}async function z(){try{(await T.post("/cad-calibration-stop")).success&&(u.value=!1,m.setCadCalibrationRunning(!1),r.value&&(r.value.close(),r.value=null),c&&(clearInterval(c),c=null))}catch(e){console.error("Failed to stop calibration:",e)}}function L(){r.value&&r.value.close();const e=te(),t=e?`?token=${encodeURIComponent(e)}`:"";r.value=new EventSource(`${ae}/api/cad-calibration-stream${t}`),r.value.onmessage=function(s){try{const p=JSON.parse(s.data);H(p)}catch(p){console.error("Failed to parse SSE data:",p)}},r.value.onerror=function(s){console.error("SSE connection error:",s),u.value||r.value&&(r.value.close(),r.value=null)}}function H(e){switch(e.type){case"status":d.value=e.message||"Status update",e.test_ranges&&(i.value=e.test_ranges,A.value=!0);break;case"progress":x.value=e.current||0,b.value=e.total||0,w.value=e.current||0;break;case"result":if(e.det_peak!==void 0&&e.det_min!==void 0&&e.detection_rate!==void 0&&e.detections!==void 0&&e.samples!==void 0){const t=`${e.det_peak}_${e.det_min}`;v.value[t]={det_peak:e.det_peak,det_min:e.det_min,detection_rate:e.detection_rate,detections:e.detections,samples:e.samples},j(),J()}break;case"complete":case"completed":u.value=!1,d.value=e.message||"Calibration completed",m.setCadCalibrationRunning(!1),Q(),r.value&&(r.value.close(),r.value=null),c&&(clearInterval(c),c=null);break;case"error":d.value=`Error: ${e.message}`,m.setCadCalibrationRunning(!1),z();break}}function J(){const e=Object.values(v.value).map(t=>t.detection_rate);e.length!==0&&(R.value=Math.max(...e),S.value=e.reduce((t,s)=>t+s,0)/e.length)}function Q(){B.value=!0;let e=null,t=0;for(const s of Object.values(v.value))s.detection_rate>t&&(t=s.detection_rate,e=s);n.value=e,e&&t>0?(y.value=!0,_.value=!1):(y.value=!1,_.value=!0)}async function Z(){if(!n.value){d.value="Error: No calibration results to save";return}try{const e=await T.post("/save_cad_settings",{peak:n.value.det_peak,min_val:n.value.det_min,detection_rate:n.value.detection_rate});if(e.success)d.value=`Settings saved! Peak=${n.value.det_peak}, Min=${n.value.det_min} applied to configuration.`;else throw new Error(e.error||"Failed to save settings")}catch(e){d.value=`Error: Failed to save settings: ${e instanceof Error?e.message:"Unknown error"}`}}return X(()=>{V()}),Y(()=>{r.value&&r.value.close(),c&&clearInterval(c),m.setCadCalibrationRunning(!1),document.getElementById("plotly-chart")&&M.purge("plotly-chart")}),(e,t)=>(f(),g("div",oe,[t[14]||(t[14]=a("div",null,[a("h1",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"CAD Calibration Tool"),a("p",{class:"text-content-secondary dark:text-content-muted mt-2"},"Channel Activity Detection calibration")],-1)),a("div",re,[a("div",le,[a("div",ne,[a("button",{onClick:U,disabled:u.value,class:"flex items-center gap-3 px-6 py-3 bg-accent-green/10 hover:bg-accent-green/20 disabled:bg-gray-500/10 text-accent-green disabled:text-gray-400 rounded-lg border border-accent-green/30 disabled:border-gray-500/20 transition-colors disabled:cursor-not-allowed"},t[0]||(t[0]=[F('
Start Calibration
Begin testing
',2)]),8,ie),a("button",{onClick:z,disabled:!u.value,class:"flex items-center gap-3 px-6 py-3 bg-accent-red/10 hover:bg-accent-red/20 disabled:bg-gray-500/10 text-accent-red disabled:text-gray-400 rounded-lg border border-accent-red/30 disabled:border-gray-500/20 transition-colors disabled:cursor-not-allowed"},t[1]||(t[1]=[F('
Stop
Halt calibration
',2)]),8,ce)])])]),a("div",de,[a("div",ue,l(d.value),1),A.value&&i.value?(f(),g("div",ve,[a("div",pe,[t[2]||(t[2]=a("strong",null,"Configuration:",-1)),h(" SF"+l(i.value.spreading_factor)+" | Peak: "+l(i.value.peak_min)+" - "+l(i.value.peak_max)+" | Min: "+l(i.value.min_min)+" - "+l(i.value.min_max)+" | "+l((i.value.peak_max-i.value.peak_min+1)*(i.value.min_max-i.value.min_min+1))+" tests ",1)])])):k("",!0),a("div",me,[a("div",be,[a("div",{class:"bg-gradient-to-r from-primary to-accent-green h-2 rounded-full transition-all duration-300",style:ee({width:b.value>0?`${x.value/b.value*100}%`:"0%"})},null,4)]),a("div",ge,l(x.value)+" / "+l(b.value)+" tests completed",1)])]),a("div",fe,[a("div",xe,[a("div",ye,l(w.value),1),t[3]||(t[3]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Tests Completed",-1))]),a("div",_e,[a("div",ke,l(R.value.toFixed(1))+"%",1),t[4]||(t[4]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Best Detection Rate",-1))]),a("div",he,[a("div",Ce,l(S.value.toFixed(1))+"%",1),t[5]||(t[5]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Average Rate",-1))]),a("div",we,[a("div",Re,l(D.value)+"s",1),t[6]||(t[6]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Elapsed Time",-1))])]),t[15]||(t[15]=a("div",{class:"glass-card rounded-[15px] p-6"},[a("div",{id:"plotly-chart",class:"w-full h-96"})],-1)),B.value?(f(),g("div",Se,[t[13]||(t[13]=a("h3",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Calibration Results",-1)),y.value&&n.value?(f(),g("div",De,[t[11]||(t[11]=a("h4",{class:"font-medium text-accent-green mb-2"},"Optimal Settings Found:",-1)),a("p",Ae,[t[7]||(t[7]=h(" Peak: ",-1)),a("strong",null,l(n.value.det_peak),1),t[8]||(t[8]=h(", Min: ",-1)),a("strong",null,l(n.value.det_min),1),t[9]||(t[9]=h(", Rate: ",-1)),a("strong",null,l(n.value.detection_rate.toFixed(1))+"%",1)]),a("div",{class:"flex justify-center"},[a("button",{onClick:Z,class:"flex items-center gap-3 px-6 py-3 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"},t[10]||(t[10]=[F('
Save Settings
Apply to configuration
',2)]))])])):k("",!0),_.value?(f(),g("div",Be,t[12]||(t[12]=[a("h4",{class:"font-medium text-secondary mb-2"},"No Optimal Settings Found",-1),a("p",{class:"text-content-secondary dark:text-content-muted"},"All tested combinations showed low detection rates. Consider running calibration again or adjusting test parameters.",-1)]))):k("",!0)])):k("",!0)]))}}),$e=se(Ee,[["__scopeId","data-v-c30e5f38"]]);export{$e as default}; diff --git a/repeater/web/html/assets/Configuration-BFp_Zwgj.js b/repeater/web/html/assets/Configuration-BFp_Zwgj.js new file mode 100644 index 0000000..6cfc979 --- /dev/null +++ b/repeater/web/html/assets/Configuration-BFp_Zwgj.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); +import{a as q,M as ee,c as N,r as v,D as Q,b as s,g as S,e,t as b,F as K,w as E,v as V,h as Y,q as te,k as I,L as U,p as r,Q as pe,s as G,E as ne,U as ae,x as le,f as R,y as de,d as be,V as re,j as P,l as ie,N as ce,W as ue,T as ve,i as O,X as Z,o as oe,u as W,Y as xe,R as J}from"./index-C2DY4pTz.js";/* empty css */import{_ as ke}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js";import{g as ge,s as ye}from"./preferences-DtwbSSgO.js";const fe={class:"space-y-4"},he={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500/50 rounded-lg p-3"},we={class:"text-green-600 dark:text-green-400 text-sm"},_e={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3"},$e={class:"text-red-600 dark:text-red-400 text-sm"},Ce={class:"flex justify-end gap-2"},Me=["disabled"],Ae=["disabled"],je={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Ne={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Se={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Te={key:1,class:"flex items-center gap-2"},Be={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ee={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Fe={key:1},Le=["value"],Pe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ze={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ie={key:1},De=["value"],He={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ue={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ve={key:1,class:"flex items-center gap-2"},Re={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ke={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},qe={key:1},We={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Oe={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ge={key:2,class:"bg-yellow-500/10 dark:bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3"},Ye=q({__name:"RadioSettings",setup(z){const f=ee(),l=N(()=>f.stats?.config?.radio||{}),m=v(!1),g=v(!1),d=v(null),i=v(null),o=v(0),c=v(0),y=v(0),h=v(0),A=v(0),$=v(0),C=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}];Q(l,_=>{_&&!m.value&&(o.value=_.frequency?Number((_.frequency/1e6).toFixed(3)):0,c.value=_.spreading_factor??0,y.value=_.bandwidth?Number((_.bandwidth/1e3).toFixed(1)):0,h.value=_.tx_power??0,A.value=_.coding_rate??0,$.value=_.preamble_length??0)},{immediate:!0});const a=N(()=>{const _=l.value.frequency;return _?(_/1e6).toFixed(3)+" MHz":"Not set"}),t=N(()=>{const _=l.value.bandwidth;return _?(_/1e3).toFixed(1)+" kHz":"Not set"}),n=N(()=>{const _=l.value.tx_power;return _!==void 0?_+" dBm":"Not set"}),M=N(()=>{const _=l.value.coding_rate;return _?"4/"+_:"Not set"}),p=N(()=>{const _=l.value.preamble_length;return _?_+" symbols":"Not set"}),u=N(()=>l.value.spreading_factor??"Not set"),x=()=>{m.value=!0,d.value=null,i.value=null},L=()=>{m.value=!1,d.value=null;const _=l.value;o.value=_.frequency?Number((_.frequency/1e6).toFixed(3)):0,c.value=_.spreading_factor??0,y.value=_.bandwidth?Number((_.bandwidth/1e3).toFixed(1)):0,h.value=_.tx_power??0,A.value=_.coding_rate??0,$.value=_.preamble_length??0},X=async()=>{g.value=!0,d.value=null,i.value=null;try{const _={};o.value&&(_.frequency=o.value*1e6),c.value&&(_.spreading_factor=c.value),y.value&&(_.bandwidth=y.value*1e3),h.value&&(_.tx_power=h.value),A.value&&(_.coding_rate=A.value);const F=(await U.post("/update_radio_config",_)).data;F.message||F.persisted?(i.value=F.message||"Settings saved successfully",m.value=!1,await f.fetchStats(),setTimeout(()=>{i.value=null},3e3)):F.error?d.value=F.error:d.value="Unknown response from server"}catch(_){console.error("Failed to update radio settings:",_);const j=_;d.value=j.response?.data?.error||"Failed to update settings"}finally{g.value=!1}};return(_,j)=>(r(),s("div",fe,[i.value?(r(),s("div",he,[e("p",we,b(i.value),1)])):S("",!0),d.value?(r(),s("div",_e,[e("p",$e,b(d.value),1)])):S("",!0),e("div",Ce,[m.value?(r(),s(K,{key:1},[e("button",{onClick:L,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Me),e("button",{onClick:X,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},b(g.value?"Saving...":"Save Changes"),9,Ae)],64)):(r(),s("button",{key:0,onClick:x,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",je,[e("div",Ne,[j[6]||(j[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Frequency",-1)),m.value?(r(),s("div",Te,[E(e("input",{"onUpdate:modelValue":j[0]||(j[0]=F=>o.value=F),type:"number",step:"0.001",min:"100",max:"1000",class:"w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,o.value,void 0,{number:!0}]]),j[5]||(j[5]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"MHz",-1))])):(r(),s("div",Se,b(a.value),1))]),e("div",Be,[j[7]||(j[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Spreading Factor",-1)),m.value?(r(),s("div",Fe,[E(e("select",{"onUpdate:modelValue":j[1]||(j[1]=F=>c.value=F),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(r(),s(K,null,Y([5,6,7,8,9,10,11,12],F=>e("option",{key:F,value:F},b(F),9,Le)),64))],512),[[te,c.value,void 0,{number:!0}]])])):(r(),s("div",Ee,b(u.value),1))]),e("div",Pe,[j[8]||(j[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bandwidth",-1)),m.value?(r(),s("div",Ie,[E(e("select",{"onUpdate:modelValue":j[2]||(j[2]=F=>y.value=F),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(r(),s(K,null,Y(C,F=>e("option",{key:F.value,value:F.value},b(F.label),9,De)),64))],512),[[te,y.value,void 0,{number:!0}]])])):(r(),s("div",ze,b(t.value),1))]),e("div",He,[j[10]||(j[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"TX Power",-1)),m.value?(r(),s("div",Ve,[E(e("input",{"onUpdate:modelValue":j[3]||(j[3]=F=>h.value=F),type:"number",min:"2",max:"30",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,h.value,void 0,{number:!0}]]),j[9]||(j[9]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"dBm",-1))])):(r(),s("div",Ue,b(n.value),1))]),e("div",Re,[j[12]||(j[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Coding Rate",-1)),m.value?(r(),s("div",qe,[E(e("select",{"onUpdate:modelValue":j[4]||(j[4]=F=>A.value=F),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},j[11]||(j[11]=[e("option",{value:5},"4/5",-1),e("option",{value:6},"4/6",-1),e("option",{value:7},"4/7",-1),e("option",{value:8},"4/8",-1)]),512),[[te,A.value,void 0,{number:!0}]])])):(r(),s("div",Ke,b(M.value),1))]),e("div",We,[j[13]||(j[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Preamble Length",-1)),e("span",Oe,b(p.value),1)])]),m.value?(r(),s("div",Ge,j[14]||(j[14]=[e("p",{class:"text-yellow-700 dark:text-yellow-400 text-xs"},[e("strong",null,"Note:"),I(" Radio hardware changes (frequency, bandwidth, spreading factor, coding rate) may require a service restart to apply. ")],-1)]))):S("",!0)]))}}),Xe={class:"glass-card border border-stroke-subtle dark:border-white/20 rounded-[15px] w-full max-w-3xl max-h-[90vh] flex flex-col shadow-2xl"},Je={class:"flex-1 relative min-h-[400px]"},Qe={class:"p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4"},Ze={class:"grid grid-cols-2 gap-4"},et=q({__name:"LocationPicker",props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:["close","select"],setup(z,{emit:f}){const l=z,m=f,g=v(null),d=v(l.latitude||0),i=v(l.longitude||0);let o=null,c=null;const y=async()=>{if(g.value){h();try{const a=(await ae(async()=>{const{default:p}=await import("./leaflet-src-BtisrQHC.js").then(u=>u.l);return{default:p}},__vite__mapDeps([0,1]))).default;delete a.Icon.Default.prototype._getIconUrl,a.Icon.Default.mergeOptions({iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"}),await ne();const t=d.value||0,n=i.value||0,M=t===0&&n===0?2:13;o=a.map(g.value).setView([t,n],M);try{const p=a.tileLayer("https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:'© OpenStreetMap contributors © CARTO',errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="}),u=a.tileLayer("https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});p.addTo(o),u.addTo(o)}catch(p){console.warn("Error loading tiles:",p)}(t!==0||n!==0)&&(c=a.marker([t,n]).addTo(o)),o.on("click",p=>{d.value=p.latlng.lat,i.value=p.latlng.lng,c?c.setLatLng(p.latlng):c=a.marker(p.latlng).addTo(o)}),setTimeout(()=>{o?.invalidateSize()},200)}catch(a){console.error("Failed to initialize map:",a)}}},h=()=>{o&&(o.remove(),o=null,c=null)};Q(()=>l.isOpen,async a=>{a?(await ne(),await y()):h()}),Q(()=>[l.latitude,l.longitude],([a,t])=>{d.value=a,i.value=t});const A=()=>{m("select",{latitude:d.value,longitude:i.value}),m("close")},$=()=>{m("close")},C=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async a=>{if(d.value=a.coords.latitude,i.value=a.coords.longitude,o){o.setView([d.value,i.value],13);const t=(await ae(async()=>{const{default:n}=await import("./leaflet-src-BtisrQHC.js").then(M=>M.l);return{default:n}},__vite__mapDeps([0,1]))).default;c?c.setLatLng([d.value,i.value]):c=t.marker([d.value,i.value]).addTo(o)}},a=>{console.error("Error getting location:",a),alert("Unable to get current location. Please check browser permissions.")}):alert("Geolocation is not supported by this browser.")};return pe(()=>{h()}),(a,t)=>a.isOpen?(r(),s("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G($,["self"])},[e("div",Xe,[e("div",{class:"flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10"},[t[3]||(t[3]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Select Location",-1)),e("button",{onClick:$,class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[2]||(t[2]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",Je,[e("div",{ref_key:"mapContainer",ref:g,class:"absolute inset-0 rounded-b-[15px] overflow-hidden"},null,512)]),e("div",Qe,[e("div",Ze,[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Latitude",-1)),E(e("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>d.value=n),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,d.value,void 0,{number:!0}]])]),e("div",null,[t[5]||(t[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Longitude",-1)),E(e("input",{"onUpdate:modelValue":t[1]||(t[1]=n=>i.value=n),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,i.value,void 0,{number:!0}]])])]),e("div",{class:"flex gap-3"},[e("button",{onClick:C,class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm flex items-center justify-center gap-2"},t[6]||(t[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),I(" Use Current Location ",-1)])),e("button",{onClick:$,class:"px-6 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm"}," Cancel "),e("button",{onClick:A,class:"px-6 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Select Location ")]),t[7]||(t[7]=e("p",{class:"text-content-muted dark:text-content-muted text-xs text-center"},"Click on the map to select a location",-1))])])])):S("",!0)}}),tt=le(et,[["__scopeId","data-v-186d3c86"]]),ot={class:"space-y-4"},rt={key:0,class:"bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3"},st={class:"text-green-700 dark:text-green-400 text-sm"},nt={key:1,class:"bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3"},at={class:"text-red-700 dark:text-red-400 text-sm"},lt={class:"flex justify-end gap-2"},dt=["disabled"],it=["disabled"],ct={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ut={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},mt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm break-all"},pt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},bt={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},vt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},xt={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right sm:max-w-xs"},kt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},gt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},yt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ft={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ht={key:0,class:"flex justify-end"},wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},_t={class:"text-content-primary dark:text-content-primary font-mono text-sm"},$t={class:"flex flex-col py-2 gap-2"},Ct={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},Mt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},At={key:1,class:"flex items-center gap-2"},jt=q({__name:"RepeaterSettings",setup(z){const f=ee(),l=N(()=>f.stats?.config||{}),m=N(()=>l.value.repeater||{}),g=N(()=>f.stats),d=v(!1),i=v(!1),o=v(null),c=v(null),y=v(!1),h=v(""),A=v(0),$=v(0),C=v(0);Q([l,m],()=>{d.value||(h.value=l.value.node_name||"",A.value=m.value.latitude||0,$.value=m.value.longitude||0,C.value=m.value.send_advert_interval_hours||0)},{immediate:!0});const a=N(()=>l.value.node_name||"Not set"),t=N(()=>g.value?.local_hash||"Not available"),n=N(()=>{const T=g.value?.public_key;return!T||T==="Not set"?"Not set":T}),M=N(()=>{const T=m.value.latitude;return T&&T!==0?T.toFixed(6):"Not set"}),p=N(()=>{const T=m.value.longitude;return T&&T!==0?T.toFixed(6):"Not set"}),u=N(()=>{const T=m.value.mode;return T?T.charAt(0).toUpperCase()+T.slice(1):"Not set"}),x=N(()=>{const T=m.value.send_advert_interval_hours;return T===void 0?"Not set":T===0?"Disabled":T+" hour"+(T!==1?"s":"")}),L=()=>{d.value=!0,o.value=null,c.value=null},X=()=>{d.value=!1,o.value=null,h.value=l.value.node_name||"",A.value=m.value.latitude||0,$.value=m.value.longitude||0,C.value=m.value.send_advert_interval_hours||0},_=async()=>{i.value=!0,o.value=null,c.value=null;try{const T={};h.value&&(T.node_name=h.value),T.latitude=A.value,T.longitude=$.value,T.flood_advert_interval_hours=C.value;const w=(await U.post("/update_radio_config",T)).data;w.message||w.persisted?(c.value=w.message||"Settings saved successfully",d.value=!1,await f.fetchStats(),setTimeout(()=>{c.value=null},3e3)):w.error?o.value=w.error:o.value="Unknown response from server"}catch(T){console.error("Failed to update repeater settings:",T);const B=T;o.value=B.response?.data?.error||"Failed to update settings"}finally{i.value=!1}},j=()=>{y.value=!0},F=T=>{A.value=T.latitude,$.value=T.longitude};return(T,B)=>(r(),s("div",ot,[c.value?(r(),s("div",rt,[e("p",st,b(c.value),1)])):S("",!0),o.value?(r(),s("div",nt,[e("p",at,b(o.value),1)])):S("",!0),e("div",lt,[d.value?(r(),s(K,{key:1},[e("button",{onClick:X,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,dt),e("button",{onClick:_,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},b(i.value?"Saving...":"Save Changes"),9,it)],64)):(r(),s("button",{key:0,onClick:L,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",ct,[e("div",ut,[B[5]||(B[5]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Node Name",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":B[0]||(B[0]=w=>h.value=w),type:"text",maxlength:"50",class:"w-full sm:w-64 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary",placeholder:"Enter node name"},null,512)),[[V,h.value]]):(r(),s("div",mt,b(a.value),1))]),e("div",pt,[B[6]||(B[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Local Hash",-1)),e("span",bt,b(t.value),1)]),e("div",vt,[B[7]||(B[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0"},"Public Key",-1)),e("span",xt,b(n.value),1)]),e("div",kt,[B[8]||(B[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Latitude",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":B[1]||(B[1]=w=>A.value=w),type:"number",step:"0.000001",min:"-90",max:"90",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,A.value,void 0,{number:!0}]]):(r(),s("div",gt,b(M.value),1))]),e("div",yt,[B[9]||(B[9]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Longitude",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":B[2]||(B[2]=w=>$.value=w),type:"number",step:"0.000001",min:"-180",max:"180",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,$.value,void 0,{number:!0}]]):(r(),s("div",ft,b(p.value),1))]),d.value?(r(),s("div",ht,[e("button",{onClick:j,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm flex items-center gap-2",title:"Pick location on map"},B[10]||(B[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),I(" Pick Location on Map ",-1)]))])):S("",!0),e("div",wt,[B[11]||(B[11]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Mode",-1)),e("span",_t,b(u.value),1)]),e("div",$t,[e("div",Ct,[B[13]||(B[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Periodic Advertisement Interval",-1)),d.value?(r(),s("div",At,[E(e("input",{"onUpdate:modelValue":B[3]||(B[3]=w=>C.value=w),type:"number",min:"0",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,C.value,void 0,{number:!0}]]),B[12]||(B[12]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"hours",-1))])):(r(),s("div",Mt,b(x.value),1))]),B[14]||(B[14]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"How often the repeater sends an advertisement packet (0 = disabled, 3-48 hours)",-1))])]),R(tt,{"is-open":y.value,latitude:A.value,longitude:$.value,onClose:B[4]||(B[4]=w=>y.value=!1),onSelect:F},null,8,["is-open","latitude","longitude"])]))}}),Nt={class:"space-y-4"},St={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},Tt={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},Bt={class:"flex justify-end gap-2"},Et=["disabled"],Ft=["disabled"],Lt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Pt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},zt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},It={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Dt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ht=q({__name:"DutyCycle",setup(z){const f=ee(),l=N(()=>f.stats?.config?.duty_cycle||{}),m=N(()=>{const a=l.value.max_airtime_percent;return typeof a=="number"?a.toFixed(1)+"%":a&&typeof a=="object"&&"parsedValue"in a?(a.parsedValue||0).toFixed(1)+"%":"Not set"}),g=N(()=>l.value.enforcement_enabled?"Enabled":"Disabled"),d=v(!1),i=v(!1),o=v(""),c=v(""),y=v(0),h=v(!0),A=()=>{const a=l.value.max_airtime_percent;typeof a=="number"?y.value=a:a&&typeof a=="object"&&"parsedValue"in a?y.value=a.parsedValue||0:y.value=6,h.value=l.value.enforcement_enabled!==!1,d.value=!0,o.value="",c.value=""},$=()=>{d.value=!1,o.value="",c.value=""},C=async()=>{i.value=!0,c.value="",o.value="";try{const t=(await de.post("/api/update_duty_cycle_config",{max_airtime_percent:y.value,enforcement_enabled:h.value})).data;t.message||t.persisted?(o.value=t.message||"Settings saved successfully",d.value=!1,await f.fetchStats(),setTimeout(()=>{o.value=""},3e3)):c.value="Failed to save settings"}catch(a){console.error("Failed to save duty cycle settings:",a),c.value=a.response?.data?.error||"Failed to save settings"}finally{i.value=!1}};return(a,t)=>(r(),s("div",Nt,[o.value?(r(),s("div",St,b(o.value),1)):S("",!0),c.value?(r(),s("div",Tt,b(c.value),1)):S("",!0),e("div",Bt,[d.value?(r(),s(K,{key:1},[e("button",{onClick:$,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Et),e("button",{onClick:C,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},b(i.value?"Saving...":"Save Changes"),9,Ft)],64)):(r(),s("button",{key:0,onClick:A,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",Lt,[e("div",Pt,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Airtime %",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=n=>y.value=n),type:"number",step:"0.1",min:"0.1",max:"100",class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,y.value,void 0,{number:!0}]]):(r(),s("div",zt,b(m.value),1))]),e("div",It,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Enforcement",-1)),d.value?E((r(),s("select",{key:1,"onUpdate:modelValue":t[1]||(t[1]=n=>h.value=n),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},t[3]||(t[3]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[te,h.value]]):(r(),s("div",Dt,b(g.value),1))])])]))}}),Ut={class:"space-y-4"},Vt={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},Rt={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},Kt={class:"flex justify-end gap-2"},qt=["disabled"],Wt=["disabled"],Ot={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Gt={class:"flex flex-col py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-2"},Yt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},Xt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},Jt={class:"flex flex-col py-2 gap-2"},Qt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},Zt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},eo=q({__name:"TransmissionDelays",setup(z){const f=ee(),l=N(()=>f.stats?.config?.delays||{}),m=N(()=>{const a=l.value.tx_delay_factor;if(a&&typeof a=="object"&&a!==null&&"parsedValue"in a){const t=a.parsedValue;if(typeof t=="number")return t.toFixed(2)+"x"}return"Not set"}),g=N(()=>{const a=l.value.direct_tx_delay_factor;return typeof a=="number"?a.toFixed(2)+"s":"Not set"}),d=v(!1),i=v(!1),o=v(""),c=v(""),y=v(0),h=v(0),A=()=>{const a=l.value.tx_delay_factor;a&&typeof a=="object"&&"parsedValue"in a?y.value=a.parsedValue||1:typeof a=="number"?y.value=a:y.value=1;const t=l.value.direct_tx_delay_factor;h.value=typeof t=="number"?t:.5,d.value=!0,o.value="",c.value=""},$=()=>{d.value=!1,o.value="",c.value=""},C=async()=>{i.value=!0,c.value="",o.value="";try{const t=(await de.post("/api/update_radio_config",{tx_delay_factor:y.value,direct_tx_delay_factor:h.value})).data;t.message||t.persisted?(o.value=t.message||"Settings saved successfully",d.value=!1,await f.fetchStats(),setTimeout(()=>{o.value=""},3e3)):c.value="Failed to save settings"}catch(a){console.error("Failed to save delay settings:",a),c.value=a.response?.data?.error||"Failed to save settings"}finally{i.value=!1}};return(a,t)=>(r(),s("div",Ut,[o.value?(r(),s("div",Vt,b(o.value),1)):S("",!0),c.value?(r(),s("div",Rt,b(c.value),1)):S("",!0),e("div",Kt,[d.value?(r(),s(K,{key:1},[e("button",{onClick:$,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,qt),e("button",{onClick:C,disabled:i.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},b(i.value?"Saving...":"Save Changes"),9,Wt)],64)):(r(),s("button",{key:0,onClick:A,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",Ot,[e("div",Gt,[e("div",Yt,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Flood TX Delay Factor",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=n=>y.value=n),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,y.value,void 0,{number:!0}]]):(r(),s("div",Xt,b(m.value),1))]),t[3]||(t[3]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Multiplier for flood packet transmission delays (collision avoidance)",-1))]),e("div",Jt,[e("div",Qt,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Direct TX Delay Factor",-1)),d.value?E((r(),s("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=n=>h.value=n),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,h.value,void 0,{number:!0}]]):(r(),s("div",Zt,b(g.value),1))]),t[5]||(t[5]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Base delay for direct-routed packet transmission (seconds)",-1))])])]))}}),me=be("treeState",()=>{const z=re(new Set),f=re({value:null}),l=o=>{z.add(o)},m=o=>{z.delete(o)};return{expandedNodes:z,selectedNodeId:f,addExpandedNode:l,removeExpandedNode:m,isNodeExpanded:o=>z.has(o),setSelectedNode:o=>{f.value=o},toggleExpanded:o=>{z.has(o)?m(o):l(o)}}}),to={class:"select-none"},oo={class:"flex-shrink-0"},ro={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},so={key:1,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},no={key:0,class:"hidden sm:flex items-center gap-1 ml-2"},ao={class:"relative group"},lo=["title"],io={key:0,class:"text-xs font-mono text-white/50 bg-white/5 px-1.5 py-0.5 rounded border border-white/10"},co={class:"flex justify-between items-start mb-4"},uo={class:"bg-black/20 border border-white/10 rounded-md p-4 mb-4"},mo={class:"text-sm font-mono text-white/80 break-all leading-relaxed"},po={class:"flex items-center gap-1 sm:gap-2 ml-auto flex-shrink-0"},bo={key:0,class:"hidden sm:flex items-center gap-1"},vo=["title"],xo={key:1,class:"hidden sm:flex items-center gap-1"},ko={key:2,class:"hidden sm:inline-block px-2 py-1 bg-white/10 text-white/60 text-xs rounded-full ml-1"},go={key:0,class:"space-y-1"},yo=q({__name:"TreeNode",props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean}},emits:["select"],setup(z,{emit:f}){const l=z,m=f,g=me(),d=v(!1),i=N({get:()=>g.isNodeExpanded(l.node.id),set:t=>{t?g.addExpandedNode(l.node.id):g.removeExpandedNode(l.node.id)}}),o=N(()=>l.node.children.length>0);function c(t){if(!t)return"Never";const M=new Date().getTime()-t.getTime(),p=Math.floor(M/(1e3*60)),u=Math.floor(M/(1e3*60*60)),x=Math.floor(M/(1e3*60*60*24)),L=Math.floor(x/365);return p<60?`${p}m ago`:u<24?`${u}h ago`:x<365?`${x}d ago`:`${L}y ago`}function y(t){return t?t.length<=16?t:`${t.slice(0,8)}...${t.slice(-8)}`:"No key"}function h(){if(o.value){const t=!i.value;i.value=t}}function A(){m("select",l.node.id)}function $(t){m("select",t)}function C(t){t.stopPropagation(),d.value=!d.value}function a(t){t.stopPropagation(),l.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(l.node.transport_key)}return(t,n)=>{const M=ue("TreeNode",!0);return r(),s("div",to,[e("div",{class:P(["flex flex-wrap sm:flex-nowrap items-start sm:items-center gap-1 sm:gap-2 py-2 px-2 sm:px-3 rounded-lg cursor-pointer transition-all duration-200",l.disabled?"opacity-50 cursor-not-allowed":"hover:bg-white/5",t.selectedNodeId===t.node.id&&!l.disabled?"bg-primary/20 text-primary":"text-white/80 hover:text-white",`ml-${t.level*4}`]),onClick:n[3]||(n[3]=p=>!l.disabled&&A())},[e("div",{class:"flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center",onClick:G(h,["stop"])},[o.value?(r(),s("svg",{key:0,class:P(["w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200",i.value?"rotate-90":"rotate-0"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n[4]||(n[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]),2)):S("",!0)]),e("div",oo,[l.node.name.startsWith("#")?(r(),s("svg",ro,n[5]||(n[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",so,n[6]||(n[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)])))]),e("span",{class:P(["font-mono text-xs sm:text-sm transition-colors duration-200 break-all",t.selectedNodeId===t.node.id?"text-primary font-medium":""])},b(t.node.name),3),t.node.transport_key?(r(),s("div",no,[e("div",ao,[e("button",{onClick:C,class:"p-1 rounded hover:bg-white/10 transition-colors",title:d.value?"Hide full key":"Show full key"},n[7]||(n[7]=[e("svg",{class:"w-3 h-3 text-white/60 hover:text-white/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1)]),8,lo),d.value?S("",!0):(r(),s("span",io,b(y(t.node.transport_key)),1)),d.value?(r(),s("div",{key:1,class:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/70 backdrop-blur-md",onClick:n[2]||(n[2]=p=>d.value=!1)},[e("div",{class:"bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4",onClick:n[1]||(n[1]=G(()=>{},["stop"]))},[e("div",co,[n[9]||(n[9]=e("h3",{class:"text-lg font-semibold text-white"},"Transport Key",-1)),e("button",{onClick:n[0]||(n[0]=p=>d.value=!1),class:"text-white/60 hover:text-white transition-colors"},n[8]||(n[8]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",uo,[e("div",mo,b(t.node.transport_key),1)]),e("div",{class:"flex justify-end"},[e("button",{onClick:a,class:"px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green rounded-lg transition-colors flex items-center gap-2",title:"Copy to clipboard"},n[10]||(n[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),I(" Copy Key ",-1)]))])])])):S("",!0)])])):S("",!0),e("div",po,[t.node.last_used?(r(),s("div",bo,[n[11]||(n[11]=e("svg",{class:"w-3 h-3 text-white/40",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("span",{class:"text-xs text-white/50",title:t.node.last_used.toLocaleString()},b(c(t.node.last_used)),9,vo)])):(r(),s("div",xo,n[12]||(n[12]=[e("svg",{class:"w-3 h-3 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),e("span",{class:"text-xs text-white/30 italic"},"Never",-1)]))),e("span",{class:P(["px-1.5 sm:px-2 py-0.5 text-[10px] sm:text-xs font-medium rounded-md transition-colors",t.node.floodPolicy==="allow"?"bg-accent-green/10 text-accent-green/90 border border-accent-green/20":"bg-accent-red/10 text-accent-red/90 border border-accent-red/20"])},b(t.node.floodPolicy==="allow"?"ALLOW":"DENY"),3),o.value?(r(),s("span",ko," > "+b(t.node.children.length),1)):S("",!0)])],2),R(ve,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 max-h-0 overflow-hidden","enter-to-class":"opacity-100 max-h-screen overflow-visible","leave-active-class":"transition-all duration-300 ease-in","leave-from-class":"opacity-100 max-h-screen overflow-visible","leave-to-class":"opacity-0 max-h-0 overflow-hidden"},{default:ie(()=>[i.value&&t.node.children.length>0?(r(),s("div",go,[(r(!0),s(K,null,Y(t.node.children,p=>(r(),ce(M,{key:p.id,node:p,"selected-node-id":t.selectedNodeId,level:t.level+1,disabled:l.disabled,onSelect:$},null,8,["node","selected-node-id","level","disabled"]))),128))])):S("",!0)]),_:1})])}}}),fo=le(yo,[["__scopeId","data-v-59e9974c"]]),ho={class:"flex items-center justify-between mb-6"},wo={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},_o={key:0},$o={class:"text-primary font-mono"},Co={key:1},Mo={for:"keyName",class:"block text-sm font-medium text-white mb-2"},Ao={class:"flex items-center gap-2"},jo={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},No={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},So={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},To={class:"flex items-center gap-3 mb-2"},Bo={class:"flex items-center gap-2"},Eo={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Fo={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Lo={class:"text-content-secondary dark:text-content-muted text-sm"},Po={class:"grid grid-cols-2 gap-3"},zo={class:"relative cursor-pointer group"},Io={class:"relative cursor-pointer group"},Do={class:"flex gap-3 pt-4"},Ho=["disabled"],Uo=q({__name:"AddKeyModal",props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:["close","add"],setup(z,{emit:f}){const l=z,m=f,g=v(""),d=v(""),i=v("allow"),o=N(()=>g.value.startsWith("#")),c=N(()=>({type:o.value?"Region":"Private Key",description:o.value?"Regional organizational key":"Individual assigned key"}));Q(o,C=>{C?d.value="This will create a new region for organizing keys":d.value="This will create a new private key entry"},{immediate:!0});const y=N(()=>g.value.trim().length>0),h=()=>{y.value&&(m("add",{name:g.value.trim(),floodPolicy:i.value,parentId:l.selectedNodeId}),g.value="",d.value="",i.value="allow")},A=()=>{g.value="",d.value="",i.value="allow",m("close")},$=C=>{C.target===C.currentTarget&&A()};return(C,a)=>C.show?(r(),s("div",{key:0,onClick:$,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:a[3]||(a[3]=G(()=>{},["stop"]))},[e("div",ho,[e("div",null,[a[5]||(a[5]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Add New Entry",-1)),e("p",wo,[l.selectedNodeName?(r(),s("span",_o,[a[4]||(a[4]=I(" Add to: ",-1)),e("span",$o,b(l.selectedNodeName),1)])):(r(),s("span",Co," Add to root level (#uk) "))])]),e("button",{onClick:A,class:"text-white/60 hover:text-white transition-colors"},a[6]||(a[6]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(h,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",Mo,[e("div",Ao,[o.value?(r(),s("svg",jo,a[7]||(a[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",No,a[8]||(a[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))),a[9]||(a[9]=I(" Region/Key Name ",-1))])]),E(e("input",{id:"keyName","onUpdate:modelValue":a[0]||(a[0]=t=>g.value=t),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",So,[e("div",To,[e("div",Bo,[o.value?(r(),s("svg",Eo,a[10]||(a[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",Fo,a[11]||(a[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1221 9z"},null,-1)]))),e("span",{class:P([o.value?"text-secondary":"text-accent-green","font-medium"])},b(c.value.type),3)]),e("div",{class:P(["flex-1 h-px",o.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",Lo,b(c.value.description),1)]),e("div",null,[a[14]||(a[14]=e("label",{class:"block text-sm font-medium text-content-primary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),I(" Flood Policy ")])],-1)),e("div",Po,[e("label",zo,[E(e("input",{type:"radio","onUpdate:modelValue":a[1]||(a[1]=t=>i.value=t),value:"allow",class:"sr-only"},null,512),[[Z,i.value]]),a[12]||(a[12]=O('
Allow

Permit flooding

',1))]),e("label",Io,[E(e("input",{type:"radio","onUpdate:modelValue":a[2]||(a[2]=t=>i.value=t),value:"deny",class:"sr-only"},null,512),[[Z,i.value]]),a[13]||(a[13]=O('
Deny

Block flooding

',1))])])]),e("div",Do,[e("button",{type:"button",onClick:A,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!y.value,class:P(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",y.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-stroke/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted cursor-not-allowed"])}," Add "+b(c.value.type),11,Ho)])],32)])])):S("",!0)}}),Vo={class:"flex items-center justify-between mb-6"},Ro={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Ko={class:"text-primary font-mono"},qo={for:"keyName",class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-2"},Wo={class:"flex items-center gap-2"},Oo={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Go={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Yo={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},Xo={class:"flex items-center gap-3 mb-2"},Jo={class:"flex items-center gap-2"},Qo={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Zo={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},er={class:"text-content-secondary dark:text-content-muted text-sm"},tr={key:0,class:"space-y-4"},or={key:0,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},rr={class:"bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3"},sr={class:"text-xs font-mono text-content-primary dark:text-content-primary/80 break-all"},nr={key:1,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},ar={class:"flex items-center justify-between"},lr={class:"text-sm text-content-secondary dark:text-content-muted"},dr={class:"text-xs text-content-muted dark:text-content-muted"},ir={class:"grid grid-cols-2 gap-3"},cr={class:"relative cursor-pointer group"},ur={class:"relative cursor-pointer group"},mr={class:"flex gap-3 pt-4"},pr=["disabled"],br=q({__name:"EditKeyModal",props:{show:{type:Boolean},node:{}},emits:["close","save","request-delete"],setup(z,{emit:f}){const l=z,m=f,g=v(""),d=v("allow"),i=N(()=>g.value.startsWith("#")),o=N(()=>({type:i.value?"Region":"Private Key",description:i.value?"Regional organizational key":"Individual assigned key"}));Q(()=>l.node,t=>{t?(g.value=t.name,d.value=t.floodPolicy):(g.value="",d.value="allow")},{immediate:!0});const c=N(()=>g.value.trim().length>0&&l.node),y=t=>{const M=new Date().getTime()-t.getTime(),p=Math.floor(M/(1e3*60)),u=Math.floor(M/(1e3*60*60)),x=Math.floor(M/(1e3*60*60*24)),L=Math.floor(x/365);return p<60?`${p}m ago`:u<24?`${u}h ago`:x<365?`${x}d ago`:`${L}y ago`},h=t=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(t)},A=()=>{!c.value||!l.node||(m("save",{id:l.node.id,name:g.value.trim(),floodPolicy:d.value}),C())},$=()=>{l.node&&(m("request-delete",l.node),C())},C=()=>{m("close")},a=t=>{t.target===t.currentTarget&&C()};return(t,n)=>t.show?(r(),s("div",{key:0,onClick:a,class:"fixed inset-0 bg-black/50 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:n[4]||(n[4]=G(()=>{},["stop"]))},[e("div",Vo,[e("div",null,[n[6]||(n[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Edit Entry",-1)),e("p",Ro,[n[5]||(n[5]=I(" Modify ",-1)),e("span",Ko,b(t.node?.name),1)])]),e("button",{onClick:C,class:"text-white/60 hover:text-white transition-colors"},n[7]||(n[7]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(A,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",qo,[e("div",Wo,[i.value?(r(),s("svg",Oo,n[8]||(n[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",Go,n[9]||(n[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),n[10]||(n[10]=I(" Region/Key Name ",-1))])]),E(e("input",{id:"keyName","onUpdate:modelValue":n[0]||(n[0]=M=>g.value=M),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",Yo,[e("div",Xo,[e("div",Jo,[i.value?(r(),s("svg",Qo,n[11]||(n[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",Zo,n[12]||(n[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",{class:P([i.value?"text-secondary":"text-accent-green","font-medium"])},b(o.value.type),3)]),e("div",{class:P(["flex-1 h-px",i.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",er,b(o.value.description),1)]),t.node?(r(),s("div",tr,[t.node.transport_key?(r(),s("div",or,[n[14]||(n[14]=O('
Transport Key
',1)),e("div",rr,[e("div",sr,b(t.node.transport_key),1),e("button",{onClick:n[1]||(n[1]=M=>h(t.node.transport_key||"")),class:"mt-2 text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1",title:"Copy to clipboard"},n[13]||(n[13]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),I(" Copy Key ",-1)]))])])):S("",!0),t.node.last_used?(r(),s("div",nr,[n[15]||(n[15]=e("div",{class:"flex items-center gap-2 mb-3"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})]),e("span",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Last Used")],-1)),e("div",ar,[e("div",lr,b(t.node.last_used.toLocaleDateString())+" at "+b(t.node.last_used.toLocaleTimeString()),1),e("div",dr,b(y(t.node.last_used)),1)])])):S("",!0)])):S("",!0),e("div",null,[n[18]||(n[18]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),I(" Flood Policy ")])],-1)),e("div",ir,[e("label",cr,[E(e("input",{type:"radio","onUpdate:modelValue":n[2]||(n[2]=M=>d.value=M),value:"allow",class:"sr-only"},null,512),[[Z,d.value]]),n[16]||(n[16]=O('
Allow

Permit flooding

',1))]),e("label",ur,[E(e("input",{type:"radio","onUpdate:modelValue":n[3]||(n[3]=M=>d.value=M),value:"deny",class:"sr-only"},null,512),[[Z,d.value]]),n[17]||(n[17]=O('
Deny

Block flooding

',1))])])]),e("div",mr,[e("button",{type:"button",onClick:$,class:"px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors"}," Delete "),e("button",{type:"button",onClick:C,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!c.value,class:P(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",c.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted/70 cursor-not-allowed"])}," Save Changes ",10,pr)])],32)])])):S("",!0)}}),vr={class:"flex items-center gap-3 mb-6"},xr={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},kr={class:"text-accent-red font-mono"},gr={key:0,class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},yr={class:"flex items-start gap-3"},fr={class:"flex-1"},hr={class:"text-accent-red font-medium text-sm mb-2"},wr={class:"space-y-1 max-h-32 overflow-y-auto"},_r={key:0,class:"w-3 h-3 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},$r={key:1,class:"w-3 h-3 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Cr={class:"font-mono"},Mr={key:0,class:"text-content-secondary dark:text-content-muted text-xs"},Ar={key:1,class:"mb-6"},jr={class:"mb-3"},Nr={class:"relative"},Sr={class:"space-y-2 max-h-40 overflow-y-auto border border-stroke-subtle dark:border-stroke/20 rounded-lg p-3 bg-gray-50 dark:bg-white/5"},Tr={key:0,class:"text-center py-4 text-content-secondary dark:text-content-muted text-sm"},Br={class:"relative"},Er=["value"],Fr={class:"flex items-center gap-2 flex-1"},Lr={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Pr={key:0,class:"ml-auto px-2 py-0.5 bg-background-mute dark:bg-stroke/10 text-content-secondary dark:text-content-muted text-xs rounded-full"},zr={class:"flex gap-3"},Ir=q({__name:"DeleteConfirmModal",props:{show:{type:Boolean},node:{},allNodes:{}},emits:["close","delete-all","move-children"],setup(z,{emit:f}){const l=z,m=f,g=v(null),d=v(""),i=a=>{const t=[],n=M=>{for(const p of M.children)t.push(p),n(p)};return n(a),t},o=N(()=>l.node?i(l.node):[]),c=N(()=>{if(!l.node)return[];const a=new Set([l.node.id,...o.value.map(n=>n.id)]),t=n=>{const M=[];for(const p of n)p.name.startsWith("#")&&!a.has(p.id)&&M.push(p),p.children.length>0&&M.push(...t(p.children));return M};return t(l.allNodes)}),y=N(()=>{if(!d.value.trim())return c.value;const a=d.value.toLowerCase();return c.value.filter(t=>t.name.toLowerCase().includes(a))}),h=()=>{l.node&&(m("delete-all",l.node.id),$())},A=()=>{!l.node||!g.value||(m("move-children",{nodeId:l.node.id,targetParentId:g.value}),$())},$=()=>{g.value=null,d.value="",m("close")},C=a=>{a.target===a.currentTarget&&$()};return(a,t)=>a.show&&a.node?(r(),s("div",{key:0,onClick:C,class:"fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:t[2]||(t[2]=G(()=>{},["stop"]))},[e("div",vr,[t[6]||(t[6]=e("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),e("div",null,[t[4]||(t[4]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Confirm Deletion",-1)),e("p",xr,[t[3]||(t[3]=I(" Deleting ",-1)),e("span",kr,b(a.node?.name),1)])]),e("button",{onClick:$,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),o.value.length>0?(r(),s("div",gr,[e("div",yr,[t[9]||(t[9]=e("svg",{class:"w-5 h-5 text-accent-red flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("div",fr,[e("h4",hr," This will affect "+b(o.value.length)+" child "+b(o.value.length===1?"entry":"entries")+": ",1),e("div",wr,[(r(!0),s(K,null,Y(o.value.slice(0,10),n=>(r(),s("div",{key:n.id,class:"flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80"},[n.name.startsWith("#")?(r(),s("svg",_r,t[7]||(t[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(r(),s("svg",$r,t[8]||(t[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",Cr,b(n.name),1),e("span",{class:P(["px-1 py-0.5 text-xs rounded",n.floodPolicy==="allow"?"bg-accent-green/20 text-accent-green":"bg-accent-red/20 text-accent-red"])},b(n.floodPolicy),3)]))),128)),o.value.length>10?(r(),s("div",Mr," ...and "+b(o.value.length-10)+" more ",1)):S("",!0)])])])])):S("",!0),o.value.length>0&&c.value.length>0?(r(),s("div",Ar,[t[13]||(t[13]=e("h4",{class:"text-content-primary dark:text-content-primary font-medium text-sm mb-3"},"Move children to another region:",-1)),e("div",jr,[e("div",Nr,[t[10]||(t[10]=e("svg",{class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-content-muted dark:text-content-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),E(e("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>d.value=n),type:"text",placeholder:"Search regions...",class:"w-full pl-9 pr-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors text-sm"},null,512),[[V,d.value]])])]),e("div",Sr,[y.value.length===0?(r(),s("div",Tr,b(d.value?"No regions match your search":"No available regions"),1)):S("",!0),(r(!0),s(K,null,Y(y.value,n=>(r(),s("label",{key:n.id,class:"flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group"},[e("div",Br,[E(e("input",{type:"radio",value:n.id,"onUpdate:modelValue":t[1]||(t[1]=M=>g.value=M),class:"sr-only peer"},null,8,Er),[[Z,g.value]]),t[11]||(t[11]=e("div",{class:"w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-hover:border-stroke dark:group-hover:border-stroke/50 peer-checked:border-primary peer-checked:bg-primary/20 transition-all"},[e("div",{class:"w-2 h-2 rounded-full bg-primary scale-0 peer-checked:scale-100 transition-transform absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"})],-1))]),e("div",Fr,[t[12]||(t[12]=e("svg",{class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})],-1)),e("span",Lr,b(n.name),1),n.children.length>0?(r(),s("span",Pr,b(n.children.length),1)):S("",!0)])]))),128))])])):S("",!0),e("div",zr,[e("button",{onClick:$,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),o.value.length>0&&g.value?(r(),s("button",{key:0,onClick:A,class:"flex-1 px-4 py-3 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary rounded-lg transition-colors"}," Move & Delete ")):S("",!0),e("button",{onClick:h,class:"flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium"},b(o.value.length>0?"Delete All":"Delete"),1)])])])):S("",!0)}}),Dr={class:"space-y-4 sm:space-y-6"},Hr={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3"},Ur={class:"flex gap-2 flex-wrap"},Vr=["disabled"],Rr=["disabled"],Kr=["disabled"],qr={class:"glass-card rounded-[15px] p-3 sm:p-4 border border-stroke-subtle dark:border-stroke/10 bg-background-mute dark:bg-white/5"},Wr={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},Or={class:"flex items-center gap-2 sm:gap-3"},Gr={class:"flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1"},Yr={class:"glass-card rounded-[15px] p-3 sm:p-6 border border-stroke-subtle dark:border-stroke/10"},Xr={key:0,class:"flex items-center justify-center py-8"},Jr={key:1,class:"text-center py-8"},Qr={class:"text-content-secondary dark:text-content-muted text-sm"},Zr={key:2,class:"text-center py-8"},es={key:3,class:"space-y-2"},ts=q({name:"TransportKeys",__name:"TransportKeys",setup(z){const f=me(),l=v(!1),m=v(!1),g=v(!1),d=v(null),i=v(null),o=v("deny"),c=v([]),y=v(!1),h=v(null),A=w=>{const k=new Map,H=[];return w.forEach(D=>{const se={id:D.id,name:D.name,floodPolicy:D.flood_policy,transport_key:D.transport_key,last_used:D.last_used?new Date(D.last_used*1e3):void 0,parent_id:D.parent_id,children:[]};k.set(D.id,se)}),k.forEach(D=>{D.parent_id&&k.has(D.parent_id)?k.get(D.parent_id).children.push(D):H.push(D)}),H},$=async()=>{try{y.value=!0,h.value=null;const w=await U.getTransportKeys();w.success&&w.data?c.value=A(w.data):h.value=w.error||"Failed to load transport keys"}catch(w){h.value=w instanceof Error?w.message:"Unknown error occurred",console.error("Error loading transport keys:",w)}finally{y.value=!1}};oe(()=>{$()});function C(w,k){for(const H of w){if(H.id===k)return H;if(H.children){const D=C(H.children,k);if(D)return D}}return null}function a(){const w=f.selectedNodeId.value;return w?C(c.value,w)?.name:void 0}function t(w){o.value==="deny"&&f.setSelectedNode(w)}function n(){o.value==="deny"&&(l.value=!0)}function M(){if(o.value==="deny"&&f.selectedNodeId.value){const w=C(c.value,f.selectedNodeId.value);w&&(i.value=w,g.value=!0)}}function p(){if(o.value==="deny"&&f.selectedNodeId.value){const w=C(c.value,f.selectedNodeId.value);w&&(d.value=w,m.value=!0)}}const u=async w=>{try{const k=await U.createTransportKey(w.name,w.floodPolicy,void 0,w.parentId,void 0);k.success?await $():(console.error("Failed to add transport key:",k.error),h.value=k.error||"Failed to add transport key")}catch(k){console.error("Error adding transport key:",k),h.value=k instanceof Error?k.message:"Unknown error occurred"}finally{l.value=!1}};function x(){l.value=!1}async function L(w){try{const k=w==="allow",H=await U.updateGlobalFloodPolicy(k);H.success?o.value=w:(console.error("Failed to update global flood policy:",H.error),h.value=H.error||"Failed to update global flood policy")}catch(k){console.error("Error updating global flood policy:",k),h.value=k instanceof Error?k.message:"Failed to update global flood policy"}}function X(){m.value=!1,d.value=null}async function _(w){try{const k=await U.updateTransportKey(w.id,w.name,w.floodPolicy);k.success?await $():(console.error("Failed to update transport key:",k.error),h.value=k.error||"Failed to update transport key")}catch(k){console.error("Error updating transport key:",k),h.value=k instanceof Error?k.message:"Unknown error occurred"}finally{X()}}function j(w){m.value=!1,d.value=null,i.value=w,g.value=!0}function F(){g.value=!1,i.value=null}async function T(w){try{const k=await U.deleteTransportKey(w);k.success?(await $(),f.setSelectedNode(null)):(console.error("Failed to delete transport key:",k.error),h.value=k.error||"Failed to delete transport key")}catch(k){console.error("Error deleting transport key:",k),h.value=k instanceof Error?k.message:"Unknown error occurred"}finally{F()}}async function B(w){try{const k=await U.deleteTransportKey(w.nodeId);k.success?(await $(),f.setSelectedNode(null)):(console.error("Failed to delete transport key:",k.error),h.value=k.error||"Failed to delete transport key")}catch(k){console.error("Error deleting transport key:",k),h.value=k instanceof Error?k.message:"Unknown error occurred"}finally{F()}}return(w,k)=>(r(),s("div",Dr,[e("div",Hr,[k[3]||(k[3]=e("div",null,[e("h3",{class:"text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2"},"Regions/Keys"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Manage regional key hierarchy")],-1)),e("div",Ur,[e("button",{onClick:n,disabled:o.value==="allow",class:P(["flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",o.value==="allow"?"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/10 hover:bg-accent-green/20 text-accent-green border-accent-green/30"])},k[2]||(k[2]=[e("svg",{class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),I(" Add ",-1)]),10,Vr),e("button",{onClick:p,disabled:!W(f).selectedNodeId.value||o.value==="allow",class:P(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!W(f).selectedNodeId.value||o.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border-accent-green/50"])}," Edit ",10,Rr),e("button",{onClick:M,disabled:!W(f).selectedNodeId.value||o.value==="allow",class:P(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!W(f).selectedNodeId.value||o.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border-accent-red/50"])}," Delete ",10,Kr)])]),e("div",qr,[e("div",Wr,[k[4]||(k[4]=e("div",null,[e("h4",{class:"text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1"},"Global Flood Policy (*)"),e("p",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Master control for repeater flooding")],-1)),e("div",Or,[e("div",Gr,[e("button",{onClick:k[0]||(k[0]=H=>L("deny")),class:P(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",o.value==="deny"?"bg-accent-red/20 text-accent-red border border-accent-red/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," DENY ",2),e("button",{onClick:k[1]||(k[1]=H=>L("allow")),class:P(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",o.value==="allow"?"bg-accent-green/20 text-accent-green border border-accent-green/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," ALLOW ",2)])])])]),e("div",Yr,[y.value?(r(),s("div",Xr,k[5]||(k[5]=[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-accent-green"},null,-1),e("span",{class:"ml-2 text-content-secondary dark:text-content-muted"},"Loading transport keys...",-1)]))):h.value?(r(),s("div",Jr,[k[6]||(k[6]=e("div",{class:"text-accent-red mb-2"},"⚠️ Error loading transport keys",-1)),e("div",Qr,b(h.value),1),e("button",{onClick:$,class:"mt-4 px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded-lg transition-colors"}," Retry ")])):c.value.length===0?(r(),s("div",Zr,k[7]||(k[7]=[e("div",{class:"text-content-muted dark:text-content-muted mb-2"},"📝 No transport keys found",-1),e("div",{class:"text-content-muted dark:text-content-muted/60 text-sm"},"Add your first transport key to get started",-1)]))):(r(),s("div",es,[(r(!0),s(K,null,Y(c.value,H=>(r(),ce(fo,{key:H.id,node:H,"selected-node-id":W(f).selectedNodeId.value,level:0,disabled:o.value==="allow",onSelect:t},null,8,["node","selected-node-id","disabled"]))),128))]))]),R(Uo,{show:l.value,"selected-node-name":a(),"selected-node-id":W(f).selectedNodeId.value||void 0,onClose:x,onAdd:u},null,8,["show","selected-node-name","selected-node-id"]),R(br,{show:m.value,node:d.value,onClose:X,onSave:_,onRequestDelete:j},null,8,["show","node"]),R(Ir,{show:g.value,node:i.value,"all-nodes":c.value,onClose:F,onDeleteAll:T,onMoveChildren:B},null,8,["show","node","all-nodes"])]))}}),os={class:"space-y-4 sm:space-y-6"},rs={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},ss={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-4"},ns={class:"flex items-center gap-2 text-red-600 dark:text-red-400"},as={key:1,class:"flex items-center justify-center py-12"},ls={key:2,class:"space-y-3"},ds={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},is={class:"flex-1"},cs={class:"flex items-center gap-2 sm:gap-3"},us={class:"min-w-0 flex-1"},ms={class:"text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all"},ps={class:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted"},bs={class:"truncate"},vs={class:"truncate"},xs=["onClick","disabled"],ks={key:3,class:"text-center py-12"},gs={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl"},ys={class:"space-y-4"},fs={class:"flex justify-end gap-3 mt-6"},hs=["disabled"],ws=["disabled"],_s={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-lg w-full shadow-2xl"},$s={class:"space-y-4"},Cs={class:"flex gap-2"},Ms=["value"],As={class:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4"},js={class:"block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto"},Ns=q({name:"APITokens",__name:"APITokens",setup(z){const f=v([]),l=v(!1),m=v(null),g=v(!1),d=v(""),i=v(null),o=v(!1),c=v(!1),y=v(null),h=async()=>{l.value=!0,m.value=null;try{const u=await U.get("/auth/tokens"),x=u.data||u;f.value=x.tokens||[]}catch(u){console.error("Failed to fetch API tokens:",u),m.value=u instanceof Error?u.message:"Failed to fetch tokens"}finally{l.value=!1}},A=async()=>{if(!d.value.trim()){m.value="Token name is required";return}l.value=!0,m.value=null;try{const u=await U.post("/auth/tokens",{name:d.value.trim()}),x=u.data||u;i.value=x.token||null,g.value=!1,o.value=!0,d.value="",await h()}catch(u){console.error("Failed to create API token:",u),m.value=u instanceof Error?u.message:"Failed to create token"}finally{l.value=!1}},$=(u,x)=>{y.value={id:u,name:x},c.value=!0},C=async()=>{if(y.value){l.value=!0,m.value=null;try{await U.delete(`/auth/tokens/${y.value.id}`),await h(),c.value=!1,y.value=null}catch(u){console.error("Failed to revoke API token:",u),m.value=u instanceof Error?u.message:"Failed to revoke token"}finally{l.value=!1}}},a=()=>{g.value=!1,d.value="",m.value=null},t=()=>{o.value=!1,i.value=null},n=()=>{i.value&&navigator.clipboard.writeText(i.value)},M=u=>u?new Date(u*1e3).toLocaleString():"Never",p=N(()=>`${window.location.origin}/api/stats`);return oe(()=>{h()}),(u,x)=>(r(),s(K,null,[e("div",os,[e("div",rs,[x[5]||(x[5]=e("div",null,[e("h2",{class:"text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary"},"API Tokens"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1"},"Manage API tokens for machine-to-machine authentication")],-1)),e("button",{onClick:x[0]||(x[0]=L=>g.value=!0),class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center justify-center gap-2 text-sm sm:text-base"},x[4]||(x[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),I(" Create Token ",-1)]))]),x[20]||(x[20]=O('

API tokens are used for machine-to-machine authentication. Include the token in the X-API-Key header when making API requests.

Tokens are only shown once at creation. Store them securely.

',1)),m.value?(r(),s("div",ss,[e("div",ns,[x[6]||(x[6]=e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),I(" "+b(m.value),1)])])):S("",!0),l.value&&f.value.length===0?(r(),s("div",as,x[7]||(x[7]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading tokens...")],-1)]))):f.value.length>0?(r(),s("div",ls,[(r(!0),s(K,null,Y(f.value,L=>(r(),s("div",{key:L.id,class:"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3 sm:p-4 hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors"},[e("div",ds,[e("div",is,[e("div",cs,[x[8]||(x[8]=e("svg",{class:"w-4 h-4 sm:w-5 sm:h-5 text-primary flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),e("div",us,[e("h3",ms,b(L.name),1),e("div",ps,[e("span",bs,"Created: "+b(M(L.created_at)),1),e("span",vs,"Last used: "+b(M(L.last_used)),1)])])])]),e("button",{onClick:X=>$(L.id,L.name),disabled:l.value,class:"w-full sm:w-auto px-3 py-1.5 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 transition-colors disabled:opacity-50 text-sm"}," Revoke ",8,xs)])]))),128))])):(r(),s("div",ks,[x[9]||(x[9]=e("svg",{class:"w-16 h-16 text-content-muted dark:text-content-muted/40 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),x[10]||(x[10]=e("h3",{class:"text-content-primary dark:text-content-primary font-medium mb-2"},"No API Tokens",-1)),x[11]||(x[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-4"},"Create a token to enable API access",-1)),e("button",{onClick:x[1]||(x[1]=L=>g.value=!0),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Create Your First Token ")])),g.value?(r(),s("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(a,["self"])},[e("div",gs,[x[14]||(x[14]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Create API Token",-1)),e("div",ys,[e("div",null,[x[12]||(x[12]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Token Name",-1)),E(e("input",{"onUpdate:modelValue":x[2]||(x[2]=L=>d.value=L),type:"text",placeholder:"e.g., Production Server, CI/CD Pipeline",class:"w-full px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-400 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",onKeydown:xe(A,["enter"])},null,544),[[V,d.value]]),x[13]||(x[13]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-1"},"Give your token a descriptive name to identify its purpose",-1))]),e("div",fs,[e("button",{onClick:a,disabled:l.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50"}," Cancel ",8,hs),e("button",{onClick:A,disabled:l.value||!d.value.trim(),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors disabled:opacity-50"},b(l.value?"Creating...":"Create Token"),9,ws)])])])])):S("",!0),o.value&&i.value?(r(),s("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(t,["self"])},[e("div",_s,[x[19]||(x[19]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Token Created Successfully",-1)),e("div",$s,[x[18]||(x[18]=O('
Save this token now! For security reasons, it will not be shown again.
',1)),e("div",null,[x[16]||(x[16]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Your API Token",-1)),e("div",Cs,[e("input",{value:i.value,readonly:"",class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary font-mono text-sm"},null,8,Ms),e("button",{onClick:n,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard"},x[15]||(x[15]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),I(" Copy ",-1)]))])]),e("div",As,[x[17]||(x[17]=e("p",{class:"text-sm text-blue-200 mb-2"},[e("strong",null,"Usage Example:")],-1)),e("code",js,' curl -H "X-API-Key: '+b(i.value)+'" '+b(p.value),1)]),e("div",{class:"flex justify-end mt-6"},[e("button",{onClick:t,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Done ")])])])])):S("",!0)]),R(ke,{show:c.value,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${y.value?.name}'? This action cannot be undone.`,"confirm-text":"Revoke","cancel-text":"Cancel",variant:"danger",onConfirm:C,onClose:x[3]||(x[3]=L=>c.value=!1)},null,8,["show","message"])],64))}}),Ss={class:"space-y-6"},Ts={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Bs={class:"space-y-4"},Es={class:"flex items-center justify-between"},Fs=["disabled"],Ls={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Ps={class:"space-y-4"},zs={class:"space-y-3"},Is=["checked","disabled"],Ds=["checked","disabled"],Hs={class:"flex items-start gap-3"},Us={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Vs={key:1,class:"w-5 h-5 text-accent-blue flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Rs={class:"flex-1"},Ks={class:"text-sm font-medium text-content-primary dark:text-content-primary"},qs={key:0,class:"text-xs text-green-600 dark:text-green-400 mt-1"},Ws={key:1,class:"p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg"},Os={class:"flex items-start justify-between gap-3"},Gs=["disabled"],Ys={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},Xs={key:1,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Js={class:"flex items-center space-x-2"},Qs={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Zs={key:1,class:"w-5 h-5 text-red-600 dark:text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},en=q({name:"WebSettings",__name:"WebSettings",setup(z){const f=v(!1),l=v(""),m=v(!1),g=v(!1),d=v(!1),i=v(!1),o=v(!0),c=re({cors_enabled:!1,use_default_frontend:!0}),y=N(()=>m.value?"bg-green-500/10 border-green-600/40 dark:border-green-500/30":"bg-red-500/10 border-red-500/30");async function h(){try{o.value=!0;const p=await U.get("/check_pymc_console");p.success&&p.data&&(i.value=p.data.exists,console.log("PyMC Console exists:",i.value))}catch(p){console.error("Failed to check PyMC Console:",p),i.value=!1}finally{o.value=!1}}async function A(){try{const p=await U.get("/stats");console.log("WebSettings: Full response:",p);let u=null;if(p.success&&p.data?u=p.data:p&&"version"in p&&(u=p),u){const x=u.config?.web||{};console.log("WebSettings: webConfig:",x),c.cors_enabled=x.cors_enabled===!0,console.log("WebSettings: Set cors_enabled to:",c.cors_enabled);const L=x.web_path;c.use_default_frontend=!L||L==="",console.log("WebSettings: Set use_default_frontend to:",c.use_default_frontend,"from web_path:",L)}}catch(p){console.error("Failed to load web settings:",p),n("Failed to load settings",!1)}}async function $(){f.value=!0,l.value="";try{const p={web:{cors_enabled:c.cors_enabled}};c.use_default_frontend?p.web.web_path=null:p.web.web_path="/opt/pymc_console/web/html";const u=await U.post("/update_web_config",p);u.success?(n("Settings saved successfully",!0),g.value=!0):n(u.error||"Failed to save settings",!1)}catch(p){console.error("Failed to save web settings:",p),n(p.message||"Failed to save settings",!1)}finally{f.value=!1}}async function C(){c.cors_enabled=!c.cors_enabled,await $()}async function a(){c.use_default_frontend=!0,await $()}async function t(){c.use_default_frontend=!1,await $()}function n(p,u){l.value=p,m.value=u,setTimeout(()=>{l.value=""},5e3)}async function M(){d.value=!0,l.value="";try{const p=await U.post("/restart_service",{});p.success?(n("Service restart initiated. Page will reload...",!0),g.value=!1,setTimeout(()=>{window.location.reload()},2e3)):n(p.error||"Failed to restart service",!1)}catch(p){p.code==="ERR_NETWORK"||p.message?.includes("Network error")?(n("Service restarting... Page will reload",!0),g.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error("Failed to restart service:",p),n(p.message||"Failed to restart service",!1))}finally{d.value=!1}}return oe(()=>{A(),h()}),(p,u)=>(r(),s("div",Ss,[e("div",Ts,[u[1]||(u[1]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"CORS Settings"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Control cross-origin resource sharing for API access")])],-1)),e("div",Bs,[e("div",Es,[u[0]||(u[0]=e("div",null,[e("label",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Enable CORS"),e("p",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Allow web frontends from different origins to access the API")],-1)),e("button",{onClick:C,disabled:f.value,class:P(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",c.cors_enabled?"bg-accent-blue border-accent-blue":"bg-gray-600 border-gray-600",f.value?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[e("span",{class:P(["inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",c.cors_enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,Fs)])])]),e("div",Ls,[u[11]||(u[11]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"Web Frontend"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Choose which web interface to use")])],-1)),e("div",Ps,[e("div",zs,[e("label",{class:P(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",c.use_default_frontend?"border-accent-blue bg-accent-blue/10":"border-stroke-subtle dark:border-stroke/10 hover:border-accent-blue/50"])},[e("input",{type:"radio",name:"frontend",checked:c.use_default_frontend,onChange:a,disabled:f.value,class:"mt-1 h-4 w-4 text-accent-blue focus:ring-accent-blue focus:ring-offset-background"},null,40,Is),u[2]||(u[2]=e("div",{class:"flex-1"},[e("div",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Default Frontend"),e("div",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Built-in pyMC Repeater web interface"),e("div",{class:"text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono"},"Built-in")],-1))],2),e("label",{class:P(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",c.use_default_frontend?"border-stroke-subtle dark:border-stroke/10 hover:border-accent-blue/50":"border-accent-blue bg-accent-blue/10"])},[e("input",{type:"radio",name:"frontend",checked:!c.use_default_frontend,onChange:t,disabled:f.value,class:"mt-1 h-4 w-4 text-accent-blue focus:ring-accent-blue focus:ring-offset-background"},null,40,Ds),u[3]||(u[3]=O('
PyMC Console
@Treehouse⚡
Alternative web interface for pyMC Repeater
/opt/pymc_console/web/html
',1))],2)]),o.value?S("",!0):(r(),s("div",{key:0,class:P(["p-4 rounded-lg border",i.value?"bg-green-500/5 border-green-500/20":"bg-accent-blue/5 border-accent-blue/20"])},[e("div",Hs,[i.value?(r(),s("svg",Us,u[4]||(u[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):(r(),s("svg",Vs,u[5]||(u[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))),e("div",Rs,[e("h4",Ks,b(i.value?"PyMC Console has been detected":"PyMC Console Not Installed"),1),i.value?(r(),s("p",qs,u[6]||(u[6]=[I(" PyMC Console is installed at ",-1),e("code",{class:"text-green-700 dark:text-green-300"},"/opt/pymc_console/web/html",-1)]))):(r(),s(K,{key:1},[u[7]||(u[7]=O('

PyMC Console must be installed at /opt/pymc_console/web/html before selecting this option.

PyMC Console Install Instructions ',2))],64))])])],2)),g.value?(r(),s("div",Ws,[e("div",Os,[u[10]||(u[10]=O('

Service restart required

Web frontend changes will take effect after restarting the pymc-repeater service.

',1)),e("button",{onClick:M,disabled:d.value,class:"px-4 py-2 bg-amber-500 hover:bg-amber-600 disabled:bg-amber-500/50 text-white font-medium rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap"},[d.value?(r(),s("svg",Ys,u[8]||(u[8]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)]))):(r(),s("svg",Xs,u[9]||(u[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)]))),I(" "+b(d.value?"Restarting...":"Restart Now"),1)],8,Gs)])])):S("",!0)])]),l.value?(r(),s("div",{key:0,class:P(["p-4 rounded-lg border",y.value])},[e("div",Js,[m.value?(r(),s("svg",Qs,u[12]||(u[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):(r(),s("svg",Zs,u[13]||(u[13]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))),e("span",{class:P(m.value?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},b(l.value),3)])],2)):S("",!0)]))}}),tn={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},on={class:"glass-card rounded-[15px] z-10 p-3 sm:p-4 border border-cyan-400 dark:border-primary/30 bg-cyan-500/10 dark:bg-primary/10"},rn={class:"text-cyan-700 dark:text-primary text-sm sm:text-base"},sn={class:"mt-1 sm:mt-2 text-cyan-600 dark:text-primary/80"},nn={class:"glass-card rounded-[15px] p-3 sm:p-6"},an={class:"flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke/10 mb-4 sm:mb-6 -mx-3 px-3 sm:mx-0 sm:px-0 scrollbar-hide"},ln=["onClick"],dn={class:"flex items-center gap-1 sm:gap-2"},cn={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},un={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},mn={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},pn={key:3,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},bn={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},vn={key:5,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},xn={key:6,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},kn={class:"min-h-[400px]"},gn={key:0,class:"flex items-center justify-center py-12"},yn={key:1,class:"flex items-center justify-center py-12"},fn={class:"text-center"},hn={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},wn={key:2},An=q({name:"ConfigurationView",__name:"Configuration",setup(z){const f=ee(),l=v(ge("configuration_activeTab","radio")),m=v(!1);Q(l,i=>ye("configuration_activeTab",i));const g=[{id:"radio",label:"Radio Settings",icon:"radio"},{id:"repeater",label:"Repeater Settings",icon:"repeater"},{id:"duty",label:"Duty Cycle",icon:"duty"},{id:"delays",label:"TX Delays",icon:"delays"},{id:"transport",label:"Regions/Keys",icon:"keys"},{id:"api-tokens",label:"API Tokens",icon:"tokens"},{id:"web",label:"Web Options",icon:"web"}];oe(async()=>{try{await f.fetchStats(),m.value=!0}catch(i){console.error("Failed to load configuration data:",i),m.value=!0}});function d(i){l.value=i}return(i,o)=>{const c=ue("router-link");return r(),s("div",tn,[o[13]||(o[13]=e("div",null,[e("h1",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Configuration"),e("p",{class:"text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base"},"System configuration and settings")],-1)),e("div",on,[e("div",rn,[o[3]||(o[3]=e("strong",null,"CAD Calibration Tool Available",-1)),e("p",sn,[o[2]||(o[2]=I(" Optimize your Channel Activity Detection settings. ",-1)),R(c,{to:"/cad-calibration",class:"underline hover:text-cyan-800 dark:hover:text-primary transition-colors"},{default:ie(()=>o[1]||(o[1]=[I(" Launch CAD Calibration Tool → ",-1)])),_:1,__:[1]})])])]),e("div",nn,[e("div",an,[(r(),s(K,null,Y(g,y=>e("button",{key:y.id,onClick:h=>d(y.id),class:P(["px-3 sm:px-4 py-2 text-xs sm:text-sm font-medium transition-colors duration-200 border-b-2 mr-3 sm:mr-6 whitespace-nowrap flex-shrink-0",l.value===y.id?"text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary":"text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30"])},[e("div",dn,[y.icon==="radio"?(r(),s("svg",cn,o[4]||(o[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.822c5.716-5.716 14.976-5.716 20.692 0"},null,-1)]))):y.icon==="repeater"?(r(),s("svg",un,o[5]||(o[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12l4-4m-4 4l4 4"},null,-1)]))):y.icon==="duty"?(r(),s("svg",mn,o[6]||(o[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):y.icon==="delays"?(r(),s("svg",pn,o[7]||(o[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):y.icon==="keys"?(r(),s("svg",bn,o[8]||(o[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))):y.icon==="tokens"?(r(),s("svg",vn,o[9]||(o[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},null,-1)]))):y.icon==="web"?(r(),s("svg",xn,o[10]||(o[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},null,-1)]))):S("",!0),I(" "+b(y.label),1)])],10,ln)),64))]),e("div",kn,[!m.value&&W(f).isLoading?(r(),s("div",gn,o[11]||(o[11]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading configuration...")],-1)]))):W(f).error&&!m.value?(r(),s("div",yn,[e("div",fn,[o[12]||(o[12]=e("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load configuration",-1)),e("div",hn,b(W(f).error),1),e("button",{onClick:o[0]||(o[0]=y=>W(f).fetchStats()),class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors"}," Retry ")])])):(r(),s("div",wn,[E(e("div",null,[R(Ye,{key:"radio-settings"})],512),[[J,l.value==="radio"]]),E(e("div",null,[R(jt,{key:"repeater-settings"})],512),[[J,l.value==="repeater"]]),E(e("div",null,[R(Ht,{key:"duty-cycle"})],512),[[J,l.value==="duty"]]),E(e("div",null,[R(eo,{key:"transmission-delays"})],512),[[J,l.value==="delays"]]),E(e("div",null,[R(ts,{key:"transport-keys"})],512),[[J,l.value==="transport"]]),E(e("div",null,[R(Ns,{key:"api-tokens"})],512),[[J,l.value==="api-tokens"]]),E(e("div",null,[R(en,{key:"web-settings"})],512),[[J,l.value==="web"]])]))])])])}}});export{An as default}; diff --git a/repeater/web/html/assets/Configuration-DCyoN75P.css b/repeater/web/html/assets/Configuration-DCyoN75P.css new file mode 100644 index 0000000..e672469 --- /dev/null +++ b/repeater/web/html/assets/Configuration-DCyoN75P.css @@ -0,0 +1 @@ +.leaflet-pane[data-v-186d3c86],.leaflet-tile[data-v-186d3c86],.leaflet-marker-icon[data-v-186d3c86],.leaflet-marker-shadow[data-v-186d3c86],.leaflet-tile-container[data-v-186d3c86],.leaflet-pane>svg[data-v-186d3c86],.leaflet-pane>canvas[data-v-186d3c86],.leaflet-zoom-box[data-v-186d3c86],.leaflet-image-layer[data-v-186d3c86],.leaflet-layer[data-v-186d3c86]{position:absolute;left:0;top:0}.leaflet-container[data-v-186d3c86]{overflow:hidden}.leaflet-tile[data-v-186d3c86],.leaflet-marker-icon[data-v-186d3c86],.leaflet-marker-shadow[data-v-186d3c86]{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile[data-v-186d3c86]::-moz-selection{background:transparent}.leaflet-tile[data-v-186d3c86]::selection{background:transparent}.leaflet-safari .leaflet-tile[data-v-186d3c86]{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container[data-v-186d3c86]{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon[data-v-186d3c86],.leaflet-marker-shadow[data-v-186d3c86]{display:block}.leaflet-container .leaflet-overlay-pane svg[data-v-186d3c86]{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img[data-v-186d3c86],.leaflet-container .leaflet-shadow-pane img[data-v-186d3c86],.leaflet-container .leaflet-tile-pane img[data-v-186d3c86],.leaflet-container img.leaflet-image-layer[data-v-186d3c86],.leaflet-container .leaflet-tile[data-v-186d3c86]{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile[data-v-186d3c86]{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom[data-v-186d3c86]{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag[data-v-186d3c86]{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom[data-v-186d3c86]{touch-action:none}.leaflet-container[data-v-186d3c86]{-webkit-tap-highlight-color:transparent}.leaflet-container a[data-v-186d3c86]{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile[data-v-186d3c86]{filter:inherit;visibility:hidden}.leaflet-tile-loaded[data-v-186d3c86]{visibility:inherit}.leaflet-zoom-box[data-v-186d3c86]{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg[data-v-186d3c86]{-moz-user-select:none}.leaflet-pane[data-v-186d3c86]{z-index:400}.leaflet-tile-pane[data-v-186d3c86]{z-index:200}.leaflet-overlay-pane[data-v-186d3c86]{z-index:400}.leaflet-shadow-pane[data-v-186d3c86]{z-index:500}.leaflet-marker-pane[data-v-186d3c86]{z-index:600}.leaflet-tooltip-pane[data-v-186d3c86]{z-index:650}.leaflet-popup-pane[data-v-186d3c86]{z-index:700}.leaflet-map-pane canvas[data-v-186d3c86]{z-index:100}.leaflet-map-pane svg[data-v-186d3c86]{z-index:200}.leaflet-vml-shape[data-v-186d3c86]{width:1px;height:1px}.lvml[data-v-186d3c86]{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control[data-v-186d3c86]{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top[data-v-186d3c86],.leaflet-bottom[data-v-186d3c86]{position:absolute;z-index:1000;pointer-events:none}.leaflet-top[data-v-186d3c86]{top:0}.leaflet-right[data-v-186d3c86]{right:0}.leaflet-bottom[data-v-186d3c86]{bottom:0}.leaflet-left[data-v-186d3c86]{left:0}.leaflet-control[data-v-186d3c86]{float:left;clear:both}.leaflet-right .leaflet-control[data-v-186d3c86]{float:right}.leaflet-top .leaflet-control[data-v-186d3c86]{margin-top:10px}.leaflet-bottom .leaflet-control[data-v-186d3c86]{margin-bottom:10px}.leaflet-left .leaflet-control[data-v-186d3c86]{margin-left:10px}.leaflet-right .leaflet-control[data-v-186d3c86]{margin-right:10px}.leaflet-fade-anim .leaflet-popup[data-v-186d3c86]{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup[data-v-186d3c86]{opacity:1}.leaflet-zoom-animated[data-v-186d3c86]{transform-origin:0 0}svg.leaflet-zoom-animated[data-v-186d3c86]{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated[data-v-186d3c86]{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile[data-v-186d3c86],.leaflet-pan-anim .leaflet-tile[data-v-186d3c86]{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide[data-v-186d3c86]{visibility:hidden}.leaflet-interactive[data-v-186d3c86]{cursor:pointer}.leaflet-grab[data-v-186d3c86]{cursor:grab}.leaflet-crosshair[data-v-186d3c86],.leaflet-crosshair .leaflet-interactive[data-v-186d3c86]{cursor:crosshair}.leaflet-popup-pane[data-v-186d3c86],.leaflet-control[data-v-186d3c86]{cursor:auto}.leaflet-dragging .leaflet-grab[data-v-186d3c86],.leaflet-dragging .leaflet-grab .leaflet-interactive[data-v-186d3c86],.leaflet-dragging .leaflet-marker-draggable[data-v-186d3c86]{cursor:move;cursor:grabbing}.leaflet-marker-icon[data-v-186d3c86],.leaflet-marker-shadow[data-v-186d3c86],.leaflet-image-layer[data-v-186d3c86],.leaflet-pane>svg path[data-v-186d3c86],.leaflet-tile-container[data-v-186d3c86]{pointer-events:none}.leaflet-marker-icon.leaflet-interactive[data-v-186d3c86],.leaflet-image-layer.leaflet-interactive[data-v-186d3c86],.leaflet-pane>svg path.leaflet-interactive[data-v-186d3c86],svg.leaflet-image-layer.leaflet-interactive path[data-v-186d3c86]{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container[data-v-186d3c86]{background:#ddd;outline-offset:1px}.leaflet-container a[data-v-186d3c86]{color:#0078a8}.leaflet-zoom-box[data-v-186d3c86]{border:2px dotted #38f;background:#ffffff80}.leaflet-container[data-v-186d3c86]{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar[data-v-186d3c86]{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a[data-v-186d3c86]{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a[data-v-186d3c86],.leaflet-control-layers-toggle[data-v-186d3c86]{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a[data-v-186d3c86]:hover,.leaflet-bar a[data-v-186d3c86]:focus{background-color:#f4f4f4}.leaflet-bar a[data-v-186d3c86]:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a[data-v-186d3c86]:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled[data-v-186d3c86]{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a[data-v-186d3c86]{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a[data-v-186d3c86]:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a[data-v-186d3c86]:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in[data-v-186d3c86],.leaflet-control-zoom-out[data-v-186d3c86]{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in[data-v-186d3c86],.leaflet-touch .leaflet-control-zoom-out[data-v-186d3c86]{font-size:22px}.leaflet-control-layers[data-v-186d3c86]{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle[data-v-186d3c86]{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle[data-v-186d3c86]{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle[data-v-186d3c86]{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list[data-v-186d3c86],.leaflet-control-layers-expanded .leaflet-control-layers-toggle[data-v-186d3c86]{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list[data-v-186d3c86]{display:block;position:relative}.leaflet-control-layers-expanded[data-v-186d3c86]{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar[data-v-186d3c86]{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector[data-v-186d3c86]{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label[data-v-186d3c86]{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator[data-v-186d3c86]{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path[data-v-186d3c86]{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution[data-v-186d3c86]{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution[data-v-186d3c86],.leaflet-control-scale-line[data-v-186d3c86]{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a[data-v-186d3c86]{text-decoration:none}.leaflet-control-attribution a[data-v-186d3c86]:hover,.leaflet-control-attribution a[data-v-186d3c86]:focus{text-decoration:underline}.leaflet-attribution-flag[data-v-186d3c86]{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale[data-v-186d3c86]{margin-left:5px}.leaflet-bottom .leaflet-control-scale[data-v-186d3c86]{margin-bottom:5px}.leaflet-control-scale-line[data-v-186d3c86]{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line[data-v-186d3c86]:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line[data-v-186d3c86]:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution[data-v-186d3c86],.leaflet-touch .leaflet-control-layers[data-v-186d3c86],.leaflet-touch .leaflet-bar[data-v-186d3c86]{box-shadow:none}.leaflet-touch .leaflet-control-layers[data-v-186d3c86],.leaflet-touch .leaflet-bar[data-v-186d3c86]{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup[data-v-186d3c86]{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper[data-v-186d3c86]{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content[data-v-186d3c86]{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p[data-v-186d3c86]{margin:1.3em 0}.leaflet-popup-tip-container[data-v-186d3c86]{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip[data-v-186d3c86]{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper[data-v-186d3c86],.leaflet-popup-tip[data-v-186d3c86]{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button[data-v-186d3c86]{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button[data-v-186d3c86]:hover,.leaflet-container a.leaflet-popup-close-button[data-v-186d3c86]:focus{color:#585858}.leaflet-popup-scrolled[data-v-186d3c86]{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper[data-v-186d3c86]{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip[data-v-186d3c86]{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom[data-v-186d3c86],.leaflet-oldie .leaflet-control-layers[data-v-186d3c86],.leaflet-oldie .leaflet-popup-content-wrapper[data-v-186d3c86],.leaflet-oldie .leaflet-popup-tip[data-v-186d3c86]{border:1px solid #999}.leaflet-div-icon[data-v-186d3c86]{background:#fff;border:1px solid #666}.leaflet-tooltip[data-v-186d3c86]{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive[data-v-186d3c86]{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top[data-v-186d3c86]:before,.leaflet-tooltip-bottom[data-v-186d3c86]:before,.leaflet-tooltip-left[data-v-186d3c86]:before,.leaflet-tooltip-right[data-v-186d3c86]:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom[data-v-186d3c86]{margin-top:6px}.leaflet-tooltip-top[data-v-186d3c86]{margin-top:-6px}.leaflet-tooltip-bottom[data-v-186d3c86]:before,.leaflet-tooltip-top[data-v-186d3c86]:before{left:50%;margin-left:-6px}.leaflet-tooltip-top[data-v-186d3c86]:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom[data-v-186d3c86]:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left[data-v-186d3c86]{margin-left:-6px}.leaflet-tooltip-right[data-v-186d3c86]{margin-left:6px}.leaflet-tooltip-left[data-v-186d3c86]:before,.leaflet-tooltip-right[data-v-186d3c86]:before{top:50%;margin-top:-6px}.leaflet-tooltip-left[data-v-186d3c86]:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right[data-v-186d3c86]:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control[data-v-186d3c86]{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.ml-0[data-v-59e9974c]{margin-left:0rem}.ml-4[data-v-59e9974c]{margin-left:1rem}.ml-8[data-v-59e9974c]{margin-left:2rem}.ml-12[data-v-59e9974c]{margin-left:3rem}.ml-16[data-v-59e9974c]{margin-left:4rem}.ml-20[data-v-59e9974c]{margin-left:5rem}.ml-24[data-v-59e9974c]{margin-left:6rem}.ml-28[data-v-59e9974c]{margin-left:7rem}.ml-32[data-v-59e9974c]{margin-left:8rem} diff --git a/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js b/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js new file mode 100644 index 0000000..8d016c8 --- /dev/null +++ b/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js @@ -0,0 +1 @@ +import{a as p,b as n,g as m,e as t,s as g,t as s,j as d,p as l}from"./index-C2DY4pTz.js";const f={class:"flex items-center justify-between mb-4"},w={class:"text-xl font-semibold text-content-primary dark:text-content-primary"},v={class:"mb-6"},h={key:0,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},y={key:1,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},C={key:2,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},B={class:"text-content-secondary dark:text-content-primary/80 text-base leading-relaxed"},j={class:"flex gap-3"},_=p({__name:"ConfirmDialog",props:{show:{type:Boolean},title:{default:"Confirm Action"},message:{},confirmText:{default:"Confirm"},cancelText:{default:"Cancel"},variant:{default:"warning"}},emits:["close","confirm"],setup(c,{emit:b}){const o=c,r=b,u=i=>{i.target===i.currentTarget&&r("close")},k={danger:"bg-red-100 dark:bg-red-500/20 border-red-500/30 text-red-600 dark:text-red-400",warning:"bg-yellow-100 dark:bg-yellow-500/20 border-yellow-500/30 text-yellow-600 dark:text-yellow-400",info:"bg-blue-500/20 border-blue-500/30 text-blue-600 dark:text-blue-400"},x={danger:"bg-red-500 hover:bg-red-600",warning:"bg-yellow-500 hover:bg-yellow-600",info:"bg-blue-500 hover:bg-blue-600"};return(i,e)=>o.show?(l(),n("div",{key:0,onClick:u,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[t("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:e[3]||(e[3]=g(()=>{},["stop"]))},[t("div",f,[t("h3",w,s(o.title),1),t("button",{onClick:e[0]||(e[0]=a=>r("close")),class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},e[4]||(e[4]=[t("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),t("div",v,[t("div",{class:d(["inline-flex p-3 rounded-xl mb-4",k[o.variant]])},[o.variant==="danger"?(l(),n("svg",h,e[5]||(e[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)]))):o.variant==="warning"?(l(),n("svg",y,e[6]||(e[6]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)]))):(l(),n("svg",C,e[7]||(e[7]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2),t("p",B,s(o.message),1)]),t("div",j,[t("button",{onClick:e[1]||(e[1]=a=>r("close")),class:"flex-1 px-4 py-3 rounded-xl bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary transition-all duration-200 border border-stroke-subtle dark:border-stroke/10"},s(o.cancelText),1),t("button",{onClick:e[2]||(e[2]=a=>r("confirm")),class:d(["flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200",x[o.variant]])},s(o.confirmText),3)])])])):m("",!0)}});export{_}; diff --git a/repeater/web/html/assets/Dashboard-DMnus2lM.js b/repeater/web/html/assets/Dashboard-DMnus2lM.js new file mode 100644 index 0000000..5e1f73c --- /dev/null +++ b/repeater/web/html/assets/Dashboard-DMnus2lM.js @@ -0,0 +1,2 @@ +import{C as wt,a as Bt,L as Ft,P as jt,b as It,c as Et,i as Ut}from"./chart-B185MtDy.js";import{a as dt,r as D,c as K,D as st,o as ut,E as it,H as yt,b as l,e as t,t as n,n as xt,g as _,I as Lt,p as r,x as pt,J as ft,K as kt,f as Z,F as L,h as O,L as ht,M as Vt,i as Pt,u as ct,k as rt,N as Ht,T as zt,l as Ct,O as Xt,j as T,s as Gt,w as $t,q as Tt,P as Ot,Q as Qt}from"./index-C2DY4pTz.js";import{u as Wt}from"./useSignalQuality-D9wfbwdb.js";import{g as St,s as Rt}from"./preferences-DtwbSSgO.js";const Kt={class:"sparkline-card"},qt={class:"card-header"},Jt={class:"card-title"},Yt={class:"card-chart"},Zt=dt({name:"ChartSparkline",__name:"ChartSparkline",props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0}},setup(at){wt.register(Bt,Ft,jt,It,Et,Ut);const S=at,H=D(null),m=D(null),R=h=>{if(h.length<3)return h;const C=Math.min(15,Math.max(3,Math.floor(h.length*.2))),B=[];for(let b=0;bP+M,0)/A.length)}const W=Math.min(12,B.length),z=B.length/W,f=[];for(let b=0;b!S.data||S.data.length===0?[]:R(S.data)),F=()=>{if(!H.value)return;const h=H.value.getContext("2d");if(!h)return;m.value&&(m.value.destroy(),m.value=null);const C=w.value;C.length<2||(m.value=Lt(new wt(h,{type:"line",data:{labels:C.map((B,W)=>W.toString()),datasets:[{data:C,borderColor:S.color,borderWidth:2.5,fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:800,easing:"easeOutQuart"},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1},grace:"10%"}},elements:{line:{capBezierPoints:!0}}}})))},E=()=>{if(!m.value){F();return}const h=w.value;h.length<2||(m.value.data.labels=h.map((C,B)=>B.toString()),m.value.data.datasets[0].data=h,m.value.update("default"))};return st(()=>S.data,()=>{it(()=>E())},{deep:!0}),st(()=>S.color,()=>{m.value&&(m.value.data.datasets[0].borderColor=S.color,m.value.update("none"))}),ut(()=>{it(()=>F())}),yt(()=>{m.value&&(m.value.destroy(),m.value=null)}),(h,C)=>(r(),l("div",Kt,[t("div",qt,[t("p",Jt,n(h.title),1),t("span",{class:"card-value",style:xt({color:h.color})},n(typeof h.value=="number"?h.value.toLocaleString():h.value),5)]),t("div",Yt,[h.showChart?(r(),l("canvas",{key:0,ref_key:"canvasRef",ref:H},null,512)):_("",!0)])]))}}),vt=pt(Zt,[["__scopeId","data-v-bcd5cf93"]]),te={class:"grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4 mb-5 stats-cards-container"},ee=dt({name:"StatsCards",__name:"StatsCards",setup(at){const S=ft(),H=kt(),m=D(null),R=D(null),w=D(!1),F=K(()=>{const C=S.packetStats,B=S.systemStats,W=x=>{const i=Math.floor(x/86400),j=Math.floor(x%86400/3600),A=Math.floor(x%3600/60);return i>0?`${i}d ${j}h`:j>0?`${j}h ${A}m`:`${A}m`},z=C?.total_packets||0,f=C?.dropped_packets||0,b=z>0?Math.round(f/z*100):0;return{packetsReceived:z,packetsForwarded:C?.transmitted_packets||0,uptimeFormatted:B?W(B.uptime_seconds||0):"0m",uptimeHours:B?Math.floor((B.uptime_seconds||0)/3600):0,droppedPackets:f,dropPercent:`${b}%`,signalQuality:Math.round((C?.avg_rssi||0)+120)}}),E=K(()=>S.sparklineData),h=async()=>{if(!w.value)try{w.value=!0,await Promise.all([S.fetchSystemStats(),S.fetchPacketStats({hours:24})]),await it()}catch(C){console.error("Error fetching stats:",C)}finally{w.value=!1}};return ut(async()=>{await S.initializeSparklineHistory(),h();const C=H.isConnected?12e4:3e4;m.value=window.setInterval(h,C),R.value=window.setInterval(()=>{S.interpolateRates()},6e4)}),st(()=>H.isConnected,C=>{if(m.value){clearInterval(m.value);const B=C?12e4:3e4;m.value=window.setInterval(h,B)}}),yt(()=>{m.value&&clearInterval(m.value),R.value&&clearInterval(R.value)}),(C,B)=>(r(),l("div",te,[Z(vt,{title:"Up Time",value:F.value.uptimeFormatted,color:"#EBA0FC",data:[],showChart:!1,class:"stat-card"},null,8,["value"]),Z(vt,{title:"RX Packets",value:F.value.packetsReceived,color:"#AAE8E8",data:E.value.totalPackets,class:"stat-card"},null,8,["value","data"]),Z(vt,{title:"Forward",value:F.value.packetsForwarded,color:"#FFC246",data:E.value.transmittedPackets,class:"stat-card"},null,8,["value","data"]),Z(vt,{title:"Dropped",value:F.value.droppedPackets,color:"#FB787B",data:E.value.droppedPackets,class:"stat-card"},null,8,["value","data"])]))}}),se=pt(ee,[["__scopeId","data-v-41b33099"]]),ae={class:"glass-card rounded-[10px] p-4 lg:p-6"},ne={class:"h-48 lg:h-56 relative"},oe={key:0,class:"absolute inset-0 flex items-center justify-center"},re={key:1,class:"absolute inset-0 flex items-center justify-center"},le={class:"text-red-600 dark:text-red-400 text-sm lg:text-base"},ie={key:2,class:"absolute inset-0 flex items-center justify-center"},de={key:3,class:"h-full flex flex-col"},ce={key:0,class:"absolute top-2 left-1/2 -translate-x-1/2 bg-white/95 dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke rounded-lg px-3 py-2 z-10 pointer-events-none min-w-48"},ue={class:"text-content-primary dark:text-content-primary text-sm font-medium mb-1"},pe={class:"text-content-primary dark:text-content-primary"},me={class:"flex-1 flex items-end justify-evenly gap-4 px-4"},xe=["onMouseenter"],ye={class:"text-content-primary dark:text-content-primary text-xs sm:text-sm font-semibold text-center w-full",style:{"padding-bottom":"5px"}},be={class:"text-content-secondary dark:text-content-muted text-xs mt-2 text-center"},ve={key:0,class:"mt-4 flex flex-wrap justify-center gap-3 sm:gap-4 px-2 sm:px-4 text-[10px] sm:text-xs text-content-secondary dark:text-content-muted"},ge={class:"truncate text-left"},he={key:1,class:"mt-3 text-xs text-content-secondary dark:text-content-muted text-center"},fe=dt({name:"PacketTypesChart",__name:"PacketTypesChart",setup(at){const S=D([]),H=D(null),m=D(!0),R=D(null),w=D(null),F=[{name:"Payload",types:["Plain Text Message","Group Text Message","Group Datagram","Multi-part Packet"],subColors:["#3B82F6","#60A5FA","#93C5FD","#BFDBFE"]},{name:"Requests",types:["Request","Response","Anonymous Request"],subColors:["#10B981","#34D399","#6EE7B7"]},{name:"Control",types:["Node Advertisement","Acknowledgment","Returned Path"],subColors:["#F59E0B","#FBBF24","#FCD34D"]},{name:"Routing",types:["Trace"],subColors:["#8B5CF6"]},{name:"Reserved",types:["Reserved Type 11","Reserved Type 12","Reserved Type 13"],subColors:["#6B7280","#9CA3AF","#D1D5DB"]}],E=K(()=>F.map(f=>{const b=S.value.filter(x=>f.types.some(i=>x.name.includes(i)||x.name===i)).sort((x,i)=>i.count-x.count).map((x,i)=>({...x,color:f.subColors[i%f.subColors.length]}));return{name:f.name,color:f.subColors[0],items:b,total:b.reduce((x,i)=>x+i.count,0)}}).filter(f=>f.total>0)),h=K(()=>Math.max(...E.value.map(f=>f.total),1)),C=K(()=>E.value.reduce((f,b)=>f+b.total,0)),B=async()=>{try{R.value=null;const f=await ht.get("/packet_type_graph_data");if(f?.success&&f?.data){const b=f.data;if(b?.series){const x=[];b.series.forEach((i,j)=>{let A=0;i.data&&Array.isArray(i.data)&&(A=i.data.reduce((P,M)=>P+(M[1]||0),0)),A>0&&x.push({name:i.name||`Type ${i.type}`,type:i.type,count:A,color:""})}),S.value=x,m.value=!1}else R.value="No series data in server response",m.value=!1}else R.value="Invalid response from server",m.value=!1}catch(f){R.value=f instanceof Error?f.message:"Failed to load data",m.value=!1}},W=f=>Math.max(f/h.value*90,2),z=(f,b)=>b===0?0:f/b*100;return ut(()=>{B(),H.value=setInterval(()=>{B()},3e4)}),yt(()=>{H.value&&clearInterval(H.value)}),(f,b)=>(r(),l("div",ae,[b[3]||(b[3]=t("div",{class:"flex items-baseline justify-between mb-3 lg:mb-4"},[t("h3",{class:"text-content-primary dark:text-content-primary text-lg lg:text-xl font-semibold"},"Packet Types"),t("p",{class:"text-content-secondary dark:text-content-muted text-xs lg:text-sm uppercase"},"Distribution by Type")],-1)),t("div",ne,[m.value?(r(),l("div",oe,b[1]||(b[1]=[t("div",{class:"text-content-secondary dark:text-content-primary text-sm lg:text-base"},"Loading packet types...",-1)]))):R.value?(r(),l("div",re,[t("div",le,n(R.value),1)])):E.value.length===0?(r(),l("div",ie,b[2]||(b[2]=[t("div",{class:"text-content-secondary dark:text-content-primary text-sm lg:text-base"},"No packet data available",-1)]))):(r(),l("div",de,[w.value?(r(),l("div",ce,[t("div",ue,n(w.value.name)+" · "+n(w.value.total.toLocaleString()),1),(r(!0),l(L,null,O(w.value.items,x=>(r(),l("div",{key:x.type,class:"flex justify-between gap-4 text-xs text-content-secondary dark:text-content-muted"},[t("span",null,n(x.name),1),t("span",pe,n(x.count.toLocaleString()),1)]))),128))])):_("",!0),t("div",me,[(r(!0),l(L,null,O(E.value,x=>(r(),l("div",{key:x.name,class:"flex flex-col items-center flex-1 max-w-32 h-full justify-end cursor-pointer",onMouseenter:i=>w.value=x,onMouseleave:b[0]||(b[0]=i=>w.value=null)},[t("span",ye,n(x.total.toLocaleString()),1),t("div",{class:"w-full rounded-[5px] transition-all duration-300 ease-out hover:opacity-90 overflow-hidden flex flex-col-reverse",style:xt({height:W(x.total)+"%",minHeight:"8px"})},[(r(!0),l(L,null,O(x.items,i=>(r(),l("div",{key:i.type,style:xt({height:z(i.count,x.total)+"%",backgroundColor:i.color})},null,4))),128))],4),t("span",be,n(x.name),1)],40,xe))),128))])]))]),E.value.length>0?(r(),l("div",ve,[(r(!0),l(L,null,O(E.value,x=>(r(),l("div",{key:"legend-"+x.name,class:"flex flex-col gap-0.5 min-w-[100px] max-w-[140px] flex-shrink-0"},[(r(!0),l(L,null,O(x.items,i=>(r(),l("div",{key:i.type,class:"flex items-center gap-1.5"},[t("span",{class:"w-2 h-2 rounded-sm shrink-0",style:xt({backgroundColor:i.color})},null,4),t("span",ge,n(i.name),1)]))),128))]))),128))])):_("",!0),E.value.length>0?(r(),l("div",he," Total: "+n(C.value.toLocaleString())+" packets ",1)):_("",!0)]))}}),ke=pt(fe,[["__scopeId","data-v-3ad21abb"]]),_e={class:"glass-card rounded-[10px] p-4 lg:p-6"},we={class:"relative h-40 lg:h-48"},$e={class:"mt-3 lg:mt-4 grid grid-cols-2 gap-3 lg:gap-4"},Te={class:"text-center"},Se={class:"text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary"},Re={class:"text-center"},Pe={class:"text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary"},Ce={class:"mt-2 lg:mt-3 grid grid-cols-3 gap-2 lg:gap-3 text-center"},Ae={class:"text-xs lg:text-sm font-semibold text-accent-purple flex items-center justify-center gap-1"},Me={key:0,class:"inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70",title:"Early data - limited uptime"},De={class:"text-xs text-content-secondary dark:text-content-muted"},Ne={class:"text-xs lg:text-sm font-semibold text-accent-red flex items-center justify-center gap-1"},Be={key:0,class:"inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70",title:"Early data - limited uptime"},Fe={class:"text-xs text-content-secondary dark:text-content-muted"},je={class:"text-xs lg:text-sm font-semibold text-white"},Ie=dt({name:"AirtimeUtilizationChart",__name:"AirtimeUtilizationChart",setup(at){const S=ft(),H=Vt(),m=D(null),R=D([]),w=D(!0),F=D(null),E=D(30),h=D({totalReceived:0,totalTransmitted:0,dropped:0,firstPacketTime:0}),C=D({sf:9,bwHz:62500,cr:5,preamble:17}),B=x=>{const{sf:i,bwHz:j,cr:A,preamble:P}=C.value,M=1,$=0,s=i>=11&&j<=125e3?1:0,e=j/1e3,c=Math.pow(2,i)/e,d=(P+4.25)*c,o=Math.max(8*x-4*i+28+16*M-20*$,0),y=4*(i-2*s),N=(8+Math.ceil(o/y)*A)*c;return d+N},W=(x,i=60)=>{if(x.length===0)return[];const j=1-Math.pow(.5,1/i),A=Math.min(x.length,Math.max(10,Math.floor(i/3)));let P=0,M=0;for(let $=0;$(P=j*$.rxUtil+(1-j)*P,M=j*$.txUtil+(1-j)*M,{...$,rxUtil:P,txUtil:M}))},z=K(()=>{const x=S.packetStats?.total_packets||0,i=S.packetStats?.transmitted_packets||0,j=H.stats?.uptime_seconds||0,A=x||h.value.totalReceived,P=i||h.value.totalTransmitted,M=h.value.firstPacketTime>0?Math.floor(Date.now()/1e3)-h.value.firstPacketTime:0,$=j||M,s=Math.max($/3600,.1);if(s<1){const k=Math.max($/60,1);return{rxRate:{value:Math.round(A/k*100)/100,label:s<.5?"RX/min (early)":"RX/min"},txRate:{value:Math.round(P/k*100)/100,label:s<.5?"TX/min (early)":"TX/min"},confidence:"low"}}const c=Math.round(A/s*100)/100,d=Math.round(P/s*100)/100;let o,y;return s<6?(o=`RX/hr (${Math.round(s)}h)`,y="medium"):s<24?(o=`RX/hr (${Math.round(s)}h)`,y="high"):(o="RX/hr",y="high"),{rxRate:{value:c,label:o},txRate:{value:d,label:o.replace("RX","TX")},confidence:y}}),f=async()=>{w.value=!0;try{const P=Math.floor(Date.now()/1e3),M=P-24*3600;let $=0;try{const g=await ht.get("/stats");if(g.success&&g.data){const v=g.data,I=v.config;if(I?.radio){const Q=I.radio;C.value={sf:Q.spreading_factor??9,bwHz:Q.bandwidth??62500,cr:Q.coding_rate??5,preamble:Q.preamble_length??17}}$=v.dropped_count??0}}catch{}const s=await ht.get("/filtered_packets",{start_timestamp:M,end_timestamp:P,limit:5e4});if(!s.success){R.value=[],w.value=!1,it(()=>b());return}const e=s.data||[],c=new Float64Array(8640),d=new Float64Array(8640);let o=0,y=0,k=1/0;for(const g of e){const v=Math.floor((g.timestamp-M)/10);if(v<0||v>=8640)continue;const I=g.length??g.payload_length??32,Q=B(I),et=g.packet_origin;g.timestamp[g.rxUtil,g.txUtil]))*1.05;E.value=Math.max(5,Math.ceil(X/5)*5),w.value=!1,it(()=>b())}catch(x){console.error("Failed to fetch airtime data:",x),R.value=[],w.value=!1,it(()=>b())}},b=()=>{if(!m.value)return;const x=m.value,i=x.getContext("2d");if(!i)return;const j=x.parentElement;if(!j)return;const A=j.getBoundingClientRect(),P=A.width,M=A.height;x.width=P*window.devicePixelRatio,x.height=M*window.devicePixelRatio,x.style.width=P+"px",x.style.height=M+"px",i.scale(window.devicePixelRatio,window.devicePixelRatio);const $=20,s=45;if(i.clearRect(0,0,P,M),w.value){i.fillStyle="#666",i.font="16px system-ui",i.textAlign="center",i.fillText("Loading chart data...",P/2,M/2);return}if(R.value.length===0){i.fillStyle="#666",i.font="16px system-ui",i.textAlign="center",i.fillText("No data available",P/2,M/2);return}const e=P-s-$,c=M-$*2,d=E.value,o=E.value;i.strokeStyle="rgba(255, 255, 255, 0.1)",i.lineWidth=1,i.font="10px system-ui",i.textAlign="right";for(let y=0;y<=5;y++){const k=$+c*y/5;i.beginPath(),i.moveTo(s,k),i.lineTo(P-$,k),i.stroke();const N=d-y/5*o;i.fillStyle="rgba(255, 255, 255, 0.5)",i.fillText(`${N.toFixed(0)}%`,s-5,k+3)}for(let y=0;y<=6;y++){const k=s+e*y/6;i.beginPath(),i.moveTo(k,$),i.lineTo(k,M-$),i.stroke()}R.value.length>1&&(i.strokeStyle="#EBA0FC",i.lineWidth=2,i.beginPath(),R.value.forEach((y,k)=>{const N=s+e*k/(R.value.length-1),U=M-$-Math.min(y.rxUtil,E.value)/o*c;k===0?i.moveTo(N,U):i.lineTo(N,U)}),i.stroke()),R.value.length>1&&(i.strokeStyle="#FB787B",i.lineWidth=2,i.beginPath(),R.value.forEach((y,k)=>{const N=s+e*k/(R.value.length-1),U=M-$-Math.min(y.txUtil,E.value)/o*c;k===0?i.moveTo(N,U):i.lineTo(N,U)}),i.stroke())};return ut(()=>{f(),F.value=window.setInterval(f,3e4),it(()=>{b(),setTimeout(()=>b(),100)}),window.addEventListener("resize",b)}),yt(()=>{F.value&&clearInterval(F.value),window.removeEventListener("resize",b)}),(x,i)=>(r(),l("div",_e,[i[3]||(i[3]=Pt('

Airtime Utilization

Activity (Last 24 Hours)

Rx Util
Tx Util
',3)),t("div",we,[t("canvas",{ref_key:"chartRef",ref:m,class:"absolute inset-0 w-full h-full"},null,512)]),t("div",$e,[t("div",Te,[t("div",Se,n(ct(S).packetStats?.total_packets||h.value.totalReceived),1),i[0]||(i[0]=t("div",{class:"text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide"},"Total Received",-1))]),t("div",Re,[t("div",Pe,n(ct(S).packetStats?.transmitted_packets||h.value.totalTransmitted),1),i[1]||(i[1]=t("div",{class:"text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide"},"Total Transmitted",-1))])]),t("div",Ce,[t("div",null,[t("div",Ae,[rt(n(z.value.rxRate.value)+" ",1),z.value.confidence==="low"?(r(),l("span",Me)):_("",!0)]),t("div",De,n(z.value.rxRate.label),1)]),t("div",null,[t("div",Ne,[rt(n(z.value.txRate.value)+" ",1),z.value.confidence==="low"?(r(),l("span",Be)):_("",!0)]),t("div",Fe,n(z.value.txRate.label),1)]),t("div",null,[t("div",je,n(ct(S).packetStats?.dropped_packets||h.value.dropped),1),i[2]||(i[2]=t("div",{class:"text-xs text-white/60"},"Dropped",-1))])])]))}}),Ee=pt(Ie,[["__scopeId","data-v-0aca4e12"]]),Ue={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/20 flex flex-col h-full overflow-hidden"},Le={class:"flex items-center justify-between p-8 pb-4 flex-shrink-0"},Ve={class:"text-content-secondary dark:text-content-muted text-sm"},He={class:"flex items-center gap-2"},ze=["title"],Xe={class:"flex-1 overflow-y-auto custom-scrollbar px-8"},Ge={class:"mb-6"},Oe={class:"glass-card bg-white/5 rounded-[15px] p-4"},Qe={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},We={class:"space-y-3"},Ke={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},qe={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Je={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ye={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},Ze={key:0,class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},ts={class:"text-content-primary dark:text-content-primary font-mono text-xs"},es={class:"space-y-3"},ss={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},as={class:"text-content-primary dark:text-content-primary font-semibold"},ns={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},os={class:"text-content-primary dark:text-content-primary font-semibold"},rs={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},ls={class:"mb-6"},is={class:"bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10"},ds={class:"space-y-3"},cs={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},us={class:"text-content-primary dark:text-content-primary"},ps={key:0,class:"pt-2"},ms={class:"glass-card bg-background-mute dark:bg-black/30 rounded-[10px] p-4 mb-4"},xs={class:"w-full overflow-x-auto"},ys={class:"text-content-primary dark:text-content-primary/90 text-xs font-mono whitespace-pre leading-relaxed min-w-full"},bs={class:"flex items-center justify-between mb-3"},vs={class:"text-content-secondary dark:text-content-primary/80 text-sm font-semibold"},gs={class:"text-content-muted dark:text-content-muted text-xs"},hs={class:"bg-background-mute dark:bg-black/40 rounded-[8px] p-3 mb-3"},fs={class:"font-mono text-xs text-content-primary dark:text-content-primary break-all whitespace-pre-wrap leading-relaxed"},ks={class:"bg-gray-50 dark:bg-white/5 rounded-[10px] overflow-hidden"},_s={key:0,class:"min-w-0"},ws={class:"text-cyan-500 text-sm font-mono break-words min-w-0"},$s={class:"text-content-primary dark:text-content-primary text-sm break-words min-w-0"},Ts={class:"text-content-primary dark:text-content-primary text-sm font-semibold break-all min-w-0 overflow-hidden"},Ss=["title"],Rs={key:0,class:"text-orange-500 text-xs font-mono break-all min-w-0 overflow-hidden"},Ps=["title"],Cs={class:"grid grid-cols-2 gap-2"},As={class:"text-cyan-500 text-sm font-mono break-words"},Ms={class:"text-content-primary dark:text-content-primary text-sm break-words"},Ds=["title"],Ns={key:0},Bs=["title"],Fs={key:0,class:"text-content-muted dark:text-content-muted text-xs italic mt-2 px-1"},js={key:1,class:"py-2"},Is={class:"mb-6"},Es={class:"bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10"},Us={class:"space-y-4"},Ls={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Vs={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Hs={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},zs={key:0,class:"py-2"},Xs={class:"bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},Gs={class:"flex items-center flex-wrap gap-2"},Os={class:"relative group"},Qs={class:"relative px-3 py-2 bg-gradient-to-br from-blue-500/20 to-cyan-500/20 border border-cyan-400/40 rounded-lg transform transition-all hover:scale-105"},Ws={class:"font-mono text-xs font-semibold text-content-primary dark:text-content-primary/90"},Ks={class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-content-primary dark:bg-background/90 text-white dark:text-content-primary text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-10"},qs={key:0,class:"mx-2 text-cyan-600 dark:text-cyan-400/60"},Js={key:1,class:"py-2"},Ys={class:"text-content-secondary dark:text-content-muted text-sm mb-2 flex items-center"},Zs={key:0,class:"w-4 h-4 ml-2 text-yellow-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ta={key:1,class:"text-yellow-500 text-xs ml-1"},ea={class:"bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},sa={class:"flex items-center flex-wrap gap-2"},aa={class:"relative group"},na={key:0,class:"absolute -top-1 -right-1 w-2 h-2 bg-yellow-400 rounded-full animate-pulse"},oa={class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-content-primary dark:bg-background/90 text-white dark:text-content-primary text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-10"},ra={key:0,class:"mx-1 text-orange-600 dark:text-orange-400/60"},la={class:"mb-6"},ia={class:"glass-card bg-gray-50 dark:bg-white/5 rounded-[15px] p-4"},da={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},ca={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},ua={class:"text-lg font-bold text-content-primary dark:text-content-primary"},pa={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},ma={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},xa={class:"text-lg font-bold text-content-primary dark:text-content-primary"},ya={key:0,class:"mb-4"},ba={class:"flex items-center gap-3"},va={class:"flex gap-1"},ga={class:"text-content-secondary dark:text-content-primary/80 text-sm capitalize"},ha={key:1,class:"mb-4"},fa={key:2,class:"mb-4"},ka={class:"text-content-secondary dark:text-content-muted text-sm mb-3"},_a={class:"space-y-2"},wa={class:"flex items-center gap-3"},$a={class:"text-content-muted dark:text-content-muted text-sm"},Ta={key:3,class:"mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke/10"},Sa={class:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-4"},Ra={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Pa={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},Ca={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Aa={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},Ma={class:"text-content-muted dark:text-content-muted text-xs mt-1"},Da={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Na={class:"text-content-muted dark:text-content-muted text-xs mt-1"},Ba={key:0,class:"glass-card bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},Fa={class:"space-y-3"},ja={class:"flex-shrink-0 w-16 text-right"},Ia={class:"text-content-secondary dark:text-content-muted text-xs"},Ea={class:"flex-1 relative"},Ua={class:"h-8 rounded-lg overflow-hidden bg-background-mute dark:bg-stroke/5 relative"},La={class:"absolute inset-0 flex items-center px-3"},Va={class:"text-content-primary dark:text-content-primary text-xs font-mono font-semibold"},Ha={class:"flex-shrink-0 w-12 text-left"},za={class:"text-content-muted dark:text-content-muted text-xs"},Xa={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Ga={class:"space-y-2"},Oa={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Qa={class:"text-content-primary dark:text-content-primary"},Wa={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ka={class:"space-y-2"},qa={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ja={key:0,class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ya={class:"text-red-600 dark:text-red-400 text-sm"},Za={class:"p-8 pt-4 border-t border-stroke-subtle dark:border-stroke/10 flex justify-end flex-shrink-0"},tn=dt({name:"PacketDetailsModal",__name:"PacketDetailsModal",props:{packet:{},isOpen:{type:Boolean},localHash:{}},emits:["close"],setup(at,{emit:S}){const{getSignalQuality:H}=Wt(),m=at,R=S,w=D(!1),F=s=>new Date(s*1e3).toLocaleString(),E=s=>s.transmitted?s.is_duplicate?"text-amber-600 dark:text-amber-400":s.drop_reason?"text-red-600 dark:text-red-400":"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400",h=s=>s.transmitted?s.is_duplicate?"Duplicate":s.drop_reason?"Dropped":"Forwarded":"Dropped",C=s=>({0:"Request",1:"Response",2:"Plain Text Message",3:"Acknowledgment",4:"Node Advertisement",5:"Group Text Message",6:"Group Datagram",7:"Anonymous Request",8:"Returned Path",9:"Trace",10:"Multi-part Packet",15:"Custom Packet"})[s]||`Unknown Type (${s})`,B=s=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[s]||`Unknown Route (${s})`,W=s=>{if(!s)return"None";const c=s.replace(/\s+/g,"").toUpperCase().match(/.{2}/g)||[],d=[];for(let o=0;o{try{let d=0;const o=e.length/2;if(o>=100){if(e.length>=d+64){const y=e.slice(d,d+64);s.push({name:"Public Key",byteRange:`${(c+d)/2}-${(c+d+63)/2}`,hexData:y.match(/.{8}/g)?.join(" ")||y,description:"Ed25519 public key of the node (32 bytes)",fields:[{bits:"0-255",name:"Ed25519 Public Key",value:`${y.slice(0,16)}...${y.slice(-16)}`,binary:"32 bytes (256 bits)"}]}),d+=64}if(e.length>=d+8){const y=e.slice(d,d+8),k=parseInt(y,16),N=new Date(k*1e3);s.push({name:"Timestamp",byteRange:`${(c+d)/2}-${(c+d+7)/2}`,hexData:y.match(/.{2}/g)?.join(" ")||y,description:"Unix timestamp of advertisement",fields:[{bits:"0-31",name:"Unix Timestamp",value:`${k} (${N.toLocaleString()})`,binary:k.toString(2).padStart(32,"0")}]}),d+=8}if(e.length>=d+128){const y=e.slice(d,d+128);s.push({name:"Signature",byteRange:`${(c+d)/2}-${(c+d+127)/2}`,hexData:y.match(/.{8}/g)?.join(" ")||y,description:"Ed25519 signature of public key, timestamp, and appdata",fields:[{bits:"0-511",name:"Ed25519 Signature",value:`${y.slice(0,16)}...${y.slice(-16)}`,binary:"64 bytes (512 bits)"}]}),d+=128}if(e.length>d){const y=e.slice(d);f(s,y,c+d)}}else s.push({name:"ADVERT AppData (Partial)",byteRange:`${c/2}-${c/2+o-1}`,hexData:e.match(/.{2}/g)?.join(" ")||e,description:`Partial ADVERT data - appears to be just AppData portion (${o} bytes)`,fields:[{bits:`0-${o*8-1}`,name:"Partial Data",value:`${o} bytes - attempting to decode as AppData`,binary:`${o} bytes (${o*8} bits)`}]}),f(s,e,c)}catch(d){s.push({name:"ADVERT Parse Error",byteRange:"N/A",hexData:e.slice(0,32)+"...",description:"Failed to parse ADVERT payload structure",fields:[{bits:"N/A",name:"Error",value:`Parse error: ${d instanceof Error?d.message:"Unknown error"}`,binary:"Invalid"}]})}},f=(s,e,c)=>{try{const d=e.length/2;s.push({name:"AppData",byteRange:`${c/2}-${c/2+d-1}`,hexData:e.match(/.{2}/g)?.join(" ")||e,description:`Node advertisement application data (${d} bytes)`,fields:[{bits:`0-${d*8-1}`,name:"Application Data",value:`${d} bytes (contains flags, location, name, etc.)`,binary:`${d} bytes (${d*8} bits)`}]});let o=0;if(e.length>=2){const y=parseInt(e.slice(o,o+2),16),k=[],N=!!(y&16),U=!!(y&32),q=!!(y&64),tt=!!(y&128);if(y&1&&k.push("is chat node"),y&2&&k.push("is repeater"),y&4&&k.push("is room server"),y&8&&k.push("is sensor"),N&&k.push("has location"),U&&k.push("has feature 1"),q&&k.push("has feature 2"),tt&&k.push("has name"),s.push({name:"AppData Flags",byteRange:`${(c+o)/2}`,hexData:`0x${e.slice(o,o+2)}`,description:"Flags indicating which optional fields are present",fields:[{bits:"0-7",name:"Flags",value:k.join(", ")||"none",binary:y.toString(2).padStart(8,"0")}]}),o+=2,N&&e.length>=o+16){const V=e.slice(o,o+8),X=[];for(let p=6;p>=0;p-=2)X.push(V.slice(p,p+2));const g=parseInt(X.join(""),16),v=g>2147483647?g-4294967296:g,I=v/1e6,Q=e.slice(o+8,o+16),et=[];for(let p=6;p>=0;p-=2)et.push(Q.slice(p,p+2));const Y=parseInt(et.join(""),16),nt=Y>2147483647?Y-4294967296:Y,bt=nt/1e6;s.push({name:"Location Data",byteRange:`${(c+o)/2}-${(c+o+15)/2}`,hexData:`${V.match(/.{2}/g)?.join(" ")||V} ${Q.match(/.{2}/g)?.join(" ")||Q}`,description:"GPS coordinates (latitude and longitude)",fields:[{bits:"0-31",name:"Latitude",value:`${I.toFixed(6)}° (raw: ${v})`,binary:v.toString(2).padStart(32,"0")},{bits:"32-63",name:"Longitude",value:`${bt.toFixed(6)}° (raw: ${nt})`,binary:nt.toString(2).padStart(32,"0")}]}),o+=16}if(U&&e.length>=o+4){const V=e.slice(o,o+4),X=parseInt(V,16);s.push({name:"Feature 1",byteRange:`${(c+o)/2}-${(c+o+3)/2}`,hexData:V.match(/.{2}/g)?.join(" ")||V,description:"Reserved feature 1 (2 bytes)",fields:[{bits:"0-15",name:"Feature 1 Value",value:`${X}`,binary:X.toString(2).padStart(16,"0")}]}),o+=4}if(q&&e.length>=o+4){const V=e.slice(o,o+4),X=parseInt(V,16);s.push({name:"Feature 2",byteRange:`${(c+o)/2}-${(c+o+3)/2}`,hexData:V.match(/.{2}/g)?.join(" ")||V,description:"Reserved feature 2 (2 bytes)",fields:[{bits:"0-15",name:"Feature 2 Value",value:`${X}`,binary:X.toString(2).padStart(16,"0")}]}),o+=4}if(tt&&e.length>o){const V=e.slice(o),X=V.match(/.{2}/g)||[],g=X.map(v=>{const I=parseInt(v,16);return I>=32&&I<=126?String.fromCharCode(I):"."}).join("").replace(/\.+$/,"");s.push({name:"Node Name",byteRange:`${(c+o)/2}-${(c+e.length-1)/2}`,hexData:V.match(/.{2}/g)?.join(" ")||V,description:`Node name string (${X.length} bytes)`,fields:[{bits:`0-${X.length*8-1}`,name:"Node Name",value:`"${g}"`,binary:`ASCII text (${X.length} bytes)`}]})}}}catch(d){s.push({name:"AppData Parse Error",byteRange:"N/A",hexData:e.slice(0,Math.min(32,e.length)),description:"Failed to parse AppData structure",fields:[{bits:"N/A",name:"Error",value:`Parse error: ${d instanceof Error?d.message:"Unknown error"}`,binary:"Invalid"}]})}},b=s=>{if(!s)return[];if(Array.isArray(s))return s;if(typeof s=="string")try{return JSON.parse(s)}catch{return[]}return[]},x=s=>{const e=[];if(!s)return e;try{const c=s.raw_packet;if(c){const d=c.replace(/\s+/g,"").toUpperCase();let o=0;if(d.length>=2){const y=d.slice(o,o+2),k=parseInt(y,16),N=k&3,U=(k&60)>>2,q=(k&192)>>6,tt={0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"},V={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"};if(e.push({name:"Header",byteRange:"0",hexData:`0x${y}`,description:"Contains routing type, payload type, and payload version",fields:[{bits:"0-1",name:"Route Type",value:tt[N]||"Unknown",binary:N.toString(2).padStart(2,"0")},{bits:"2-5",name:"Payload Type",value:V[U]||"Unknown",binary:U.toString(2).padStart(4,"0")},{bits:"6-7",name:"Version",value:q.toString(),binary:q.toString(2).padStart(2,"0")}]}),o+=2,(N===0||N===3)&&d.length>=o+8){const g=d.slice(o,o+8),v=parseInt(g.slice(0,4),16),I=parseInt(g.slice(4,8),16);e.push({name:"Transport Codes",byteRange:"1-4",hexData:`${g.slice(0,4)} ${g.slice(4,8)}`,description:"2x 16-bit transport codes for routing optimization",fields:[{bits:"0-15",name:"Code 1",value:v.toString(),binary:v.toString(2).padStart(16,"0")},{bits:"16-31",name:"Code 2",value:I.toString(),binary:I.toString(2).padStart(16,"0")}]}),o+=8}if(d.length>=o+2){const g=d.slice(o,o+2),v=parseInt(g,16);if(e.push({name:"Path Length",byteRange:`${o/2}`,hexData:`0x${g}`,description:`${v} bytes of path data`,fields:[{bits:"0-7",name:"Path Length",value:`${v} bytes`,binary:v.toString(2).padStart(8,"0")}]}),o+=2,v>0&&d.length>=o+v*2){const I=d.slice(o,o+v*2);e.push({name:"Path Data",byteRange:`${o/2}-${(o+v*2-2)/2}`,hexData:I.match(/.{2}/g)?.join(" ")||I,description:"Routing path information",fields:[{bits:`0-${v*8-1}`,name:"Route Path",value:`${v} bytes of routing data`,binary:`${v} bytes (${v*8} bits)`}]}),o+=v*2}}if(d.length>o){const g=d.slice(o),v=g.length/2;U===4?z(e,g,o):e.push({name:"Payload Data",byteRange:`${o/2}-${o/2+v-1}`,hexData:g.match(/.{2}/g)?.join(" ")||g,description:"Application data content",fields:[{bits:`0-${v*8-1}`,name:"Application Data",value:`${v} bytes`,binary:`${v} bytes (${v*8} bits)`}]})}}}else{if(s.header){const d=s.header.replace(/0x/gi,"").replace(/\s+/g,"").toUpperCase(),o=parseInt(d,16),y=o&3,k=(o&60)>>2,N=(o&192)>>6,U={0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"},q={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"};e.push({name:"Header",byteRange:"0",hexData:`0x${d}`,description:"Contains routing type, payload type, and payload version",fields:[{bits:"0-1",name:"Route Type",value:U[y]||"Unknown",binary:y.toString(2).padStart(2,"0")},{bits:"2-5",name:"Payload Type",value:q[k]||"Unknown",binary:k.toString(2).padStart(4,"0")},{bits:"6-7",name:"Version",value:N.toString(),binary:N.toString(2).padStart(2,"0")}]}),s.transport_codes&&e.push({name:"Transport Codes",byteRange:"1-4",hexData:s.transport_codes,description:"2x 16-bit transport codes for routing optimization",fields:[{bits:"0-31",name:"Transport Codes",value:s.transport_codes,binary:"Available in separate field"}]}),s.original_path&&s.original_path.length>0&&e.push({name:"Original Path",byteRange:"?",hexData:s.original_path.join(" "),description:`Original routing path (${s.original_path.length} nodes)`,fields:[{bits:"0-?",name:"Path Nodes",value:`${s.original_path.length} nodes`,binary:"Available as node list"}]}),s.forwarded_path&&s.forwarded_path.length>0&&e.push({name:"Forwarded Path",byteRange:"?",hexData:s.forwarded_path.join(" "),description:`Forwarded routing path (${s.forwarded_path.length} nodes)`,fields:[{bits:"0-?",name:"Path Nodes",value:`${s.forwarded_path.length} nodes`,binary:"Available as node list"}]})}if(s.payload){const d=s.payload.replace(/\s+/g,"").toUpperCase(),o=d.length/2;s.type===4?z(e,d,0):e.push({name:"Payload Data",byteRange:`0-${o-1}`,hexData:d.match(/.{2}/g)?.join(" ")||d,description:`Application data content (${o} bytes)`,fields:[{bits:`0-${o*8-1}`,name:"Application Data",value:`${o} bytes`,binary:`${o} bytes (${o*8} bits)`}]})}}}catch{e.push({name:"Parse Error",byteRange:"N/A",hexData:"Error",description:"Unable to parse packet structure",fields:[{bits:"N/A",name:"Error",value:"Parse failed",binary:"Invalid"}]})}return e},i=(s,e)=>s==null||e==null?"text-content-muted dark:text-content-muted":H(e).color,j=s=>{if(s==null)return{level:0,className:"signal-none"};const e=H(s);let c,d;return e.bars>=5?(c=4,d="signal-excellent"):e.bars>=4?(c=3,d="signal-good"):e.bars>=2?(c=2,d="signal-fair"):e.bars>=1?(c=1,d="signal-poor"):(c=0,d="signal-none"),{level:c,className:d}},A=s=>{if(!s)return[];try{const e=JSON.parse(s);return Array.isArray(e)?e:[]}catch{return[]}},P=s=>s>=1e3?`${(s/1e3).toFixed(2)}s`:`${Math.round(s)}ms`,M=s=>{s.key==="Escape"&&R("close")},$=s=>{s.target===s.currentTarget&&R("close")};return st(()=>m.isOpen,s=>{s?document.body.style.overflow="hidden":document.body.style.overflow=""},{immediate:!0}),(s,e)=>(r(),Ht(Xt,{to:"body"},[Z(zt,{name:"modal",appear:""},{default:Ct(()=>[s.isOpen&&s.packet?(r(),l("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden",onClick:$,onKeydown:M,tabindex:"0"},[e[51]||(e[51]=t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none"},null,-1)),t("div",{class:"relative w-full max-w-4xl max-h-[90vh] flex flex-col",onClick:e[3]||(e[3]=Gt(()=>{},["stop"]))},[t("div",Ue,[t("div",Le,[t("div",null,[e[4]||(e[4]=t("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},"Packet Details",-1)),t("p",Ve,n(C(s.packet.type))+" - "+n(B(s.packet.route)),1)]),t("div",He,[t("button",{onClick:e[0]||(e[0]=c=>w.value=!w.value),class:T(["flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all duration-200",w.value?"bg-cyan-500/20 border border-cyan-400/30 text-cyan-600 dark:text-cyan-400":"bg-background-mute dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted"]),title:w.value?"Hide binary values":"Show binary values"},e[5]||(e[5]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})],-1),t("span",{class:"text-xs font-medium"},"Binary",-1)]),10,ze),t("button",{onClick:e[1]||(e[1]=c=>R("close")),class:"w-8 h-8 flex items-center justify-center rounded-full bg-background-mute dark:bg-white/10 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors duration-200 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary"},e[6]||(e[6]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",Xe,[t("div",Ge,[e[13]||(e[13]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-cyan-400 mr-3"}),rt(" Basic Information ")],-1)),t("div",Oe,[t("div",Qe,[t("div",We,[t("div",Ke,[e[7]||(e[7]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Timestamp",-1)),t("span",qe,n(F(s.packet.timestamp)),1)]),t("div",Je,[e[8]||(e[8]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Packet Hash",-1)),t("span",Ye,n(s.packet.packet_hash),1)]),s.packet.header?(r(),l("div",Ze,[e[9]||(e[9]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Header",-1)),t("span",ts,n(s.packet.header),1)])):_("",!0)]),t("div",es,[t("div",ss,[e[10]||(e[10]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Type",-1)),t("span",as,n(s.packet.type)+" ("+n(C(s.packet.type))+")",1)]),t("div",ns,[e[11]||(e[11]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Route",-1)),t("span",os,n(s.packet.route)+" ("+n(B(s.packet.route))+")",1)]),t("div",rs,[e[12]||(e[12]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Status",-1)),t("span",{class:T(["font-semibold",E(s.packet)])},n(h(s.packet)),3)])])])])]),t("div",ls,[e[25]||(e[25]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-orange-400 mr-3"}),rt(" Payload Data ")],-1)),t("div",is,[t("div",ds,[t("div",cs,[e[14]||(e[14]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Payload Length",-1)),t("span",us,n(s.packet.payload_length||s.packet.length)+" bytes",1)]),s.packet.payload?(r(),l("div",ps,[e[23]||(e[23]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3"},"Payload Analysis",-1)),t("div",ms,[e[15]||(e[15]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-2 font-semibold"},"Raw Hex Data",-1)),t("div",xs,[t("pre",ys,n(W(s.packet.payload)),1)])]),(r(!0),l(L,null,O(x(s.packet).filter(c=>!c.name.includes("Parse Error")),(c,d)=>(r(),l("div",{key:d,class:"mb-4"},[t("div",bs,[t("h4",vs,n(c.name),1),t("span",gs,"Bytes "+n(c.byteRange),1)]),t("div",hs,[t("div",fs,n(c.hexData),1)]),t("div",ks,[t("div",{class:T(["hidden md:grid gap-3 p-3 bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-muted text-xs font-semibold uppercase tracking-wide",w.value?"grid-cols-4":"grid-cols-3"])},[e[16]||(e[16]=t("div",{class:"min-w-0"},"Bits",-1)),e[17]||(e[17]=t("div",{class:"min-w-0"},"Field",-1)),e[18]||(e[18]=t("div",{class:"min-w-0"},"Value",-1)),w.value?(r(),l("div",_s,"Binary")):_("",!0)],2),(r(!0),l(L,null,O(c.fields,(o,y)=>(r(),l("div",{key:y,class:T(["hidden md:grid gap-3 p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors",w.value?"grid-cols-4":"grid-cols-3"])},[t("div",ws,n(o.bits),1),t("div",$s,n(o.name),1),t("div",Ts,[t("span",{class:"block",title:o.value},n(o.value),9,Ss)]),w.value?(r(),l("div",Rs,[t("span",{class:"block",title:o.binary},n(o.binary),9,Ps)])):_("",!0)],2))),128)),(r(!0),l(L,null,O(c.fields,(o,y)=>(r(),l("div",{key:`mobile-${y}`,class:"md:hidden p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 space-y-2"},[t("div",Cs,[t("div",null,[e[19]||(e[19]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Bits:",-1)),t("div",As,n(o.bits),1)]),t("div",null,[e[20]||(e[20]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Field:",-1)),t("div",Ms,n(o.name),1)])]),t("div",null,[e[21]||(e[21]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Value:",-1)),t("div",{class:"text-content-primary dark:text-content-primary text-sm font-semibold break-all",title:o.value},n(o.value),9,Ds)]),w.value?(r(),l("div",Ns,[e[22]||(e[22]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Binary:",-1)),t("div",{class:"text-orange-500 text-xs font-mono break-all",title:o.binary},n(o.binary),9,Bs)])):_("",!0)]))),128))]),c.description?(r(),l("div",Fs,n(c.description),1)):_("",!0)]))),128))])):(r(),l("div",js,e[24]||(e[24]=[t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Payload:",-1),t("span",{class:"text-content-muted dark:text-content-muted ml-2"},"None",-1)])))])])]),t("div",Is,[e[33]||(e[33]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-purple-400 mr-3"}),rt(" Path Information ")],-1)),t("div",Es,[t("div",Us,[t("div",Ls,[t("div",Vs,[e[26]||(e[26]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Source Hash",-1)),t("span",{class:T(["text-content-primary dark:text-content-primary font-mono text-xs",m.localHash&&s.packet.src_hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(s.packet.src_hash||"Unknown"),3)]),t("div",Hs,[e[27]||(e[27]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Destination Hash",-1)),t("span",{class:T(["text-content-primary dark:text-content-primary font-mono text-xs",m.localHash&&s.packet.dst_hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(s.packet.dst_hash||"Broadcast"),3)])]),b(s.packet.original_path).length>0?(r(),l("div",zs,[e[29]||(e[29]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"Original Path",-1)),t("div",Xs,[t("div",Gs,[(r(!0),l(L,null,O(b(s.packet.original_path),(c,d)=>(r(),l("div",{key:d,class:"flex items-center"},[t("div",Os,[t("div",Qs,[t("div",Ws,n(c.length<=2?c.toUpperCase():c.slice(0,2).toUpperCase()),1)]),t("div",Ks," Node: "+n(c),1)]),d0?(r(),l("div",Js,[t("div",Ys,[e[31]||(e[31]=rt(" Forwarded Path ",-1)),JSON.stringify(b(s.packet.original_path))!==JSON.stringify(b(s.packet.forwarded_path))?(r(),l("svg",Zs,e[30]||(e[30]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):_("",!0),JSON.stringify(b(s.packet.original_path))!==JSON.stringify(b(s.packet.forwarded_path))?(r(),l("span",ta,"(Modified)")):_("",!0)]),t("div",ea,[t("div",sa,[(r(!0),l(L,null,O(b(s.packet.forwarded_path),(c,d)=>(r(),l("div",{key:d,class:"flex items-center"},[t("div",aa,[t("div",{class:T(["relative px-3 py-2 bg-gradient-to-br from-orange-500/20 to-yellow-500/20 border border-orange-500 dark:border-orange-400/40 rounded-lg transform transition-all hover:scale-105",m.localHash&&c===m.localHash?"bg-gradient-to-br from-yellow-400/30 to-orange-400/30 border-yellow-300 shadow-yellow-400/20 shadow-lg":"hover:border-orange-500 dark:border-orange-400/60"])},[t("div",{class:T(["font-mono text-xs font-semibold",m.localHash&&c===m.localHash?"text-yellow-200":"text-white/90"])},n(c.slice(0,2).toUpperCase()),3),m.localHash&&c===m.localHash?(r(),l("div",na)):_("",!0)],2),t("div",oa,n(c),1)]),dt("div",{key:c,class:T(["w-2 h-6 rounded-sm transition-all duration-300",c<=j(s.packet.rssi).level?{"signal-excellent":"bg-green-400","signal-good":"bg-cyan-400","signal-fair":"bg-yellow-400","signal-poor":"bg-red-400"}[j(s.packet.rssi).className]:"bg-stroke-subtle dark:bg-stroke/10"])},null,2)),64))]),t("span",ga,n(j(s.packet.rssi).className.replace("signal-","")),1)])])):(r(),l("div",ha,e[40]||(e[40]=[t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"Signal Quality",-1),t("div",{class:"text-content-muted dark:text-content-muted text-sm italic"},"N/A (TX Packet)",-1)]))),s.packet.is_trace&&s.packet.path_snr_details&&s.packet.path_snr_details.length>0?(r(),l("div",fa,[t("div",ka,"Path SNR Details ("+n(s.packet.path_snr_details.length)+" hops)",1),t("div",_a,[(r(!0),l(L,null,O(s.packet.path_snr_details,(c,d)=>(r(),l("div",{key:d,class:"flex items-center justify-between p-2 glass-card bg-background-mute dark:bg-black/20 rounded-[8px]"},[t("div",wa,[t("span",$a,n(d+1)+".",1),t("span",{class:T(["font-mono text-xs text-content-primary dark:text-content-primary",m.localHash&&c.hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(c.hash),3)]),t("span",{class:T(["text-sm font-bold",i(c.snr_db,null)])},n(c.snr_db.toFixed(1))+"dB ",3)]))),128))])])):_("",!0),s.packet.transmitted&&s.packet.lbt_attempts!==void 0?(r(),l("div",Ta,[e[45]||(e[45]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3 flex items-center"},[t("svg",{class:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})]),rt(" Listen Before Talk (LBT) Metrics ")],-1)),t("div",Sa,[t("div",Ra,[e[41]||(e[41]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"CAD Attempts",-1)),t("div",Pa,n(s.packet.lbt_attempts),1)]),t("div",Ca,[e[42]||(e[42]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Total LBT Delay",-1)),t("div",Aa,n(P(A(s.packet.lbt_backoff_delays_ms).reduce((c,d)=>c+d,0))),1),t("div",Ma,n(A(s.packet.lbt_backoff_delays_ms).length)+" backoffs ",1)]),t("div",Da,[e[43]||(e[43]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Channel Status",-1)),t("div",{class:T(["text-lg font-bold",s.packet.lbt_channel_busy?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"])},n(s.packet.lbt_channel_busy?"BUSY":"CLEAR"),3),t("div",Na,n(s.packet.lbt_channel_busy?"Waited for clear":"Immediate TX"),1)])]),A(s.packet.lbt_backoff_delays_ms).length>0?(r(),l("div",Ba,[e[44]||(e[44]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-3 font-semibold"},"Backoff Pattern (Exponential with Jitter)",-1)),t("div",Fa,[(r(!0),l(L,null,O(A(s.packet.lbt_backoff_delays_ms),(c,d)=>(r(),l("div",{key:d,class:"flex items-center gap-3"},[t("div",ja,[t("span",Ia,"Attempt "+n(d+1),1)]),t("div",Ea,[t("div",Ua,[t("div",{class:T(["h-full rounded-lg transition-all duration-300",[d===0?"bg-gradient-to-r from-cyan-500/50 to-cyan-600/50":d===1?"bg-gradient-to-r from-yellow-500/50 to-yellow-600/50":d===2?"bg-gradient-to-r from-orange-500/50 to-orange-600/50":"bg-gradient-to-r from-red-500/50 to-red-600/50"]]),style:xt({width:`${Math.min(100,c/Math.max(...A(s.packet.lbt_backoff_delays_ms))*100)}%`})},[t("div",La,[t("span",Va,n(P(c)),1)])],6)])]),t("div",Ha,[t("span",za,n(Math.round(c/A(s.packet.lbt_backoff_delays_ms).reduce((o,y)=>o+y,0)*100))+"% ",1)])]))),128))])])):_("",!0)])):_("",!0),t("div",Xa,[t("div",Ga,[t("div",Oa,[e[46]||(e[46]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"TX Delay",-1)),t("span",Qa,n(Number(s.packet.tx_delay_ms)>0?Number(s.packet.tx_delay_ms).toFixed(1)+"ms":"-"),1)]),t("div",Wa,[e[47]||(e[47]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Transmitted",-1)),t("span",{class:T(s.packet.transmitted?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},n(s.packet.transmitted?"Yes":"No"),3)])]),t("div",Ka,[t("div",qa,[e[48]||(e[48]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Is Duplicate",-1)),t("span",{class:T(s.packet.is_duplicate?"text-amber-600 dark:text-amber-400":"text-content-muted dark:text-content-muted")},n(s.packet.is_duplicate?"Yes":"No"),3)]),s.packet.drop_reason?(r(),l("div",Ja,[e[49]||(e[49]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Drop Reason",-1)),t("span",Ya,n(s.packet.drop_reason),1)])):_("",!0)])])])])]),t("div",Za,[t("button",{onClick:e[2]||(e[2]=c=>R("close")),class:"px-6 py-2 bg-gradient-to-r from-cyan-500/20 to-cyan-400/20 hover:from-cyan-500/30 hover:to-cyan-400/30 border border-cyan-400/30 rounded-[10px] text-content-primary dark:text-content-primary transition-all duration-200 backdrop-blur-sm"}," Close ")])])])],32)):_("",!0)]),_:1})]))}}),en=pt(tn,[["__scopeId","data-v-7f139e4b"]]),sn={class:"glass-card rounded-[20px] p-6"},an={class:"flex flex-col lg:flex-row lg:justify-between lg:items-center mb-6 gap-4 filter-container"},nn={class:"flex items-center gap-2 header-info relative"},on={class:"text-content-secondary dark:text-content-muted text-sm packet-count"},rn=["title"],ln={class:"hidden sm:inline"},dn={key:1,class:"text-accent-red text-sm error-indicator"},cn={class:"flex items-center gap-3 lg:flex filter-controls"},un={class:"flex flex-col"},pn=["value"],mn={class:"flex flex-col"},xn=["value"],yn={class:"flex flex-col"},bn={class:"flex flex-col reset-container"},vn=["disabled"],gn={class:"space-y-4 overflow-hidden"},hn=["onClick"],fn={class:"hidden lg:grid grid-cols-12 gap-2 items-center"},kn={class:"col-span-1 text-content-primary dark:text-content-primary text-sm"},_n={class:"col-span-1 flex items-center gap-2"},wn={class:"flex flex-col"},$n={class:"text-content-primary dark:text-content-primary text-xs"},Tn=["title"],Sn={class:"col-span-2"},Rn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},Pn={class:"col-span-2"},Cn={class:"space-y-1"},An={key:0,class:"flex items-center gap-0.5 flex-wrap"},Mn={key:0,class:"w-2.5 h-2.5 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Dn={key:0,class:"text-[9px] text-content-muted dark:text-content-muted ml-1"},Nn={key:1,class:"flex items-center gap-1"},Bn={class:"inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono"},Fn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},jn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},In={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},En={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},Un={key:0,class:"flex items-center gap-1"},Ln={class:"col-span-1"},Vn={key:0,class:"text-accent-red text-[8px] italic truncate"},Hn={class:"lg:hidden space-y-2"},zn={class:"flex items-center justify-between"},Xn={class:"flex items-center gap-2"},Gn={class:"flex flex-col"},On={class:"text-content-primary dark:text-content-primary text-sm font-medium"},Qn=["title"],Wn={class:"flex items-center gap-2 text-right"},Kn={class:"text-content-secondary dark:text-content-muted text-xs"},qn={class:"flex items-center justify-between"},Jn={class:"flex items-center gap-1.5"},Yn={key:0,class:"flex items-center gap-0.5"},Zn={key:0,class:"w-2.5 h-2.5 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},to={key:0,class:"text-[9px] text-content-muted dark:text-content-muted ml-1"},eo={class:"flex items-center gap-1"},so={class:"inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono font-semibold"},ao={class:"flex items-center gap-0.5 text-content-muted dark:text-content-muted/60"},no={key:0,class:"text-[9px] font-medium",title:"Multi-hop path"},oo={class:"flex items-center gap-1"},ro={class:"flex items-center gap-2"},lo={class:"flex items-center gap-1"},io={key:0,class:"flex gap-0.5"},co={class:"text-content-primary dark:text-content-primary text-xs"},uo={class:"flex items-center justify-between text-content-secondary dark:text-content-muted text-xs"},po={class:"flex items-center gap-3"},mo={class:"flex items-center gap-2"},xo={key:0,class:"flex items-center gap-1"},yo={key:0,class:"text-accent-red text-xs italic"},bo={key:0,class:"flex justify-between items-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke pagination-container"},vo={class:"flex items-center gap-4 pagination-info"},go={class:"text-content-secondary dark:text-content-muted text-sm"},ho={key:0,class:"flex items-center gap-2 load-more-section"},fo=["disabled"],ko={class:"text-content-secondary dark:text-content-muted text-xs load-more-count"},_o={class:"flex items-center gap-2 pagination-controls"},wo=["disabled"],$o={class:"flex items-center gap-1 page-numbers"},To={key:1,class:"text-content-secondary dark:text-content-muted text-sm px-2 ellipsis"},So=["onClick"],Ro={key:2,class:"text-content-secondary dark:text-content-muted text-sm px-2 ellipsis"},Po=["disabled"],Co={key:1,class:"flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke"},Ao={class:"flex items-center gap-4"},Mo={class:"text-content-secondary dark:text-content-muted text-sm"},Do={class:"text-content-secondary dark:text-content-muted text-xs"},No={key:2,class:"flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke"},mt=10,lt=1e3,Bo=dt({name:"PacketTable",__name:"PacketTable",setup(at){const S=ft(),H=kt(),m=D(1),R=D(null),w=D(100),F=D(!1),E=D(!1);let h=null;st(()=>S.isLoading,p=>{p?(h&&(clearTimeout(h),h=null),E.value=!0):h=window.setTimeout(()=>{E.value=!1,h=null},600)});const C=D(null),B=D(!1),W=p=>{C.value=p,B.value=!0},z=()=>{B.value=!1,C.value=null},f=D(St("packetTable_selectedType","all")),b=D(St("packetTable_selectedRoute","all")),x=D(!1),i=D(null),j=["all","0","1","2","3","4","5","6","7","8","9","10","11"],A=["all","1","2"];st(f,p=>{Rt("packetTable_selectedType",p),m.value=1}),st(b,p=>{Rt("packetTable_selectedRoute",p),m.value=1}),st(x,()=>{m.value=1});const P=K(()=>{let p=S.recentPackets;if(f.value!=="all"){const u=parseInt(f.value);p=p.filter(a=>a.type===u)}if(b.value!=="all"){const u=parseInt(b.value);p=p.filter(a=>a.route===u)}return x.value&&i.value!==null&&(p=p.filter(u=>u.timestamp>=i.value)),p}),M=K(()=>{const p=(m.value-1)*mt,u=p+mt;return P.value.slice(p,u)}),$=K(()=>Math.ceil(P.value.length/mt)),s=K(()=>m.value===$.value),e=K(()=>S.recentPackets.length>=w.value&&w.values.value&&e.value&&!F.value),d=p=>new Date(p*1e3).toLocaleTimeString(void 0,{hour12:!0}),o=p=>({0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTI_PART",11:"CONTROL"})[p]||`TYPE_${p}`,y=p=>({0:"T-Flood",1:"Flood",2:"Direct",3:"T-Direct"})[p]||`Route ${p}`,k=p=>p.transmitted?"text-accent-green":"text-primary",N=p=>p.drop_reason?"Dropped":p.transmitted?"Forward":"Received",U=p=>p===1?"bg-badge-cyan-bg text-badge-cyan-text":"bg-badge-neutral-bg text-badge-neutral-text",q=p=>({0:"bg-primary",1:"bg-accent-green",2:"bg-secondary",3:"bg-accent-purple",4:"bg-accent-red",5:"bg-accent-cyan",6:"bg-primary",7:"bg-accent-purple",8:"bg-accent-green",9:"bg-secondary"})[p]||"bg-gray-500",tt=p=>({0:"border-l-primary",1:"border-l-accent-green",2:"border-l-secondary",3:"border-l-accent-purple",4:"border-l-accent-red",5:"border-l-accent-cyan",6:"border-l-primary",7:"border-l-accent-purple",8:"border-l-accent-green",9:"border-l-secondary"})[p]||"border-l-gray-500",V=p=>!p.transmitted||!p.lbt_attempts||p.lbt_attempts===0?"bg-green-400":p.lbt_attempts===1?"bg-cyan-400":p.lbt_attempts===2?"bg-yellow-400":"bg-orange-400",X=p=>p>=1e3?(p/1e3).toFixed(2)+"s":p.toFixed(1)+"ms",g=p=>{if(!p)return[];if(Array.isArray(p))return p;if(typeof p=="string")try{const u=JSON.parse(p);return typeof u=="string"?JSON.parse(u):Array.isArray(u)?u:[]}catch{return[]}return[]},v=p=>{const u=g(p.original_path),a=g(p.forwarded_path),G=u.length>0?u:a;return G.length===0?null:{hops:G.length-1,nodes:G.map(ot=>ot.slice(-4).toUpperCase())}},I=p=>{if(p.type!==4||!p.payload)return null;try{const u=p.payload.replace(/\s+/g,"").toUpperCase();let a=u,G=0;if(u.length/2>=100)if(u.length>200)a=u.slice(200),G=0;else return null;if(a.length>=2){const J=parseInt(a.slice(0,2),16);G+=2;const At=!!(J&16),Mt=!!(J&32),Dt=!!(J&64);if(!!!(J&128))return null;if(At&&a.length>=G+16&&(G+=16),Mt&&a.length>=G+4&&(G+=4),Dt&&a.length>=G+4&&(G+=4),a.length>G){const _t=(a.slice(G).match(/.{2}/g)||[]).map(Nt=>{const gt=parseInt(Nt,16);return gt>=32&><=126?String.fromCharCode(gt):"."}).join("").replace(/\.*$/,"");return _t.length>0?_t:null}}}catch(u){console.error("Error parsing ADVERT node name:",u)}return null},Q=()=>{f.value="all",b.value="all",x.value=!1,i.value=null,m.value=1},et=()=>{x.value?(x.value=!1,i.value=null):(x.value=!0,i.value=Date.now()/1e3),m.value=1},Y=K(()=>i.value?new Date(i.value*1e3).toLocaleTimeString(void 0,{hour12:!0}):""),nt=async p=>{try{const u=p||w.value;await S.fetchRecentPackets({limit:u})}catch(u){console.error("Error fetching packet data:",u)}},bt=async()=>{if(!(F.value||w.value>=lt)){F.value=!0;try{const p=Math.min(w.value+200,lt);w.value=p,await nt(p)}catch(p){console.error("Error loading more records:",p)}finally{F.value=!1}}};return ut(async()=>{await nt(),H.isConnected||(R.value=window.setInterval(nt,1e4))}),st(()=>H.isConnected,p=>{p?R.value&&(clearInterval(R.value),R.value=null):R.value||(R.value=window.setInterval(nt,1e4))}),yt(()=>{R.value&&clearInterval(R.value),h&&clearTimeout(h)}),(p,u)=>(r(),l(L,null,[t("div",sn,[t("div",an,[t("div",nn,[u[7]||(u[7]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold"},"Recent Packets",-1)),t("span",on," ("+n(P.value.length)+" of "+n(ct(S).recentPackets.length)+") ",1),x.value?(r(),l("span",{key:0,class:"text-primary text-xs sm:text-sm bg-primary/10 px-2 py-1 rounded-md border border-primary/20 live-mode-badge whitespace-nowrap",title:`Filter activated at ${Y.value}`},[t("span",ln,"Live Mode (since "+n(Y.value)+")",1),u[6]||(u[6]=t("span",{class:"sm:hidden"},"Live",-1))],8,rn)):_("",!0),ct(S).error?(r(),l("span",dn,n(ct(S).error),1)):_("",!0)]),t("div",cn,[t("div",un,[u[8]||(u[8]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Type",-1)),$t(t("select",{"onUpdate:modelValue":u[0]||(u[0]=a=>f.value=a),class:"glass-card border border-stroke-subtle dark:border-stroke rounded-[10px] px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20 transition-all duration-200 min-w-[120px] cursor-pointer hover:border-primary/50"},[(r(),l(L,null,O(j,a=>t("option",{key:a,value:a,class:"bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary"},n(a==="all"?"All Types":`Type ${a} (${o(parseInt(a))})`),9,pn)),64))],512),[[Tt,f.value]])]),t("div",mn,[u[9]||(u[9]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Route",-1)),$t(t("select",{"onUpdate:modelValue":u[1]||(u[1]=a=>b.value=a),class:"glass-card border border-stroke-subtle dark:border-stroke rounded-[10px] px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20 transition-all duration-200 min-w-[120px] cursor-pointer hover:border-primary/50"},[(r(),l(L,null,O(A,a=>t("option",{key:a,value:a,class:"bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary"},n(a==="all"?"All Routes":`Route ${a} (${y(parseInt(a))})`),9,xn)),64))],512),[[Tt,b.value]])]),t("div",yn,[u[10]||(u[10]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Filter",-1)),t("button",{onClick:et,class:T(["glass-card border rounded-[10px] px-4 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 min-w-[120px]",{"border-primary bg-primary/10 text-primary":x.value,"border-stroke-subtle dark:border-stroke text-content-secondary dark:text-content-muted hover:border-primary hover:text-content-primary dark:hover:text-content-primary hover:bg-primary/5":!x.value}])},n(x.value?"New Only":"Show New"),3)]),t("div",bn,[u[11]||(u[11]=t("label",{class:"text-transparent text-xs mb-1"},".",-1)),t("button",{onClick:Q,class:T(["glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[10px] px-4 py-2 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary text-sm transition-all duration-200 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20",{"opacity-50 cursor-not-allowed hover:border-stroke-subtle dark:hover:border-stroke hover:text-content-secondary dark:hover:text-content-muted":f.value==="all"&&b.value==="all"&&!x.value,"hover:bg-primary/10":f.value!=="all"||b.value!=="all"||x.value}]),disabled:f.value==="all"&&b.value==="all"&&!x.value}," Reset ",10,vn)])])]),u[25]||(u[25]=Pt('',1)),t("div",gn,[Z(Ot,{name:"packet-list",tag:"div",class:"space-y-4",appear:""},{default:Ct(()=>[(r(!0),l(L,null,O(M.value,(a,G)=>(r(),l("div",{key:`${a.packet_hash}_${a.timestamp}_${G}`,class:T(["packet-row border-b border-stroke-subtle dark:border-dark-border/50 pb-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors duration-200 cursor-pointer rounded-[10px] p-2 border-l-4",tt(a.type)]),onClick:ot=>W(a)},[t("div",fn,[t("div",kn,n(d(a.timestamp)),1),t("div",_n,[t("div",{class:T(["w-2 h-2 rounded-full",q(a.type)])},null,2),t("div",wn,[t("span",$n,n(o(a.type)),1),a.type===4&&I(a)?(r(),l("span",{key:0,class:"text-accent-red/70 text-[10px] font-medium max-w-[80px] truncate",title:I(a)||void 0},n(I(a)),9,Tn)):_("",!0)])]),t("div",Sn,[t("span",{class:T(["inline-block px-2 py-1 rounded text-xs font-medium",U(a.route)])},n(y(a.route)),3)]),t("div",Rn,n(a.length)+"B",1),t("div",Pn,[t("div",Cn,[v(a)?(r(),l("div",An,[(r(!0),l(L,null,O(v(a).nodes,(ot,J)=>(r(),l(L,{key:J},[t("span",{class:T(["inline-block px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold",J===0?"bg-badge-cyan-bg text-badge-cyan-text":"bg-gray-500/20 text-content-muted dark:text-content-muted"])},n(ot),3),J0?(r(),l("span",Dn," ("+n(v(a).hops)+" hop"+n(v(a).hops>1?"s":"")+") ",1)):_("",!0)])):(r(),l("div",Nn,[t("span",Bn,n(a.src_hash?.slice(-4).toUpperCase()||"????"),1),u[13]||(u[13]=t("svg",{class:"w-3 h-3 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M9 5l7 7-7 7"})],-1)),t("span",{class:T(["inline-block px-2 py-0.5 rounded text-xs font-mono",a.dst_hash?"bg-badge-cyan-bg text-badge-cyan-text":"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"])},n(a.dst_hash?a.dst_hash.slice(-4).toUpperCase():"BCAST"),3)]))])]),t("div",Fn,n(a.rssi!=null?a.rssi.toFixed(0):"N/A"),1),t("div",jn,n(a.snr!=null?a.snr.toFixed(1)+"dB":"N/A"),1),t("div",In,n(a.score!=null?a.score.toFixed(2):"N/A"),1),t("div",En,[Number(a.tx_delay_ms)>0?(r(),l("div",Un,[a.transmitted?(r(),l("div",{key:0,class:T(["w-1.5 h-1.5 rounded-full flex-shrink-0",V(a)])},null,2)):_("",!0),t("span",null,n(X(Number(a.tx_delay_ms))),1)])):_("",!0)]),t("div",Ln,[t("div",null,[t("span",{class:T(["text-xs font-medium",k(a)])},n(N(a)),3),a.drop_reason?(r(),l("p",Vn,n(a.drop_reason),1)):_("",!0)])])]),t("div",Hn,[t("div",zn,[t("div",Xn,[t("div",{class:T(["w-2 h-2 rounded-full flex-shrink-0",q(a.type)])},null,2),t("div",Gn,[t("span",On,n(o(a.type)),1),a.type===4&&I(a)?(r(),l("span",{key:0,class:"text-accent-red/70 text-[10px] font-medium leading-tight",title:I(a)||void 0},n(I(a)),9,Qn)):_("",!0)]),t("span",{class:T(["inline-block px-2 py-1 rounded text-xs font-medium ml-2",U(a.route)])},n(y(a.route)),3)]),t("div",Wn,[t("span",Kn,n(d(a.timestamp)),1),t("span",{class:T(["text-xs font-medium",k(a)])},n(N(a)),3)])]),t("div",qn,[t("div",Jn,[v(a)?(r(),l("div",Yn,[u[15]||(u[15]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"PATH",-1)),(r(!0),l(L,null,O(v(a).nodes,(ot,J)=>(r(),l(L,{key:J},[t("span",{class:T(["inline-block px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold",J===0?"bg-badge-cyan-bg text-badge-cyan-text":"bg-gray-500/20 text-content-muted dark:text-content-muted"])},n(ot),3),J0?(r(),l("span",to," ("+n(v(a).hops)+" hop"+n(v(a).hops>1?"s":"")+") ",1)):_("",!0)])):(r(),l(L,{key:1},[t("div",eo,[u[16]||(u[16]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"SRC",-1)),t("span",so,n(a.src_hash?.slice(-4)||"????"),1)]),t("div",ao,[u[18]||(u[18]=t("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M9 5l7 7-7 7"})],-1)),a.route===1?(r(),l("span",no,u[17]||(u[17]=[t("svg",{class:"w-2.5 h-2.5 inline",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 5l7 7-7 7M5 5l7 7-7 7"})],-1)]))):_("",!0)]),t("div",oo,[t("span",{class:T(["inline-block px-2 py-0.5 rounded text-xs font-mono font-semibold",a.dst_hash?"bg-badge-cyan-bg text-badge-cyan-text":"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"])},n(a.dst_hash?a.dst_hash.slice(-4).toUpperCase():"BCAST"),3),u[19]||(u[19]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"DST",-1))])],64))]),t("div",ro,[t("div",lo,[a.snr!=null?(r(),l("div",io,[t("div",{class:T(["w-1 h-3 rounded-sm",a.snr>=-10?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-4 rounded-sm",a.snr>=-5?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-5 rounded-sm",a.snr>=0?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-6 rounded-sm",a.snr>=10?"bg-green-400":"bg-white/20"])},null,2)])):_("",!0),t("span",co,n(a.rssi!=null?a.rssi.toFixed(0)+"dBm":"TX"),1)])])]),t("div",uo,[t("div",po,[t("span",null,n(a.length)+"B",1),t("span",null,"SNR: "+n(a.snr!=null?a.snr.toFixed(1)+"dB":"N/A"),1),t("span",null,"Score: "+n(a.score!=null?a.score.toFixed(2):"N/A"),1)]),t("div",mo,[Number(a.tx_delay_ms)>0?(r(),l("span",xo,[a.transmitted?(r(),l("div",{key:0,class:T(["w-1.5 h-1.5 rounded-full flex-shrink-0",V(a)])},null,2)):_("",!0),t("span",null,n(X(Number(a.tx_delay_ms))),1)])):_("",!0)])]),a.drop_reason?(r(),l("div",yo,n(a.drop_reason),1)):_("",!0)])],10,hn))),128))]),_:1})]),$.value>1?(r(),l("div",bo,[t("div",vo,[t("span",go," Showing "+n((m.value-1)*mt+1)+" - "+n(Math.min(m.value*mt,P.value.length))+" of "+n(P.value.length)+" packets ",1),c.value?(r(),l("div",ho,[u[20]||(u[20]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"•",-1)),t("button",{onClick:bt,disabled:F.value,class:T(["glass-card border border-primary rounded-[8px] px-3 py-1.5 text-xs transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 hover:bg-primary/5",{"text-primary border-primary cursor-pointer":!F.value,"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke cursor-not-allowed opacity-50":F.value}])},n(F.value?"Loading...":`Load ${Math.min(200,lt-w.value)} more`),11,fo),t("span",ko,"("+n(w.value)+"/"+n(lt)+" max)",1)])):_("",!0)]),t("div",_o,[t("button",{onClick:u[2]||(u[2]=a=>m.value=m.value-1),disabled:m.value<=1,class:T(["glass-card border rounded-[10px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 prev-next-btn",{"border-stroke-subtle dark:border-stroke text-content-muted dark:text-content-muted cursor-not-allowed opacity-50":m.value<=1,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value>1}])},u[21]||(u[21]=[t("span",{class:"hidden sm:inline"},"Previous",-1),t("span",{class:"sm:hidden"},"‹",-1)]),10,wo),t("div",$o,[m.value>3?(r(),l("button",{key:0,onClick:u[3]||(u[3]=a=>m.value=1),class:"glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[8px] px-3 py-2 text-sm text-content-primary dark:text-content-primary hover:text-primary hover:bg-primary/5 transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20"}," 1 ")):_("",!0),m.value>4?(r(),l("span",To,"...")):_("",!0),(r(!0),l(L,null,O(Array.from({length:Math.min(5,$.value)},(a,G)=>Math.max(1,Math.min(m.value-2,$.value-4))+G).filter(a=>a<=$.value),a=>(r(),l("button",{key:a,onClick:G=>m.value=a,class:T(["glass-card border rounded-[8px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 page-number",{"border-primary bg-primary/10 text-primary":m.value===a,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value!==a}])},n(a),11,So))),128)),m.value<$.value-3?(r(),l("span",Ro,"...")):_("",!0),m.value<$.value-2?(r(),l("button",{key:3,onClick:u[4]||(u[4]=a=>m.value=$.value),class:"glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[8px] px-3 py-2 text-sm text-content-primary dark:text-content-primary hover:text-primary hover:bg-primary/5 transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20"},n($.value),1)):_("",!0)]),t("button",{onClick:u[5]||(u[5]=a=>m.value=m.value+1),disabled:m.value>=$.value,class:T(["glass-card border rounded-[10px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 prev-next-btn",{"border-stroke-subtle dark:border-stroke text-content-muted dark:text-content-muted cursor-not-allowed opacity-50":m.value>=$.value,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value<$.value}])},u[22]||(u[22]=[t("span",{class:"hidden sm:inline"},"Next",-1),t("span",{class:"sm:inline"},"›",-1)]),10,Po)])])):e.value&&!F.value?(r(),l("div",Co,[t("div",Ao,[t("span",Mo," Showing "+n(P.value.length)+" packets ",1),u[23]||(u[23]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"•",-1)),t("button",{onClick:bt,class:"glass-card border border-primary rounded-[8px] px-4 py-2 text-sm text-primary hover:bg-primary/5 transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20"}," Load "+n(Math.min(200,lt-w.value))+" more records ",1),t("span",Do,"("+n(w.value)+"/"+n(lt)+" max)",1)])])):F.value?(r(),l("div",No,u[24]||(u[24]=[t("div",{class:"flex items-center gap-2"},[t("div",{class:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),t("span",{class:"text-primary text-sm"},"Loading more records...")],-1)]))):_("",!0)]),Z(en,{packet:C.value,isOpen:B.value,onClose:z},null,8,["packet","isOpen"])],64))}}),Fo=pt(Bo,[["__scopeId","data-v-836a7cf1"]]),jo={class:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-2"},Xo=dt({name:"DashboardView",__name:"Dashboard",setup(at){const S=kt();return ut(()=>{S.connect()}),Qt(()=>{S.disconnect()}),(H,m)=>(r(),l("div",null,[Z(se),t("div",jo,[Z(Ee),Z(ke)]),Z(Fo)]))}});export{Xo as default}; diff --git a/repeater/web/html/assets/Dashboard-QP8Te5jj.css b/repeater/web/html/assets/Dashboard-QP8Te5jj.css new file mode 100644 index 0000000..f20deeb --- /dev/null +++ b/repeater/web/html/assets/Dashboard-QP8Te5jj.css @@ -0,0 +1 @@ +.sparkline-card[data-v-bcd5cf93]{background:#ffffffbf;border:1px solid rgba(0,0,0,.06);border-radius:12px;padding:12px 14px;-webkit-backdrop-filter:blur(50px);backdrop-filter:blur(50px);overflow:hidden;transition:background .3s ease,border-color .3s ease,box-shadow .3s ease;box-shadow:0 4px 16px #0000000a,0 1px 3px #00000005}.dark .sparkline-card[data-v-bcd5cf93]{background:#0006;border:1px solid rgba(255,255,255,.05);box-shadow:0 4px 16px #0003}.card-header[data-v-bcd5cf93]{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}.card-title[data-v-bcd5cf93]{color:#4b5563b3;font-size:11px;font-weight:500;text-transform:uppercase;letter-spacing:.05em;transition:color .3s ease}.dark .card-title[data-v-bcd5cf93]{color:#fff9}.card-value[data-v-bcd5cf93]{font-size:22px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}.card-chart[data-v-bcd5cf93]{width:100%;height:28px;overflow:hidden}.card-chart canvas[data-v-bcd5cf93]{width:100%!important;height:100%!important}@media (min-width: 1024px){.sparkline-card[data-v-bcd5cf93]{padding:14px 16px}.card-header[data-v-bcd5cf93]{margin-bottom:10px}.card-title[data-v-bcd5cf93]{font-size:12px}.card-value[data-v-bcd5cf93]{font-size:26px}.card-chart[data-v-bcd5cf93]{height:32px}}.stats-cards-container[data-v-41b33099]{will-change:auto;contain:layout}.stat-card[data-v-41b33099]{transition:opacity .3s ease-out}.stat-card[data-v-41b33099] .text-lg,.stat-card[data-v-41b33099] .text-\[30px\]{transition:color .2s ease-out}canvas[data-v-0aca4e12]{width:100%;height:100%}.modal-enter-active[data-v-7f139e4b]{transition:all .3s cubic-bezier(.4,0,.2,1)}.modal-leave-active[data-v-7f139e4b]{transition:all .2s ease-in}.modal-enter-from[data-v-7f139e4b]{opacity:0;transform:scale(.95) translateY(-10px)}.modal-leave-to[data-v-7f139e4b]{opacity:0;transform:scale(1.05)}.custom-scrollbar[data-v-7f139e4b]{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.3) transparent}.custom-scrollbar[data-v-7f139e4b]::-webkit-scrollbar{width:6px}.custom-scrollbar[data-v-7f139e4b]::-webkit-scrollbar-track{background:#ffffff1a;border-radius:3px}.custom-scrollbar[data-v-7f139e4b]::-webkit-scrollbar-thumb{background:#ffffff4d;border-radius:3px}.custom-scrollbar[data-v-7f139e4b]::-webkit-scrollbar-thumb:hover{background:#fff6}.glass-card[data-v-7f139e4b]{-webkit-backdrop-filter:blur(50px);backdrop-filter:blur(50px)}.fade-enter-active[data-v-836a7cf1],.fade-leave-active[data-v-836a7cf1]{transition:opacity .3s ease-out,transform .3s ease-out}.fade-enter-from[data-v-836a7cf1],.fade-leave-to[data-v-836a7cf1]{opacity:0;transform:translateY(-10px)}@keyframes spin-836a7cf1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin[data-v-836a7cf1]{animation:spin-836a7cf1 .8s linear infinite}.packet-list-enter-active[data-v-836a7cf1],.packet-list-leave-active[data-v-836a7cf1],.packet-list-move[data-v-836a7cf1]{transition:all .4s ease-out}.packet-list-enter-from[data-v-836a7cf1]{opacity:0;transform:translateY(-30px) scale(.98)}.packet-list-enter-to[data-v-836a7cf1],.packet-list-leave-from[data-v-836a7cf1]{opacity:1;transform:translateY(0) scale(1)}.packet-list-leave-to[data-v-836a7cf1]{opacity:0;transform:translateY(-20px) scale(.95)}.packet-row[data-v-836a7cf1]{position:relative;transition:all .3s ease}.packet-list-enter-active .packet-row[data-v-836a7cf1]{background:linear-gradient(90deg,rgba(78,201,176,.1) 0%,rgba(78,201,176,.05) 50%,transparent 100%);box-shadow:0 0 20px #4ec9b033;border-left:3px solid rgba(78,201,176,.6);border-radius:8px;padding-left:12px}.packet-row[data-v-836a7cf1]:hover{background:#ffffff05;border-radius:8px;transition:background .2s ease}@media (max-width: 1023px){.filter-container[data-v-836a7cf1]{flex-direction:column;gap:1rem;align-items:stretch}.header-info[data-v-836a7cf1]{flex-direction:column;align-items:flex-start;gap:.5rem}.packet-count[data-v-836a7cf1]{order:1}.live-mode-badge[data-v-836a7cf1]{order:2;align-self:flex-start}.loading-indicator[data-v-836a7cf1],.error-indicator[data-v-836a7cf1]{order:3;align-self:flex-start}.filter-controls[data-v-836a7cf1]{display:grid!important;grid-template-columns:1fr 1fr;gap:.75rem;flex-direction:column}.filter-controls .flex.flex-col[data-v-836a7cf1]{flex-direction:column;align-items:stretch;gap:.25rem}.filter-controls .flex.flex-col label[data-v-836a7cf1]{margin-bottom:0;font-size:.75rem}.reset-container[data-v-836a7cf1]{grid-column:span 2!important;display:flex;justify-content:center;margin-top:.5rem}.pagination-container[data-v-836a7cf1]{flex-direction:column;gap:1rem;align-items:stretch}.pagination-info[data-v-836a7cf1]{justify-content:center;text-align:center;flex-direction:column;gap:.5rem}.load-more-section[data-v-836a7cf1]{justify-content:center}.load-more-count[data-v-836a7cf1]{display:none}.pagination-controls[data-v-836a7cf1]{justify-content:center}.page-numbers[data-v-836a7cf1]{max-width:200px;overflow-x:auto;scrollbar-width:none;-ms-overflow-style:none}.page-numbers[data-v-836a7cf1]::-webkit-scrollbar{display:none}.ellipsis[data-v-836a7cf1]{display:none}.page-number[data-v-836a7cf1]{min-width:40px;flex-shrink:0}}@media (max-width: 640px){.filter-controls[data-v-836a7cf1]{grid-template-columns:1fr!important;gap:.75rem}.reset-container[data-v-836a7cf1]{grid-column:span 1!important}.header-info h3[data-v-836a7cf1]{font-size:1.125rem}.packet-count[data-v-836a7cf1]{font-size:.75rem}.live-mode-badge[data-v-836a7cf1]{font-size:.75rem;padding:.25rem .5rem}.pagination-info span[data-v-836a7cf1]{font-size:.75rem}.prev-next-btn[data-v-836a7cf1]{min-width:40px;padding:.5rem}.page-numbers[data-v-836a7cf1]{max-width:150px;gap:.25rem}.page-number[data-v-836a7cf1]{min-width:36px;padding:.5rem .25rem;font-size:.75rem}.load-more-section button[data-v-836a7cf1]{font-size:.6rem;padding:.375rem .75rem}} diff --git a/repeater/web/html/assets/Help-BBcBoX4k.js b/repeater/web/html/assets/Help-BBcBoX4k.js new file mode 100644 index 0000000..d483dc8 --- /dev/null +++ b/repeater/web/html/assets/Help-BBcBoX4k.js @@ -0,0 +1 @@ +import{a as e,b as r,i as o,p as n}from"./index-C2DY4pTz.js";const d=e({name:"HelpView",__name:"Help",setup(a){return(i,t)=>(n(),r("div",null,t[0]||(t[0]=[o('

Help & Documentation

pyMC Repeater Wiki

Access documentation, setup guides, troubleshooting tips, and community resources on our official wiki.

Visit Wiki Documentation
Opens in a new tab
',1)])))}});export{d as default}; diff --git a/repeater/web/html/assets/Login-BiyTDci2.css b/repeater/web/html/assets/Login-BiyTDci2.css new file mode 100644 index 0000000..98c60ff --- /dev/null +++ b/repeater/web/html/assets/Login-BiyTDci2.css @@ -0,0 +1 @@ +.bg-gradient-light[data-v-7d3a3377]{background:linear-gradient(to bottom,#0ea5e966,#06b6d44d)}.bg-gradient-dark[data-v-7d3a3377]{background:linear-gradient(to bottom,#67e8f94d,#a5f3fc26)}.login-card[data-v-7d3a3377]{background:#11191c66;backdrop-filter:blur(40px) saturate(180%);-webkit-backdrop-filter:blur(40px) saturate(180%)}.login-card[data-v-7d3a3377]{background:#ffffffb3}.dark .login-card[data-v-7d3a3377]{background:#11191c66}.input-glass[data-v-7d3a3377]{backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)}.input-glass[data-v-7d3a3377]{background:#ffffffe6;border:1px solid #D1D5DB}.dark .input-glass[data-v-7d3a3377]{background:#ffffff0d;border-color:#ffffff1a}.input-glass[data-v-7d3a3377]:focus{background:#fff}.dark .input-glass[data-v-7d3a3377]:focus{background:#ffffff1a}.input-glass[data-v-7d3a3377]:focus{box-shadow:0 0 0 1px #aae8e833,0 0 20px #aae8e826,inset 0 1px #ffffff1a}.input-glow[data-v-7d3a3377]{opacity:0;transition:opacity .3s ease;box-shadow:inset 0 1px #ffffff0d}.input-glass:focus+.input-glow[data-v-7d3a3377]{opacity:1;box-shadow:0 0 20px #aae8e833,inset 0 1px #ffffff1a}.button-glass[data-v-7d3a3377]{backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);position:relative}.button-glass[data-v-7d3a3377]:before{content:"";position:absolute;inset:0;border-radius:12px;padding:1px;background:linear-gradient(90deg,transparent 0%,rgba(170,232,232,.3) 50%,transparent 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;transform:translate(-100%);transition:transform 1s ease}.button-glass[data-v-7d3a3377]:hover:not(:disabled):before{transform:translate(100%)}.button-glass[data-v-7d3a3377]{box-shadow:0 0 0 1px #aae8e833,0 4px 16px #0003,inset 0 1px #ffffff1a}.button-glass[data-v-7d3a3377]:hover:not(:disabled){box-shadow:0 0 0 1px #aae8e866,0 0 30px #aae8e84d,0 4px 20px #0000004d,inset 0 1px #ffffff26}.login-content:has(.button-glass:hover:not(:disabled)) .logo-image[data-v-7d3a3377]{filter:brightness(1.4) drop-shadow(0 0 12px rgba(170,232,232,.7));transform:scale(1.02)}.login-content:has(.button-glass:hover:not(:disabled)) .logo-glow[data-v-7d3a3377]{opacity:.6;transform:scale(1.15)}.logo-glow[data-v-7d3a3377]{opacity:0}.dark .logo-glow[data-v-7d3a3377]{opacity:1}@keyframes float-7d3a3377{0%,to{transform:translateY(0)}50%{transform:translateY(-10px)}}@keyframes pulse-slow-7d3a3377{0%,to{opacity:.8;transform:scale(1)}50%{opacity:.6;transform:scale(1.05)}}@keyframes pulse-slower-7d3a3377{0%,to{opacity:.75;transform:scale(1)}50%{opacity:.5;transform:scale(1.08)}}@keyframes pulse-slowest-7d3a3377{0%,to{opacity:.8;transform:scale(1)}50%{opacity:.6;transform:scale(1.06)}}.animate-pulse-slow[data-v-7d3a3377]{animation:pulse-slow-7d3a3377 8s ease-in-out infinite}.animate-pulse-slower[data-v-7d3a3377]{animation:pulse-slower-7d3a3377 10s ease-in-out infinite}.animate-pulse-slowest[data-v-7d3a3377]{animation:pulse-slowest-7d3a3377 12s ease-in-out infinite}@keyframes shake-7d3a3377{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-5px)}20%,40%,60%,80%{transform:translate(5px)}}.animate-shake[data-v-7d3a3377]{animation:shake-7d3a3377 .5s ease-in-out}.form-group[data-v-7d3a3377]{position:relative}.form-group:hover label[data-v-7d3a3377]{color:#aae8e8e6;transition:color .3s ease} diff --git a/repeater/web/html/assets/Login-l9pwpiS6.js b/repeater/web/html/assets/Login-l9pwpiS6.js new file mode 100644 index 0000000..82f6a96 --- /dev/null +++ b/repeater/web/html/assets/Login-l9pwpiS6.js @@ -0,0 +1 @@ +import{a as P,r as a,b as i,g,s as _,e,w as v,v as h,t as y,k as M,y as S,p as u,f as w,_ as $,i as N,G as j,C as B,z as D,m as I,A as L,B as C,x as U}from"./index-C2DY4pTz.js";const q={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl"},E={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-3"},z={class:"text-red-600 dark:text-red-400 text-sm"},T={key:1,class:"bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3"},G={class:"text-green-600 dark:text-green-400 text-sm"},H={class:"flex justify-end gap-3 mt-6"},F=["disabled"],O=["disabled"],R={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},A=P({name:"ChangePasswordModal",__name:"ChangePasswordModal",props:{isOpen:{type:Boolean},canSkip:{type:Boolean,default:!0}},emits:["close","success"],setup(V,{emit:x}){const p=x,l=a(""),s=a(""),d=a(""),o=a(!1),n=a(""),m=a(""),f=()=>{o.value||p("close")},k=()=>{p("close")},c=async()=>{if(n.value="",m.value="",s.value.length<8){n.value="New password must be at least 8 characters long";return}if(s.value!==d.value){n.value="Passwords do not match";return}if(s.value===l.value){n.value="New password must be different from current password";return}o.value=!0;try{const r=(await S.post("/auth/change_password",{current_password:l.value,new_password:s.value})).data;r&&r.success?(m.value=r.message||"Password changed successfully!",setTimeout(()=>{p("success"),p("close")},1500)):n.value=r?.error||"Failed to change password"}catch(t){console.error("Password change error:",t),n.value=t.response?.data?.error||"Failed to change password. Please try again."}finally{o.value=!1}};return(t,r)=>t.isOpen?(u(),i("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:_(f,["self"])},[e("div",q,[r[6]||(r[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-2"},"Change Default Password",-1)),r[7]||(r[7]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-6"}," You're using the default password. Please change it to secure your account. ",-1)),e("form",{onSubmit:_(c,["prevent"]),class:"space-y-4"},[e("div",null,[r[3]||(r[3]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"Current Password",-1)),v(e("input",{"onUpdate:modelValue":r[0]||(r[0]=b=>l.value=b),type:"password",required:"",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Enter current password"},null,512),[[h,l.value]])]),e("div",null,[r[4]||(r[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"New Password",-1)),v(e("input",{"onUpdate:modelValue":r[1]||(r[1]=b=>s.value=b),type:"password",required:"",minlength:"8",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Enter new password (min 8 characters)"},null,512),[[h,s.value]])]),e("div",null,[r[5]||(r[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"Confirm New Password",-1)),v(e("input",{"onUpdate:modelValue":r[2]||(r[2]=b=>d.value=b),type:"password",required:"",minlength:"8",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Confirm new password"},null,512),[[h,d.value]])]),n.value?(u(),i("div",E,[e("p",z,y(n.value),1)])):g("",!0),m.value?(u(),i("div",T,[e("p",G,y(m.value),1)])):g("",!0),e("div",H,[t.canSkip?(u(),i("button",{key:0,type:"button",onClick:k,disabled:o.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50"}," Skip for Now ",8,F)):g("",!0),e("button",{type:"submit",disabled:o.value,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-white rounded-lg border border-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2"},[o.value?(u(),i("div",R)):g("",!0),M(" "+y(o.value?"Changing...":"Change Password"),1)],8,O)])],32)])])):g("",!0)}}),Y={class:"min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-start sm:items-center justify-center p-2 sm:p-4 pt-8 sm:pt-4"},J={class:"absolute top-4 right-4 z-20"},K={class:"login-card relative z-10 w-full max-w-md p-6 sm:p-10 rounded-[16px] sm:rounded-[24px] border-0 sm:border sm:border-stroke-subtle dark:sm:border-stroke/20 shadow-[0_8px_32px_0_rgba(0,0,0,0.1)] dark:shadow-[0_8px_32px_0_rgba(0,0,0,0.37)] backdrop-blur-xl"},Q={class:"relative login-content"},W={class:"form-group"},X={class:"relative"},Z=["disabled"],ee={class:"form-group"},te={class:"relative"},re=["disabled"],se={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-[12px] p-2.5 sm:p-3.5 backdrop-blur-sm animate-shake"},oe={class:"text-red-600 dark:text-red-400 text-xs sm:text-sm font-medium"},ae=["disabled"],ne={key:0,class:"w-4 h-4 sm:w-5 sm:h-5 border-2 border-white border-t-transparent rounded-full animate-spin"},le={key:1,class:"w-4 h-4 sm:w-5 sm:h-5 group-hover:translate-x-1 transition-transform duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},de={class:"relative"},ie={class:"mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-stroke-subtle dark:border-stroke/10"},ue={class:"flex items-center justify-center gap-3"},pe={href:"https://github.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-primary/20 dark:hover:bg-primary/30 hover:border-primary/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"GitHub"},ce={href:"https://buymeacoffee.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-yellow-50 dark:hover:bg-yellow-500/20 hover:border-yellow-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"Buy Me a Coffee"},me=P({name:"LoginView",__name:"Login",setup(V){const x=I(),p=a("admin"),l=a(""),s=a(!1),d=a(""),o=a(!1),n=a(!1),m=async()=>{d.value="",s.value=!0;try{const c=L(),r=(await S.post("/auth/login",{username:p.value,password:l.value,client_id:c})).data;r.success&&r.token?l.value==="admin123"?(C(r.token),n.value=!0,o.value=!0):(C(r.token),x.push("/")):d.value=r.error||"Login failed"}catch(c){console.error("Login error:",c);const t=c;d.value=t.response?.data?.error||"Connection error. Please try again."}finally{s.value=!1}},f=()=>{o.value=!1,x.push("/")},k=()=>{o.value=!1,n.value&&x.push("/")};return(c,t)=>(u(),i("div",Y,[e("div",J,[w($)]),t[9]||(t[9]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slow -top-[79px] left-[575px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[10]||(t[10]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-75 animate-pulse-slower -top-[94px] -left-[92px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[11]||(t[11]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slowest top-[373px] left-[246px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),e("div",K,[t[8]||(t[8]=e("div",{class:"absolute inset-0 rounded-[24px] bg-gradient-to-br from-primary/3 dark:from-primary/5 to-transparent pointer-events-none"},null,-1)),e("div",Q,[t[7]||(t[7]=N('
MeshCore

pyMC Repeater

Sign in to access your dashboard

',1)),e("form",{onSubmit:_(m,["prevent"]),class:"space-y-4 sm:space-y-5"},[e("div",W,[t[3]||(t[3]=e("label",{for:"username",class:"block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2"}," Username ",-1)),e("div",X,[v(e("input",{id:"username","onUpdate:modelValue":t[0]||(t[0]=r=>p.value=r),type:"text",autocomplete:"username",required:"",class:"input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300",placeholder:"Enter username",disabled:s.value},null,8,Z),[[h,p.value]]),t[2]||(t[2]=e("div",{class:"absolute inset-0 rounded-[12px] pointer-events-none input-glow"},null,-1))])]),e("div",ee,[t[5]||(t[5]=e("label",{for:"password",class:"block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2"}," Password ",-1)),e("div",te,[v(e("input",{id:"password","onUpdate:modelValue":t[1]||(t[1]=r=>l.value=r),type:"password",autocomplete:"current-password",required:"",class:"input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300",placeholder:"Enter password",disabled:s.value},null,8,re),[[h,l.value]]),t[4]||(t[4]=e("div",{class:"absolute inset-0 rounded-[12px] pointer-events-none input-glow"},null,-1))])]),d.value?(u(),i("div",se,[e("p",oe,y(d.value),1)])):g("",!0),e("button",{type:"submit",disabled:s.value,class:"button-glass w-full relative overflow-hidden bg-primary/20 hover:bg-primary/30 active:scale-[0.98] text-primary dark:text-white font-semibold py-3 sm:py-4 px-4 rounded-[12px] border border-primary/50 hover:border-primary/60 transition-all duration-300 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 sm:gap-2.5 group mt-6 sm:mt-8 text-sm sm:text-base backdrop-blur-sm"},[s.value?(u(),i("div",ne)):(u(),i("svg",le,t[6]||(t[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"},null,-1)]))),e("span",de,y(s.value?"Signing in...":"Sign In"),1)],8,ae)],32),e("div",ie,[e("div",ue,[e("a",pe,[w(j,{class:"w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-primary transition-colors"})]),e("a",ce,[w(B,{class:"w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-yellow-500 transition-colors"})])])])])]),w(A,{"is-open":o.value,"can-skip":!0,onClose:k,onSuccess:f},null,8,["is-open"])]))}}),ge=U(me,[["__scopeId","data-v-7d3a3377"]]);export{ge as default}; diff --git a/repeater/web/html/assets/Logs-BeEVtJ2E.js b/repeater/web/html/assets/Logs-BeEVtJ2E.js new file mode 100644 index 0000000..5bcf60f --- /dev/null +++ b/repeater/web/html/assets/Logs-BeEVtJ2E.js @@ -0,0 +1 @@ +import{a as j,r as i,c as w,o as H,H as T,b as s,e as o,k as $,j as h,t as c,g as q,F as L,h as N,i as J,L as K,p as n}from"./index-C2DY4pTz.js";const P={class:"space-y-6"},Q={class:"glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6"},X={class:"flex items-center justify-between mb-4"},Y=["disabled"],Z={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},ee={class:"flex flex-wrap gap-2"},te=["onClick"],re={key:0,class:"w-px h-6 bg-stroke-subtle dark:bg-stroke/20 mx-2 self-center"},oe=["onClick"],se={class:"glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden"},ne={key:0,class:"p-8 text-center"},ae={key:1,class:"p-8 text-center"},le={class:"text-content-secondary dark:text-content-muted mb-4"},de={key:2,class:"max-h-[600px] overflow-y-auto"},ce={key:0,class:"p-8 text-center"},ie={key:1,class:"divide-y divide-gray-200 dark:divide-white/5"},ue={class:"flex-shrink-0 text-content-secondary dark:text-content-muted"},ge={class:"flex-shrink-0 px-2 py-1 text-xs font-medium rounded bg-blue-500/20 text-blue-600 dark:text-blue-400"},be={class:"text-content-primary dark:text-content-primary flex-1 break-all"},ve=j({name:"LogsView",__name:"Logs",setup(xe){const x=i([]),a=i(new Set),d=i(new Set(["DEBUG","INFO","WARNING","ERROR"])),v=i(new Set),p=i(new Set),m=i(!0),k=i(null);let u=null;const f=t=>{const e=t.match(/- ([^-]+) - (?:DEBUG|INFO|WARNING|ERROR) -/);return e?e[1].trim():"Unknown"},S=t=>{const e=t.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} - [^-]+ - (?:DEBUG|INFO|WARNING|ERROR) - (.+)$/);return e?e[1]:t},R=(t,e)=>{if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0},y=async()=>{try{const t=await K.getLogs();if(t.logs&&t.logs.length>0){x.value=t.logs;const e=new Set;x.value.forEach(b=>{const z=f(b.message);e.add(z)});const r=new Set;x.value.forEach(b=>{r.add(b.level)}),a.value.size===0&&(a.value=new Set(e));const l=!R(v.value,e),g=!R(p.value,r);l&&(v.value=e),g&&(p.value=r),k.value=null}}catch(t){console.error("Error loading logs:",t),k.value=t instanceof Error?t.message:"Failed to load logs"}finally{m.value=!1}},_=w(()=>x.value.filter(e=>{const r=f(e.message),l=a.value.has(r),g=d.value.has(e.level);return l&&g})),C=w(()=>Array.from(v.value).sort()),A=w(()=>{const t=["ERROR","WARNING","WARN","INFO","DEBUG"];return Array.from(p.value).sort((r,l)=>{const g=t.indexOf(r),b=t.indexOf(l);return g!==-1&&b!==-1?g-b:r.localeCompare(l)})}),I=t=>{d.value.has(t)?d.value.delete(t):d.value.add(t),d.value=new Set(d.value)},O=t=>new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),B=t=>({ERROR:"text-red-600 dark:text-red-400 bg-red-900/20",WARNING:"text-yellow-600 dark:text-yellow-400 bg-yellow-900/20",WARN:"text-yellow-600 dark:text-yellow-400 bg-yellow-900/20",INFO:"text-blue-600 dark:text-blue-400 bg-blue-900/20",DEBUG:"text-gray-400 bg-gray-900/20"})[t]||"text-gray-400 bg-gray-900/20",E=(t,e)=>e?{ERROR:"bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400 border-red-500/50",WARNING:"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-600 dark:text-yellow-400 border-yellow-500/50",WARN:"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-600 dark:text-yellow-400 border-yellow-500/50",INFO:"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50",DEBUG:"bg-gray-500/20 text-gray-400 border-gray-500/50"}[t]||"bg-primary/20 text-primary border-primary/50":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-white/60 border-stroke-subtle dark:border-white/20 hover:bg-stroke-subtle dark:hover:bg-white/10",G=t=>{a.value.has(t)?a.value.delete(t):a.value.add(t),a.value=new Set(a.value)},F=()=>{a.value=new Set(v.value)},M=()=>{a.value=new Set},D=()=>{d.value=new Set(p.value)},U=()=>{d.value=new Set},W=()=>{u&&clearInterval(u),u=setInterval(y,5e3)},V=()=>{u&&(clearInterval(u),u=null)};return H(()=>{y(),W()}),T(()=>{V()}),(t,e)=>(n(),s("div",P,[o("div",Q,[o("div",X,[e[1]||(e[1]=o("div",null,[o("h1",{class:"text-content-primary dark:text-content-primary text-2xl font-semibold mb-2"},"System Logs"),o("p",{class:"text-content-secondary dark:text-content-muted"},"Real-time system events and diagnostics")],-1)),o("button",{onClick:y,disabled:m.value,class:"flex items-center gap-2 px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary border border-primary/50 rounded-lg transition-colors disabled:opacity-50"},[(n(),s("svg",{class:h(["w-4 h-4",{"animate-spin":m.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e[0]||(e[0]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)]),2)),$(" "+c(m.value?"Loading...":"Refresh"),1)],8,Y)]),o("div",Z,[o("div",{class:"flex flex-wrap items-center gap-3 mb-4"},[e[2]||(e[2]=o("span",{class:"text-content-primary dark:text-content-primary font-medium"},"Filters:",-1)),o("button",{onClick:F,class:"px-3 py-1 text-xs bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded transition-colors"}," All Loggers "),o("button",{onClick:M,class:"px-3 py-1 text-xs bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border border-accent-red/50 rounded transition-colors"}," Clear Loggers "),e[3]||(e[3]=o("div",{class:"w-px h-4 bg-white/20 mx-1"},null,-1)),o("button",{onClick:D,class:"px-3 py-1 text-xs bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded transition-colors"}," All Levels "),o("button",{onClick:U,class:"px-3 py-1 text-xs bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border border-accent-red/50 rounded transition-colors"}," Clear Levels ")]),o("div",ee,[(n(!0),s(L,null,N(C.value,r=>(n(),s("button",{key:"logger-"+r,onClick:l=>G(r),class:h(["px-3 py-1 text-xs border rounded-full transition-colors",a.value.has(r)?"bg-primary/20 text-primary border-primary/50":"bg-background-mute dark:bg-white/5 text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/10"])},c(r),11,te))),128)),C.value.length>0&&A.value.length>0?(n(),s("div",re)):q("",!0),(n(!0),s(L,null,N(A.value,r=>(n(),s("button",{key:"level-"+r,onClick:l=>I(r),class:h(["px-3 py-1 text-xs border rounded-full transition-colors font-medium",d.value.has(r)?E(r,!0):E(r,!1)])},c(r),11,oe))),128))])])]),o("div",se,[m.value&&x.value.length===0?(n(),s("div",ne,e[4]||(e[4]=[o("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"},null,-1),o("p",{class:"text-content-secondary dark:text-content-muted"},"Loading system logs...",-1)]))):k.value?(n(),s("div",ae,[e[5]||(e[5]=o("div",{class:"text-red-600 dark:text-red-400 mb-4"},[o("svg",{class:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),e[6]||(e[6]=o("h3",{class:"text-content-primary dark:text-content-primary text-lg font-medium mb-2"},"Error Loading Logs",-1)),o("p",le,c(k.value),1),o("button",{onClick:y,class:"px-4 py-2 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 border border-red-500/50 rounded-lg transition-colors"}," Try Again ")])):(n(),s("div",de,[_.value.length===0?(n(),s("div",ce,e[7]||(e[7]=[J('

No Logs to Display

No logs match the current filter criteria.

',3)]))):(n(),s("div",ie,[(n(!0),s(L,null,N(_.value,(r,l)=>(n(),s("div",{key:l,class:"flex items-start gap-4 p-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors font-mono text-sm"},[o("span",ue," ["+c(O(r.timestamp))+"] ",1),o("span",ge,c(f(r.message)),1),o("span",{class:h(["flex-shrink-0 px-2 py-1 text-xs font-medium rounded",B(r.level)])},c(r.level),3),o("span",be,c(S(r.message)),1)]))),128))]))]))])]))}});export{ve as default}; diff --git a/repeater/web/html/assets/Neighbors-BhwSlX3P.js b/repeater/web/html/assets/Neighbors-BhwSlX3P.js new file mode 100644 index 0000000..b89fca9 --- /dev/null +++ b/repeater/web/html/assets/Neighbors-BhwSlX3P.js @@ -0,0 +1,65 @@ +import{a as bt,b as $,g as D,e as t,t as C,s as Lt,p as f,M as Yt,r as F,c as J,D as ht,N as zt,f as it,T as Ft,l as Dt,O as jt,j as M,F as ct,h as gt,x as It,k as tt,o as Xt,Q as te,i as ft,E as Pt,n as At,w as wt,R as ie,q as Wt,v as le,L as Et}from"./index-C2DY4pTz.js";import{u as Ut}from"./useSignalQuality-D9wfbwdb.js";import{L as W}from"./leaflet-src-BtisrQHC.js";/* empty css */import{g as _t,s as Ct}from"./preferences-DtwbSSgO.js";import"./_commonjsHelpers-CqkleIqs.js";const de={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mb-6"},ce={class:"flex items-center gap-3"},ue={class:"flex-1 min-w-0"},pe={class:"text-content-primary dark:text-content-primary font-medium truncate"},ge={class:"text-content-secondary dark:text-content-muted text-sm font-mono"},me={key:0,class:"text-white/50 text-xs"},he={key:1,class:"text-white/50 text-xs"},be=bt({__name:"DeleteNeighborModal",props:{show:{type:Boolean},neighbor:{}},emits:["close","delete"],setup(A,{emit:o}){const r=A,i=o,e=()=>{r.neighbor&&(i("delete",r.neighbor.id),d())},d=()=>{i("close")},g=s=>{s.target===s.currentTarget&&d()};return(s,a)=>s.show&&s.neighbor?(f(),$("div",{key:0,onClick:g,class:"fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[t("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:a[0]||(a[0]=Lt(()=>{},["stop"]))},[t("div",{class:"flex items-center gap-3 mb-6"},[a[2]||(a[2]=t("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),a[3]||(a[3]=t("div",null,[t("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Delete Neighbor"),t("p",{class:"text-content-secondary dark:text-content-muted text-sm mt-1"}," Are you sure you want to delete this neighbor? ")],-1)),t("button",{onClick:d,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},a[1]||(a[1]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),t("div",de,[t("div",ce,[t("div",ue,[t("div",pe,C(s.neighbor?.node_name||s.neighbor?.long_name||s.neighbor?.short_name||"Unknown"),1),t("div",ge," ID: "+C(s.neighbor?.node_num_hex||s.neighbor?.node_num||s.neighbor?.id||"N/A"),1),s.neighbor?.contact_type?(f(),$("div",me,C(s.neighbor.contact_type),1)):D("",!0),s.neighbor?.hw_model?(f(),$("div",he,C(s.neighbor.hw_model),1)):D("",!0)])])]),a[4]||(a[4]=t("div",{class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},[t("div",{class:"flex items-center gap-2 text-accent-red text-sm"},[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),t("span",null,"This action cannot be undone")])],-1)),t("div",{class:"flex gap-3"},[t("button",{onClick:d,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),t("button",{onClick:e,class:"flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium"}," Delete ")])])])):D("",!0)}}),xe={class:"bg-gradient-to-r from-primary/20 to-accent-blue/20 border-b border-stroke-subtle dark:border-stroke/10 px-6 py-4"},ve={class:"flex items-center justify-between"},ye={class:"flex items-center gap-3"},ke={key:0,class:"text-sm text-content-secondary dark:text-content-muted"},fe={class:"p-6"},we={key:0,class:"text-center py-8"},_e={key:1,class:"text-center py-8"},Ce={class:"text-content-secondary dark:text-content-muted text-sm"},$e={key:2,class:"space-y-4"},Me={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Ae={class:"flex items-center justify-between mb-2"},Le={class:"flex items-baseline gap-2"},Te={class:"text-3xl font-bold text-content-primary dark:text-content-primary"},Ee={class:"grid grid-cols-2 gap-3"},Se={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Be={class:"flex items-center gap-2 mb-2"},Ne={class:"flex gap-0.5"},Fe={class:"flex items-baseline gap-1"},De={class:"text-xl font-bold text-content-primary dark:text-content-primary"},Pe={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Re={class:"flex items-baseline gap-1"},ze={class:"text-xl font-bold text-content-primary dark:text-content-primary"},je={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Ie={class:"relative"},Ue={class:"flex items-center gap-2 overflow-x-auto pb-2"},Oe={key:0,class:"relative flex items-center"},Ve={key:0,class:"absolute left-1/2 -translate-x-1/2 animate-pulse"},He={class:"text-content-muted dark:text-content-muted text-xs mt-2 flex items-center justify-between"},Ze={key:0,class:"text-cyan-500 dark:text-primary animate-pulse"},We={class:"flex items-center justify-between text-xs text-content-muted dark:text-content-muted pt-2"},Qe=bt({__name:"PingResultModal",props:{show:{type:Boolean},nodeName:{default:null},result:{default:null},error:{default:null},loading:{type:Boolean,default:!1}},emits:["close"],setup(A,{emit:o}){const r=A,i=o,e=Yt(),{getSignalQuality:d}=Ut(),g=F(0),s=F(!1),a=J(()=>{const x=e.stats?.config?.radio?.spreading_factor??7,b=e.stats?.config?.radio?.bandwidth??125,L=e.stats?.config?.radio?.coding_rate??5,_=Math.pow(2,x)/b,k=8+4.25*(L-4)+20;return _*k}),w=J(()=>{if(!r.result)return{color:"text-gray-400",label:"Unknown"};const x=r.result.rtt_ms,b=a.value,L=r.result.path.length,k=2*b*L+500*L;return x{if(!r.result)return{bars:0,color:"text-gray-400"};const x=d(r.result.rssi);return{bars:x.bars,color:x.color}});ht(()=>r.result,x=>{if(x&&!s.value){s.value=!0,g.value=0;const b=x.path.length,_=1500/(b*2);let k=0;const P=b*2-2,I=()=>{k<=P?(g.value=k/P,k++,setTimeout(I,_)):(s.value=!1,g.value=1)};setTimeout(I,100)}},{immediate:!0});const y=J(()=>{if(!r.result||!s.value)return-1;const x=r.result.path.length;if(x<=1)return-1;const b=g.value,L=.5;if(b<=L)return b/L*(x-1);{const _=(b-L)/L;return(x-1)*(1-_)}}),S=()=>{i("close")};return(x,b)=>(f(),zt(jt,{to:"body"},[it(Ft,{name:"modal"},{default:Dt(()=>[x.show?(f(),$("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[99999] p-4",onClick:Lt(S,["self"])},[t("div",{class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/20 rounded-[20px] shadow-2xl w-full max-w-md overflow-hidden",onClick:b[0]||(b[0]=Lt(()=>{},["stop"]))},[t("div",xe,[t("div",ve,[t("div",ye,[b[2]||(b[2]=t("div",{class:"p-2 bg-cyan-400/20 dark:bg-primary/20 rounded-lg"},[t("svg",{class:"w-5 h-5 text-cyan-500 dark:text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})])],-1)),t("div",null,[b[1]||(b[1]=t("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Ping Result",-1)),x.nodeName?(f(),$("p",ke,C(x.nodeName),1)):D("",!0)])]),t("button",{onClick:S,class:"p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary"},b[3]||(b[3]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",fe,[x.loading?(f(),$("div",we,b[4]||(b[4]=[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"},null,-1),t("p",{class:"text-content-secondary dark:text-content-muted"},"Sending ping...",-1),t("p",{class:"text-content-muted dark:text-content-muted text-sm mt-1"},"Waiting for response...",-1)]))):x.error?(f(),$("div",_e,[b[5]||(b[5]=t("div",{class:"p-3 bg-accent-red/10 rounded-full w-16 h-16 mx-auto mb-4 flex items-center justify-center"},[t("svg",{class:"w-8 h-8 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-1.964-1.333-2.732 0L3.268 16c-.77 1.333.192 3 1.732 3z"})])],-1)),b[6]||(b[6]=t("h3",{class:"text-accent-red font-semibold mb-2"},"Ping Failed",-1)),t("p",Ce,C(x.error),1)])):x.result?(f(),$("div",$e,[t("div",Me,[t("div",Ae,[b[7]||(b[7]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Round-Trip Time",-1)),t("span",{class:M(["text-xs font-medium px-2 py-1 rounded-full",w.value.color,"bg-current/10"])},C(w.value.label),3)]),t("div",Le,[t("span",Te,C(x.result.rtt_ms.toFixed(2)),1),b[8]||(b[8]=t("span",{class:"text-content-secondary dark:text-content-muted"},"ms",-1))])]),t("div",Ee,[t("div",Se,[t("div",Be,[b[9]||(b[9]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"RSSI",-1)),t("div",Ne,[(f(),$(ct,null,gt(5,L=>t("div",{key:L,class:M(["w-1 h-3 rounded-sm",L<=m.value.bars?m.value.color:"bg-stroke-subtle dark:bg-stroke/10"])},null,2)),64))])]),t("div",Fe,[t("span",De,C(x.result.rssi),1),b[10]||(b[10]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"dBm",-1))])]),t("div",Pe,[b[12]||(b[12]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"SNR",-1)),t("div",Re,[t("span",ze,C(x.result.snr_db),1),b[11]||(b[11]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"dB",-1))])])]),t("div",je,[b[15]||(b[15]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3"},"Network Path",-1)),t("div",Ie,[t("div",Ue,[(f(!0),$(ct,null,gt(x.result.path,(L,_)=>(f(),$("div",{key:_,class:"flex items-center gap-2 flex-shrink-0 relative"},[t("div",{class:M(["bg-cyan-400/20 dark:bg-primary/20 text-cyan-600 dark:text-primary border border-cyan-400/40 dark:border-primary/30 px-3 py-1.5 rounded-lg text-sm font-mono transition-all duration-300",s.value&&Math.floor(y.value)===_?"ring-2 ring-cyan-400/50 dark:ring-primary/50 scale-105":""])},C(L),3),_[s.value&&y.value>=_&&y.value<_+1?(f(),$("div",Ve,b[13]||(b[13]=[t("svg",{class:"w-3 h-3 text-cyan-500 dark:text-primary drop-shadow-[0_0_6px_rgba(6,182,212,0.8)] dark:drop-shadow-[0_0_6px_rgba(59,130,246,0.8)]",fill:"currentColor",viewBox:"0 0 24 24"},[t("circle",{cx:"12",cy:"12",r:"8"})],-1)]))):D("",!0)]),_:2},1024)])):D("",!0)]))),128))])]),t("div",He,[t("span",null,C(x.result.path.length)+" hop"+C(x.result.path.length!==1?"s":""),1),s.value?(f(),$("span",Ze,"● Tracing route...")):D("",!0)])]),t("div",We,[t("span",null,"Target: "+C(x.result.target_id),1),t("span",null,"Tag: #"+C(x.result.tag),1)])])):D("",!0)]),t("div",{class:"border-t border-stroke-subtle dark:border-stroke/10 px-6 py-4"},[t("button",{onClick:S,class:"w-full py-2.5 bg-gradient-to-r from-cyan-400 to-cyan-500 text-white hover:from-cyan-500 hover:to-cyan-600 dark:bg-primary/20 dark:text-primary dark:border dark:border-primary/30 dark:hover:bg-primary/30 dark:from-transparent dark:to-transparent rounded-lg font-medium transition-all shadow-[0_2px_12px_rgba(6,182,212,0.3)] dark:shadow-none"}," Close ")])])])):D("",!0)]),_:1})]))}}),qe=It(Qe,[["__scopeId","data-v-bea9143c"]]),Ke={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/20 flex flex-col h-full overflow-hidden"},Ge={class:"flex items-center justify-between p-8 pb-4 flex-shrink-0"},Je={class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},Ye={class:"text-content-secondary dark:text-content-muted text-sm font-mono"},Xe={class:"flex items-center gap-2"},to={class:"flex-1 overflow-y-auto custom-scrollbar px-8"},eo={class:"mb-6"},oo={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},ro={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},no={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},so={class:"text-content-primary dark:text-content-primary font-medium"},ao={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},io={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},lo={class:"text-content-primary dark:text-content-primary font-medium"},co={class:"mb-6"},uo={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},po={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},go={class:"text-content-primary dark:text-content-primary font-medium"},mo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},ho={class:"text-content-primary dark:text-content-primary font-medium"},bo={key:0,class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},xo={class:"flex items-center gap-2"},vo={class:"flex gap-0.5"},yo={class:"mb-6"},ko={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},fo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},wo={class:"text-content-primary dark:text-content-primary text-sm"},_o={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},Co={class:"text-content-primary dark:text-content-primary text-sm"},$o={key:0,class:"mb-6"},Mo={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},Ao={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},Lo={class:"text-content-primary dark:text-content-primary font-mono text-sm"},To={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},Eo={class:"text-content-primary dark:text-content-primary font-mono text-sm"},So={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},Bo={class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},No={key:0,class:"text-content-primary dark:text-content-primary font-medium"},Fo={class:"p-8 pt-4 border-t border-stroke-subtle dark:border-white/10 flex-shrink-0"},Do=bt({name:"NeighborDetailsModal",__name:"NeighborDetailsModal",props:{neighbor:{},isOpen:{type:Boolean},baseLatitude:{default:null},baseLongitude:{default:null}},emits:["close"],setup(A,{emit:o}){const{getSignalQuality:r}=Ut(),i=F("Copy"),e=A,d=o,g=F();let s=null;const a=v=>new Date(v*1e3).toLocaleString(),w=v=>v?`${v} dBm`:"N/A",m=v=>v?`${v.toFixed(1)} dB`:"N/A",y=v=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[v||0]||"Unknown",S=v=>({Unknown:"Unknown","Chat Node":"Chat Node",Repeater:"Repeater","Room Server":"Room Server","Hybrid Node":"Hybrid Node"})[v]||v,x=v=>({Unknown:"text-gray-600 dark:text-gray-400","Chat Node":"text-blue-600 dark:text-blue-400",Repeater:"text-emerald-600 dark:text-emerald-400","Room Server":"text-purple-600 dark:text-purple-400","Hybrid Node":"text-amber-600 dark:text-amber-400"})[v]||"text-gray-600 dark:text-gray-400",b=async()=>{if(!e.neighbor?.latitude||!e.neighbor?.longitude)return;const v=e.neighbor.latitude.toFixed(6),u=e.neighbor.longitude.toFixed(6),j=`${v}, ${u}`;try{await navigator.clipboard.writeText(j),i.value="Copied!",setTimeout(()=>{i.value="Copy"},2e3)}catch(K){console.error("Failed to copy coordinates:",K),i.value="Failed",setTimeout(()=>{i.value="Copy"},2e3)}},L=J(()=>{if(!e.neighbor?.latitude||!e.neighbor?.longitude||!e.baseLatitude||!e.baseLongitude)return null;const v=6371,u=(e.neighbor.latitude-e.baseLatitude)*Math.PI/180,j=(e.neighbor.longitude-e.baseLongitude)*Math.PI/180,K=Math.sin(u/2)*Math.sin(u/2)+Math.cos(e.baseLatitude*Math.PI/180)*Math.cos(e.neighbor.latitude*Math.PI/180)*Math.sin(j/2)*Math.sin(j/2),et=2*Math.atan2(Math.sqrt(K),Math.sqrt(1-K));return v*et}),_=J(()=>e.neighbor?.latitude!==null&&e.neighbor?.longitude!==null&&e.neighbor?.latitude!==0&&e.neighbor?.longitude!==0&&Math.abs(e.neighbor?.latitude??0)<=90&&Math.abs(e.neighbor?.longitude??0)<=180),k=()=>{if(!g.value||!e.neighbor||!_.value)return;s&&(s.remove(),s=null);const v=document.documentElement.classList.contains("dark");s=W.map(g.value,{center:[e.neighbor.latitude,e.neighbor.longitude],zoom:13,zoomControl:!0,attributionControl:!1});const u=v?"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png";W.tileLayer(u,{maxZoom:19,attribution:"© OpenStreetMap © CARTO"}).addTo(s);const j=W.divIcon({className:"custom-marker",html:`
${e.neighbor.node_name?.charAt(0)||"?"}
`,iconSize:[32,32],iconAnchor:[16,16]});if(W.marker([e.neighbor.latitude,e.neighbor.longitude],{icon:j}).addTo(s).bindPopup(`${e.neighbor.node_name||"Unknown"}
${e.neighbor.pubkey.slice(0,8)}...`),e.baseLatitude!==null&&e.baseLongitude!==null&&e.baseLatitude!==0&&e.baseLongitude!==0&&Math.abs(e.baseLatitude)<=90&&Math.abs(e.baseLongitude)<=180){const et=W.divIcon({className:"custom-marker",html:'
B
',iconSize:[32,32],iconAnchor:[16,16]});W.marker([e.baseLatitude,e.baseLongitude],{icon:et}).addTo(s).bindPopup("Base Station"),W.polyline([[e.baseLatitude,e.baseLongitude],[e.neighbor.latitude,e.neighbor.longitude]],{color:"#3b82f6",weight:2,opacity:.6,dashArray:"5, 10"}).addTo(s);const lt=W.latLngBounds([e.baseLatitude,e.baseLongitude],[e.neighbor.latitude,e.neighbor.longitude]);s.fitBounds(lt,{padding:[50,50]})}},P=v=>{v.key==="Escape"&&d("close")},I=v=>{v.target===v.currentTarget&&d("close")};ht(()=>e.isOpen,v=>{v?(document.body.style.overflow="hidden",setTimeout(()=>{_.value&&k()},100)):(document.body.style.overflow="",s&&(s.remove(),s=null))},{immediate:!0});const Z=J(()=>e.neighbor?.rssi?r(e.neighbor.rssi):null);return(v,u)=>(f(),zt(jt,{to:"body"},[it(Ft,{name:"modal",appear:""},{default:Dt(()=>[v.isOpen&&v.neighbor?(f(),$("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden",onClick:I,onKeydown:P,tabindex:"0"},[u[20]||(u[20]=t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none"},null,-1)),t("div",{class:"relative w-full max-w-4xl max-h-[90vh] flex flex-col",onClick:u[2]||(u[2]=Lt(()=>{},["stop"]))},[t("div",Ke,[t("div",Ge,[t("div",null,[t("h2",Je,C(v.neighbor.node_name||"Unknown Node"),1),t("p",Ye,C(v.neighbor.pubkey),1)]),t("div",Xe,[t("button",{onClick:u[0]||(u[0]=j=>d("close")),class:"w-8 h-8 flex items-center justify-center rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors duration-200 text-gray-700 dark:text-white hover:text-gray-900 dark:hover:text-white"},u[3]||(u[3]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",to,[t("div",eo,[u[8]||(u[8]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Basic Information",-1)),t("div",oo,[t("div",ro,[u[4]||(u[4]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Contact Type",-1)),t("div",{class:M(["font-medium",x(v.neighbor.contact_type)])},C(S(v.neighbor.contact_type)),3)]),t("div",no,[u[5]||(u[5]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Route Type",-1)),t("div",so,C(y(v.neighbor.route_type)),1)]),t("div",ao,[u[6]||(u[6]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Zero Hop",-1)),t("div",{class:M(["font-medium",v.neighbor.zero_hop?"text-green-600 dark:text-green-400":"text-gray-600 dark:text-gray-400"])},C(v.neighbor.zero_hop?"Yes":"No"),3)]),t("div",io,[u[7]||(u[7]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Advert Count",-1)),t("div",lo,C(v.neighbor.advert_count.toLocaleString()),1)])])]),t("div",co,[u[12]||(u[12]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Signal Quality",-1)),t("div",uo,[t("div",po,[u[9]||(u[9]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"RSSI",-1)),t("div",go,C(w(v.neighbor.rssi)),1)]),t("div",mo,[u[10]||(u[10]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"SNR",-1)),t("div",ho,C(m(v.neighbor.snr)),1)]),Z.value?(f(),$("div",bo,[u[11]||(u[11]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Signal Strength",-1)),t("div",xo,[t("div",vo,[(f(),$(ct,null,gt(4,j=>t("div",{key:j,class:M(["w-1 h-3 rounded-sm",j<=Z.value.bars?Z.value.color:"bg-gray-300 dark:bg-gray-700"])},null,2)),64))]),t("span",{class:M(["text-sm font-medium",Z.value.color])},C(Z.value.quality),3)])])):D("",!0)])]),t("div",yo,[u[15]||(u[15]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Timeline",-1)),t("div",ko,[t("div",fo,[u[13]||(u[13]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"First Seen",-1)),t("div",wo,C(a(v.neighbor.first_seen)),1)]),t("div",_o,[u[14]||(u[14]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Last Seen",-1)),t("div",Co,C(a(v.neighbor.last_seen)),1)])])]),_.value?(f(),$("div",$o,[u[19]||(u[19]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Location",-1)),t("div",Mo,[t("div",Ao,[u[16]||(u[16]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Latitude",-1)),t("div",Lo,C(v.neighbor.latitude?.toFixed(6)),1)]),t("div",To,[u[17]||(u[17]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Longitude",-1)),t("div",Eo,C(v.neighbor.longitude?.toFixed(6)),1)]),t("div",So,[t("div",Bo,C(L.value!==null?"Distance":"Coordinates"),1),L.value!==null?(f(),$("div",No,C(L.value.toFixed(2))+" km ",1)):(f(),$("button",{key:1,onClick:b,class:"w-full px-3 py-1.5 bg-primary hover:bg-primary/90 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-1.5"},[u[18]||(u[18]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1)),tt(" "+C(i.value),1)]))])]),t("div",{ref_key:"mapContainer",ref:g,class:"w-full h-96 rounded-[12px] overflow-hidden border border-stroke-subtle dark:border-white/10"},null,512)])):D("",!0)]),t("div",Fo,[t("button",{onClick:u[1]||(u[1]=j=>d("close")),class:"w-full px-4 py-2.5 bg-primary hover:bg-primary/90 dark:bg-gray-700 dark:hover:bg-gray-600 text-white font-medium rounded-lg transition-colors"}," Close ")])])])],32)):D("",!0)]),_:1})]))}}),Po=It(Do,[["__scopeId","data-v-cbe6bf60"]]),Qt=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],St=1,yt=8;class Ot{static from(o){if(!(o instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,i]=new Uint8Array(o,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const e=i>>4;if(e!==St)throw new Error(`Got v${e} data when expected v${St}.`);const d=Qt[i&15];if(!d)throw new Error("Unrecognized array type.");const[g]=new Uint16Array(o,2,1),[s]=new Uint32Array(o,4,1);return new Ot(s,g,d,o)}constructor(o,r=64,i=Float64Array,e){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const d=Qt.indexOf(this.ArrayType),g=o*2*this.ArrayType.BYTES_PER_ELEMENT,s=o*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${i}.`);e&&e instanceof ArrayBuffer?(this.data=e,this.ids=new this.IndexArrayType(this.data,yt,o),this.coords=new this.ArrayType(this.data,yt+s+a,o*2),this._pos=o*2,this._finished=!0):(this.data=new ArrayBuffer(yt+g+s+a),this.ids=new this.IndexArrayType(this.data,yt,o),this.coords=new this.ArrayType(this.data,yt+s+a,o*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(St<<4)+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=o)}add(o,r){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=o,this.coords[this._pos++]=r,i}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return Rt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,r,i,e){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:g,nodeSize:s}=this,a=[0,d.length-1,0],w=[];for(;a.length;){const m=a.pop()||0,y=a.pop()||0,S=a.pop()||0;if(y-S<=s){for(let _=S;_<=y;_++){const k=g[2*_],P=g[2*_+1];k>=o&&k<=i&&P>=r&&P<=e&&w.push(d[_])}continue}const x=S+y>>1,b=g[2*x],L=g[2*x+1];b>=o&&b<=i&&L>=r&&L<=e&&w.push(d[x]),(m===0?o<=b:r<=L)&&(a.push(S),a.push(x-1),a.push(1-m)),(m===0?i>=b:e>=L)&&(a.push(x+1),a.push(y),a.push(1-m))}return w}within(o,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:e,coords:d,nodeSize:g}=this,s=[0,e.length-1,0],a=[],w=i*i;for(;s.length;){const m=s.pop()||0,y=s.pop()||0,S=s.pop()||0;if(y-S<=g){for(let _=S;_<=y;_++)qt(d[2*_],d[2*_+1],o,r)<=w&&a.push(e[_]);continue}const x=S+y>>1,b=d[2*x],L=d[2*x+1];qt(b,L,o,r)<=w&&a.push(e[x]),(m===0?o-i<=b:r-i<=L)&&(s.push(S),s.push(x-1),s.push(1-m)),(m===0?o+i>=b:r+i>=L)&&(s.push(x+1),s.push(y),s.push(1-m))}return a}}function Rt(A,o,r,i,e,d){if(e-i<=r)return;const g=i+e>>1;ee(A,o,g,i,e,d),Rt(A,o,r,i,g-1,1-d),Rt(A,o,r,g+1,e,1-d)}function ee(A,o,r,i,e,d){for(;e>i;){if(e-i>600){const w=e-i+1,m=r-i+1,y=Math.log(w),S=.5*Math.exp(2*y/3),x=.5*Math.sqrt(y*S*(w-S)/w)*(m-w/2<0?-1:1),b=Math.max(i,Math.floor(r-m*S/w+x)),L=Math.min(e,Math.floor(r+(w-m)*S/w+x));ee(A,o,r,b,L,d)}const g=o[2*r+d];let s=i,a=e;for(kt(A,o,i,r),o[2*e+d]>g&&kt(A,o,i,e);sg;)a--}o[2*i+d]===g?kt(A,o,i,a):(a++,kt(A,o,a,e)),a<=r&&(i=a+1),r<=a&&(e=a-1)}}function kt(A,o,r,i){Bt(A,r,i),Bt(o,2*r,2*i),Bt(o,2*r+1,2*i+1)}function Bt(A,o,r){const i=A[o];A[o]=A[r],A[r]=i}function qt(A,o,r,i){const e=A-r,d=o-i;return e*e+d*d}const Ro={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:A=>A},Kt=Math.fround||(A=>o=>(A[0]=+o,A[0]))(new Float32Array(1)),mt=2,pt=3,Nt=4,ut=5,oe=6;class zo{constructor(o){this.options=Object.assign(Object.create(Ro),o),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(o){const{log:r,minZoom:i,maxZoom:e}=this.options;r&&console.time("total time");const d=`prepare ${o.length} points`;r&&console.time(d),this.points=o;const g=[];for(let a=0;a=i;a--){const w=+Date.now();s=this.trees[a]=this._createTree(this._cluster(s,a)),r&&console.log("z%d: %d clusters in %dms",a,s.numItems,+Date.now()-w)}return r&&console.timeEnd("total time"),this}getClusters(o,r){let i=((o[0]+180)%360+360)%360-180;const e=Math.max(-90,Math.min(90,o[1]));let d=o[2]===180?180:((o[2]+180)%360+360)%360-180;const g=Math.max(-90,Math.min(90,o[3]));if(o[2]-o[0]>=360)i=-180,d=180;else if(i>d){const y=this.getClusters([i,e,180,g],r),S=this.getClusters([-180,e,d,g],r);return y.concat(S)}const s=this.trees[this._limitZoom(r)],a=s.range($t(i),Mt(g),$t(d),Mt(e)),w=s.data,m=[];for(const y of a){const S=this.stride*y;m.push(w[S+ut]>1?Gt(w,S,this.clusterProps):this.points[w[S+pt]])}return m}getChildren(o){const r=this._getOriginId(o),i=this._getOriginZoom(o),e="No cluster with the specified id.",d=this.trees[i];if(!d)throw new Error(e);const g=d.data;if(r*this.stride>=g.length)throw new Error(e);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=g[r*this.stride],w=g[r*this.stride+1],m=d.within(a,w,s),y=[];for(const S of m){const x=S*this.stride;g[x+Nt]===o&&y.push(g[x+ut]>1?Gt(g,x,this.clusterProps):this.points[g[x+pt]])}if(y.length===0)throw new Error(e);return y}getLeaves(o,r,i){r=r||10,i=i||0;const e=[];return this._appendLeaves(e,o,r,i,0),e}getTile(o,r,i){const e=this.trees[this._limitZoom(o)],d=Math.pow(2,o),{extent:g,radius:s}=this.options,a=s/g,w=(i-a)/d,m=(i+1+a)/d,y={features:[]};return this._addTileFeatures(e.range((r-a)/d,w,(r+1+a)/d,m),e.data,r,i,d,y),r===0&&this._addTileFeatures(e.range(1-a/d,w,1,m),e.data,d,i,d,y),r===d-1&&this._addTileFeatures(e.range(0,w,a/d,m),e.data,-1,i,d,y),y.features.length?y:null}getClusterExpansionZoom(o){let r=this._getOriginZoom(o)-1;for(;r<=this.options.maxZoom;){const i=this.getChildren(o);if(r++,i.length!==1)break;o=i[0].properties.cluster_id}return r}_appendLeaves(o,r,i,e,d){const g=this.getChildren(r);for(const s of g){const a=s.properties;if(a&&a.cluster?d+a.point_count<=e?d+=a.point_count:d=this._appendLeaves(o,a.cluster_id,i,e,d):d1;let m,y,S;if(w)m=re(r,a,this.clusterProps),y=r[a],S=r[a+1];else{const L=this.points[r[a+pt]];m=L.properties;const[_,k]=L.geometry.coordinates;y=$t(_),S=Mt(k)}const x={type:1,geometry:[[Math.round(this.options.extent*(y*d-i)),Math.round(this.options.extent*(S*d-e))]],tags:m};let b;w||this.options.generateId?b=r[a+pt]:b=this.points[r[a+pt]].id,b!==void 0&&(x.id=b),g.features.push(x)}}_limitZoom(o){return Math.max(this.options.minZoom,Math.min(Math.floor(+o),this.options.maxZoom+1))}_cluster(o,r){const{radius:i,extent:e,reduce:d,minPoints:g}=this.options,s=i/(e*Math.pow(2,r)),a=o.data,w=[],m=this.stride;for(let y=0;yr&&(_+=a[P+ut])}if(_>L&&_>=g){let k=S*L,P=x*L,I,Z=-1;const v=((y/m|0)<<5)+(r+1)+this.points.length;for(const u of b){const j=u*m;if(a[j+mt]<=r)continue;a[j+mt]=r;const K=a[j+ut];k+=a[j]*K,P+=a[j+1]*K,a[j+Nt]=v,d&&(I||(I=this._map(a,y,!0),Z=this.clusterProps.length,this.clusterProps.push(I)),d(I,this._map(a,j)))}a[y+Nt]=v,w.push(k/_,P/_,1/0,v,-1,_),d&&w.push(Z)}else{for(let k=0;k1)for(const k of b){const P=k*m;if(!(a[P+mt]<=r)){a[P+mt]=r;for(let I=0;I>5}_getOriginZoom(o){return(o-this.points.length)%32}_map(o,r,i){if(o[r+ut]>1){const g=this.clusterProps[o[r+oe]];return i?Object.assign({},g):g}const e=this.points[o[r+pt]].properties,d=this.options.map(e);return i&&d===e?Object.assign({},d):d}}function Gt(A,o,r){return{type:"Feature",id:A[o+pt],properties:re(A,o,r),geometry:{type:"Point",coordinates:[jo(A[o]),Io(A[o+1])]}}}function re(A,o,r){const i=A[o+ut],e=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,d=A[o+oe],g=d===-1?{}:Object.assign({},r[d]);return Object.assign(g,{cluster:!0,cluster_id:A[o+pt],point_count:i,point_count_abbreviated:e})}function $t(A){return A/360+.5}function Mt(A){const o=Math.sin(A*Math.PI/180),r=.5-.25*Math.log((1+o)/(1-o))/Math.PI;return r<0?0:r>1?1:r}function jo(A){return(A-.5)*360}function Io(A){const o=(180-A*360)*Math.PI/180;return 360*Math.atan(Math.exp(o))/Math.PI-90}const Uo={class:"map-container"},Oo={key:0,class:"flex items-center justify-center h-96 glass-card backdrop-blur border border-black/6 dark:border-white/10 rounded-[12px] shadow-sm dark:shadow-none"},Vo={class:"hidden sm:inline"},Ho={key:3,class:"map-legend"},Zo={class:"legend-footer"},Wo={key:4,class:"map-attribution"},Qo=bt({__name:"NetworkMap",props:{adverts:{},baseLatitude:{default:null},baseLongitude:{default:null},showLegend:{type:Boolean,default:!0}},emits:["update:showLegend"],setup(A,{expose:o,emit:r}){typeof window<"u"&&!window.chrome&&(window.chrome={runtime:{}});const i=A,e=r,d=()=>{e("update:showLegend",!i.showLegend)},g=F();let s=null;const a=F(new Map);let w=null;const m=F(new Map),y=F([]),S=F(!0),x=F(60),b=F(14),L=F(document.documentElement.classList.contains("dark")),_=new MutationObserver(()=>{const E=document.documentElement.classList.contains("dark");E!==L.value&&(L.value=E,s&&K())}),k=J(()=>i.baseLatitude!==null&&i.baseLongitude!==null&&typeof i.baseLatitude=="number"&&typeof i.baseLongitude=="number"&&i.baseLatitude!==0&&i.baseLongitude!==0&&Math.abs(i.baseLatitude)<=90&&Math.abs(i.baseLongitude)<=180),P=E=>new Date(E*1e3).toLocaleString(),I=E=>E?`${E} dBm`:"N/A",Z=E=>E?`${E} dB`:"N/A",v=E=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[E||0]||"Unknown",u=(E,c,n,l)=>{const z=(n-E)*Math.PI/180,V=(l-c)*Math.PI/180,G=Math.sin(z/2)*Math.sin(z/2)+Math.cos(E*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(V/2)*Math.sin(V/2);return 6371*(2*Math.atan2(Math.sqrt(G),Math.sqrt(1-G)))},j=()=>{s&&(y.value.forEach(E=>{s&&E.remove()}),y.value.length=0,s.remove(),s=null),a.value.clear(),m.value.clear(),w=null},K=async()=>{const E=s?.getZoom()||11,c=s?.getCenter()||(k.value?[i.baseLatitude,i.baseLongitude]:[0,0]);j(),await Pt(),await at(),s&&s.setView(c,E)},et=E=>{const c=new Map;return E.filter(n=>n.latitude!==null&&n.longitude!==null).map(n=>{let l=n.latitude,B=n.longitude;const z=`${l.toFixed(6)}_${B.toFixed(6)}`,V=c.get(z)||0;if(c.set(z,V+1),V>0){const X=V*60*(Math.PI/180);l+=Math.sin(X)*.001*(V*.5),B+=Math.cos(X)*.001*(V*.5)}return{type:"Feature",properties:{advert:{...n,jittered_latitude:l,jittered_longitude:B}},geometry:{type:"Point",coordinates:[B,l]}}})},lt=E=>{w=new zo({radius:x.value,maxZoom:b.value,minPoints:2}),w.load(E)},at=async()=>{if(!g.value||!k.value){console.warn("Cannot initialize map: missing container or coordinates");return}j(),await Pt();const E=i.baseLatitude,c=i.baseLongitude;s=W.map(g.value,{center:[E,c],zoom:11,zoomControl:!0,attributionControl:!1,preferCanvas:!1});try{const n=L.value?"https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png",l=L.value?"https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}{r}.png",B=W.tileLayer(n,{maxZoom:19,attribution:'© OpenStreetMap contributors © CARTO',errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="}),z=W.tileLayer(l,{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});B.addTo(s),z.addTo(s)}catch(n){console.warn("Error loading tiles:",n)}try{const n=(R,H=!1)=>{const h=H?16:12;return W.divIcon({className:"custom-div-icon",html:`
`,iconSize:[h+4,h+4],iconAnchor:[(h+4)/2,(h+4)/2]})},l=R=>{const H=R<10?30:R<100?40:50;return W.divIcon({className:"custom-cluster-icon",html:` +
+ ${R} +
+ `,iconSize:[H,H],iconAnchor:[H/2,H/2]})},B=n("#ef4444",!0);W.marker([E,c],{icon:B}).addTo(s).bindPopup(` +
+ Base Station
+ Base Station
+ ${E.toFixed(6)}, ${c.toFixed(6)} +
+ `);const z={Unknown:"#9CA3AF","Chat Node":"#60A5FA",Repeater:"#A5E5B6","Room Server":"#EBA0FC","Hybrid Node":"#FFC246"},V=(R,H,h,p,T=0)=>{if(!s)return;const N=R.jittered_latitude||R.latitude,U=R.jittered_longitude||R.longitude;if(N===null||U===null)return;const O=R.route_type||0;let Y=p,ot=3,Q=.7,q;O===2?(Y="#A5E5B6",ot=4,Q=.9):O===1?(Y="#FFC246",q="10, 5",Q=.8):O===3?(Y="#059669",ot=5,Q=.95):O===0?(Y="#ea580c",q="12, 6",Q=.8):(Y="#9CA3AF",q="2, 5",Q=.6);const rt=[H,h],st=[N,U],dt=W.polyline([rt,st],{color:Y,weight:ot,opacity:0,dashArray:q,className:"connection-line"}).addTo(s),xt=W.polyline([rt,rt],{color:Y,weight:ot,opacity:0,dashArray:q,className:"connection-line animated-line"}).addTo(s);setTimeout(()=>{let Tt=0;const Vt=30;xt.setStyle({opacity:Q+.2});const Ht=()=>{Tt++;const Zt=Tt/Vt,ne=rt[0]+(st[0]-rt[0])*Zt,se=rt[1]+(st[1]-rt[1])*Zt;xt.setLatLngs([rt,[ne,se]]),Tt{s&&xt&&xt.remove(),dt.setStyle({opacity:Q}),dt.on("mouseover",()=>{dt.setStyle({weight:ot+2,opacity:Math.min(Q+.3,1)})}),dt.on("mouseout",()=>{dt.setStyle({weight:ot,opacity:Q})});const ae=u(H,h,N,U);dt.bindPopup(` +
+ Connection to ${R.node_name||"Unknown Node"}
+ Distance: ${ae.toFixed(2)} km
+ Route: ${v(R.route_type)}
+ Signal: ${I(R.rssi)} / ${Z(R.snr)} +
+ `),y.value.push(dt)},200)};Ht()},T)},G=()=>{if(!s||!w)return;const R=s.getBounds(),H=Math.floor(s.getZoom());m.value.forEach(p=>{s&&p.remove()}),m.value.clear(),y.value.forEach(p=>{s&&p.remove()}),y.value.length=0,w.getClusters([R.getWest(),R.getSouth(),R.getEast(),R.getNorth()],H).forEach(p=>{const[T,N]=p.geometry.coordinates,U=p.properties;if(U.cluster){const O=W.marker([N,T],{icon:l(U.point_count||0)}).addTo(s);O.on("click",()=>{if(s&&w){const st=w.getClusterExpansionZoom(U.cluster_id);s.setView([N,T],st)}});const ot=w.getLeaves(U.cluster_id,1/0).map(st=>`
+ • ${st.properties.advert.node_name||"Unknown Node"} (${st.properties.advert.contact_type}) +
`).join("");O.bindPopup(` +
+ Cluster: ${U.point_count} nodes
+
+ ${ot} +
+
+ Click to zoom in and separate nodes +
+
+ `),m.value.set(`cluster-${U.cluster_id}`,O);const Q=u(E,c,N,T),q=Math.min(Math.floor(Q*5),200),rt={node_name:`Cluster of ${U.point_count} nodes`,contact_type:"Cluster",route_type:2,rssi:null,snr:null,jittered_latitude:N,jittered_longitude:T,latitude:N,longitude:T};V(rt,E,c,"#AAE8E8",q)}else{const O=U.advert,Y=z[O.contact_type]||z.Unknown,ot=n(Y),Q=N,q=T,rt=u(E,c,Q,q),st=W.marker([Q,q],{icon:ot}).addTo(s).bindPopup(` +
+ ${O.node_name||"Unknown Node"}
+ Type: ${O.contact_type}
+ Distance: ${rt.toFixed(2)} km
+ Signal: ${I(O.rssi)} / ${Z(O.snr)}
+ Route: ${v(O.route_type)}
+ Last Seen: ${P(O.last_seen)} + ${O.jittered_latitude?'
Position adjusted to separate overlapping nodes':""} +
+ `);a.value.set(O.pubkey,st),m.value.set(`node-${O.pubkey}`,st);const dt=Math.min(Math.floor(rt*5),200),xt={...O,jittered_latitude:Q,jittered_longitude:q};V(xt,E,c,Y,dt)}})},X=(R,H)=>{let h=0;et(i.adverts).forEach(T=>{const N=T.properties.advert;if(N.latitude!==null&&N.longitude!==null){const U=z[N.contact_type]||z.Unknown,O=n(U),Y=N.jittered_latitude||N.latitude,ot=N.jittered_longitude||N.longitude,Q=W.marker([Y,ot],{icon:O}).addTo(s).bindPopup(` +
+ ${N.node_name||"Unknown Node"}
+ Type: ${N.contact_type}
+ Distance: ${u(R,H,Y,ot).toFixed(2)} km
+ Signal: ${I(N.rssi)} / ${Z(N.snr)}
+ Route: ${v(N.route_type)}
+ Last Seen: ${P(N.last_seen)} + ${N.jittered_latitude?'
Position adjusted to separate overlapping nodes':""} +
+ `);a.value.set(N.pubkey,Q);const q=Q.getElement();q&&(q.style.opacity="0",q.style.transition="opacity 0.5s ease-out"),V(N,R,H,U,h),setTimeout(()=>{q&&(q.style.opacity="1")},h+1e3),h+=100}})};if(S.value&&i.adverts.length>0)try{const R=et(i.adverts);lt(R);const H=Math.min(14,s.getZoom());s.setZoom(H),setTimeout(()=>{try{G()}catch(h){console.warn("Error updating clusters:",h),X(E,c)}},100),s.on("moveend",()=>{try{G()}catch(h){console.warn("Error updating clusters on move:",h)}}),s.on("zoomend",()=>{try{G()}catch(h){console.warn("Error updating clusters on zoom:",h)}})}catch(R){console.warn("Error initializing clustering:",R),X(E,c)}else X(E,c);setTimeout(()=>{s&&s.invalidateSize()},1e3)}catch(n){console.error("Error initializing map:",n)}};return o({highlightNode:E=>{const c=a.value.get(E);if(c){const n=c.getElement();if(n){const l=n.querySelector("div");l&&l.classList.add("marker-highlight")}}},unhighlightNode:E=>{const c=a.value.get(E);if(c){const n=c.getElement();if(n){const l=n.querySelector("div");l&&l.classList.remove("marker-highlight")}}},initializeOpenStreetMap:at}),ht(()=>i.adverts,()=>{s&&k.value&&setTimeout(()=>{at()},100)},{immediate:!1}),Xt(()=>{_.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),k.value&&i.adverts.length>0&&setTimeout(()=>{at()},300)}),te(()=>{_.disconnect(),j()}),(E,c)=>(f(),$("div",Uo,[k.value?(f(),$("div",{key:1,ref_key:"mapContainer",ref:g,class:"leaflet-map-container h-96 w-full glass-card backdrop-blur border border-black/6 dark:border-white/10 rounded-[12px] overflow-hidden shadow-sm dark:shadow-none",style:{"min-height":"384px",position:"relative"}},null,512)):(f(),$("div",Oo,c[0]||(c[0]=[ft('

No valid coordinates available

Configure base station location to view map

',1)]))),k.value&&E.adverts.length>0?(f(),$("button",{key:2,onClick:d,class:"absolute bottom-3 right-3 z-[1001] flex items-center gap-2 px-3 py-2 bg-black/40 border border-white/10 rounded-lg text-white/80 hover:bg-white/10 hover:text-white transition-colors text-sm backdrop-blur-sm"},[c[1]||(c[1]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),t("span",Vo,C(E.showLegend?"Hide":"Show"),1)])):D("",!0),k.value&&E.adverts.length>0&&E.showLegend?(f(),$("div",Ho,[c[2]||(c[2]=ft('
Node Types
Base Station
Chat Node
Repeater
Room Server
Hybrid Node
Route Types
Direct
Transport Direct
Flood
Transport Flood
',2)),t("div",Zo,C(E.adverts.length)+" node"+C(E.adverts.length!==1?"s":"")+" visible ",1)])):D("",!0),k.value?(f(),$("div",Wo," © OpenStreetMap contributors © CARTO ")):D("",!0)]))}}),qo=It(Qo,[["__scopeId","data-v-a6a23e33"]]),Ko={class:"relative","data-menu-container":""},Jt=bt({__name:"NeighborMenu",props:{neighbor:{},canPing:{type:Boolean}},emits:["ping","delete","show-details"],setup(A,{emit:o}){const r=window.__neighborMenuManager||{activeMenu:null,setActiveMenu:_=>{if(r.activeMenu&&r.activeMenu!==_)try{r.activeMenu.closeMenu()}catch(k){console.warn("Error closing previous menu:",k)}r.activeMenu=_}};window.__neighborMenuManager=r;const i=A,e=o,d=F(!1),g=F(),s=F({top:0,left:0}),a=()=>{d.value=!1,document.removeEventListener("click",x,!0),document.removeEventListener("keydown",b),r.activeMenu===w&&(r.activeMenu=null)},w={closeMenu:a},m=()=>{a(),e("ping",i.neighbor)},y=()=>{a(),e("show-details",i.neighbor)},S=()=>{a(),e("delete",i.neighbor)},x=_=>{_.target.closest("[data-menu-container]")||a()},b=_=>{_.key==="Escape"&&a()},L=async()=>{if(!d.value&&g.value){r.setActiveMenu(w);const _=g.value.getBoundingClientRect(),k=window.innerWidth,P=144,I=k<1024,Z=_.left+P>k-16;let v=_.left;I&&Z&&(v=_.right-P),v=Math.max(8,v),s.value={top:_.bottom+4,left:v},d.value=!0,await Pt(),document.addEventListener("click",x,!0),document.addEventListener("keydown",b)}else a()};return te(()=>{a()}),(_,k)=>(f(),$("div",Ko,[t("button",{ref_key:"buttonRef",ref:g,onClick:L,class:M(["p-1 rounded hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary/80",{"bg-background-mute dark:bg-stroke/10 text-content-primary dark:text-content-primary/80":d.value}]),"data-menu-container":""},k[0]||(k[0]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})],-1)]),2),(f(),zt(jt,{to:"body"},[d.value?(f(),$("div",{key:0,class:"fixed w-36 bg-white dark:bg-surface-elevated backdrop-blur-lg border border-stroke-subtle dark:border-white/20 rounded-[15px] shadow-2xl z-[999999]",style:At({top:s.value.top+"px",left:s.value.left+"px"}),"data-menu-container":""},[t("div",{class:"py-2"},[t("button",{onClick:y,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10"},k[1]||(k[1]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),t("span",{class:"font-medium"},"Details",-1)])),t("button",{onClick:m,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10"},k[2]||(k[2]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})],-1),t("span",{class:"font-medium"},"Ping",-1)])),t("button",{onClick:S,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-accent-red hover:bg-accent-red/10 transition-colors"},k[3]||(k[3]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),t("span",{class:"font-medium"},"Delete",-1)]))])],4)):D("",!0)]))]))}}),Go={class:"glass-card/30 backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[12px] p-6 shadow-sm dark:shadow-none"},Jo={class:"flex items-center justify-between mb-4"},Yo={class:"flex items-center gap-3"},Xo={class:"text-content-primary dark:text-content-primary text-lg font-semibold"},tr={class:"bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary text-xs px-2 py-1 rounded-full"},er={key:0,class:"text-content-muted dark:text-content-muted"},or={key:0,class:"hidden lg:flex bg-background-mute dark:bg-surface-elevated/30 backdrop-blur rounded-lg border border-stroke-subtle dark:border-stroke/10 p-1"},rr={class:"hidden lg:block overflow-x-auto"},nr={class:"w-full"},sr={class:"bg-background-mute dark:bg-transparent"},ar={class:"flex items-center gap-1"},ir={class:"flex items-center gap-1"},lr={class:"flex items-center gap-1"},dr={class:"flex items-center gap-1"},cr={class:"flex items-center gap-1"},ur={class:"flex items-center gap-1"},pr={class:"flex items-center gap-1"},gr={class:"flex items-center gap-1"},mr={class:"flex items-center gap-1"},hr={class:"bg-surface/50 dark:bg-transparent"},br=["onMouseenter","onMouseleave"],xr=["onClick","title"],vr={key:0,class:"ml-1 text-xs"},yr={key:0,class:"flex items-center gap-3"},kr={class:"text-content-secondary dark:text-content-muted"},fr={class:"flex gap-1"},wr=["onClick"],_r=["onClick"],Cr={key:1,class:"text-content-muted"},$r={class:"flex items-center gap-2"},Mr={class:"flex items-end gap-0.5"},Ar={class:"flex items-center gap-2"},Lr=["title"],Tr=["title"],Er={class:"lg:hidden space-y-3"},Sr=["onClick"],Br={class:"flex items-center justify-between mb-3"},Nr={class:"flex items-center gap-3"},Fr={class:"text-content-primary dark:text-content-primary font-medium text-base"},Dr={class:"flex items-center gap-2"},Pr={class:"grid grid-cols-1 gap-3"},Rr={class:"grid grid-cols-2 gap-4"},zr=["onClick","title"],jr={key:0,class:"ml-1 text-xs"},Ir={class:"flex items-center gap-2 justify-end"},Ur={class:"flex items-end gap-0.5"},Or={class:"grid grid-cols-2 gap-4"},Vr={class:"flex items-center gap-2"},Hr=["title"],Zr={class:"text-content-primary dark:text-content-primary text-sm block text-right"},Wr={key:0,class:"border-t border-white/10 pt-3"},Qr={class:"flex items-center justify-between"},qr={class:"text-content-secondary dark:text-content-muted text-sm font-mono"},Kr={class:"flex gap-2"},Gr=["onClick"],Jr=["onClick"],Yr={class:"grid grid-cols-3 gap-4 pt-3 border-t border-white/10"},Xr={class:"text-center"},tn={class:"text-content-primary dark:text-content-primary text-sm font-medium"},en={class:"text-center"},on={class:"text-content-primary dark:text-content-primary text-sm font-medium"},rn={class:"text-center"},nn=["title"],sn=bt({__name:"NeighborTable",props:{contactType:{},contactTypeKey:{},adverts:{},originalCount:{default:0},color:{},baseLatitude:{default:null},baseLongitude:{default:null},isCompactView:{type:Boolean,default:!1},isFirstTable:{type:Boolean,default:!1},showViewToggle:{type:Boolean,default:!1}},emits:["highlight-node","unhighlight-node","menu-ping","menu-delete","show-details","toggle-view"],setup(A,{emit:o}){const r=F(null),{getSignalQuality:i}=Ut(),e=F("advert_count"),d=F("desc"),g=A,s=o,a=c=>new Date(c*1e3).toLocaleString(),w=c=>`${c.slice(0,4)}...${c.slice(-4)}`,m=c=>{switch(c){case 2:return{text:"Direct",bgColor:"bg-green-100 dark:bg-green-500/20",borderColor:"border-green-500 dark:border-green-400/30",textColor:"text-green-600 dark:text-green-400"};case 3:return{text:"Transport Direct",bgColor:"bg-green-100 dark:bg-green-600/20",borderColor:"border-green-600/40 dark:border-green-500/30",textColor:"text-green-700 dark:text-green-500"};case 1:return{text:"Flood",bgColor:"bg-yellow-100 dark:bg-yellow-500/20",borderColor:"border-yellow-500 dark:border-yellow-400/30",textColor:"text-yellow-600 dark:text-yellow-400"};case 0:return{text:"Transport Flood",bgColor:"bg-orange-100 dark:bg-orange-500/20",borderColor:"border-orange-500 dark:border-orange-400/30",textColor:"text-orange-600 dark:text-orange-400"};default:return{text:"Unknown",bgColor:"bg-gray-500/20",borderColor:"border-gray-400/30",textColor:"text-gray-400"}}},y=c=>c?`${c} dBm`:"N/A",S=c=>c?`${c} dB`:"N/A",x=(c,n,l,B)=>{const V=(l-c)*Math.PI/180,G=(B-n)*Math.PI/180,X=Math.sin(V/2)*Math.sin(V/2)+Math.cos(c*Math.PI/180)*Math.cos(l*Math.PI/180)*Math.sin(G/2)*Math.sin(G/2);return 6371*(2*Math.atan2(Math.sqrt(X),Math.sqrt(1-X)))},b=c=>g.baseLatitude===null||g.baseLongitude===null||c.latitude===null||c.longitude===null?"N/A":`${x(g.baseLatitude,g.baseLongitude,c.latitude,c.longitude).toFixed(1)} km`,L=async c=>{try{return await navigator.clipboard.writeText(c),!0}catch{const n=document.createElement("textarea");return n.value=c,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),!0}},_=c=>{const n=Date.now(),l=c*1e3,B=n-l,z=Math.floor(B/1e3),V=Math.floor(z/60),G=Math.floor(V/60),X=Math.floor(G/24);return z<60?`${z}s ago`:V<60?`${V}m ago`:G<24?`${G}h ago`:`${X}d ago`},k=c=>{const n=Date.now(),l=c*1e3,B=n-l,z=Math.floor(B/(1e3*60*60));return z<1?{color:"text-green-600 dark:text-green-400"}:z<26?{color:"text-yellow-600 dark:text-yellow-400"}:{color:"text-red-600 dark:text-red-400"}},P=async(c,n)=>{const l=`${c.toFixed(6)}, ${n.toFixed(6)}`;await L(l)},I=(c,n)=>{const l=`https://www.google.com/maps?q=${c},${n}`;window.open(l,"_blank")},Z=async c=>{await L(c),r.value=c,setTimeout(()=>{r.value=null},2e3)},v=c=>{const n=i(c);return{bars:n.bars,color:n.color}},u=()=>g.isCompactView?"py-2 px-2":"py-4 px-3",j=()=>{s("toggle-view")},K=c=>{s("highlight-node",c)},et=c=>{s("unhighlight-node",c)},lt=c=>{s("menu-ping",c)},at=c=>{s("show-details",c)},vt=c=>{s("menu-delete",c)},nt=c=>{e.value===c?d.value=d.value==="asc"?"desc":"asc":(e.value=c,d.value=typeof g.adverts[0]?.[c]=="number"?"desc":"asc")},E=J(()=>e.value?[...g.adverts].sort((c,n)=>{const l=c[e.value],B=n[e.value];if(l==null)return 1;if(B==null)return-1;let z=0;return typeof l=="string"&&typeof B=="string"?z=l.localeCompare(B):typeof l=="number"&&typeof B=="number"?z=l-B:typeof l=="boolean"&&typeof B=="boolean"&&(z=l===B?0:l?1:-1),d.value==="asc"?z:-z}):g.adverts);return(c,n)=>(f(),$("div",Go,[t("div",Jo,[t("div",Yo,[t("div",{class:"w-3 h-3 rounded-full border border-white/20",style:At({backgroundColor:c.color})},null,4),t("h3",Xo,C(c.contactType),1),t("span",tr,[tt(C(c.adverts.length)+" ",1),c.originalCount>0&&c.adverts.lengthnt("node_name")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",ar,[n[12]||(n[12]=tt(" Node Name ",-1)),e.value==="node_name"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[11]||(n[11]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[1]||(n[1]=l=>nt("pubkey")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",ir,[n[14]||(n[14]=tt(" Public Key ",-1)),e.value==="pubkey"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[13]||(n[13]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5`)},"Location",2),t("th",{class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5`)},"Distance",2),t("th",{onClick:n[2]||(n[2]=l=>nt("route_type")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",lr,[n[16]||(n[16]=tt(" Route Type ",-1)),e.value==="route_type"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[15]||(n[15]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[3]||(n[3]=l=>nt("zero_hop")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",dr,[n[18]||(n[18]=tt(" Zero Hop ",-1)),e.value==="zero_hop"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[17]||(n[17]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[4]||(n[4]=l=>nt("rssi")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",cr,[n[20]||(n[20]=tt(" RSSI ",-1)),e.value==="rssi"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[19]||(n[19]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[5]||(n[5]=l=>nt("snr")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",ur,[n[22]||(n[22]=tt(" SNR ",-1)),e.value==="snr"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[21]||(n[21]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[6]||(n[6]=l=>nt("last_seen")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",pr,[n[24]||(n[24]=tt(" Last Seen ",-1)),e.value==="last_seen"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[23]||(n[23]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[7]||(n[7]=l=>nt("first_seen")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",gr,[n[26]||(n[26]=tt(" First Seen ",-1)),e.value==="first_seen"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[25]||(n[25]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[8]||(n[8]=l=>nt("advert_count")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",mr,[n[28]||(n[28]=tt(" Advert Count ",-1)),e.value==="advert_count"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[27]||(n[27]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2)])]),t("tbody",hr,[(f(!0),$(ct,null,gt(E.value,l=>(f(),$("tr",{key:l.id,class:"hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors",onMouseenter:B=>K(l.pubkey),onMouseleave:B=>et(l.pubkey)},[t("td",{class:M(u())},[it(Jt,{neighbor:l,onPing:lt,onShowDetails:at,onDelete:vt},null,8,["neighbor"])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(l.node_name||"Unknown"),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm font-mono`)},[t("button",{onClick:B=>Z(l.pubkey),class:M(["text-content-primary dark:text-content-primary hover:text-primary-light transition-colors cursor-pointer underline underline-offset-2 decoration-gray-400 dark:decoration-white/30 hover:decoration-primary-light/60",r.value===l.pubkey?"text-green-600 dark:text-green-400 decoration-green-400/60":""]),title:r.value===l.pubkey?"Copied!":"Click to copy full public key"},[tt(C(w(l.pubkey))+" ",1),r.value===l.pubkey?(f(),$("span",vr,"✓")):D("",!0)],10,xr)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[l.latitude!==null&&l.longitude!==null?(f(),$("div",yr,[t("span",kr,C(l.latitude.toFixed(4))+", "+C(l.longitude.toFixed(4)),1),t("div",fr,[t("button",{onClick:B=>P(l.latitude,l.longitude),class:"text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors cursor-pointer",title:"Copy coordinates to clipboard"},n[29]||(n[29]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2"}),t("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"currentColor","stroke-width":"2"})],-1)]),8,wr),t("button",{onClick:B=>I(l.latitude,l.longitude),class:"text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors cursor-pointer",title:"Open in Google Maps"},n[30]||(n[30]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z",stroke:"currentColor","stroke-width":"2"}),t("circle",{cx:"12",cy:"10",r:"3",stroke:"currentColor","stroke-width":"2"})],-1)]),8,_r)])])):(f(),$("span",Cr,"Unknown"))],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(b(l)),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border transition-colors",m(l.route_type).bgColor,m(l.route_type).borderColor,m(l.route_type).textColor])},C(m(l.route_type).text),3)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border transition-colors",l.zero_hop?"bg-green-100 dark:bg-green-500/20 border-green-500 dark:border-green-400/30 text-green-600 dark:text-green-400":"bg-orange-100 dark:bg-orange-500/20 border-orange-500 dark:border-orange-400/30 text-orange-600 dark:text-orange-400"])},C(l.zero_hop?"Zero Hop":"Multi-Hop"),3)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("div",$r,[t("div",Mr,[(f(),$(ct,null,gt(5,B=>t("div",{key:B,class:M(["w-1 transition-colors",B<=v(l.rssi).bars?v(l.rssi).color:"text-gray-600"]),style:At({height:`${4+B*2}px`})},n[31]||(n[31]=[t("div",{class:"w-full h-full bg-current rounded-sm"},null,-1)]),6)),64))]),t("span",{class:M(v(l.rssi).color)},C(y(l.rssi)),3)])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(S(l.snr)),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("div",Ar,[t("div",{class:M(["w-2 h-2 rounded-full",k(l.last_seen).color==="text-green-600 dark:text-green-400"?"bg-green-400":"",k(l.last_seen).color==="text-yellow-600 dark:text-yellow-400"?"bg-yellow-400":"",k(l.last_seen).color==="text-red-600 dark:text-red-400"?"bg-red-400":""])},null,2),t("span",{class:M([k(l.last_seen).color,"cursor-help"]),title:a(l.last_seen)},C(_(l.last_seen)),11,Lr)])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{title:a(l.first_seen),class:"cursor-help"},C(_(l.first_seen)),9,Tr)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm text-center`)},C(l.advert_count),3)],40,br))),128))])])]),t("div",Er,[(f(!0),$(ct,null,gt(E.value,l=>(f(),$("div",{key:l.id,class:"bg-surface/50 dark:bg-transparent border border-stroke-subtle dark:border-white/10 rounded-lg p-4 hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors",onClick:B=>K(l.pubkey)},[t("div",Br,[t("div",Nr,[t("h4",Fr,C(l.node_name||"Unknown Node"),1),t("div",Dr,[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border",m(l.route_type).bgColor,m(l.route_type).borderColor,m(l.route_type).textColor])},C(m(l.route_type).text),3),t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border",l.zero_hop?"bg-green-100 dark:bg-green-500/20 border-green-500 dark:border-green-400/30 text-green-600 dark:text-green-400":"bg-orange-100 dark:bg-orange-500/20 border-orange-500 dark:border-orange-400/30 text-orange-600 dark:text-orange-400"])},C(l.zero_hop?"Zero Hop":"Multi-Hop"),3)])]),it(Jt,{neighbor:l,onPing:lt,onShowDetails:at,onDelete:vt},null,8,["neighbor"])]),t("div",Pr,[t("div",Rr,[t("div",null,[n[32]||(n[32]=t("div",{class:"text-content-muted text-xs mb-1"},"Public Key",-1)),t("button",{onClick:B=>Z(l.pubkey),class:M(["text-content-primary dark:text-content-primary hover:text-primary-light transition-colors cursor-pointer font-mono text-sm underline underline-offset-2 decoration-gray-400 dark:decoration-white/30 hover:decoration-primary-light/60 break-all",r.value===l.pubkey?"text-green-600 dark:text-green-400 decoration-green-400/60":""]),title:r.value===l.pubkey?"Copied!":"Click to copy full public key"},[tt(C(w(l.pubkey))+" ",1),r.value===l.pubkey?(f(),$("span",jr,"✓")):D("",!0)],10,zr)]),t("div",null,[n[34]||(n[34]=t("div",{class:"text-content-muted text-xs mb-1"},"Signal",-1)),t("div",Ir,[t("div",Ur,[(f(),$(ct,null,gt(5,B=>t("div",{key:B,class:M(["w-1.5 transition-colors",B<=v(l.rssi).bars?v(l.rssi).color:"text-gray-600"]),style:At({height:`${6+B*2}px`})},n[33]||(n[33]=[t("div",{class:"w-full h-full bg-current rounded-sm"},null,-1)]),6)),64))]),t("span",{class:M(`${v(l.rssi).color} text-sm font-medium`)},C(y(l.rssi)),3)])])]),t("div",Or,[t("div",null,[n[35]||(n[35]=t("div",{class:"text-content-muted text-xs mb-1"},"Last Seen",-1)),t("div",Vr,[t("div",{class:M(["w-2 h-2 rounded-full",k(l.last_seen).color==="text-green-600 dark:text-green-400"?"bg-green-400":"",k(l.last_seen).color==="text-yellow-600 dark:text-yellow-400"?"bg-yellow-400":"",k(l.last_seen).color==="text-red-600 dark:text-red-400"?"bg-red-400":""])},null,2),t("span",{class:M(`${k(l.last_seen).color} text-sm`),title:a(l.last_seen)},C(_(l.last_seen)),11,Hr)])]),t("div",null,[n[36]||(n[36]=t("div",{class:"text-content-muted text-xs mb-1"},"Distance",-1)),t("span",Zr,C(b(l)),1)])]),l.latitude!==null&&l.longitude!==null?(f(),$("div",Wr,[n[39]||(n[39]=t("div",{class:"text-content-muted text-xs mb-1"},"Location",-1)),t("div",Qr,[t("span",qr,C(l.latitude.toFixed(4))+", "+C(l.longitude.toFixed(4)),1),t("div",Kr,[t("button",{onClick:B=>P(l.latitude,l.longitude),class:"text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg",title:"Copy coordinates"},n[37]||(n[37]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2"}),t("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"currentColor","stroke-width":"2"})],-1)]),8,Gr),t("button",{onClick:B=>I(l.latitude,l.longitude),class:"text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors p-2 hover:bg-white/10 rounded-lg",title:"Open in Maps"},n[38]||(n[38]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z",stroke:"currentColor","stroke-width":"2"}),t("circle",{cx:"12",cy:"10",r:"3",stroke:"currentColor","stroke-width":"2"})],-1)]),8,Jr)])])])):D("",!0),t("div",Yr,[t("div",Xr,[n[40]||(n[40]=t("div",{class:"text-content-muted text-xs mb-1"},"SNR",-1)),t("span",tn,C(S(l.snr)),1)]),t("div",en,[n[41]||(n[41]=t("div",{class:"text-content-muted text-xs mb-1"},"Adverts",-1)),t("span",on,C(l.advert_count),1)]),t("div",rn,[n[42]||(n[42]=t("div",{class:"text-content-muted text-xs mb-1"},"First Seen",-1)),t("span",{class:"text-content-primary dark:text-content-primary text-sm",title:a(l.first_seen)},C(_(l.first_seen)),9,nn)])])])],8,Sr))),128))])]))}}),an={class:"space-y-6"},ln={key:0,class:"flex items-center justify-center py-12"},dn={key:1,class:"bg-red-50 dark:bg-accent-red/10 border border-red-300 dark:border-accent-red/20 rounded-[15px] p-6"},cn={class:"flex items-center gap-3"},un={class:"text-red-500 dark:text-accent-red/80 text-sm"},pn={key:0,class:""},gn={class:"flex items-center justify-between"},mn={class:"flex items-center gap-3"},hn={class:"hidden lg:flex bg-background-mute dark:bg-surface-elevated/30 backdrop-blur rounded-lg border border-stroke-subtle dark:border-stroke/10 mb p-1"},bn={class:"flex items-center gap-2"},xn={key:0,class:"ml-1 bg-accent-blue/20 text-accent-blue border border-accent-blue/30 text-xs px-1.5 py-0.5 rounded-full font-medium"},vn={class:"bg-background dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mt-4 space-y-4"},yn={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},kn={key:1,class:"text-center py-12"},fn={key:2,class:"text-center py-12"},Ln=bt({name:"NeighborsView",__name:"Neighbors",setup(A){const o=Yt(),r={0:"Unknown",1:"Chat Node",2:"Repeater",3:"Room Server",4:"Hybrid Node"},i={0:"#6b7280",1:"#60a5fa",2:"#34d399",3:"#a855f7",4:"#f59e0b"},e=F({}),d=F(!0),g=F(null),s=F(_t("neighbors_compactView",!1)),a=F(_t("neighbors_showMapLegend",typeof window<"u"?window.innerWidth>=1024:!0)),w=F(_t("neighbors_showFilters",!1)),m=F(_t("neighbors_filters",{zeroHop:"all",routeType:"all",searchText:""}));ht(s,h=>Ct("neighbors_compactView",h)),ht(a,h=>Ct("neighbors_showMapLegend",h)),ht(w,h=>Ct("neighbors_showFilters",h)),ht(m,h=>Ct("neighbors_filters",h),{deep:!0});const y=F(!1),S=F(!1),x=F(!1),b=F(null),L=F(null),_=F(null),k=F(null),P=F(!1),I=F(null),Z=J(()=>{if(!k.value)return null;const h=k.value;return{id:h.id,pubkey:h.pubkey,node_name:h.node_name,contact_type:h.contact_type,latitude:h.latitude,longitude:h.longitude,rssi:h.rssi,snr:h.snr,route_type:h.route_type,last_seen:h.last_seen,first_seen:h.first_seen,advert_count:h.advert_count,timestamp:h.timestamp,is_repeater:h.is_repeater,is_new_neighbor:h.is_new_neighbor,zero_hop:h.zero_hop}}),v=J(()=>o.stats?.config?.repeater?.latitude),u=J(()=>o.stats?.config?.repeater?.longitude),j=h=>h.filter(p=>{if(m.value.zeroHop!=="all"){const T=p.zero_hop;if(m.value.zeroHop==="true"&&!T||m.value.zeroHop==="false"&&T)return!1}if(m.value.routeType!=="all"){const T=p.route_type;if(m.value.routeType==="direct"&&T!==2||m.value.routeType==="transport_direct"&&T!==3||m.value.routeType==="flood"&&T!==1||m.value.routeType==="transport_flood"&&T!==0)return!1}if(m.value.searchText){const T=m.value.searchText.toLowerCase(),N=p.node_name?.toLowerCase()||"",U=p.pubkey.toLowerCase();if(!N.includes(T)&&!U.includes(T))return!1}return!0}),K=()=>{m.value={zeroHop:"all",routeType:"all",searchText:""}},et=J(()=>m.value.zeroHop!=="all"||m.value.routeType!=="all"||m.value.searchText!==""),lt=J(()=>{const h={};for(const[p,T]of Object.entries(e.value))h[p]=j(T);return h}),at=J(()=>Object.entries(r).filter(([h])=>lt.value[h]?.length>0).sort(([h],[p])=>parseInt(h)-parseInt(p))),vt=J(()=>Object.values(e.value).flat().filter(h=>{const p=h.latitude,T=h.longitude;return p!=null&&p!==0&&T!==null&&T!==void 0&&T!==0&&typeof p=="number"&&typeof T=="number"&&!isNaN(p)&&!isNaN(T)&&h.zero_hop===!0})),nt=async h=>{try{const p=await Et.get(`/adverts_by_contact_type?contact_type=${encodeURIComponent(h)}&hours=168`);return p.success&&Array.isArray(p.data)?p.data:[]}catch(p){return console.error(`Error fetching adverts for contact type ${h}:`,p),[]}},E=async()=>{d.value=!0,g.value=null;try{e.value={};for(const[h,p]of Object.entries(r)){const T=await nt(p);T.length>0&&(e.value[h]=T)}}catch(h){console.error("Error loading adverts:",h),g.value=h instanceof Error?h.message:"Failed to load neighbor data"}finally{d.value=!1}},c=F(),n=h=>{c.value?.highlightNode(h)},l=h=>{c.value?.unhighlightNode(h)},B=async h=>{const p=h;b.value=null,L.value=null,x.value=!0,_.value=p.node_name||"Unknown Node",S.value=!0;try{const N=`0x${parseInt(p.pubkey.substring(0,2),16).toString(16).padStart(2,"0")}`;console.log(`Pinging neighbor ${p.node_name||"Unknown"} (${N})...`);const U=await Et.pingNeighbor(N,10);U.success&&U.data?(b.value=U.data,console.log("Ping successful:",U.data)):(L.value=U.error||"Unknown error occurred",console.error("Failed to ping neighbor:",U.error))}catch(T){console.error("Error pinging neighbor:",T),L.value=T instanceof Error?T.message:"Unknown error occurred"}finally{x.value=!1}},z=()=>{S.value=!1,b.value=null,L.value=null,_.value=null},V=h=>{k.value=h,y.value=!0},G=h=>{I.value=h,P.value=!0},X=()=>{P.value=!1,I.value=null},R=()=>{y.value=!1,k.value=null},H=async h=>{try{await Et.deleteAdvert(h),await E(),R()}catch(p){console.error("Error deleting neighbor:",p)}};return Xt(async()=>{await E()}),(h,p)=>(f(),$("div",an,[d.value?(f(),$("div",ln,p[7]||(p[7]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),t("p",{class:"text-content-secondary dark:text-content-muted"},"Loading neighbor data...")],-1)]))):g.value?(f(),$("div",dn,[t("div",cn,[p[9]||(p[9]=t("svg",{class:"w-5 h-5 text-red-600 dark:text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),t("div",null,[p[8]||(p[8]=t("h3",{class:"text-red-600 dark:text-accent-red font-medium"},"Error Loading Neighbors",-1)),t("p",un,C(g.value),1)])])])):(f(),$(ct,{key:2},[it(qo,{ref_key:"networkMapRef",ref:c,adverts:vt.value,"base-latitude":v.value,"base-longitude":u.value,"show-legend":a.value,"onUpdate:showLegend":p[0]||(p[0]=T=>a.value=T)},null,8,["adverts","base-latitude","base-longitude","show-legend"]),Object.keys(e.value).length>0?(f(),$("div",pn,[t("div",gn,[p[14]||(p[14]=t("span",{class:"text-content-primary dark:text-content-primary text-lg font-semibold"},null,-1)),t("div",mn,[t("div",hn,[t("button",{onClick:p[1]||(p[1]=T=>s.value=!1),class:M(["p-2 rounded-md transition-colors",s.value?"text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10":"bg-primary/20 text-primary border border-primary/30"]),title:"Comfortable view"},p[10]||(p[10]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"6",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"12",width:"18",height:"6",rx:"2",stroke:"currentColor","stroke-width":"2"})],-1)]),2),t("button",{onClick:p[2]||(p[2]=T=>s.value=!0),class:M(["p-2 rounded-md transition-colors",s.value?"bg-primary/20 text-primary border border-primary/30":"text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10"]),title:"Compact view"},p[11]||(p[11]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"10",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"17",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"})],-1)]),2)]),t("div",bn,[t("button",{onClick:p[3]||(p[3]=T=>w.value=!w.value),class:M(["px-3 py-1.5 text-xs rounded-lg transition-colors border",et.value?"bg-primary/20 text-primary border-primary/30":"bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20"])},[p[12]||(p[12]=t("svg",{class:"w-4 h-4 inline mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707v6.586a1 1 0 01-1.447.894l-4-2A1 1 0 717 18.586V13.414a1 1 0 00-.293-.707L.293 6.293A1 1 0 010 5.586V3a1 1 0 011-1z"})],-1)),p[13]||(p[13]=tt(" Filters ",-1)),et.value?(f(),$("span",xn," Active ")):D("",!0)],2),et.value?(f(),$("button",{key:0,onClick:K,class:"px-3 py-1.5 text-xs rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors"}," Clear Filters ")):D("",!0)])])]),wt(t("div",vn,[t("div",yn,[t("div",null,[p[16]||(p[16]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Zero Hop",-1)),wt(t("select",{"onUpdate:modelValue":p[4]||(p[4]=T=>m.value.zeroHop=T),class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none"},p[15]||(p[15]=[t("option",{value:"all"},"All Nodes",-1),t("option",{value:"true"},"Zero Hop Only",-1),t("option",{value:"false"},"Multi-Hop Only",-1)]),512),[[Wt,m.value.zeroHop]])]),t("div",null,[p[18]||(p[18]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Route Type",-1)),wt(t("select",{"onUpdate:modelValue":p[5]||(p[5]=T=>m.value.routeType=T),class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none"},p[17]||(p[17]=[ft('',5)]),512),[[Wt,m.value.routeType]])]),t("div",null,[p[19]||(p[19]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Search",-1)),wt(t("input",{"onUpdate:modelValue":p[6]||(p[6]=T=>m.value.searchText=T),type:"text",placeholder:"Node name or pubkey...",class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none placeholder-gray-400 dark:placeholder-white/40"},null,512),[[le,m.value.searchText]])])])],512),[[ie,w.value]])])):D("",!0),(f(!0),$(ct,null,gt(at.value,([T,N])=>(f(),$("div",{key:T,class:"space-y-6"},[it(sn,{"contact-type":N,"contact-type-key":T,adverts:lt.value[T],"original-count":e.value[T]?.length||0,color:i[parseInt(T)],"base-latitude":v.value,"base-longitude":u.value,"is-compact-view":s.value,"is-first-table":!1,"show-view-toggle":!1,onHighlightNode:n,onUnhighlightNode:l,onMenuPing:B,onMenuDelete:V,onShowDetails:G},null,8,["contact-type","contact-type-key","adverts","original-count","color","base-latitude","base-longitude","is-compact-view"])]))),128)),at.value.length===0&&Object.keys(e.value).length===0?(f(),$("div",kn,[p[20]||(p[20]=ft('

No Neighbors Found

No mesh neighbors have been discovered in your area yet.

',3)),t("button",{onClick:E,class:"mt-4 px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors"}," Refresh ")])):at.value.length===0&&et.value?(f(),$("div",fn,[p[21]||(p[21]=ft('

No neighbors match your filters

Try adjusting your filter criteria to see more results.

',3)),t("button",{onClick:K,class:"px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors"}," Clear Filters ")])):D("",!0)],64)),it(be,{show:y.value,neighbor:Z.value,onClose:R,onDelete:H},null,8,["show","neighbor"]),it(qe,{show:S.value,"node-name":_.value,result:b.value,error:L.value,loading:x.value,onClose:z},null,8,["show","node-name","result","error","loading"]),it(Po,{"is-open":P.value,neighbor:I.value,"base-latitude":v.value,"base-longitude":u.value,onClose:X},null,8,["is-open","neighbor","base-latitude","base-longitude"])]))}});export{Ln as default}; diff --git a/repeater/web/html/assets/Neighbors-Dm-0E9wE.css b/repeater/web/html/assets/Neighbors-Dm-0E9wE.css new file mode 100644 index 0000000..59fe5a8 --- /dev/null +++ b/repeater/web/html/assets/Neighbors-Dm-0E9wE.css @@ -0,0 +1 @@ +.modal-enter-active[data-v-bea9143c],.modal-leave-active[data-v-bea9143c]{transition:opacity .2s ease}.modal-enter-from[data-v-bea9143c],.modal-leave-to[data-v-bea9143c]{opacity:0}.modal-enter-active>div[data-v-bea9143c],.modal-leave-active>div[data-v-bea9143c]{transition:transform .2s ease}.modal-enter-from>div[data-v-bea9143c],.modal-leave-to>div[data-v-bea9143c]{transform:scale(.95)}.packet-enter-active[data-v-bea9143c],.packet-leave-active[data-v-bea9143c]{transition:all .15s ease}.packet-enter-from[data-v-bea9143c],.packet-leave-to[data-v-bea9143c]{opacity:0;transform:translate(-50%) scale(.5)}.custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar{width:8px}.custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar-track{background:transparent}.custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar-thumb{background:#0003;border-radius:4px}.dark .custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar-thumb{background:#fff3}.custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar-thumb:hover{background:#0000004d}.dark .custom-scrollbar[data-v-cbe6bf60]::-webkit-scrollbar-thumb:hover{background:#ffffff4d}.modal-enter-active[data-v-cbe6bf60],.modal-leave-active[data-v-cbe6bf60]{transition:opacity .3s ease}.modal-enter-active>div[data-v-cbe6bf60],.modal-leave-active>div[data-v-cbe6bf60]{transition:transform .3s ease,opacity .3s ease}.modal-enter-from[data-v-cbe6bf60],.modal-leave-to[data-v-cbe6bf60]{opacity:0}.modal-enter-from>div[data-v-cbe6bf60],.modal-leave-to>div[data-v-cbe6bf60]{transform:scale(.95);opacity:0}.leaflet-container{background:transparent}.custom-marker{background:transparent!important;border:none!important}.map-container[data-v-a6a23e33]{position:relative;background:transparent;border-radius:15px;overflow:hidden}.leaflet-map-container[data-v-a6a23e33]{background:linear-gradient(135deg,#09090bcc,#0009);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}.map-legend[data-v-a6a23e33]{position:absolute;top:10px;right:10px;background:#0006;border:1px solid rgba(255,255,255,.1);border-radius:15px;padding:12px;font-size:12px;color:#fff;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);z-index:1000;min-width:150px;max-width:180px;box-shadow:0 8px 32px #0000004d}.legend-title[data-v-a6a23e33]{font-weight:700;margin-bottom:10px;color:#fff;font-size:13px}.legend-section[data-v-a6a23e33]{margin-bottom:10px}.legend-section[data-v-a6a23e33]:last-of-type{margin-bottom:8px}.legend-subtitle[data-v-a6a23e33]{font-weight:600;margin-bottom:6px;color:#fffc;font-size:11px;text-transform:uppercase;letter-spacing:.5px}.legend-footer[data-v-a6a23e33]{margin-top:10px;padding-top:8px;border-top:1px solid rgba(255,255,255,.1);color:#fff9;font-size:10px;text-align:center}.legend-items[data-v-a6a23e33]{display:flex;flex-direction:column;gap:4px}.legend-item[data-v-a6a23e33]{display:flex;align-items:center;gap:6px}.legend-icon[data-v-a6a23e33]{width:8px;height:8px;border-radius:50%;border:1px solid rgba(255,255,255,.8);box-shadow:0 1px 2px #0003;flex-shrink:0}.legend-icon.cluster-icon[data-v-a6a23e33]{width:16px;height:16px;border-radius:50%;border:1px solid #AAE8E8;-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px)}.legend-line[data-v-a6a23e33]{width:16px;height:2px;border-radius:1px;flex-shrink:0;position:relative}.legend-line-dashed[data-v-a6a23e33]{background-image:repeating-linear-gradient(90deg,currentColor 0px,currentColor 4px,transparent 4px,transparent 8px)!important;background-color:transparent!important}.legend-line-dashed[style*="#FFC246"][data-v-a6a23e33]{color:#ffc246!important}.legend-line-dashed[style*="#ea580c"][data-v-a6a23e33]{color:#ea580c!important}.marker-highlight{position:relative!important;z-index:1000!important;animation:marker-glow-a6a23e33 1s ease-in-out infinite!important;border-radius:50%!important;box-shadow:0 0 0 3px #a5e5b6,0 0 8px #a5e5b6,0 0 16px #a5e5b6!important;transform:scale(1.2)!important}@keyframes marker-glow-a6a23e33{0%,to{box-shadow:0 0 0 3px #a5e5b6,0 0 8px #a5e5b6,0 0 16px #a5e5b6;filter:brightness(1)}50%{box-shadow:0 0 0 5px #a5e5b6,0 0 12px #a5e5b6,0 0 24px #a5e5b6;filter:brightness(1.3)}}@keyframes pulse-highlight-a6a23e33{0%{box-shadow:0 0 #3b82f6b3}70%{box-shadow:0 0 0 8px #3b82f600}to{box-shadow:0 0 #3b82f600}}.leaflet-popup-content-wrapper{background:#0006!important;color:#fff!important;border-radius:15px!important;box-shadow:0 8px 32px #0000004d!important;border:1px solid rgba(255,255,255,.1)!important;-webkit-backdrop-filter:blur(20px)!important;backdrop-filter:blur(20px)!important}.leaflet-popup-tip{background:#0006!important;border:1px solid rgba(255,255,255,.1)!important}.leaflet-popup-close-button{color:#fff9!important;font-size:18px!important}.leaflet-popup-close-button:hover{color:#fff!important}.custom-div-icon,.custom-cluster-icon{background:transparent!important;border:none!important}.custom-cluster-icon div{transition:all .3s ease!important;cursor:pointer!important}.custom-cluster-icon:hover div{transform:scale(1.1)!important;box-shadow:0 6px 16px #aae8e880!important}.leaflet-control-zoom{border:1px solid rgba(255,255,255,.1)!important;border-radius:15px!important;overflow:hidden;-webkit-backdrop-filter:blur(20px)!important;backdrop-filter:blur(20px)!important}.leaflet-control-zoom a{background-color:#0006!important;color:#fff!important;border-bottom:1px solid rgba(255,255,255,.1)!important;transition:all .2s ease!important}.leaflet-control-zoom a:hover{background-color:#ffffff1a!important;color:#fff!important}.leaflet-control-attribution{background-color:#1f2937cc!important;color:#9ca3af!important;border-top:1px solid rgba(75,85,99,.3)!important;border-radius:4px!important;padding:4px 8px!important;font-size:11px!important}.leaflet-control-attribution a{color:#60a5fa!important;text-decoration:none}.leaflet-control-attribution a:hover{color:#93c5fd!important;text-decoration:underline}.leaflet-bottom.leaflet-left .leaflet-control-attribution{margin-left:10px!important;margin-bottom:10px!important}.map-attribution[data-v-a6a23e33]{position:absolute;bottom:10px;left:10px;background:#0006;color:#fff9;border:1px solid rgba(255,255,255,.1);border-radius:15px;padding:4px 8px;font-size:10px;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);z-index:1000}@media (max-width: 640px){.leaflet-control-attribution{display:none!important}} diff --git a/repeater/web/html/assets/RoomServers-IKqFauvg.js b/repeater/web/html/assets/RoomServers-IKqFauvg.js new file mode 100644 index 0000000..aab7443 --- /dev/null +++ b/repeater/web/html/assets/RoomServers-IKqFauvg.js @@ -0,0 +1 @@ +import{a as te,b as s,g as c,e,j as f,t as a,s as q,p as n,r as d,D as xe,o as ge,L as y,f as Z,i as G,k,F as N,h as J,w as v,v as b,Y as ee}from"./index-C2DY4pTz.js";import{g as ye,s as ke}from"./preferences-DtwbSSgO.js";import{_ as fe}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js";const he={class:"mb-6"},we={key:0,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},_e={key:1,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ce={key:2,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Me={class:"text-content-secondary dark:text-content-primary/80 text-base leading-relaxed"},je={class:"flex"},Le=te({__name:"MessageDialog",props:{show:{type:Boolean},message:{},variant:{default:"success"}},emits:["close"],setup(W,{emit:B}){const x=W,i=B,M=g=>{g.target===g.currentTarget&&i("close")},j={success:"bg-green-100 dark:bg-green-500/20 border-green-600/40 dark:border-green-500/30 text-green-600 dark:text-green-400",error:"bg-red-100 dark:bg-red-500/20 border-red-500/30 text-red-600 dark:text-red-400",info:"bg-blue-500/20 border-blue-500/30 text-blue-600 dark:text-blue-400"},l={success:"bg-green-500 hover:bg-green-600",error:"bg-red-500 hover:bg-red-600",info:"bg-blue-500 hover:bg-blue-600"};return(g,p)=>x.show?(n(),s("div",{key:0,onClick:M,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:p[1]||(p[1]=q(()=>{},["stop"]))},[e("div",he,[e("div",{class:f(["inline-flex p-3 rounded-xl mb-4",j[x.variant]])},[x.variant==="success"?(n(),s("svg",we,p[2]||(p[2]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):x.variant==="error"?(n(),s("svg",_e,p[3]||(p[3]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(n(),s("svg",Ce,p[4]||(p[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2),e("p",Me,a(x.message),1)]),e("div",je,[e("button",{onClick:p[0]||(p[0]=L=>i("close")),class:f(["flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200",l[x.variant]])}," OK ",2)])])])):c("",!0)}}),$e={class:"p-6 space-y-6"},Se={class:"relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10"},Be={class:"relative flex items-center justify-between"},Ae={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-4"},Ve={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},Re={class:"relative flex items-center justify-between"},ze={class:"text-3xl font-bold text-content-primary dark:text-content-primary mb-1"},De={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},Ee={class:"relative flex items-center justify-between"},Fe={class:"text-3xl font-bold text-primary mb-1"},Ie={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},Ne={class:"relative flex items-center justify-between"},Ue={key:0,class:"w-6 h-6 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},He={key:1,class:"w-6 h-6 text-accent-yellow",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ke={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6"},Oe={key:0,class:"flex items-center justify-center py-12"},Pe={key:1,class:"flex items-center justify-center py-12"},Te={class:"text-center"},Ge={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Je={key:2,class:"space-y-4"},qe={class:"relative flex items-start justify-between"},We={class:"flex-1"},Ye={class:"flex items-center gap-3 mb-4"},Qe={class:"relative"},Xe={key:0,class:"absolute inset-0 bg-accent-green/50 rounded-full animate-ping"},Ze={class:"text-xl font-bold text-content-primary dark:text-content-primary group-hover:text-primary transition-colors"},et={key:0,class:"text-content-muted dark:text-content-muted text-sm"},tt={class:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3"},rt={class:"text-content-primary dark:text-content-primary/90 ml-2"},ot={class:"flex items-center gap-2"},st={key:0,class:"text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs"},nt={key:1,class:"text-content-muted dark:text-content-muted ml-2 text-xs"},at=["onClick"],lt={class:"text-content-primary dark:text-content-primary/90 ml-2"},dt={key:0},it={class:"text-content-primary dark:text-content-primary/90 ml-2"},ut={key:0,class:"text-accent-green"},ct={key:1,class:"text-content-muted dark:text-content-muted"},pt={key:2,class:"text-primary"},mt={key:0,class:"text-xs text-content-muted dark:text-content-muted font-mono"},vt={class:"ml-4 flex flex-wrap gap-2"},bt=["onClick","disabled","title"],xt=["onClick","disabled","title"],gt=["onClick"],yt=["onClick"],kt={key:3,class:"text-center py-12 text-content-secondary dark:text-content-muted"},ft={key:1,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},ht={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},wt={class:"space-y-4"},_t={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},Ct={key:0},Mt={key:1,class:"text-content-secondary dark:text-content-muted text-sm"},jt={class:"grid grid-cols-2 gap-4"},Lt={class:"grid grid-cols-2 gap-4"},$t={key:2,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},St={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},Bt={class:"space-y-4"},At=["value"],Vt={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},Rt={key:0},zt={key:1,class:"text-content-secondary dark:text-content-muted text-sm"},Dt={class:"grid grid-cols-2 gap-4"},Et={class:"grid grid-cols-2 gap-4"},Ft={key:0,class:"fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-50 p-4"},It={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[20px] p-6 max-w-4xl w-full h-[85vh] flex flex-col shadow-2xl"},Nt={class:"relative overflow-hidden rounded-[15px] mb-6 p-5 bg-white/50 dark:bg-white/5 border border-stroke-subtle dark:border-white/10"},Ut={class:"relative flex items-center justify-between"},Ht={class:"flex items-center gap-4"},Kt={class:"text-content-secondary dark:text-content-muted text-sm flex items-center gap-2"},Ot={class:"text-primary font-semibold"},Pt={class:"flex items-center gap-2"},Tt={class:"bg-primary/30 px-1.5 py-0.5 rounded-full text-[10px]"},Gt={class:"flex-1 overflow-y-auto mb-4 space-y-3"},Jt={key:0,class:"flex items-center justify-center py-12"},qt={key:1,class:"flex items-center justify-center py-12"},Wt={class:"text-center"},Yt={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Qt={key:2,class:"space-y-3"},Xt={class:"relative flex items-start justify-between gap-3"},Zt={class:"flex-1 min-w-0"},er={class:"flex items-center gap-2 mb-3"},tr={class:"flex items-center gap-2 flex-wrap"},rr={key:0,class:"text-primary text-sm font-bold"},or={key:1,class:"text-primary/80 text-xs font-mono bg-primary/10 px-2 py-1 rounded-md border border-primary/20"},sr={key:2,class:"text-content-muted dark:text-content-muted text-xs"},nr={class:"text-content-secondary dark:text-content-muted text-xs flex items-center gap-1"},ar={key:3,class:"text-content-muted dark:text-content-muted/50 text-[10px] font-mono bg-background-mute dark:bg-white/5 px-1.5 py-0.5 rounded"},lr={class:"text-content-primary dark:text-content-primary/90 text-sm leading-relaxed break-words whitespace-pre-wrap bg-gray-50 dark:bg-white/5 p-3 rounded-[10px] border border-stroke-subtle dark:border-white/5"},dr=["onClick"],ir={key:0,class:"text-center pt-4"},ur={key:1,class:"text-center pt-4"},cr={key:3,class:"flex items-center justify-center h-full"},pr={class:"relative overflow-hidden rounded-[15px] border-t border-stroke-subtle dark:border-white/20 pt-4 mt-4"},mr={class:"relative space-y-3"},vr={class:"flex gap-3"},br={class:"flex-1 relative"},xr=["onKeydown"],gr=["disabled"],yr={key:1,class:"fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-[60] p-4"},kr={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-3xl w-full max-h-[80vh] flex flex-col"},fr={class:"flex items-center justify-between mb-4 pb-4 border-b border-stroke-subtle dark:border-white/10"},hr={class:"text-content-secondary dark:text-content-primary/70 text-sm mt-1"},wr={class:"text-primary"},_r={class:"flex-1 overflow-y-auto space-y-3"},Cr={key:0,class:"text-center py-12"},Mr={class:"space-y-2"},jr={class:"flex items-center justify-between"},Lr={class:"flex items-center gap-2"},$r={class:"text-content-primary dark:text-content-primary font-semibold"},Sr={class:"flex items-center gap-2"},Br={class:"text-content-secondary dark:text-content-muted text-xs"},Ar=["onClick"],Vr={class:"space-y-1 text-xs"},Rr={class:"flex items-center gap-2"},zr={class:"text-primary font-mono bg-primary/10 px-2 py-0.5 rounded"},Dr={class:"flex items-center gap-2"},Er={class:"text-primary font-mono bg-primary/10 px-2 py-0.5 rounded text-[10px] break-all"},Fr={class:"flex items-center justify-between text-xs text-content-secondary dark:text-content-muted"},Ir={class:"flex items-center gap-4"},Nr={key:0},Ur={key:1},Hr={key:0},Tr=te({name:"RoomServersView",__name:"RoomServers",setup(W){const B=d(!1),x=d(null),i=d(null),M=d(!1),j=d(!1),l=d(null),g=d(!1),p=d(!1),L=d(new Set),z=d(!1),D=d(""),U=d(!1),H=d({message:"",variant:"success"}),K=d(!1),h=d(""),E=d(""),w=d([]),A=d(!1),$=d(null),_=d(""),F=d(ye("roomServers_messagesLimit",50)),I=d(0),O=d(!0);xe(F,o=>ke("roomServers_messagesLimit",o));const S=d([]),P=d(!1),m=d({name:"",identity_key:"",type:"room_server",settings:{node_name:"",latitude:0,longitude:0,admin_password:"",guest_password:""}});ge(async()=>{await V()});async function V(){B.value=!0,x.value=null;try{const o=await y.getIdentities();o.success?i.value=o.data:x.value=o.error||"Failed to load identities"}catch(o){x.value=o instanceof Error?o.message:"Failed to load identities"}finally{B.value=!1}}async function re(){try{const o=await y.createIdentity(m.value);o.success?(M.value=!1,Y(),await V(),u(o.message||"Identity created successfully!","success")):u(`Failed to create identity: ${o.error}`,"error")}catch(o){u(`Error creating identity: ${o}`,"error")}}async function oe(){try{const o=await y.updateIdentity(l.value);o.success?(j.value=!1,l.value=null,await V(),u(o.message||"Identity updated successfully!","success")):u(`Failed to update identity: ${o.error}`,"error")}catch(o){u(`Error updating identity: ${o}`,"error")}}function se(o){D.value=o,z.value=!0}async function ne(){const o=D.value;z.value=!1;try{const t=await y.deleteIdentity(o);t.success?(await V(),u(t.message||"Identity deleted successfully!","success")):u(`Failed to delete identity: ${t.error}`,"error")}catch(t){u(`Error deleting identity: ${t}`,"error")}finally{D.value=""}}function u(o,t){H.value={message:o,variant:t},U.value=!0}async function ae(o){try{const t=await y.sendRoomServerAdvert(o);t.success?u(t.message||`Advert sent for '${o}'!`,"success"):u(`Failed to send advert: ${t.error}`,"error")}catch(t){u(`Error sending advert: ${t}`,"error")}}function le(o){l.value=JSON.parse(JSON.stringify(o)),l.value.settings||(l.value.settings={}),l.value.settings.admin_password||(l.value.settings.admin_password=""),l.value.settings.guest_password||(l.value.settings.guest_password=""),p.value=!1,j.value=!0}function Y(){m.value={name:"",identity_key:"",type:"room_server",settings:{node_name:"",latitude:0,longitude:0,admin_password:"",guest_password:""}},g.value=!1}function Q(){M.value=!1,j.value=!1,l.value=null,g.value=!1,p.value=!1,Y()}function de(o){L.value.has(o)?L.value.delete(o):L.value.add(o)}async function ie(o){h.value=o,K.value=!0,I.value=0,O.value=!0;const t=i.value?.configured.find(r=>r.name===o);E.value=t?.hash||"",await X(),await R(!0)}async function X(){try{console.log("Fetching ACL clients for room:",h.value,"hash:",E.value);const o=await y.getACLClients({identity_hash:E.value,identity_name:h.value});console.log("ACL clients response:",o),o.success&&o.data&&(S.value=o.data.clients||[],console.log("ACL clients loaded:",S.value.length))}catch(o){console.error("Failed to fetch ACL clients:",o)}}async function R(o=!1){o&&(I.value=0,w.value=[]),A.value=!0,$.value=null;try{const t=await y.getRoomMessages({room_name:h.value,limit:F.value,offset:I.value});if(t.success&&t.data){const r=t.data.messages||[];o?w.value=r:w.value=[...w.value,...r],O.value=r.length===F.value}else $.value=t.error||"Failed to load messages"}catch(t){$.value=t instanceof Error?t.message:"Failed to load messages"}finally{A.value=!1}}async function ue(){I.value+=F.value,await R(!1)}async function T(){if(_.value.trim())try{const o=await y.postRoomMessage({room_name:h.value,message:_.value,author_pubkey:"server"});o.success?(_.value="",await R(!0)):u(`Failed to send message: ${o.error}`,"error")}catch(o){u(`Error sending message: ${o}`,"error")}}async function ce(o){if(confirm("Are you sure you want to delete this message?"))try{const t=await y.deleteRoomMessage({room_name:h.value,message_id:o});t.success?(await R(!0),u("Message deleted successfully","success")):u(`Failed to delete message: ${t.error}`,"error")}catch(t){u(`Error deleting message: ${t}`,"error")}}function pe(){K.value=!1,h.value="",E.value="",w.value=[],_.value="",$.value=null,S.value=[]}function me(o){return o?new Date(o*1e3).toLocaleString():"Unknown"}async function ve(o,t){if(confirm("Are you sure you want to remove this client from the ACL?"))try{const r=await y.removeACLClient({public_key:o,identity_hash:t});r.success?(await X(),u("Client removed successfully","success")):u(`Failed to remove client: ${r.error}`,"error")}catch(r){u(`Error removing client: ${r}`,"error")}}return(o,t)=>(n(),s(N,null,[e("div",$e,[e("div",Se,[t[26]||(t[26]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50"},null,-1)),t[27]||(t[27]=e("div",{class:"absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse"},null,-1)),e("div",Be,[t[25]||(t[25]=G('

Room Servers

Manage room server identities and messages

',1)),e("button",{onClick:t[0]||(t[0]=r=>M.value=!0),class:"group relative px-6 py-3 bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary rounded-[12px] border border-primary/50 transition-all hover:scale-105 hover:shadow-lg hover:shadow-primary/20"},t[24]||(t[24]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),k(" Add Room Server ")],-1)]))])]),i.value&&i.value.total_configured>0?(n(),s("div",Ae,[e("div",Ve,[t[30]||(t[30]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Re,[e("div",null,[t[28]||(t[28]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Total Configured",-1)),e("div",ze,a(i.value.total_configured),1)]),t[29]||(t[29]=e("div",{class:"bg-background-mute dark:bg-white/10 p-3 rounded-[12px] group-hover:bg-background-mute dark:group-hover:bg-stroke/20 transition-colors"},[e("svg",{class:"w-6 h-6 text-content-secondary dark:text-content-primary/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1))])]),e("div",De,[t[33]||(t[33]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Ee,[e("div",null,[t[31]||(t[31]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Currently Registered",-1)),e("div",Fe,a(i.value.total_registered),1)]),t[32]||(t[32]=e("div",{class:"bg-primary/20 p-3 rounded-[12px] group-hover:bg-primary/30 transition-colors"},[e("svg",{class:"w-6 h-6 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})])],-1))])]),e("div",Ie,[t[37]||(t[37]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-accent-green/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Ne,[e("div",null,[t[34]||(t[34]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Status",-1)),e("div",{class:f(["text-3xl font-bold",i.value.total_registered===i.value.total_configured?"text-accent-green":"text-accent-yellow"])},a(i.value.total_registered===i.value.total_configured?"Synced":"Out of Sync"),3)]),e("div",{class:f(["p-3 rounded-[12px] transition-colors",i.value.total_registered===i.value.total_configured?"bg-accent-green/20 group-hover:bg-accent-green/30":"bg-accent-yellow/20 group-hover:bg-accent-yellow/30"])},[i.value.total_registered===i.value.total_configured?(n(),s("svg",Ue,t[35]||(t[35]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):(n(),s("svg",He,t[36]||(t[36]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2)])])])):c("",!0),e("div",Ke,[B.value?(n(),s("div",Oe,t[38]||(t[38]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-primary/70"},"Loading room servers...")],-1)]))):x.value?(n(),s("div",Pe,[e("div",Te,[t[39]||(t[39]=e("div",{class:"text-red-600 dark:text-red-400 mb-2"},"Failed to load room servers",-1)),e("div",Ge,a(x.value),1),e("button",{onClick:V,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Retry ")])])):i.value&&i.value.configured.length>0?(n(),s("div",Je,[(n(!0),s(N,null,J(i.value.configured,r=>(n(),s("div",{key:r.name,class:"group relative overflow-hidden glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10 hover:border-primary/30 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300"},[t[46]||(t[46]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-primary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",qe,[e("div",We,[e("div",Ye,[e("div",Qe,[r.registered?(n(),s("div",Xe)):c("",!0),e("div",{class:f(["relative w-3 h-3 rounded-full",r.registered?"bg-accent-green":"bg-accent-red"])},null,2)]),e("h3",Ze,a(r.name),1),e("span",{class:f(["px-3 py-1 text-xs font-semibold rounded-full",r.registered?"bg-accent-green/20 text-accent-green border border-accent-green/30":"bg-accent-red/20 text-accent-red border border-accent-red/30"])},a(r.registered?"● Active":"○ Inactive"),3),r.hash?(n(),s("span",et,a(r.hash),1)):c("",!0)]),e("div",tt,[e("div",null,[t[40]||(t[40]=e("span",{class:"text-content-muted dark:text-content-muted"},"Node Name:",-1)),e("span",rt,a(r.settings?.node_name||"Not set"),1)]),e("div",ot,[t[41]||(t[41]=e("span",{class:"text-content-muted dark:text-content-muted"},"Identity Key:",-1)),L.value.has(r.name)?(n(),s("span",st,a(r.identity_key),1)):(n(),s("span",nt," •••••••••••••••• ")),e("button",{onClick:C=>de(r.name),class:"text-primary/70 hover:text-primary text-xs underline"},a(L.value.has(r.name)?"Hide":"Show"),9,at)]),e("div",null,[t[42]||(t[42]=e("span",{class:"text-content-muted dark:text-content-muted"},"Location:",-1)),e("span",lt,a(r.settings?.latitude||0)+", "+a(r.settings?.longitude||0),1)]),r.settings?.admin_password||r.settings?.guest_password?(n(),s("div",dt,[t[43]||(t[43]=e("span",{class:"text-content-muted dark:text-content-muted"},"Passwords:",-1)),e("span",it,[r.settings?.admin_password?(n(),s("span",ut,"Admin")):c("",!0),r.settings?.admin_password&&r.settings?.guest_password?(n(),s("span",ct," / ")):c("",!0),r.settings?.guest_password?(n(),s("span",pt,"Guest")):c("",!0)])])):c("",!0)]),r.address?(n(),s("div",mt," Address: "+a(r.address),1)):c("",!0)]),e("div",vt,[e("button",{onClick:C=>ie(r.name),disabled:!r.registered,class:f(["group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2",r.registered?"bg-secondary/20 hover:bg-secondary/30 text-secondary border border-secondary/30 hover:scale-105 hover:shadow-lg hover:shadow-secondary/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"]),title:r.registered?"Manage messages for this room":"Room server must be active to manage messages"},t[44]||(t[44]=[e("svg",{class:"w-4 h-4 group-hover:rotate-12 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})],-1),k(" Messages ",-1)]),10,bt),e("button",{onClick:C=>ae(r.name),disabled:!r.registered,class:f(["group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2",r.registered?"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/30 hover:scale-105 hover:shadow-lg hover:shadow-accent-green/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"]),title:r.registered?"Send advert for this room server":"Room server must be active to send advert"},t[45]||(t[45]=[e("svg",{class:"w-4 h-4 group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1),k(" Send Advert ",-1)]),10,xt),e("button",{onClick:C=>le(r),class:"px-3 py-1 bg-primary/20 hover:bg-primary/30 text-primary rounded text-xs transition-colors"}," Edit ",8,gt),e("button",{onClick:C=>se(r.name),class:"px-3 py-1 bg-accent-red/20 hover:bg-accent-red/30 text-accent-red rounded text-xs transition-colors"}," Delete ",8,yt)])])]))),128))])):(n(),s("div",kt,[t[47]||(t[47]=e("svg",{class:"w-16 h-16 mx-auto mb-4 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})],-1)),t[48]||(t[48]=e("p",{class:"text-lg mb-2"},"No room servers configured",-1)),t[49]||(t[49]=e("p",{class:"text-sm mb-4"},"Add your first room server to get started",-1)),e("button",{onClick:t[1]||(t[1]=r=>M.value=!0),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," + Add Room Server ")]))]),M.value?(n(),s("div",ft,[e("div",ht,[t[60]||(t[60]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Add Room Server",-1)),e("div",wt,[e("div",null,[t[50]||(t[50]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Name *",-1)),v(e("input",{"onUpdate:modelValue":t[2]||(t[2]=r=>m.value.name=r),type:"text",placeholder:"e.g., MainBBS",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.name]])]),e("div",null,[e("label",_t,[t[51]||(t[51]=k(" Identity Key (Optional) ",-1)),e("button",{onClick:t[3]||(t[3]=r=>g.value=!g.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},a(g.value?"Hide":"Show/Edit"),1)]),g.value?(n(),s("div",Ct,[v(e("input",{"onUpdate:modelValue":t[4]||(t[4]=r=>m.value.identity_key=r),type:"text",placeholder:"Leave empty to auto-generate",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.identity_key]]),t[52]||(t[52]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Leave empty to automatically generate a secure key",-1))])):(n(),s("div",Mt," Will be auto-generated if not provided "))]),e("div",null,[t[53]||(t[53]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),v(e("input",{"onUpdate:modelValue":t[5]||(t[5]=r=>m.value.settings.node_name=r),type:"text",placeholder:"Display name for the room server",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.settings.node_name]])]),e("div",jt,[e("div",null,[t[54]||(t[54]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Latitude",-1)),v(e("input",{"onUpdate:modelValue":t[6]||(t[6]=r=>m.value.settings.latitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.settings.latitude,void 0,{number:!0}]])]),e("div",null,[t[55]||(t[55]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Longitude",-1)),v(e("input",{"onUpdate:modelValue":t[7]||(t[7]=r=>m.value.settings.longitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.settings.longitude,void 0,{number:!0}]])])]),e("div",Lt,[e("div",null,[t[56]||(t[56]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Admin Password (Optional)",-1)),v(e("input",{"onUpdate:modelValue":t[8]||(t[8]=r=>m.value.settings.admin_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.settings.admin_password]]),t[57]||(t[57]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Full access to room server",-1))]),e("div",null,[t[58]||(t[58]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Guest Password (Optional)",-1)),v(e("input",{"onUpdate:modelValue":t[9]||(t[9]=r=>m.value.settings.guest_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,m.value.settings.guest_password]]),t[59]||(t[59]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Read-only access",-1))])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:Q,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:re,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Create ")])])])):c("",!0),j.value&&l.value?(n(),s("div",$t,[e("div",St,[t[72]||(t[72]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Edit Room Server",-1)),e("div",Bt,[e("div",null,[t[61]||(t[61]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Current Name",-1)),e("input",{value:l.value.name,disabled:"",type:"text",class:"w-full bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-muted dark:text-content-muted cursor-not-allowed"},null,8,At)]),e("div",null,[t[62]||(t[62]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"New Name (optional)",-1)),v(e("input",{"onUpdate:modelValue":t[10]||(t[10]=r=>l.value.new_name=r),type:"text",placeholder:"Leave empty to keep current name",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.new_name]])]),e("div",null,[e("label",Vt,[t[63]||(t[63]=k(" Identity Key (Optional) ",-1)),e("button",{onClick:t[11]||(t[11]=r=>p.value=!p.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},a(p.value?"Hide":"Show/Edit"),1)]),p.value?(n(),s("div",Rt,[v(e("input",{"onUpdate:modelValue":t[12]||(t[12]=r=>l.value.identity_key=r),type:"text",placeholder:"Leave empty to keep current key",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.identity_key]]),t[64]||(t[64]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Leave empty to keep the current identity key",-1))])):(n(),s("div",zt,' Click "Show/Edit" to change the identity key '))]),e("div",null,[t[65]||(t[65]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),v(e("input",{"onUpdate:modelValue":t[13]||(t[13]=r=>l.value.settings.node_name=r),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.settings.node_name]])]),e("div",Dt,[e("div",null,[t[66]||(t[66]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Latitude",-1)),v(e("input",{"onUpdate:modelValue":t[14]||(t[14]=r=>l.value.settings.latitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.settings.latitude,void 0,{number:!0}]])]),e("div",null,[t[67]||(t[67]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Longitude",-1)),v(e("input",{"onUpdate:modelValue":t[15]||(t[15]=r=>l.value.settings.longitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.settings.longitude,void 0,{number:!0}]])])]),e("div",Et,[e("div",null,[t[68]||(t[68]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Admin Password",-1)),v(e("input",{"onUpdate:modelValue":t[16]||(t[16]=r=>l.value.settings.admin_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.settings.admin_password]]),t[69]||(t[69]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Full access to room server",-1))]),e("div",null,[t[70]||(t[70]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Guest Password",-1)),v(e("input",{"onUpdate:modelValue":t[17]||(t[17]=r=>l.value.settings.guest_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[b,l.value.settings.guest_password]]),t[71]||(t[71]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Read-only access",-1))])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:Q,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:oe,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Update ")])])])):c("",!0)]),Z(fe,{show:z.value,title:"Delete Room Server",message:`Are you sure you want to delete '${D.value}'? This action cannot be undone.`,"confirm-text":"Delete","cancel-text":"Cancel",variant:"danger",onClose:t[18]||(t[18]=r=>z.value=!1),onConfirm:ne},null,8,["show","message"]),Z(Le,{show:U.value,message:H.value.message,variant:H.value.variant,onClose:t[19]||(t[19]=r=>U.value=!1)},null,8,["show","message","variant"]),K.value?(n(),s("div",Ft,[e("div",It,[e("div",Nt,[t[79]||(t[79]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-secondary/20 via-primary/20 to-accent-purple/20"},null,-1)),t[80]||(t[80]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-transparent"},null,-1)),e("div",Ut,[e("div",Ht,[t[75]||(t[75]=G('
',1)),e("div",null,[t[74]||(t[74]=e("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},"Room Messages",-1)),e("p",Kt,[t[73]||(t[73]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})],-1)),e("span",Ot,a(h.value),1)])])]),e("div",Pt,[e("button",{onClick:t[20]||(t[20]=r=>P.value=!0),class:"group px-3 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-[10px] text-xs font-medium transition-all hover:scale-105 border border-primary/30 flex items-center gap-2",title:"View active sessions"},[t[76]||(t[76]=e("svg",{class:"w-4 h-4 group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"})],-1)),t[77]||(t[77]=e("span",{class:"hidden sm:inline"},"Sessions",-1)),e("span",Tt,a(S.value.length),1)]),e("button",{onClick:pe,class:"p-2 text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-[10px] transition-all"},t[78]||(t[78]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])])]),e("div",Gt,[A.value&&w.value.length===0?(n(),s("div",Jt,t[81]||(t[81]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-primary/70"},"Loading messages...")],-1)]))):$.value?(n(),s("div",qt,[e("div",Wt,[t[82]||(t[82]=e("div",{class:"text-red-600 dark:text-red-400 mb-2"},"Failed to load messages",-1)),e("div",Yt,a($.value),1),e("button",{onClick:t[21]||(t[21]=r=>R(!0)),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Retry ")])])):w.value.length>0?(n(),s("div",Qt,[(n(!0),s(N,null,J(w.value,(r,C)=>(n(),s("div",{key:r.id||C,class:"group relative overflow-hidden glass-card backdrop-blur-xl rounded-[12px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-secondary/30 transition-all duration-300 hover:shadow-lg hover:shadow-secondary/10"},[t[87]||(t[87]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-secondary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Xt,[e("div",Zt,[e("div",er,[e("div",tr,[t[84]||(t[84]=e("div",{class:"w-6 h-6 rounded-full bg-gradient-to-br from-primary/30 to-secondary/30 flex items-center justify-center"},[e("svg",{class:"w-3 h-3 text-content-secondary dark:text-content-primary/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})])],-1)),r.author_name?(n(),s("span",rr,a(r.author_name),1)):c("",!0),r.author_pubkey?(n(),s("span",or,a(r.author_pubkey.substring(0,8))+"... ",1)):(n(),s("span",sr," Anonymous ")),t[85]||(t[85]=e("span",{class:"text-content-muted dark:text-content-muted/60 text-xs"},"•",-1)),e("span",nr,[t[83]||(t[83]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),k(" "+a(me(r.timestamp)),1)]),r.id?(n(),s("span",ar," #"+a(r.id),1)):c("",!0)])]),e("div",lr,a(r.message_text),1)]),e("button",{onClick:be=>ce(r.id),class:"group/delete flex-shrink-0 p-2 bg-accent-red/10 hover:bg-accent-red/20 text-accent-red rounded-[8px] transition-all hover:scale-110 border border-accent-red/20",title:"Delete this message"},t[86]||(t[86]=[e("svg",{class:"w-4 h-4 group-hover/delete:rotate-12 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)]),8,dr)])]))),128)),O.value&&!A.value?(n(),s("div",ir,[e("button",{onClick:ue,class:"group px-6 py-2.5 bg-gradient-to-r from-gray-100 dark:from-white/5 to-gray-200 dark:to-white/10 hover:from-gray-200 dark:hover:from-white/10 hover:to-gray-300 dark:hover:to-white/15 text-content-primary dark:text-content-primary rounded-[10px] transition-all hover:scale-105 text-sm font-medium border border-stroke-subtle dark:border-stroke/10 flex items-center gap-2 mx-auto"},t[88]||(t[88]=[e("svg",{class:"w-4 h-4 group-hover:translate-y-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})],-1),k(" Load More Messages ",-1)]))])):A.value?(n(),s("div",ur,t[89]||(t[89]=[e("div",{class:"flex items-center justify-center gap-2 text-content-secondary dark:text-content-muted text-sm"},[e("div",{class:"animate-spin w-4 h-4 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full"}),k(" Loading... ")],-1)]))):c("",!0)])):(n(),s("div",cr,t[90]||(t[90]=[G('

No messages yet

Be the first to start the conversation

',1)])))]),e("div",pr,[t[93]||(t[93]=e("div",{class:"absolute inset-0 bg-gradient-to-t from-primary/5 to-transparent pointer-events-none"},null,-1)),e("div",mr,[e("div",vr,[e("div",br,[v(e("textarea",{"onUpdate:modelValue":t[22]||(t[22]=r=>_.value=r),onKeydown:[ee(q(T,["ctrl"]),["enter"]),ee(q(T,["meta"]),["enter"])],placeholder:"Type your message... (Ctrl+Enter to send)",rows:"3",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-3 text-content-primary dark:text-content-primary text-sm placeholder-gray-500 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 focus:bg-white dark:focus:bg-white/10 transition-all resize-none"},null,40,xr),[[b,_.value]])]),e("button",{onClick:T,disabled:!_.value.trim(),class:f(["group px-6 py-3 rounded-[12px] transition-all duration-200 flex items-center justify-center gap-2 font-medium",_.value.trim()?"bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary border border-primary/50 hover:scale-105 hover:shadow-lg hover:shadow-primary/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"])},t[91]||(t[91]=[e("svg",{class:"w-5 h-5 group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})],-1),e("span",{class:"hidden sm:inline"},"Send",-1)]),10,gr)]),t[92]||(t[92]=e("p",{class:"text-content-secondary dark:text-content-muted/60 text-xs flex items-center gap-2"},[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),k(" Press Ctrl+Enter to send message quickly ")],-1))])])])])):c("",!0),P.value?(n(),s("div",yr,[e("div",kr,[e("div",fr,[e("div",null,[t[95]||(t[95]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Active Sessions",-1)),e("p",hr,[t[94]||(t[94]=k("Room: ",-1)),e("span",wr,a(h.value),1)])]),e("button",{onClick:t[23]||(t[23]=r=>P.value=!1),class:"text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[96]||(t[96]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",_r,[S.value.length===0?(n(),s("div",Cr,t[97]||(t[97]=[e("div",{class:"text-content-secondary dark:text-content-muted"},"No active sessions found",-1)]))):c("",!0),(n(!0),s(N,null,J(S.value,(r,C)=>(n(),s("div",{key:r.public_key_full||C,class:"glass-card backdrop-blur-xl rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10"},[e("div",Mr,[e("div",jr,[e("div",Lr,[e("span",$r,a(r.identity_name||"Unknown"),1),e("span",{class:f(["px-2 py-0.5 text-xs font-medium rounded",r.permissions==="admin"?"bg-accent-green/20 text-accent-green":"bg-secondary/20 text-secondary"])},a(r.permissions),3)]),e("div",Sr,[e("span",Br,a(r.identity_type),1),e("button",{onClick:be=>ve(r.public_key_full,r.identity_hash),class:"px-2 py-1 bg-accent-red/20 hover:bg-accent-red/30 text-accent-red rounded text-xs transition-colors",title:"Remove client from ACL"}," Remove ",8,Ar)])]),e("div",Vr,[e("div",Rr,[t[98]||(t[98]=e("span",{class:"text-content-secondary dark:text-content-muted"},"Short Key:",-1)),e("code",zr,a(r.public_key),1)]),e("div",Dr,[t[99]||(t[99]=e("span",{class:"text-content-secondary dark:text-content-muted"},"Full Key:",-1)),e("code",Er,a(r.public_key_full),1)])]),e("div",Fr,[e("div",Ir,[r.address?(n(),s("span",Nr,"📍 "+a(r.address),1)):c("",!0),r.last_login_success?(n(),s("span",Ur,"Last Login: "+a(new Date(r.last_login_success*1e3).toLocaleString()),1)):c("",!0)]),r.last_activity?(n(),s("span",Hr,"Active: "+a(Math.floor((Date.now()/1e3-r.last_activity)/60))+"m ago",1)):c("",!0)])])]))),128))])])])):c("",!0)],64))}});export{Tr as default}; diff --git a/repeater/web/html/assets/Sessions-BycQoG5Z.js b/repeater/web/html/assets/Sessions-BycQoG5Z.js new file mode 100644 index 0000000..8d7030d --- /dev/null +++ b/repeater/web/html/assets/Sessions-BycQoG5Z.js @@ -0,0 +1 @@ +import{a as I,r as d,o as N,L as b,c as S,b as o,e as t,g as f,t as n,F as m,h as y,w as R,q as V,j as i,k as B,p as r}from"./index-C2DY4pTz.js";const z={class:"p-6 space-y-6"},D={key:0,class:"grid grid-cols-1 md:grid-cols-4 gap-4"},F={class:"glass-card rounded-[15px] p-4"},T={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},$={class:"glass-card rounded-[15px] p-4"},E={class:"text-2xl font-bold text-cyan-500 dark:text-primary"},H={class:"glass-card rounded-[15px] p-4"},P={class:"text-2xl font-bold text-green-700 dark:text-green-500 dark:text-accent-green"},G={class:"glass-card rounded-[15px] p-4"},O={class:"text-2xl font-bold text-yellow-500 dark:text-secondary"},q={class:"glass-card rounded-[15px] p-6"},U={class:"flex flex-wrap border-b border-stroke-subtle dark:border-stroke/10 mb-6"},J=["onClick"],K={class:"flex items-center gap-2"},Q={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},W={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},X={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Y={class:"min-h-[400px]"},Z={key:0,class:"flex items-center justify-center py-12"},tt={key:1,class:"flex items-center justify-center py-12"},et={class:"text-center"},st={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},nt={key:2,class:"space-y-4"},ot={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},rt={key:1,class:"space-y-4"},at={class:"flex items-start justify-between"},dt={class:"flex-1"},it={class:"flex items-center gap-3 mb-2"},lt={class:"text-lg font-semibold text-content-primary dark:text-content-primary"},ct={class:"text-content-muted dark:text-content-muted text-sm"},xt={class:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4"},ut={class:"text-content-primary dark:text-content-primary font-medium"},mt={class:"text-cyan-500 dark:text-primary font-medium"},yt={class:"mt-3 flex items-center gap-2"},vt={key:3,class:"space-y-4"},kt={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},pt={key:1,class:"overflow-x-auto"},bt={class:"w-full"},_t={class:"py-3"},gt={class:"font-mono text-sm text-content-primary dark:text-content-primary"},ht={class:"py-3"},ft={class:"font-mono text-xs text-content-secondary dark:text-content-muted"},wt={class:"py-3"},Ct={class:"text-sm text-content-primary dark:text-content-primary"},At={class:"text-xs text-content-muted dark:text-content-muted"},Lt={class:"py-3"},St={class:"py-3"},Mt={class:"text-sm text-content-secondary dark:text-content-muted"},jt={class:"py-3"},It=["onClick"],Nt={key:4,class:"space-y-4"},Rt={class:"mb-4"},Vt=["value"],Bt={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},zt={key:1,class:"grid grid-cols-1 gap-4"},Dt={class:"flex items-start justify-between"},Ft={class:"flex-1"},Tt={class:"flex items-center gap-3 mb-3"},$t={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Et={class:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm"},Ht={class:"text-content-primary dark:text-content-primary/90 font-mono ml-2"},Pt={class:"text-content-primary dark:text-content-primary/90 ml-2"},Gt={class:"text-content-primary dark:text-content-primary/90 ml-2"},Ot={class:"text-content-primary dark:text-content-primary/90 ml-2"},qt=["onClick"],Ut={class:"flex justify-end"},Jt=["disabled"],Wt=I({name:"SessionsView",__name:"Sessions",setup(Kt){const c=d("overview"),w=d(!1),x=d(!1),v=d(null),_=d(null),u=d([]),l=d(null),k=d(null),M=[{id:"overview",label:"Overview",icon:"overview"},{id:"clients",label:"Authenticated Clients",icon:"clients"},{id:"identities",label:"By Identity",icon:"identities"}];N(async()=>{await p(),w.value=!0});async function p(){x.value=!0,v.value=null;try{const a=await b.getACLInfo();a.success&&(_.value=a.data);const s=await b.getACLClients();s.success&&s.data&&(u.value=s.data.clients||[]);const e=await b.getACLStats();e.success&&(l.value=e.data)}catch(a){v.value=a instanceof Error?a.message:"Failed to load ACL data",console.error("Error fetching ACL data:",a)}finally{x.value=!1}}async function C(a,s){if(confirm("Are you sure you want to remove this client from the ACL?"))try{const e=await b.removeACLClient({public_key:a,identity_hash:s});e.success?await p():alert(`Failed to remove client: ${e.error}`)}catch(e){alert(`Error removing client: ${e}`)}}function g(a){return a?new Date(a*1e3).toLocaleString():"Never"}function j(a){c.value=a}const A=S(()=>k.value?u.value.filter(a=>a.identity_name===k.value):u.value),h=S(()=>_.value?_.value.acls||[]:[]);return(a,s)=>(r(),o("div",z,[s[22]||(s[22]=t("div",null,[t("h1",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"Sessions & Access Control"),t("p",{class:"text-content-secondary dark:text-content-muted mt-2"},"Manage authenticated clients and access control lists")],-1)),l.value?(r(),o("div",D,[t("div",F,[s[1]||(s[1]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Total Identities",-1)),t("div",T,n(l.value.total_identities),1)]),t("div",$,[s[2]||(s[2]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Authenticated Clients",-1)),t("div",E,n(l.value.total_clients),1)]),t("div",H,[s[3]||(s[3]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Admin Clients",-1)),t("div",P,n(l.value.admin_clients),1)]),t("div",G,[s[4]||(s[4]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Guest Clients",-1)),t("div",O,n(l.value.guest_clients),1)])])):f("",!0),t("div",q,[t("div",U,[(r(),o(m,null,y(M,e=>t("button",{key:e.id,onClick:L=>j(e.id),class:i(["px-4 py-2 text-sm font-medium transition-colors duration-200 border-b-2 mr-6 mb-2",c.value===e.id?"text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary":"text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30"])},[t("div",K,[e.icon==="overview"?(r(),o("svg",Q,s[5]||(s[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"},null,-1)]))):e.icon==="clients"?(r(),o("svg",W,s[6]||(s[6]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):e.icon==="identities"?(r(),o("svg",X,s[7]||(s[7]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2"},null,-1)]))):f("",!0),B(" "+n(e.label),1)])],10,J)),64))]),t("div",Y,[x.value&&!w.value?(r(),o("div",Z,s[8]||(s[8]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4"}),t("div",{class:"text-content-secondary dark:text-content-muted"},"Loading ACL data...")],-1)]))):v.value?(r(),o("div",tt,[t("div",et,[s[9]||(s[9]=t("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load ACL data",-1)),t("div",st,n(v.value),1),t("button",{onClick:p,class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors"}," Retry ")])])):c.value==="overview"?(r(),o("div",nt,[h.value.length===0?(r(),o("div",ot," No identities configured ")):(r(),o("div",rt,[(r(!0),o(m,null,y(h.value,e=>(r(),o("div",{key:e.hash,class:"glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-cyan-400 dark:hover:border-primary/30 transition-colors"},[t("div",at,[t("div",dt,[t("div",it,[t("h3",lt,n(e.name),1),t("span",{class:i(["px-2 py-1 text-xs font-medium rounded",e.type==="repeater"?"bg-cyan-500/20 dark:bg-primary/20 text-cyan-700 dark:text-primary":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"])},n(e.type),3),t("span",ct,n(e.hash),1)]),t("div",xt,[t("div",null,[s[10]||(s[10]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Max Clients",-1)),t("div",ut,n(e.max_clients),1)]),t("div",null,[s[11]||(s[11]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Authenticated",-1)),t("div",mt,n(e.authenticated_clients),1)]),t("div",null,[s[12]||(s[12]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Admin Password",-1)),t("div",{class:i(e.has_admin_password?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.has_admin_password?"✓ Set":"✗ Not Set"),3)]),t("div",null,[s[13]||(s[13]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Guest Password",-1)),t("div",{class:i(e.has_guest_password?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.has_guest_password?"✓ Set":"✗ Not Set"),3)])]),t("div",yt,[s[14]||(s[14]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"Read-Only Access:",-1)),t("span",{class:i(e.allow_read_only?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.allow_read_only?"Allowed":"Disabled"),3)])])])]))),128))]))])):c.value==="clients"?(r(),o("div",vt,[u.value.length===0?(r(),o("div",kt," No authenticated clients ")):(r(),o("div",pt,[t("table",bt,[s[15]||(s[15]=t("thead",null,[t("tr",{class:"border-b border-stroke-subtle dark:border-stroke/10"},[t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Client"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Address"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Identity"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Permissions"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Last Activity"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Actions")])],-1)),t("tbody",null,[(r(!0),o(m,null,y(u.value,e=>(r(),o("tr",{key:e.public_key_full,class:"border-b border-stroke-subtle dark:border-white/5 hover:bg-gray-100/50 dark:hover:bg-white/5 transition-colors"},[t("td",_t,[t("div",gt,n(e.public_key),1)]),t("td",ht,[t("div",ft,n(e.address),1)]),t("td",wt,[t("div",Ct,n(e.identity_name),1),t("div",At,n(e.identity_hash),1)]),t("td",Lt,[t("span",{class:i(["px-2 py-1 text-xs font-medium rounded",e.permissions==="admin"?"bg-green-100 dark:bg-green-500/20 dark:bg-accent-green/20 text-green-700 dark:text-accent-green":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"])},n(e.permissions),3)]),t("td",St,[t("div",Mt,n(g(e.last_activity)),1)]),t("td",jt,[t("button",{onClick:L=>C(e.public_key_full,e.identity_hash),class:"px-3 py-1 bg-red-100 dark:bg-red-500/20 dark:bg-accent-red/20 hover:bg-red-500/30 dark:hover:bg-accent-red/30 text-red-600 dark:text-accent-red rounded text-xs transition-colors"}," Remove ",8,It)])]))),128))])])]))])):c.value==="identities"?(r(),o("div",Nt,[t("div",Rt,[s[17]||(s[17]=t("label",{class:"block text-content-secondary dark:text-content-muted text-sm mb-2"},"Filter by Identity",-1)),R(t("select",{"onUpdate:modelValue":s[0]||(s[0]=e=>k.value=e),class:"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-cyan-500 dark:focus:border-primary/50 transition-colors"},[s[16]||(s[16]=t("option",{value:null},"All Identities",-1)),(r(!0),o(m,null,y(h.value,e=>(r(),o("option",{key:e.name,value:e.name},n(e.name)+" ("+n(e.authenticated_clients)+" clients) ",9,Vt))),128))],512),[[V,k.value]])]),A.value.length===0?(r(),o("div",Bt," No clients for selected identity ")):(r(),o("div",zt,[(r(!0),o(m,null,y(A.value,e=>(r(),o("div",{key:e.public_key_full,class:"glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10"},[t("div",Dt,[t("div",Ft,[t("div",Tt,[t("span",{class:i(["px-2 py-1 text-xs font-medium rounded",e.permissions==="admin"?"bg-green-100 dark:bg-green-500/20 dark:bg-accent-green/20 text-green-700 dark:text-accent-green":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"])},n(e.permissions),3),t("span",$t,n(e.public_key),1)]),t("div",Et,[t("div",null,[s[18]||(s[18]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Address:",-1)),t("span",Ht,n(e.address),1)]),t("div",null,[s[19]||(s[19]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Identity:",-1)),t("span",Pt,n(e.identity_name)+" ("+n(e.identity_hash)+")",1)]),t("div",null,[s[20]||(s[20]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Last Activity:",-1)),t("span",Gt,n(g(e.last_activity)),1)]),t("div",null,[s[21]||(s[21]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Last Login:",-1)),t("span",Ot,n(g(e.last_login_success)),1)])])]),t("button",{onClick:L=>C(e.public_key_full,e.identity_hash),class:"ml-4 px-3 py-1 bg-red-100 dark:bg-red-500/20 dark:bg-accent-red/20 hover:bg-red-500/30 dark:hover:bg-accent-red/30 text-red-600 dark:text-accent-red rounded text-xs transition-colors"}," Remove ",8,qt)])]))),128))]))])):f("",!0)])]),t("div",Ut,[t("button",{onClick:p,disabled:x.value,class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-primary rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors disabled:opacity-50"},n(x.value?"Refreshing...":"Refresh Data"),9,Jt)])]))}});export{Wt as default}; diff --git a/repeater/web/html/assets/Setup-CbTFhVaK.js b/repeater/web/html/assets/Setup-CbTFhVaK.js new file mode 100644 index 0000000..f264bea --- /dev/null +++ b/repeater/web/html/assets/Setup-CbTFhVaK.js @@ -0,0 +1 @@ +import{d as A,r as l,c as P,a as W,o as I,b as a,e,f as B,_ as Y,t as i,u as o,n as J,g as k,F as N,h as z,i as K,w as h,v as C,j as _,k as V,l as q,T,m as Q,p as n,q as E,s as X,x as Z}from"./index-C2DY4pTz.js";const ee=A("setup",()=>{const m=l(1),r=l(5),y=l(`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`),b=l(null),v=l(null),x=l(""),f=l(""),w=l(!1),c=l({frequency:"915.0",spreading_factor:"7",bandwidth:"125",coding_rate:"5"}),R=l([]),j=l([]),g=l(!1),S=l(!1),u=l(null),t=P(()=>{switch(m.value){case 1:return!0;case 2:return y.value.trim().length>0;case 3:return b.value!==null;case 4:return w.value?c.value.frequency&&c.value.spreading_factor&&c.value.bandwidth&&c.value.coding_rate:v.value!==null;case 5:return x.value.length>=6&&x.value===f.value;default:return!1}}),s=P(()=>m.value>1),M=P(()=>m.value===r.value);async function F(){g.value=!0,u.value=null;try{const p=await(await fetch("/api/hardware_options")).json();if(p.error)throw new Error(p.error);R.value=p.hardware||[]}catch(d){u.value=d instanceof Error?d.message:"Failed to load hardware options",console.error("Error fetching hardware options:",d)}finally{g.value=!1}}async function H(){g.value=!0,u.value=null;try{const p=await(await fetch("/api/radio_presets")).json();if(p.error)throw new Error(p.error);j.value=p.presets||[]}catch(d){u.value=d instanceof Error?d.message:"Failed to load radio presets",console.error("Error fetching radio presets:",d)}finally{g.value=!1}}async function U(){if(!t.value)return{success:!1,error:"Please complete all required fields"};S.value=!0,u.value=null;try{const d=w.value?{title:"Custom Configuration",description:"Custom radio settings",frequency:c.value.frequency,spreading_factor:c.value.spreading_factor,bandwidth:c.value.bandwidth,coding_rate:c.value.coding_rate}:v.value,L=await(await fetch("/api/setup_wizard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({node_name:y.value.trim(),hardware_key:b.value?.key,radio_preset:d,admin_password:x.value})})).json();if(!L.success)throw new Error(L.error||"Setup failed");return{success:!0,data:L}}catch(d){const p=d instanceof Error?d.message:"Failed to complete setup";return u.value=p,{success:!1,error:p}}finally{S.value=!1}}function O(){t.value&&m.value=1&&d<=r.value&&(m.value=d)}function D(){m.value=1,y.value=`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`,b.value=null,v.value=null,w.value=!1,c.value={frequency:"915.0",spreading_factor:"7",bandwidth:"125",coding_rate:"5"},x.value="",f.value="",u.value=null}return{currentStep:m,totalSteps:r,nodeName:y,selectedHardware:b,selectedRadioPreset:v,useCustomRadio:w,customRadio:c,adminPassword:x,confirmPassword:f,hardwareOptions:R,radioPresets:j,isLoading:g,isSubmitting:S,error:u,canGoNext:t,canGoBack:s,isLastStep:M,fetchHardwareOptions:F,fetchRadioPresets:H,completeSetup:U,nextStep:O,previousStep:$,goToStep:G,reset:D}}),te={class:"min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-center justify-center p-4"},re={class:"absolute top-4 right-4 z-20"},oe={class:"w-full max-w-4xl relative z-10"},se={class:"mb-8"},ae={class:"flex justify-between mb-2"},ne={class:"text-content-secondary dark:text-content-muted text-sm"},de={class:"text-content-secondary dark:text-content-muted text-sm"},ie={class:"h-2 bg-stroke-subtle dark:bg-stroke/10 rounded-full overflow-hidden"},le={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[20px] p-6 sm:p-8 md:p-12"},ue={class:"flex justify-center mb-8"},ce={class:"flex gap-2"},pe={class:"mb-8"},me={class:"text-2xl sm:text-3xl font-bold text-content-primary dark:text-content-primary mb-2 text-center"},be={key:0,class:"space-y-6 mt-8"},fe={key:1,class:"space-y-6 mt-8"},xe={class:"max-w-md mx-auto"},ke={key:2,class:"space-y-6 mt-8"},ve={key:0,class:"text-center text-content-secondary dark:text-content-muted"},ge={key:1,class:"text-center text-content-secondary dark:text-content-muted"},ye={key:2,class:"grid grid-cols-1 md:grid-cols-2 gap-4 max-w-3xl mx-auto"},he=["onClick"],we={class:"font-medium text-content-primary dark:text-content-primary mb-1"},_e={class:"text-sm text-content-secondary dark:text-content-muted"},Se={key:3,class:"space-y-6 mt-8"},Ce={key:0,class:"text-center text-content-secondary dark:text-content-muted"},Re={key:1,class:"text-center text-content-secondary dark:text-content-muted"},je={key:2,class:"max-w-5xl mx-auto"},Pe={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4"},Me=["onClick"],Le={class:"relative z-10"},Be={class:"font-medium text-content-primary dark:text-content-primary mb-1 flex items-start justify-between gap-2"},Ne={class:"flex items-center gap-2"},ze={class:"text-2xl"},Ve={key:0,class:"text-primary flex-shrink-0"},qe={class:"text-xs text-content-secondary dark:text-content-muted mb-3"},Te={class:"grid grid-cols-2 gap-2 text-xs"},Ee={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},Fe={class:"text-content-primary dark:text-content-primary/80 font-medium"},He={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},Ue={class:"text-content-primary dark:text-content-primary/80 font-medium"},Oe={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},$e={class:"text-content-primary dark:text-content-primary/80 font-medium"},Ge={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},De={class:"text-content-primary dark:text-content-primary/80 font-medium"},Ae={class:"border-t border-stroke-subtle dark:border-stroke/10 pt-6"},We={class:"flex items-center justify-between mb-2"},Ie={key:0,class:"text-primary"},Ye={key:0,class:"mt-4 grid grid-cols-2 gap-4"},Je={key:4,class:"space-y-6 mt-8"},Ke={class:"max-w-md mx-auto space-y-4"},Qe={key:0,class:"text-red-600 dark:text-red-400 text-sm"},Xe={key:0,class:"mb-6 bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-red-600 dark:text-red-200"},Ze={class:"flex justify-between gap-4"},et={key:1},tt=["disabled"],rt={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},ot={key:1},st={key:2},at={key:3},nt={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},dt={class:"flex justify-center mb-6"},it={key:0,class:"w-16 h-16 rounded-full bg-green-100 dark:bg-green-500/20 flex items-center justify-center"},lt={key:1,class:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-500/20 flex items-center justify-center"},ut={class:"text-2xl font-bold text-content-primary dark:text-content-primary text-center mb-4"},ct={class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"},pt=W({name:"SetupView",__name:"Setup",setup(m){const r=ee(),y=Q(),b=l(!1),v=l(""),x=l(""),f=l("success"),w=u=>{const t=u.toLowerCase();return t.includes("australia")?"🇦🇺":t.includes("eu")||t.includes("uk")?"🇪🇺":t.includes("czech")?"🇨🇿":t.includes("new zealand")?"🇳🇿":t.includes("portugal")?"🇵🇹":t.includes("switzerland")?"🇨🇭":t.includes("usa")||t.includes("canada")?"🇺🇸":t.includes("vietnam")?"🇻🇳":"🌍"};I(async()=>{await Promise.all([r.fetchHardwareOptions(),r.fetchRadioPresets()])});const c=P(()=>r.currentStep/r.totalSteps*100);async function R(){if(r.isLastStep){const u=await r.completeSetup();u.success?(f.value="success",v.value="Setup Complete!",x.value="Your repeater has been configured successfully. The service is restarting now...",b.value=!0,setTimeout(()=>{b.value=!1,y.push("/login")},5e3)):(f.value="error",v.value="Setup Failed",x.value=u.error||"An unknown error occurred",b.value=!0)}else r.nextStep()}function j(){r.previousStep()}function g(){b.value=!1,f.value==="success"&&y.push("/login")}const S=["Welcome","Repeater Name","Hardware Selection","Radio Configuration","Security Setup"];return(u,t)=>(n(),a("div",te,[e("div",re,[B(Y)]),t[36]||(t[36]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slow -top-[79px] left-[575px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[37]||(t[37]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-75 animate-pulse-slower -top-[94px] -left-[92px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[38]||(t[38]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slowest top-[373px] left-[246px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),e("div",oe,[e("div",se,[e("div",ae,[e("span",ne,"Step "+i(o(r).currentStep)+" of "+i(o(r).totalSteps),1),e("span",de,i(Math.round(c.value))+"% Complete",1)]),e("div",ie,[e("div",{class:"h-full bg-gradient-to-r from-primary to-primary/80 transition-all duration-500",style:J({width:`${c.value}%`})},null,4)])]),e("div",le,[e("div",ue,[e("div",ce,[(n(!0),a(N,null,z(o(r).totalSteps,s=>(n(),a("div",{key:s,class:_(["w-10 h-10 rounded-full flex items-center justify-center text-sm font-medium transition-all",s===o(r).currentStep?"bg-primary text-white":s

Welcome to your pyMC Repeater! Let's get you set up in just a few steps.

You'll configure:

  • Repeater name and identification
  • Hardware board selection
  • Radio frequency and settings
  • Admin password for secure access
',1)]))):o(r).currentStep===2?(n(),a("div",fe,[t[12]||(t[12]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Choose a unique name for your repeater. This will be used for identification on the mesh network. ",-1)),e("div",xe,[t[10]||(t[10]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Repeater Name",-1)),h(e("input",{"onUpdate:modelValue":t[0]||(t[0]=s=>o(r).nodeName=s),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., pyRpt0001",maxlength:"32"},null,512),[[C,o(r).nodeName]]),t[11]||(t[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-2"}," Use letters, numbers, hyphens, or underscores (3-32 characters) ",-1))])])):o(r).currentStep===3?(n(),a("div",ke,[t[13]||(t[13]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Select your hardware board type ",-1)),o(r).isLoading?(n(),a("div",ve," Loading hardware options... ")):o(r).hardwareOptions.length===0?(n(),a("div",ge," No hardware options available ")):(n(),a("div",ye,[(n(!0),a(N,null,z(o(r).hardwareOptions,s=>(n(),a("button",{key:s.key,onClick:M=>o(r).selectedHardware=s,class:_(["p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm",o(r).selectedHardware?.key===s.key?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",we,i(s.name),1),e("div",_e,i(s.description||s.key),1)],10,he))),128))]))])):o(r).currentStep===4?(n(),a("div",Se,[t[28]||(t[28]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Choose a radio configuration preset for your region or create a custom configuration ",-1)),o(r).isLoading?(n(),a("div",Ce," Loading radio presets... ")):o(r).radioPresets.length===0?(n(),a("div",Re," No radio presets available ")):(n(),a("div",je,[e("div",Pe,[(n(!0),a(N,null,z(o(r).radioPresets,s=>(n(),a("button",{key:s.title,onClick:M=>{o(r).selectedRadioPreset=s,o(r).useCustomRadio=!1},class:_(["p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm relative overflow-hidden",!o(r).useCustomRadio&&o(r).selectedRadioPreset?.title===s.title?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",Le,[e("div",Be,[e("span",Ne,[e("span",ze,i(w(s.title)),1),e("span",null,i(s.title),1)]),!o(r).useCustomRadio&&o(r).selectedRadioPreset?.title===s.title?(n(),a("div",Ve,t[14]||(t[14]=[e("svg",{class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)]))):k("",!0)]),e("div",qe,i(s.description),1),e("div",Te,[e("div",Ee,[t[15]||(t[15]=e("div",{class:"text-content-muted dark:text-content-muted"},"Freq",-1)),e("div",Fe,i(s.frequency),1)]),e("div",He,[t[16]||(t[16]=e("div",{class:"text-content-muted dark:text-content-muted"},"BW",-1)),e("div",Ue,i(s.bandwidth),1)]),e("div",Oe,[t[17]||(t[17]=e("div",{class:"text-content-muted dark:text-content-muted"},"SF",-1)),e("div",$e,i(s.spreading_factor),1)]),e("div",Ge,[t[18]||(t[18]=e("div",{class:"text-content-muted dark:text-content-muted"},"CR",-1)),e("div",De,i(s.coding_rate),1)])])])],10,Me))),128))]),e("div",Ae,[e("button",{onClick:t[1]||(t[1]=s=>{o(r).useCustomRadio=!o(r).useCustomRadio,o(r).useCustomRadio&&(o(r).selectedRadioPreset=null)}),class:_(["w-full p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm",o(r).useCustomRadio?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",We,[t[20]||(t[20]=e("div",{class:"font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})]),V(" Custom Configuration ")],-1)),o(r).useCustomRadio?(n(),a("div",Ie,t[19]||(t[19]=[e("svg",{class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)]))):k("",!0)]),t[21]||(t[21]=e("div",{class:"text-xs text-content-secondary dark:text-content-muted"},"Manually configure frequency, bandwidth, spreading factor, and coding rate",-1))],2),B(T,{name:"slide"},{default:q(()=>[o(r).useCustomRadio?(n(),a("div",Ye,[e("div",null,[t[22]||(t[22]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Frequency (MHz)",-1)),h(e("input",{"onUpdate:modelValue":t[2]||(t[2]=s=>o(r).customRadio.frequency=s),type:"number",step:"0.1",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all",placeholder:"915.0"},null,512),[[C,o(r).customRadio.frequency]])]),e("div",null,[t[23]||(t[23]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Bandwidth (kHz)",-1)),h(e("input",{"onUpdate:modelValue":t[3]||(t[3]=s=>o(r).customRadio.bandwidth=s),type:"number",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all",placeholder:"125"},null,512),[[C,o(r).customRadio.bandwidth]])]),e("div",null,[t[25]||(t[25]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Spreading Factor",-1)),h(e("select",{"onUpdate:modelValue":t[4]||(t[4]=s=>o(r).customRadio.spreading_factor=s),class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all"},t[24]||(t[24]=[e("option",{value:"7"},"7",-1),e("option",{value:"8"},"8",-1),e("option",{value:"9"},"9",-1),e("option",{value:"10"},"10",-1),e("option",{value:"11"},"11",-1),e("option",{value:"12"},"12",-1)]),512),[[E,o(r).customRadio.spreading_factor]])]),e("div",null,[t[27]||(t[27]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Coding Rate",-1)),h(e("select",{"onUpdate:modelValue":t[5]||(t[5]=s=>o(r).customRadio.coding_rate=s),class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all"},t[26]||(t[26]=[e("option",{value:"5"},"4/5",-1),e("option",{value:"6"},"4/6",-1),e("option",{value:"7"},"4/7",-1),e("option",{value:"8"},"4/8",-1)]),512),[[E,o(r).customRadio.coding_rate]])])])):k("",!0)]),_:1})])]))])):o(r).currentStep===5?(n(),a("div",Je,[t[32]||(t[32]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Set a secure admin password to protect your repeater ",-1)),e("div",Ke,[e("div",null,[t[29]||(t[29]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Admin Password",-1)),h(e("input",{"onUpdate:modelValue":t[6]||(t[6]=s=>o(r).adminPassword=s),type:"password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"Enter password (min 6 characters)",minlength:"6"},null,512),[[C,o(r).adminPassword]])]),e("div",null,[t[30]||(t[30]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Confirm Password",-1)),h(e("input",{"onUpdate:modelValue":t[7]||(t[7]=s=>o(r).confirmPassword=s),type:"password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"Confirm password"},null,512),[[C,o(r).confirmPassword]])]),o(r).adminPassword&&o(r).confirmPassword&&o(r).adminPassword!==o(r).confirmPassword?(n(),a("div",Qe," Passwords do not match ")):k("",!0),t[31]||(t[31]=e("div",{class:"bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3 text-sm text-yellow-800 dark:text-yellow-200"},[e("strong",null,"Important:"),V(" Remember this password - you'll need it to access the dashboard. ")],-1))])])):k("",!0)]),o(r).error?(n(),a("div",Xe,i(o(r).error),1)):k("",!0),e("div",Ze,[o(r).canGoBack?(n(),a("button",{key:0,onClick:j,class:"px-6 py-3 rounded-[12px] bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 text-content-primary dark:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20 transition-all duration-300 font-medium"}," Back ")):(n(),a("div",et)),e("button",{onClick:R,disabled:!o(r).canGoNext||o(r).isSubmitting,class:_(["px-8 py-3 rounded-[12px] font-semibold transition-all duration-300 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",o(r).canGoNext&&!o(r).isSubmitting?"bg-gradient-to-r from-primary/20 to-primary/10 hover:from-primary/30 hover:to-primary/20 text-white border border-primary/30 hover:border-primary/50":"bg-background-mute dark:bg-stroke/5 text-content-muted dark:text-content-muted border border-stroke-subtle dark:border-stroke/10"])},[o(r).isSubmitting?(n(),a("div",rt)):k("",!0),o(r).isSubmitting?(n(),a("span",ot,"Setting up...")):o(r).isLastStep?(n(),a("span",st,"Complete Setup")):(n(),a("span",at,"Next")),!o(r).isSubmitting&&!o(r).isLastStep?(n(),a("svg",nt,t[33]||(t[33]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]))):k("",!0)],10,tt)])])]),B(T,{name:"modal"},{default:q(()=>[b.value?(n(),a("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",onClick:g},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl max-w-md w-full p-8 rounded-[24px] border border-stroke-subtle dark:border-white/20 shadow-[0_8px_32px_0_rgba(0,0,0,0.37)]",onClick:t[8]||(t[8]=X(()=>{},["stop"]))},[e("div",dt,[f.value==="success"?(n(),a("div",it,t[34]||(t[34]=[e("svg",{class:"w-8 h-8 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)]))):(n(),a("div",lt,t[35]||(t[35]=[e("svg",{class:"w-8 h-8 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])))]),e("h3",ut,i(v.value),1),e("p",ct,i(x.value),1),e("button",{onClick:g,class:_(["w-full px-6 py-3 rounded-lg font-medium transition-all",f.value==="success"?"bg-gradient-to-r from-primary/20 to-primary/10 hover:from-primary/30 hover:to-primary/20 text-white":"bg-gradient-to-r from-red-500/20 to-red-500/10 hover:from-red-500/30 hover:to-red-500/20 text-white"])},i(f.value==="success"?"Continue to Login":"Close"),3)])])):k("",!0)]),_:1})]))}}),bt=Z(pt,[["__scopeId","data-v-20a8772f"]]);export{bt as default}; diff --git a/repeater/web/html/assets/Setup-RshMWyiL.css b/repeater/web/html/assets/Setup-RshMWyiL.css new file mode 100644 index 0000000..83d3740 --- /dev/null +++ b/repeater/web/html/assets/Setup-RshMWyiL.css @@ -0,0 +1 @@ +.glass-card[data-v-20a8772f]{background:#ffffff0d;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.1)}.modal-enter-active[data-v-20a8772f],.modal-leave-active[data-v-20a8772f]{transition:opacity .3s ease}.modal-enter-from[data-v-20a8772f],.modal-leave-to[data-v-20a8772f]{opacity:0}.modal-enter-active .glass-card[data-v-20a8772f],.modal-leave-active .glass-card[data-v-20a8772f]{transition:transform .3s ease}.modal-enter-from .glass-card[data-v-20a8772f],.modal-leave-to .glass-card[data-v-20a8772f]{transform:scale(.9)}.slide-enter-active[data-v-20a8772f],.slide-leave-active[data-v-20a8772f]{transition:all .3s ease}.slide-enter-from[data-v-20a8772f],.slide-leave-to[data-v-20a8772f]{opacity:0;transform:translateY(-10px)}@keyframes float-slow-20a8772f{0%,to{opacity:.8;transform:translate(0) scale(1) rotate(-24.22deg)}50%{opacity:.6;transform:translate(20px,-20px) scale(1.05) rotate(-24.22deg)}}@keyframes float-slower-20a8772f{0%,to{opacity:.75;transform:translate(0) scale(1) rotate(-24.22deg)}50%{opacity:.5;transform:translate(-30px,20px) scale(1.08) rotate(-24.22deg)}}@keyframes float-slowest-20a8772f{0%,to{opacity:.8;transform:translate(0) scale(1) rotate(-24.22deg)}50%{opacity:.55;transform:translate(25px,25px) scale(1.1) rotate(-24.22deg)}}.animate-pulse-slow[data-v-20a8772f]{animation:float-slow-20a8772f 15s ease-in-out infinite;will-change:transform,opacity}.animate-pulse-slower[data-v-20a8772f]{animation:float-slower-20a8772f 18s ease-in-out infinite;will-change:transform,opacity}.animate-pulse-slowest[data-v-20a8772f]{animation:float-slowest-20a8772f 20s ease-in-out infinite;will-change:transform,opacity} diff --git a/repeater/web/html/assets/Statistics-D4QKs0bR.css b/repeater/web/html/assets/Statistics-D4QKs0bR.css new file mode 100644 index 0000000..2273990 --- /dev/null +++ b/repeater/web/html/assets/Statistics-D4QKs0bR.css @@ -0,0 +1 @@ +.plotly-chart[data-v-967da4a4]{background:transparent!important} diff --git a/repeater/web/html/assets/Statistics-D8GGvrdt.js b/repeater/web/html/assets/Statistics-D8GGvrdt.js new file mode 100644 index 0000000..c7b958b --- /dev/null +++ b/repeater/web/html/assets/Statistics-D8GGvrdt.js @@ -0,0 +1 @@ +import{a as Fe,J as Me,r as u,D as Pe,c as ie,o as Be,E as ce,S as M,H as Ae,b as k,e as a,g as B,w as Ne,q as Oe,F as de,h as ue,f as ee,u as pe,i as Le,t as K,L as X,I as te,n as He,p as C,x as ze}from"./index-C2DY4pTz.js";import{S as ae}from"./chartjs-adapter-date-fns.esm-BTd89PGn.js";import{g as Je,s as Ue}from"./preferences-DtwbSSgO.js";import{C as G,a as Ie,L as Ve,P as je,b as $e,c as Ke,B as Xe,D as Ge,S as We,p as Ye,d as Ze,e as qe,A as Qe,f as et,i as tt,T as at}from"./chart-B185MtDy.js";import{P as H}from"./plotly.min-DO11Gp-n.js";import"./_commonjsHelpers-CqkleIqs.js";const st={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},rt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3"},ot={class:"flex items-center gap-2 sm:gap-3"},lt=["value"],nt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"},it={class:"glass-card rounded-[15px] p-3 sm:p-6"},ct={class:"relative h-40 sm:h-48 rounded-lg p-2 sm:p-4"},dt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-xs z-20"},ut={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},pt={class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 items-stretch"},mt={class:"glass-card rounded-[15px] p-3 sm:p-6 flex flex-col"},vt={class:"relative flex-1 min-h-[12rem] sm:min-h-[16rem] rounded-lg"},ft={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-xs z-20"},gt={class:"glass-card rounded-[15px] p-3 sm:p-6 flex flex-col"},xt={class:"flex-1 flex flex-col justify-evenly"},bt={key:0,class:"flex items-center justify-center flex-1"},yt={key:1,class:"flex items-center justify-center flex-1"},ht={class:"w-28 sm:w-32 text-sm text-content-primary dark:text-content-primary truncate"},kt={class:"flex-1 h-12 bg-background-mute dark:bg-stroke/10 rounded overflow-hidden"},Ct={class:"w-20 text-sm text-content-secondary dark:text-content-muted text-right tabular-nums"},_t={key:0,class:"glass-card rounded-[15px] p-6 sm:p-8 text-center"},wt={key:1,class:"glass-card rounded-[15px] p-6 sm:p-8 text-center"},St={class:"text-content-secondary dark:text-content-muted text-sm"},Rt=Fe({name:"StatisticsView",__name:"Statistics",setup(Tt){G.register(Ie,Ve,je,$e,Ke,Xe,Ge,We,Ye,Ze,qe,Qe,et,tt,at);const A=Me(),W=u(null),Y=u(!1),R=()=>{const t=document.documentElement.classList.contains("dark");return{gridColor:t?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",tickColor:t?"rgba(255, 255, 255, 0.7)":"rgba(0, 0, 0, 0.7)",legendColor:t?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)",titleColor:t?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)"}},g=u(Je("statistics_selectedHours",24)),me=[{value:1,label:"1 Hour"},{value:6,label:"6 Hours"},{value:12,label:"12 Hours"},{value:24,label:"24 Hours"},{value:48,label:"2 Days"},{value:168,label:"1 Week"}];Pe(g,t=>Ue("statistics_selectedHours",t));const T=u(null),N=u(null),z=u([]),D=u(null),Z=u([]),J=u(!0),U=u(null),S=u({packetRate:!0,packetType:!0,noiseFloor:!1,routePie:!0,sparklines:!0}),O=u(!1),I=u(!1),L=u(!1),_=u(null),w=u(null),h=u(null),V=u(null),q=u(null),Q=u(null),E=u(null),se=ie(()=>{const t=A.packetStats;return t?{totalRx:t.total_packets||0,totalTx:t.transmitted_packets||0}:{totalRx:0,totalTx:0}}),re=(t,e)=>{if(t.length===0)return[];const i=Math.round(e*60*60*1e3/72),r=new Map;return t.forEach(([o,f])=>{let p=o;o>1e15?p=o/1e3:o>1e9&&o<1e12&&(p=o*1e3);const x=Math.floor(p/i)*i;r.has(x)||r.set(x,[]),r.get(x).push(f)}),Array.from(r.entries()).sort((o,f)=>o[0]-f[0]).map(([,o])=>o.reduce((f,p)=>f+p,0)/o.length)},oe=ie(()=>{let t=[],e=[];if(T.value?.series){const s=T.value.series.find(r=>r.type==="rx_count"),i=T.value.series.find(r=>r.type==="tx_count");s?.data&&(t=re(s.data,g.value)),i?.data&&(e=re(i.data,g.value))}return{totalPackets:t,transmittedPackets:e,droppedPackets:[]}}),j=async()=>{try{J.value=!0,U.value=null,await Promise.all([A.fetchPacketStats({hours:g.value}),A.fetchSystemStats()]),J.value=!1,ve()}catch(t){U.value=t instanceof Error?t.message:"Failed to fetch data",J.value=!1}},ve=async()=>{S.value={packetRate:!0,packetType:!0,noiseFloor:!0,routePie:!0,sparklines:!0};const t=[fe(),ge(),xe(),be()];try{await Promise.allSettled(t),await ce(),!V.value||!q.value?setTimeout(()=>{le()},100):le()}catch(e){console.error("Error loading chart data:",e)}},fe=async()=>{try{const t=await X.get("/metrics_graph_data",{hours:g.value,resolution:"average",metrics:"rx_count,tx_count"});t?.success&&(T.value=t.data)}catch{T.value=null}},ge=async()=>{try{const t=await X.get("/packet_type_graph_data",{hours:g.value,resolution:"average",types:"all"});if(t?.success&&t.data){const e=t.data;z.value=e.series||[]}}catch{z.value=[]}},xe=async()=>{try{const t=await X.get("/route_stats",{hours:g.value});t?.success&&t.data&&(D.value=t.data)}catch{D.value=null}},be=async()=>{try{const s=Math.floor(g.value*120);let i;s<=1500?i=void 0:i=2e3;const r={hours:g.value};i!==void 0&&(r.limit=i);const o=await X.get("/noise_floor_history",r);if(o.success&&o.data){const p=o.data.history||[];Array.isArray(p)&&p.length>0&&(N.value={chart_data:p.map(x=>({timestamp:x.timestamp||Date.now()/1e3,noise_floor_dbm:x.noise_floor_dbm||x.noise_floor||-120}))},he())}}catch{N.value={chart_data:[]}}},ye=()=>{S.value={packetRate:!0,packetType:!0,noiseFloor:!0,routePie:!0,sparklines:!0},ne(),O.value=!1,I.value=!1,L.value=!1,j()},he=()=>{if(Z.value=[],N.value?.chart_data&&N.value.chart_data.length>0){const t=N.value.chart_data;Z.value=t.map(e=>({timestamp:e.timestamp*1e3,snr:null,rssi:null,noiseFloor:e.noise_floor_dbm}))}},le=()=>{if(!Y.value){Y.value=!0;try{ke(),Ce(),_e(),we(),setTimeout(()=>{S.value={packetRate:!1,packetType:!1,noiseFloor:!1,routePie:!1,sparklines:!1},setTimeout(()=>{const t=M(_.value),e=M(w.value),s=M(h.value);t&&t.update("none"),e&&e.update("none"),s&&s.update("none")},50)},100)}catch(t){console.error("Error creating/updating charts:",t),ne()}finally{Y.value=!1}}},ne=()=>{try{_.value&&(_.value.destroy(),_.value=null),w.value&&(w.value.destroy(),w.value=null),h.value&&(h.value.destroy(),h.value=null),E.value&&H.purge(E.value)}catch(t){console.error("Error destroying charts:",t)}},ke=()=>{if(!V.value)return;const t=V.value.getContext("2d");if(!t)return;let e=[],s=[];if(T.value?.series){const m=T.value.series.find(c=>c.type==="rx_count"),y=T.value.series.find(c=>c.type==="tx_count");m?.data&&(e=m.data.map(([c,d])=>{let n=c;return c>1e15?n=c/1e3:c>1e12?n=c:c>1e9?n=c*1e3:n=Date.now(),{x:n,y:d}})),y?.data&&(s=y.data.map(([c,d])=>{let n=c;return c>1e15?n=c/1e3:c>1e12?n=c:c>1e9?n=c*1e3:n=Date.now(),{x:n,y:d}}))}if(e.length===0&&s.length===0){O.value=!0;return}O.value=!1,_.value&&(_.value.destroy(),_.value=null);const r=Math.round(g.value*60*60*1e3/72),o=m=>{if(m.length===0)return[];const y=new Map;return m.forEach(d=>{const n=Math.floor(d.x/r)*r;y.has(n)||y.set(n,[]),y.get(n).push(d.y)}),Array.from(y.entries()).map(([d,n])=>({x:d,y:n.reduce((F,$)=>F+$,0)/n.length})).sort((d,n)=>d.x-n.x)},f=(m,y=3)=>{if(m.lengthDe+Ee.y,0)/$.length;c.push({x:m[d].x,y:Te})}return c},p=f(o(e)),x=f(o(s)),P=[...p.map(m=>m.y),...x.map(m=>m.y)],l=Math.min(...P),v=Math.max(...P),b=v-l||v*.1||.001,Se=Math.max(0,l-b*.05),Re=v+b*.05;try{const m=JSON.parse(JSON.stringify(p)),y=JSON.parse(JSON.stringify(x)),c=new G(t,{type:"line",data:{datasets:[{label:"TX/hr",data:y,borderColor:"#F59E0B",backgroundColor:"#F59E0B",borderWidth:2,fill:"origin",tension:.4,pointRadius:0,pointHoverRadius:3,order:1},{label:"RX/hr",data:m,borderColor:"#C084FC",backgroundColor:"#C084FC",borderWidth:2,fill:"origin",tension:.4,pointRadius:0,pointHoverRadius:3,order:2}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},title:{display:!1},tooltip:{enabled:!0,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"rgba(255, 255, 255, 0.9)",bodyColor:"rgba(255, 255, 255, 0.8)",borderColor:"rgba(255, 255, 255, 0.2)",borderWidth:1,padding:12,displayColors:!0,callbacks:{title:function(d){const n=d[0]?.parsed?.x;return n==null?"":new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},label:function(d){const n=d.dataset?.label||"",F=d.parsed?.y;return F==null?n:`${n}: ${F.toFixed(3)}`}}}},scales:{x:{type:"time",time:{unit:"hour",displayFormats:{hour:"HH:mm"}},min:Date.now()-g.value*3600*1e3,max:Date.now(),grid:{color:R().gridColor},ticks:{color:R().tickColor,maxTicksLimit:8}},y:{beginAtZero:!1,grid:{color:R().gridColor},ticks:{color:R().tickColor,callback:function(d){return typeof d=="number"?d.toFixed(3):d}},min:Se,max:Re}}}});_.value=te(c)}catch(m){console.error("Error creating packet rate chart:",m),O.value=!0}},Ce=()=>{if(!q.value)return;const t=q.value.getContext("2d");if(!t)return;const e=[],s=[],i=["#60A5FA","#34D399","#FBBF24","#A78BFA","#F87171","#06B6D4","#84CC16","#F472B6","#10B981"];if(z.value.length>0)z.value.forEach(r=>{const o=r.data?r.data.reduce((f,p)=>f+p[1],0):0;o>0&&(e.push(r.name.replace(/\([^)]*\)/g,"").trim()),s.push(o))});else{I.value=!0;return}I.value=!1,w.value&&(w.value.destroy(),w.value=null);try{const r=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(s)),f=new G(t,{type:"bar",data:{labels:r,datasets:[{data:o,backgroundColor:i.slice(0,o.length),borderRadius:8,borderSkipped:!1}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(255, 255, 255, 0.7)",font:{size:10}}},y:{beginAtZero:!0,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.7)"}}}}});w.value=te(f)}catch(r){console.error("Error creating packet type chart:",r),I.value=!0}},_e=()=>{if(!Q.value)return;const t=Q.value.getContext("2d");if(!t)return;const e=Z.value.map(l=>({x:l.timestamp,y:l.noiseFloor})).filter(l=>l.y!==null&&l.y!==void 0),s=e.map(l=>l.y),i=s.length>0?Math.min(...s):-120,r=s.length>0?Math.max(...s):-110,o=r-i||1,f=i-o*.05,p=r+o*.05;if(h.value)try{const l=M(h.value),v=JSON.parse(JSON.stringify(e));l.data.datasets[0]&&(l.data.datasets[0].data=v),l.options?.scales?.x&&(l.options.scales.x.min=Date.now()-g.value*3600*1e3,l.options.scales.x.max=Date.now()),l.update("active");return}catch{h.value.destroy(),h.value=null}const x=JSON.parse(JSON.stringify(e)),P=new G(t,{type:"scatter",data:{datasets:[{label:"Noise Floor (dBm)",data:x,borderWidth:0,backgroundColor:"rgba(245, 158, 11, 0.8)",pointRadius:3,pointHoverRadius:5,pointStyle:"circle"}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!0,position:"top",labels:{color:R().legendColor,usePointStyle:!0,padding:20}},tooltip:{enabled:!0,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"rgba(255, 255, 255, 0.9)",bodyColor:"rgba(255, 255, 255, 0.8)",borderColor:"rgba(255, 255, 255, 0.2)",borderWidth:1,padding:12,displayColors:!0,callbacks:{title:function(l){const v=l[0]?.parsed?.x;return v==null?"":new Date(v).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},label:function(l){const v=l.dataset?.label||"",b=l.parsed?.y;return b==null?v:`${v}: ${b.toFixed(1)} dBm`}}}},scales:{x:{type:"time",time:{unit:"hour",displayFormats:{hour:"HH:mm"}},min:Date.now()-g.value*3600*1e3,max:Date.now(),grid:{color:R().gridColor},ticks:{color:R().tickColor,maxTicksLimit:8}},y:{type:"linear",display:!0,title:{display:!0,text:"Noise Floor (dBm)",color:R().titleColor},grid:{color:"rgba(245, 158, 11, 0.2)"},ticks:{color:"#F59E0B",callback:function(l){return typeof l=="number"?l.toFixed(1):l}},min:f,max:p}}}});h.value=te(P)},we=()=>{if(!E.value)return;if(!D.value||!D.value.route_totals){L.value=!0;return}L.value=!1;const t=D.value.route_totals,e=Object.keys(t),s=Object.values(t),i=["#3B82F6","#10B981","#F59E0B","#A78BFA","#F87171"];try{const r=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(s)),f=o.reduce((v,b)=>v+b,0),p=o.map(v=>v/f*100),x=r.map((v,b)=>({type:"bar",name:v,x:[p[b]],y:[""],orientation:"h",marker:{color:i[b%i.length]},text:p[b]>=5?`${v} ${p[b].toFixed(0)}%`:"",textposition:"inside",textfont:{color:"white",size:11},hoverinfo:"none",insidetextanchor:"middle"})),P={paper_bgcolor:"rgba(0,0,0,0)",plot_bgcolor:"rgba(0,0,0,0)",font:{color:"rgba(255, 255, 255, 0.8)",size:11},margin:{t:10,b:60,l:10,r:10},barmode:"stack",showlegend:!0,legend:{orientation:"h",x:0,y:-.3,xanchor:"left",font:{color:"rgba(255, 255, 255, 0.8)",size:10}},xaxis:{showgrid:!1,showticklabels:!1,zeroline:!1,range:[0,100]},yaxis:{showgrid:!1,showticklabels:!1,zeroline:!1},hovermode:!1,bargap:0},l={responsive:!0,displayModeBar:!1,staticPlot:!0};H.newPlot(E.value,x,P,l)}catch(r){console.error("Error creating route treemap chart:",r),L.value=!0}};return Be(async()=>{await ce(),j(),W.value=window.setInterval(j,3e4),window.addEventListener("resize",()=>{setTimeout(()=>{M(_.value)?.resize(),M(w.value)?.resize(),M(h.value)?.resize(),E.value&&H.Plots&&H.Plots.resize(E.value)},100)})}),Ae(()=>{W.value&&clearInterval(W.value),_.value?.destroy(),w.value?.destroy(),h.value?.destroy(),E.value&&H.purge(E.value),window.removeEventListener("resize",()=>{})}),(t,e)=>(C(),k("div",st,[a("div",rt,[e[2]||(e[2]=a("h2",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Statistics",-1)),a("div",ot,[e[1]||(e[1]=a("label",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Time Range:",-1)),Ne(a("select",{"onUpdate:modelValue":e[0]||(e[0]=s=>g.value=s),onChange:ye,class:"bg-white dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 text-content-primary dark:text-content-primary text-xs sm:text-sm focus:outline-hidden focus:border-primary dark:focus:border-accent-purple/50 transition-colors"},[(C(),k(de,null,ue(me,s=>a("option",{key:s.value,value:s.value,class:"bg-white dark:bg-gray-800 text-content-primary dark:text-content-primary"},K(s.label),9,lt)),64))],544),[[Oe,g.value]])])]),a("div",nt,[ee(ae,{title:"Total RX",value:se.value.totalRx,color:"#AAE8E8",data:oe.value.totalPackets,loading:S.value.sparklines,variant:"classic"},null,8,["value","data","loading"]),ee(ae,{title:"Total TX",value:se.value.totalTx,color:"#FFC246",data:oe.value.transmittedPackets,loading:S.value.sparklines,variant:"classic"},null,8,["value","data","loading"]),ee(ae,{title:"Packet Hash Cache",value:pe(A).systemStats?.duplicate_cache_size??0,color:"#9F7AEA",data:[],loading:!1,variant:"smooth",subtitle:`Entries expire after ${(()=>{const s=pe(A).systemStats?.cache_ttl??3600,i=Math.floor(s/60);return i>=60?`${Math.floor(i/60)}h`:`${i}m`})()}`},null,8,["value","subtitle"])]),a("div",it,[e[6]||(e[6]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"},"Performance Metrics",-1)),a("div",null,[e[5]||(e[5]=Le('

Packet Rate (RX/TX PER HOUR)

RX/hr
TX/hr
',2)),a("div",ct,[a("canvas",{ref_key:"packetRateCanvasRef",ref:V,class:"w-full h-full relative z-10"},null,512),S.value.packetRate?(C(),k("div",dt,e[3]||(e[3]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-purple-600 dark:border-t-purple-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Loading packet rate data...")],-1)]))):B("",!0),O.value&&!S.value.packetRate?(C(),k("div",ut,e[4]||(e[4]=[a("div",{class:"text-center"},[a("div",{class:"text-red-700 dark:text-red-400 text-sm font-semibold mb-1"},"No Data Available"),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Packet rate data not found")],-1)]))):B("",!0)])])]),a("div",pt,[a("div",mt,[e[8]||(e[8]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"}," Noise Floor Over Time ",-1)),a("div",vt,[a("canvas",{ref_key:"signalMetricsCanvasRef",ref:Q,class:"w-full h-full"},null,512),S.value.noiseFloor?(C(),k("div",ft,e[7]||(e[7]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-amber-600 dark:border-t-amber-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Loading noise floor data...")],-1)]))):B("",!0)])]),a("div",gt,[e[11]||(e[11]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"},"Route Distribution",-1)),a("div",xt,[S.value.routePie?(C(),k("div",bt,e[9]||(e[9]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-green-600 dark:border-t-green-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading route data...")],-1)]))):L.value?(C(),k("div",yt,e[10]||(e[10]=[a("div",{class:"text-center"},[a("div",{class:"text-red-700 dark:text-red-400 text-sm font-semibold mb-1"},"No Data Available"),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Route statistics not found")],-1)]))):D.value?.route_totals?(C(!0),k(de,{key:2},ue(D.value.route_totals,(s,i,r)=>(C(),k("div",{key:i,class:"flex items-center gap-3"},[a("div",ht,K(i),1),a("div",kt,[a("div",{class:"h-full rounded transition-all duration-300",style:He({width:`${s/Math.max(...Object.values(D.value.route_totals))*100}%`,backgroundColor:["#3B82F6","#10B981","#F59E0B","#A78BFA","#F87171"][r%5]})},null,4)]),a("div",Ct,K(s.toLocaleString()),1)]))),128)):B("",!0)])])]),J.value?(C(),k("div",_t,e[12]||(e[12]=[a("div",{class:"text-content-secondary dark:text-content-muted mb-2 text-sm"},"Loading statistics...",-1),a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-content-primary dark:border-t-white/70 rounded-full mx-auto"},null,-1)]))):B("",!0),U.value?(C(),k("div",wt,[e[13]||(e[13]=a("div",{class:"text-red-700 dark:text-red-400 mb-2 text-sm font-semibold"},"Failed to load statistics",-1)),a("p",St,K(U.value),1),a("button",{onClick:j,class:"mt-4 px-4 py-2 bg-primary hover:bg-primary/90 dark:bg-primary dark:hover:bg-primary/80 text-white font-medium rounded-lg border border-primary/20 dark:border-primary/30 transition-colors shadow-sm"}," Retry ")])):B("",!0)]))}}),At=ze(Rt,[["__scopeId","data-v-967da4a4"]]);export{At as default}; diff --git a/repeater/web/html/assets/SystemStats-B8-MXEai.css b/repeater/web/html/assets/SystemStats-B8-MXEai.css new file mode 100644 index 0000000..228aab9 --- /dev/null +++ b/repeater/web/html/assets/SystemStats-B8-MXEai.css @@ -0,0 +1 @@ +.glass-card[data-v-eab6d04d]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#ffffffbf;border:1px solid rgba(0,0,0,.06);box-shadow:0 2px 8px #0000000a}.dark .glass-card[data-v-eab6d04d]{background:#0000004d;border:1px solid rgba(255,255,255,.1);box-shadow:none}.chart-updating[data-v-eab6d04d]{animation:subtle-pulse-eab6d04d .8s ease-in-out}@keyframes subtle-pulse-eab6d04d{0%{transform:scale(1)}50%{transform:scale(1.02)}to{transform:scale(1)}}.chart-container[data-v-eab6d04d]{position:relative;transition:all .3s ease}.chart-container[data-v-eab6d04d]:hover{background:#0000000a}.dark .chart-container[data-v-eab6d04d]:hover{background:#ffffff14}.process-row[data-v-eab6d04d]{transition:all .3s ease}.process-row[data-v-eab6d04d]:hover{background:#00000005;transform:translate(2px)}.dark .process-row[data-v-eab6d04d]:hover{background:#ffffff0d}.process-row-enter-active[data-v-eab6d04d],.process-row-leave-active[data-v-eab6d04d]{transition:all .4s ease}.process-row-enter-from[data-v-eab6d04d]{opacity:0;transform:translateY(-10px) scale(.95)}.process-row-leave-to[data-v-eab6d04d]{opacity:0;transform:translateY(10px) scale(.95)}.process-row-move[data-v-eab6d04d]{transition:transform .4s ease}.cpu-value[data-v-eab6d04d],.memory-value[data-v-eab6d04d]{transition:all .3s ease;padding:2px 6px;border-radius:4px}.cpu-value[data-v-eab6d04d]:hover,.memory-value[data-v-eab6d04d]:hover{background:#f59e0b1a;transform:scale(1.05)}@keyframes value-update-eab6d04d{0%{background:#f59e0b4d}to{background:transparent}}.value-updated[data-v-eab6d04d]{animation:value-update-eab6d04d .6s ease-out} diff --git a/repeater/web/html/assets/SystemStats-C7xzR_wP.js b/repeater/web/html/assets/SystemStats-C7xzR_wP.js new file mode 100644 index 0000000..5cbcc76 --- /dev/null +++ b/repeater/web/html/assets/SystemStats-C7xzR_wP.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plotly.min-DO11Gp-n.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); +import{a as ot,r as u,c as W,E as N,o as nt,S as X,U as O,H as lt,b as d,e as t,g as v,f as A,t as o,F as Y,h as G,I as K,L as Q,j as V,p as i,x as dt}from"./index-C2DY4pTz.js";import{S as P}from"./chartjs-adapter-date-fns.esm-BTd89PGn.js";import{C as j,a as it,L as ct,P as ut,b as mt,c as vt,B as pt,D as xt,p as yt,d as gt,e as ft,A as bt,f as kt,i as ht,T as _t}from"./chart-B185MtDy.js";const Ct={class:"p-6 space-y-6"},wt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"},Ft={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},St={class:"glass-card rounded-[15px] p-6"},Ut={class:"relative h-32 bg-gray-100/50 dark:bg-white/5 rounded-lg p-4 mb-4 chart-container"},Bt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-sm z-20"},Et={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},At={key:0,class:"grid grid-cols-2 gap-4 text-sm"},Pt={class:"text-content-primary dark:text-content-primary font-semibold"},Lt={class:"text-content-primary dark:text-content-primary font-semibold"},Mt={class:"text-content-primary dark:text-content-primary font-semibold"},Dt={class:"text-content-primary dark:text-content-primary font-semibold"},Rt={class:"glass-card rounded-[15px] p-6"},Tt={class:"relative h-32 bg-gray-100/50 dark:bg-white/5 rounded-lg p-4 mb-4 chart-container"},zt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-sm z-20"},$t={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},It={key:0,class:"grid grid-cols-2 gap-4 text-sm"},Nt={class:"text-content-primary dark:text-content-primary font-semibold"},Ot={class:"text-content-primary dark:text-content-primary font-semibold"},Vt={class:"text-content-primary dark:text-content-primary font-semibold"},jt={class:"text-content-primary dark:text-content-primary font-semibold"},Ht={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},qt={class:"glass-card rounded-[15px] p-6"},Jt={class:"relative h-48"},Wt={key:0,class:"grid grid-cols-3 gap-4 text-sm mt-4"},Xt={class:"text-center"},Yt={class:"text-content-primary dark:text-content-primary font-semibold"},Gt={class:"text-center"},Kt={class:"font-semibold text-red-500 dark:text-red-400"},Qt={class:"text-center"},Zt={class:"font-semibold text-green-700 dark:text-green-400"},te={class:"glass-card rounded-[15px] p-6"},ee={key:0,class:"space-y-4"},ae={class:"grid grid-cols-2 gap-4 text-sm"},se={class:"text-content-primary dark:text-content-primary font-semibold"},re={class:"text-content-primary dark:text-content-primary font-semibold"},oe={class:"text-content-primary dark:text-content-primary font-semibold"},ne={class:"text-content-primary dark:text-content-primary font-semibold"},le={key:0,class:"pt-4 border-t border-stroke-subtle dark:border-stroke/10"},de={class:"grid grid-cols-2 gap-2 text-sm"},ie={class:"text-content-secondary dark:text-content-muted"},ce={class:"text-content-primary dark:text-content-primary font-semibold ml-1"},ue={class:"glass-card rounded-[15px] p-6"},me={key:0,class:"overflow-x-auto"},ve={class:"w-full text-sm"},pe={class:"text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300"},xe={class:"text-content-primary dark:text-content-primary font-semibold py-2 transition-all duration-300"},ye={class:"text-center text-orange-500 dark:text-orange-400 py-2 transition-all duration-300"},ge={class:"text-center text-green-700 dark:text-green-400 py-2 transition-all duration-300"},fe={class:"text-right text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300"},be={key:0,class:"mt-4 text-center text-content-secondary dark:text-content-muted text-sm transition-all duration-300"},ke={key:1,class:"text-center text-content-secondary dark:text-content-muted py-8"},he={key:0,class:"glass-card rounded-[15px] p-8 text-center"},_e={key:1,class:"glass-card rounded-[15px] p-8 text-center"},Ce={class:"text-content-secondary dark:text-content-muted text-sm"},we=ot({name:"SystemStatsView",__name:"SystemStats",setup(Fe){j.register(it,ct,ut,mt,vt,pt,xt,yt,gt,ft,bt,kt,ht,_t);const L=u(null),_=u(!0),C=u(null),s=u(null),b=u(null),x=u([]),M=u(null),p=u({cpuChart:!0,memoryChart:!0,diskChart:!1,processChart:!0}),D=u(!1),R=u(!1),y=u(null),g=u(null),T=u(null),z=u(null),k=u(null),B=W(()=>s.value?{cpuUsage:s.value.cpu.usage_percent,memoryUsage:s.value.memory.usage_percent,diskUsage:s.value.disk.usage_percent,uptime:s.value.system.uptime}:{cpuUsage:0,memoryUsage:0,diskUsage:0,uptime:0}),E=W(()=>x.value.length===0?{cpu:[],memory:[],disk:[],network:[]}:{cpu:x.value.map(a=>a.cpu.usage_percent),memory:x.value.map(a=>a.memory.usage_percent),disk:x.value.map(a=>a.disk.usage_percent),network:x.value.map(a=>a.network.bytes_recv/1024/1024)}),f=a=>{const e=["B","KB","MB","GB","TB"];if(a===0)return"0 B";const r=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,r)).toFixed(2))+" "+e[r]},Z=a=>{const e=Math.floor(a/86400),r=Math.floor(a%86400/3600),n=Math.floor(a%3600/60);return e>0?`${e}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`},tt=async()=>{try{const a=await Q.get("/hardware_stats");if(a?.success&&a.data){const e=a.data;if(s.value=e,x.value.length===0)for(let n=0;n<12;n++)x.value.push(JSON.parse(JSON.stringify(e)));else x.value.push(e),x.value.length>20&&x.value.shift()}}catch(a){console.error("Failed to fetch hardware stats:",a),C.value="Failed to fetch hardware stats"}},et=async()=>{try{const a=await Q.get("/hardware_processes");a?.success&&a.data&&(M.value=b.value,b.value=a.data)}catch(a){console.error("Failed to fetch process stats:",a)}},$=(a,e)=>{if(!M.value)return!1;const r=M.value.processes.find(n=>n.pid===a.pid);return r?r[e]!==a[e]:!0},I=async()=>{try{_.value=!0,C.value=null,await Promise.all([tt(),et()]),_.value=!1,await N(),H()}catch(a){C.value=a instanceof Error?a.message:"Failed to fetch system data",_.value=!1}},H=()=>{s.value&&(at(),st(),rt())},at=()=>{if(!T.value||!s.value){p.value.cpuChart=!1;return}const a=T.value.getContext("2d");if(!a){p.value.cpuChart=!1;return}const e=s.value.cpu.usage_percent,r=100-e;if(y.value)try{y.value.data.datasets[0].data=[e,r],y.value.update("none");return}catch(m){console.warn("Failed to update CPU chart, recreating...",m),y.value.destroy(),y.value=null}const n=document.documentElement.classList.contains("dark"),h=n?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",w=n?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)",F=n?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.6)";try{const m=new j(a,{type:"doughnut",data:{labels:["Used","Available"],datasets:[{data:[e,r],backgroundColor:["#FFC246",h],borderColor:["#FFC246",w],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(c){return`${c.label}: ${c.parsed.toFixed(1)}%`}}}}},plugins:[{id:"centerText",beforeDraw:function(c){const l=c.ctx;l.save();const S=(c.chartArea.left+c.chartArea.right)/2,U=(c.chartArea.top+c.chartArea.bottom)/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle="#FFC246",l.font="bold 18px sans-serif",l.fillText(`${e.toFixed(1)}%`,S,U-5),l.fillStyle=F,l.font="10px sans-serif",l.fillText("CPU",S,U+12),l.restore()}}]});y.value=K(m),D.value=!1,p.value.cpuChart=!1}catch(m){console.error("Error creating CPU chart:",m),D.value=!0,p.value.cpuChart=!1}},st=()=>{if(!z.value||!s.value){p.value.memoryChart=!1;return}const a=z.value.getContext("2d");if(!a){p.value.memoryChart=!1;return}const e=s.value.memory.usage_percent,r=100-e;if(g.value)try{g.value.data.datasets[0].data=[e,r],g.value.update("none");return}catch(m){console.warn("Failed to update Memory chart, recreating...",m),g.value.destroy(),g.value=null}const n=document.documentElement.classList.contains("dark"),h=n?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",w=n?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)",F=n?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.6)";try{const m=new j(a,{type:"doughnut",data:{labels:["Used","Available"],datasets:[{data:[e,r],backgroundColor:["#A5E5B6",h],borderColor:["#A5E5B6",w],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(c){return`${c.label}: ${c.parsed.toFixed(1)}%`}}}}},plugins:[{id:"centerText",beforeDraw:function(c){const l=c.ctx;l.save();const S=(c.chartArea.left+c.chartArea.right)/2,U=(c.chartArea.top+c.chartArea.bottom)/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle="#A5E5B6",l.font="bold 18px sans-serif",l.fillText(`${e.toFixed(1)}%`,S,U-5),l.fillStyle=F,l.font="10px sans-serif",l.fillText("Memory",S,U+12),l.restore()}}]});g.value=K(m),R.value=!1,p.value.memoryChart=!1}catch(m){console.error("Error creating Memory chart:",m),R.value=!0,p.value.memoryChart=!1}},rt=()=>{if(!k.value||!s.value)return;const e=document.documentElement.classList.contains("dark")?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)";try{O(()=>import("./plotly.min-DO11Gp-n.js").then(r=>r.p),__vite__mapDeps([0,1])).then(r=>{const n=r.default||r,h=s.value.disk,w=[{type:"pie",labels:["Used","Free"],values:[h.used,h.free],marker:{colors:["#FB787B","#A5E5B6"]},hovertemplate:"%{label}
Size: %{value}
Percentage: %{percent}",textinfo:"label+percent",textposition:"auto",hole:.4}],F={title:{text:"",font:{color:e}},paper_bgcolor:"rgba(0,0,0,0)",plot_bgcolor:"rgba(0,0,0,0)",font:{color:e,size:11},margin:{t:20,b:20,l:20,r:20},showlegend:!0,legend:{orientation:"h",x:0,y:-.2,font:{color:e,size:10}}},m={responsive:!0,displayModeBar:!1,staticPlot:!1};n.newPlot(k.value,w,F,m)})}catch(r){console.error("Error creating disk chart:",r)}},q=()=>{try{if(y.value&&(y.value.destroy(),y.value=null),g.value&&(g.value.destroy(),g.value=null),k.value)try{O(()=>import("./plotly.min-DO11Gp-n.js").then(a=>a.p),__vite__mapDeps([0,1])).then(a=>{const e=a?.default||a;e?.purge&&e.purge(k.value)}).catch(()=>{})}catch{}}catch(a){console.error("Error destroying charts:",a)}},J=new MutationObserver(a=>{a.forEach(e=>{e.attributeName==="class"&&(q(),N(()=>{H()}))})});return nt(async()=>{await N(),I(),L.value=window.setInterval(I,5e3),J.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),window.addEventListener("resize",()=>{setTimeout(()=>{X(y.value)?.resize(),X(g.value)?.resize();try{O(()=>import("./plotly.min-DO11Gp-n.js").then(a=>a.p),__vite__mapDeps([0,1])).then(a=>{const e=a?.default||a;e?.Plots&&e.Plots.resize(k.value)}).catch(()=>{})}catch{}},100)})}),lt(()=>{L.value&&clearInterval(L.value),J.disconnect(),q(),window.removeEventListener("resize",()=>{})}),(a,e)=>(i(),d("div",Ct,[e[28]||(e[28]=t("div",{class:"flex justify-between items-center"},[t("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"System Statistics"),t("div",{class:"text-content-secondary dark:text-content-muted text-sm"}," Updates every 5 seconds ")],-1)),t("div",wt,[A(P,{title:"CPU Usage",value:`${B.value.cpuUsage.toFixed(1)}%`,color:"#FFC246",data:E.value.cpu},null,8,["value","data"]),A(P,{title:"Memory Usage",value:`${B.value.memoryUsage.toFixed(1)}%`,color:"#A5E5B6",data:E.value.memory},null,8,["value","data"]),A(P,{title:"Disk Usage",value:`${B.value.diskUsage.toFixed(1)}%`,color:"#FB787B",data:E.value.disk},null,8,["value","data"]),A(P,{title:"Uptime",value:Z(B.value.uptime),color:"#EBA0FC",data:E.value.network},null,8,["value","data"])]),t("div",Ft,[t("div",St,[e[6]||(e[6]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"CPU Performance",-1)),t("div",Ut,[t("canvas",{ref_key:"cpuCanvasRef",ref:T,class:"w-full h-full relative z-10"},null,512),p.value.cpuChart?(i(),d("div",Bt,e[0]||(e[0]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-orange-400 rounded-full mx-auto mb-2"}),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading CPU data...")],-1)]))):v("",!0),D.value&&!p.value.cpuChart?(i(),d("div",Et,e[1]||(e[1]=[t("div",{class:"text-center"},[t("div",{class:"text-red-500 dark:text-red-400 text-sm mb-1"},"No Data Available"),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"CPU data not found")],-1)]))):v("",!0)]),s.value?(i(),d("div",At,[t("div",null,[e[2]||(e[2]=t("div",{class:"text-content-secondary dark:text-content-muted"},"CPU Count",-1)),t("div",Pt,o(s.value.cpu.count)+" cores",1)]),t("div",null,[e[3]||(e[3]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Frequency",-1)),t("div",Lt,o(s.value.cpu.frequency.toFixed(0))+" MHz",1)]),t("div",null,[e[4]||(e[4]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Load (1m)",-1)),t("div",Mt,o(s.value.cpu.load_avg["1min"].toFixed(2)),1)]),t("div",null,[e[5]||(e[5]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Load (5m)",-1)),t("div",Dt,o(s.value.cpu.load_avg["5min"].toFixed(2)),1)])])):v("",!0)]),t("div",Rt,[e[13]||(e[13]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Memory Usage",-1)),t("div",Tt,[t("canvas",{ref_key:"memoryCanvasRef",ref:z,class:"w-full h-full relative z-10"},null,512),p.value.memoryChart?(i(),d("div",zt,e[7]||(e[7]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-green-400 rounded-full mx-auto mb-2"}),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading memory data...")],-1)]))):v("",!0),R.value&&!p.value.memoryChart?(i(),d("div",$t,e[8]||(e[8]=[t("div",{class:"text-center"},[t("div",{class:"text-red-500 dark:text-red-400 text-sm mb-1"},"No Data Available"),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Memory data not found")],-1)]))):v("",!0)]),s.value?(i(),d("div",It,[t("div",null,[e[9]||(e[9]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Total",-1)),t("div",Nt,o(f(s.value.memory.total)),1)]),t("div",null,[e[10]||(e[10]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Used",-1)),t("div",Ot,o(f(s.value.memory.used)),1)]),t("div",null,[e[11]||(e[11]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Available",-1)),t("div",Vt,o(f(s.value.memory.available)),1)]),t("div",null,[e[12]||(e[12]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Usage",-1)),t("div",jt,o(s.value.memory.usage_percent.toFixed(1))+"%",1)])])):v("",!0)])]),t("div",Ht,[t("div",qt,[e[17]||(e[17]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Storage Usage",-1)),t("div",Jt,[t("div",{ref_key:"diskCanvasRef",ref:k,class:"w-full h-full"},null,512)]),s.value?(i(),d("div",Wt,[t("div",Xt,[e[14]||(e[14]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Total",-1)),t("div",Yt,o(f(s.value.disk.total)),1)]),t("div",Gt,[e[15]||(e[15]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Used",-1)),t("div",Kt,o(f(s.value.disk.used)),1)]),t("div",Qt,[e[16]||(e[16]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Free",-1)),t("div",Zt,o(f(s.value.disk.free)),1)])])):v("",!0)]),t("div",te,[e[23]||(e[23]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Network Statistics",-1)),s.value?(i(),d("div",ee,[t("div",ae,[t("div",null,[e[18]||(e[18]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Bytes Sent",-1)),t("div",se,o(f(s.value.network.bytes_sent)),1)]),t("div",null,[e[19]||(e[19]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Bytes Received",-1)),t("div",re,o(f(s.value.network.bytes_recv)),1)]),t("div",null,[e[20]||(e[20]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Packets Sent",-1)),t("div",oe,o(s.value.network.packets_sent.toLocaleString()),1)]),t("div",null,[e[21]||(e[21]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Packets Received",-1)),t("div",ne,o(s.value.network.packets_recv.toLocaleString()),1)])]),s.value.temperatures&&Object.keys(s.value.temperatures).length>0?(i(),d("div",le,[e[22]||(e[22]=t("div",{class:"text-content-secondary dark:text-content-muted mb-2"},"System Temperatures",-1)),t("div",de,[(i(!0),d(Y,null,G(s.value.temperatures,(r,n)=>(i(),d("div",{key:n},[t("span",ie,o(n)+":",1),t("span",ce,o(r.toFixed(1))+"°C",1)]))),128))])])):v("",!0)])):v("",!0)])]),t("div",ue,[e[25]||(e[25]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Top Processes",-1)),b.value?.processes&&b.value.processes.length>0?(i(),d("div",me,[t("table",ve,[e[24]||(e[24]=t("thead",null,[t("tr",{class:"border-b border-stroke-subtle dark:border-stroke/10"},[t("th",{class:"text-left text-content-secondary dark:text-content-muted py-2"},"PID"),t("th",{class:"text-left text-content-secondary dark:text-content-muted py-2"},"Name"),t("th",{class:"text-center text-content-secondary dark:text-content-muted py-2"},"CPU %"),t("th",{class:"text-center text-content-secondary dark:text-content-muted py-2"},"Memory %"),t("th",{class:"text-right text-content-secondary dark:text-content-muted py-2"},"Memory")])],-1)),t("tbody",null,[(i(!0),d(Y,null,G(b.value.processes.slice(0,10),r=>(i(),d("tr",{key:r.pid,class:"border-b border-stroke-subtle dark:border-white/5 process-row"},[t("td",pe,o(r.pid),1),t("td",xe,o(r.name),1),t("td",ye,[t("span",{class:V(["cpu-value",{"value-updated":$(r,"cpu_percent")}])},o(r.cpu_percent.toFixed(1))+"% ",3)]),t("td",ge,[t("span",{class:V(["memory-value",{"value-updated":$(r,"memory_percent")}])},o(r.memory_percent.toFixed(1))+"% ",3)]),t("td",fe,[t("span",{class:V({"value-updated":$(r,"memory_mb")})},o(r.memory_mb.toFixed(1))+" MB ",3)])]))),128))])]),b.value.total_processes?(i(),d("div",be," Showing top 10 of "+o(b.value.total_processes)+" total processes ",1)):v("",!0)])):_.value?v("",!0):(i(),d("div",ke," No process data available "))]),_.value?(i(),d("div",he,e[26]||(e[26]=[t("div",{class:"text-content-secondary dark:text-content-muted mb-2"},"Loading system statistics...",-1),t("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-gray-900 dark:border-t-white/70 rounded-full mx-auto"},null,-1)]))):v("",!0),C.value?(i(),d("div",_e,[e[27]||(e[27]=t("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load system statistics",-1)),t("p",Ce,o(C.value),1),t("button",{onClick:I,class:"mt-4 px-4 py-2 bg-purple-500/20 dark:bg-accent-purple/20 hover:bg-purple-500/30 dark:hover:bg-accent-purple/30 text-content-primary dark:text-content-primary rounded-lg border border-purple-500/50 dark:border-accent-purple/50 transition-colors"}," Retry ")])):v("",!0)]))}}),Ee=dt(we,[["__scopeId","data-v-eab6d04d"]]);export{Ee as default}; diff --git a/repeater/web/html/assets/Terminal-DYn8WA9j.js b/repeater/web/html/assets/Terminal-DYn8WA9j.js new file mode 100644 index 0000000..afe7600 --- /dev/null +++ b/repeater/web/html/assets/Terminal-DYn8WA9j.js @@ -0,0 +1,184 @@ +import{L as J,a as zl,r as ut,o as Hl,a0 as Ul,Q as Rn,D as ql,b as tt,e as Z,g as Yt,t as Is,w as Kl,v as Vl,Y as Ji,j as Tn,s as jl,p as it,x as Gl}from"./index-C2DY4pTz.js";/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */var oa=Object.defineProperty,Yl=Object.getOwnPropertyDescriptor,Xl=(t,e)=>{for(var i in e)oa(t,i,{get:e[i],enumerable:!0})},ue=(t,e,i,s)=>{for(var r=s>1?void 0:s?Yl(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&oa(e,i,r),r},P=(t,e)=>(i,s)=>e(i,s,t),Dn="Terminal input",pr={get:()=>Dn,set:t=>Dn=t},An="Too much output to announce, navigate to rows manually to read",vr={get:()=>An,set:t=>An=t};function Jl(t){return t.replace(/\r?\n/g,"\r")}function Zl(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Ql(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function eh(t,e,i,s){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");aa(r,e,i,s)}}function aa(t,e,i,s){t=Jl(t),t=Zl(t,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function la(t,e,i){let s=i.getBoundingClientRect(),r=t.clientX-s.left-10,n=t.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function Pn(t,e,i,s,r){la(t,e,i),r&&s.rightClickSelect(t),e.value=s.selectionText,e.select()}function Kt(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Ts(t,e=0,i=t.length){let s="";for(let r=e;r65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var th=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?i[r++]=(this._interim-55296)*1024+o-56320+65536:(i[r++]=this._interim,i[r++]=o),this._interim=0}for(let o=n;o=s)return this._interim=l,r;let h=e.charCodeAt(o);56320<=h&&h<=57343?i[r++]=(l-55296)*1024+h-56320+65536:(i[r++]=l,i[r++]=h);continue}l!==65279&&(i[r++]=l)}return r}},ih=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n,o,l,h,a=0,c=0;if(this.interim[0]){let d=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let y=0,k;for(;(k=this.interim[++y]&63)&&y<4;)m<<=6,m|=k;let R=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=R-y;for(;c=s)return 0;if(k=e[c++],(k&192)!==128){c--,d=!0;break}else this.interim[y++]=k,m<<=6,m|=k&63}d||(R===2?m<128?c--:i[r++]=m:R===3?m<2048||m>=55296&&m<=57343||m===65279||(i[r++]=m):m<65536||m>1114111||(i[r++]=m)),this.interim.fill(0)}let _=s-4,f=c;for(;f=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(a=(n&31)<<6|o&63,a<128){f--;continue}i[r++]=a}else if((n&240)===224){if(f>=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[f++],(l&192)!==128){f--;continue}if(a=(n&15)<<12|(o&63)<<6|l&63,a<2048||a>=55296&&a<=57343||a===65279)continue;i[r++]=a}else if((n&248)===240){if(f>=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[f++],(l&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(h=e[f++],(h&192)!==128){f--;continue}if(a=(n&7)<<18|(o&63)<<12|(l&63)<<6|h&63,a<65536||a>1114111)continue;i[r++]=a}}return r}},ha="",Vt=" ",ji=class ca{constructor(){this.fg=0,this.bg=0,this.extended=new bs}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new ca;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},bs=class da{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new da(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ct=class ua extends ji{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new bs,this.combinedData=""}static fromCharData(e){let i=new ua;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Kt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$n="di$target",mr="di$dependencies",Os=new Map;function sh(t){return t[mr]||[]}function Ie(t){if(Os.has(t))return Os.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rh(e,i,r)};return e._id=t,Os.set(t,e),e}function rh(t,e,i){e[$n]===e?e[mr].push({id:t,index:i}):(e[mr]=[{id:t,index:i}],e[$n]=e)}var Ve=Ie("BufferService"),_a=Ie("CoreMouseService"),li=Ie("CoreService"),nh=Ie("CharsetService"),fn=Ie("InstantiationService"),fa=Ie("LogService"),je=Ie("OptionsService"),ga=Ie("OscLinkService"),oh=Ie("UnicodeService"),Gi=Ie("DecorationService"),wr=class{constructor(e,i,s){this._bufferService=e,this._optionsService=i,this._oscLinkService=s}provideLinks(e,i){let s=this._bufferService.buffer.lines.get(e-1);if(!s){i(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new ct,l=s.getTrimmedLength(),h=-1,a=-1,c=!1;for(let _=0;_n?n.activate(y,k,d):ah(y,k),hover:(y,k)=>n?.hover?.(y,k,d),leave:(y,k)=>n?.leave?.(y,k,d)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(a=_,h=o.extended.urlId):(a=-1,h=-1)}}i(r)}};wr=ue([P(0,Ve),P(1,je),P(2,ga)],wr);function ah(t,e){if(confirm(`Do you want to navigate to ${e}? + +WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Ds=Ie("CharSizeService"),$t=Ie("CoreBrowserService"),gn=Ie("MouseService"),It=Ie("RenderService"),lh=Ie("SelectionService"),pa=Ie("CharacterJoinerService"),bi=Ie("ThemeService"),va=Ie("LinkProviderService"),hh=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?In.isErrorNoTelemetry(e)?new In(e.message+` + +`+e.stack):new Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},ch=new hh;function hs(t){dh(t)||ch.onUnexpectedError(t)}var Sr="Canceled";function dh(t){return t instanceof uh?!0:t instanceof Error&&t.name===Sr&&t.message===Sr}var uh=class extends Error{constructor(){super(Sr),this.name=this.message}};function _h(t){return new Error(`Illegal argument: ${t}`)}var In=class br extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof br)return e;let i=new br;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},yr=class ma extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,ma.prototype)}};function Xe(t,e=0){return t[t.length-(1+e)]}var fh;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(fh||={});function gh(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var wa;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function ph(...t){return re(()=>oi(t))}function re(t){return{dispose:gh(()=>{t()})}}var Sa=class ba{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{oi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ba.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Sa.DISABLE_DISPOSED_WARNING=!1;var jt=Sa,j=class{constructor(){this._store=new jt,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};j.None=Object.freeze({dispose(){}});var Si=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},At=typeof window=="object"?window:globalThis,Cr=class xr{constructor(e){this.element=e,this.next=xr.Undefined,this.prev=xr.Undefined}};Cr.Undefined=new Cr(void 0);var oe=Cr,On=class{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let e=this._first;for(;e!==oe.Undefined;){let i=e.next;e.prev=oe.Undefined,e.next=oe.Undefined,e=i}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let s=new oe(e);if(this._first===oe.Undefined)this._first=s,this._last=s;else if(i){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oe.Undefined&&e.next!==oe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===oe.Undefined&&e.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):e.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):e.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oe.Undefined;)yield e.element,e=e.next}},vh=globalThis.performance&&typeof globalThis.performance.now=="function",mh=class ya{static create(e){return new ya(e)}constructor(e){this._now=vh&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Fe;(t=>{t.None=()=>j.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=ph(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new A(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new A(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new A({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new A({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new A({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new A;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new A(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof jt?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(Fe||={});var kr=class Lr{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Lr._idPool++}`,Lr.all.add(this)}start(e){this._stopWatch=new mh,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};kr.all=new Set,kr._idPool=0;var wh=kr,Sh=-1,Ca=class xa{constructor(e,i,s=(xa._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new xh(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||hs)(a),j.None}if(this._disposed)return j.None;i&&(e=e.bind(i));let r=new Fs(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=yh.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Fs?(this._deliveryQueue??=new Eh,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=re(()=>{n?.(),this._removeListener(r)});return s instanceof jt?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Lh<=i.length){let n=0;for(let o=0;o0}},Eh=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,s){this.i=0,this.end=s,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Br=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new A,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new A,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Br.INSTANCE=new Br;var pn=Br;function Mh(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}pn.INSTANCE.onDidChangeZoomLevel;function Rh(t){return pn.INSTANCE.getZoomFactor(t)}pn.INSTANCE.onDidChangeFullscreen;var yi=typeof navigator=="object"?navigator.userAgent:"",Er=yi.indexOf("Firefox")>=0,Th=yi.indexOf("AppleWebKit")>=0,vn=yi.indexOf("Chrome")>=0,Dh=!vn&&yi.indexOf("Safari")>=0;yi.indexOf("Electron/")>=0;yi.indexOf("Android")>=0;var Ns=!1;if(typeof At.matchMedia=="function"){let t=At.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=At.matchMedia("(display-mode: fullscreen)");Ns=t.matches,Mh(At,t,({matches:i})=>{Ns&&e.matches||(Ns=i)})}var gi="en",Mr=!1,Rr=!1,cs=!1,La=!1,Zi,ds=gi,Fn=gi,Ah,Mt,ii=globalThis,Ze;typeof ii.vscode<"u"&&typeof ii.vscode.process<"u"?Ze=ii.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ze=process);var Ph=typeof Ze?.versions?.electron=="string",$h=Ph&&Ze?.type==="renderer";if(typeof Ze=="object"){Mr=Ze.platform==="win32",Rr=Ze.platform==="darwin",cs=Ze.platform==="linux",cs&&Ze.env.SNAP&&Ze.env.SNAP_REVISION,Ze.env.CI||Ze.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zi=gi,ds=gi;let t=Ze.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Zi=e.userLocale,Fn=e.osLocale,ds=e.resolvedLanguage||gi,Ah=e.languagePack?.translationsConfigFile}catch{}La=!0}else typeof navigator=="object"&&!$h?(Mt=navigator.userAgent,Mr=Mt.indexOf("Windows")>=0,Rr=Mt.indexOf("Macintosh")>=0,(Mt.indexOf("Macintosh")>=0||Mt.indexOf("iPad")>=0||Mt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,cs=Mt.indexOf("Linux")>=0,Mt?.indexOf("Mobi")>=0,ds=globalThis._VSCODE_NLS_LANGUAGE||gi,Zi=navigator.language.toLowerCase(),Fn=Zi):console.error("Unable to resolve platform.");var Ba=Mr,wt=Rr,Ih=cs,Nn=La,St=Mt,Ot=ds,Oh;(t=>{function e(){return Ot}t.value=e;function i(){return Ot.length===2?Ot==="en":Ot.length>=3?Ot[0]==="e"&&Ot[1]==="n"&&Ot[2]==="-":!1}t.isDefaultVariant=i;function s(){return Ot==="en"}t.isDefault=s})(Oh||={});var Fh=typeof ii.postMessage=="function"&&!ii.importScripts;(()=>{if(Fh){let t=[];ii.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),ii.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Nh=!!(St&&St.indexOf("Chrome")>=0);St&&St.indexOf("Firefox")>=0;!Nh&&St&&St.indexOf("Safari")>=0;St&&St.indexOf("Edg/")>=0;St&&St.indexOf("Android")>=0;var ci=typeof navigator=="object"?navigator:{};Nn||document.queryCommandSupported&&document.queryCommandSupported("copy")||ci&&ci.clipboard&&ci.clipboard.writeText,Nn||ci&&ci.clipboard&&ci.clipboard.readText;var mn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ws=new mn,Wn=new mn,zn=new mn,Wh=new Array(230),Ea;(t=>{function e(l){return Ws.keyCodeToStr(l)}t.toString=e;function i(l){return Ws.strToKeyCode(l)}t.fromString=i;function s(l){return Wn.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return zn.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return Wn.strToKeyCode(l)||zn.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ws.keyCodeToStr(l)}t.toElectronAccelerator=o})(Ea||={});var zh=class Ma{constructor(e,i,s,r,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof Ma&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Hh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Hh=class{constructor(t){if(t.length===0)throw _h("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e{function e(i){return i===t.None||i===t.Cancelled||i instanceof Jh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Fe.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ra})})(Xh||={});var Jh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Ra:(this._emitter||(this._emitter=new A),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},wn=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new yr("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new yr("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},Zh=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,s=globalThis){if(this.isDisposed)throw new yr("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},i);this.disposable=re(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Qh;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(Qh||={});var Kn=class rt{static fromArray(e){return new rt(i=>{i.emitMany(e)})}static fromPromise(e){return new rt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new rt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new rt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new A,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new rt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return rt.map(this,e)}static filter(e,i){return new rt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return rt.filter(this,e)}static coalesce(e){return rt.filter(e,i=>!!i)}coalesce(){return rt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return rt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Kn.EMPTY=Kn.fromArray([]);var{getWindow:mt,getWindowId:ec,onDidRegisterWindow:tc}=function(){let t=new Map,e={window:At,disposables:new jt};t.set(At.vscodeWindowId,e);let i=new A,s=new A,r=new A;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return j.None;let l=new jt,h={window:o,disposables:l.add(new jt)};return t.set(o.vscodeWindowId,h),l.add(re(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(H(o,Me.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:At},getDocument(o){return mt(o).document}}}(),ic=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function H(t,e,i,s){return new ic(t,e,i,s)}var Vn=function(t,e,i,s){return H(t,e,i,s)},Sn,sc=class extends Zh{constructor(t){super(),this.defaultTarget=t&&mt(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},jn=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){hs(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),s.set(n,!0);o.length>0;)o.sort(jn.sort),o.shift().execute();s.set(n,!1)};Sn=(n,o,l=0)=>{let h=ec(n),a=new jn(o,l),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),a}})();function rc(t){let e=t.getBoundingClientRect(),i=mt(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Me={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},nc=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=Ge(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Ge(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Ge(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Ge(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Ge(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Ge(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Ge(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Ge(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Ge(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Ge(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Ge(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Ge(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Ge(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Ge(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ge(t){return typeof t=="number"?`${t}px`:t}function zi(t){return new nc(t)}var Ta=class{constructor(){this._hooks=new jt,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(re(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=mt(e)}this._hooks.add(H(o,Me.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(H(o,Me.POINTER_UP,l=>this.stopMonitoring(!0)))}};function oc(t,e,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var pt;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(pt||={});var $i=class Ne extends j{constructor(){super(),this.dispatched=!1,this.targets=new On,this.ignoreTargets=new On,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Fe.runAndSubscribe(tc,({window:e,disposables:i})=>{i.add(H(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(H(e.document,"touchend",s=>this.onTouchEnd(e,s))),i.add(H(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:At,disposables:this._store}))}static addTarget(e){if(!Ne.isTouchDevice())return j.None;Ne.INSTANCE||(Ne.INSTANCE=new Ne);let i=Ne.INSTANCE.targets.push(e);return re(i)}static ignoreTarget(e){if(!Ne.isTouchDevice())return j.None;Ne.INSTANCE||(Ne.INSTANCE=new Ne);let i=Ne.INSTANCE.ignoreTargets.push(e);return re(i)}static isTouchDevice(){return"ontouchstart"in At||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s=Ne.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(pt.Contextmenu,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(r===1){let c=Xe(h.rollingPageX),_=Xe(h.rollingPageY),f=Xe(h.rollingTimestamps)-h.rollingTimestamps[0],d=c-h.rollingPageX[0],m=_-h.rollingPageY[0],y=[...this.targets].filter(k=>h.initialTarget instanceof Node&&k.contains(h.initialTarget));this.inertia(e,y,s,Math.abs(d)/f,d>0?1:-1,c,Math.abs(m)/f,m>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(pt.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(e){if(e.type===pt.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>Ne.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,e.tapCount=s}else(e.type===pt.Change||e.type===pt.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,s,r,n,o,l,h,a){this.handle=Sn(e,()=>{let c=Date.now(),_=c-s,f=0,d=0,m=!0;r+=Ne.SCROLL_FRICTION*_,l+=Ne.SCROLL_FRICTION*_,r>0&&(m=!1,f=n*r*_),l>0&&(m=!1,d=h*l*_);let y=this.newGestureEvent(pt.Change);y.translationX=f,y.translationY=d,i.forEach(k=>k.dispatchEvent(y)),m||this.inertia(e,i,c,r,n,o+f,l,h,a+d)})}onTouchMove(e){let i=Date.now();for(let s=0,r=e.changedTouches.length;s3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};$i.SCROLL_FRICTION=-.005,$i.HOLD_DELAY=700,$i.CLEAR_TAP_COUNT_TIME=400,ue([oc],$i,"isTouchDevice",1);var ac=$i,bn=class extends j{onclick(e,i){this._register(H(e,Me.CLICK,s=>i(new Qi(mt(e),s))))}onmousedown(e,i){this._register(H(e,Me.MOUSE_DOWN,s=>i(new Qi(mt(e),s))))}onmouseover(e,i){this._register(H(e,Me.MOUSE_OVER,s=>i(new Qi(mt(e),s))))}onmouseleave(e,i){this._register(H(e,Me.MOUSE_LEAVE,s=>i(new Qi(mt(e),s))))}onkeydown(e,i){this._register(H(e,Me.KEY_DOWN,s=>i(new Hn(s))))}onkeyup(e,i){this._register(H(e,Me.KEY_UP,s=>i(new Hn(s))))}oninput(e,i){this._register(H(e,Me.INPUT,i))}onblur(e,i){this._register(H(e,Me.BLUR,i))}onfocus(e,i){this._register(H(e,Me.FOCUS,i))}onchange(e,i){this._register(H(e,Me.CHANGE,i))}ignoreGesture(e){return ac.ignoreTarget(e)}},Gn=11,lc=class extends bn{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Gn+"px",this.domNode.style.height=Gn+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new Ta),this._register(Vn(this.bgDomNode,Me.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Vn(this.domNode,Me.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new sc),this._pointerdownScheduleRepeatTimer=this._register(new wn)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,mt(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},hc=class Tr{constructor(e,i,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new Tr(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Tr(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},cc=class extends j{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new hc(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;e?s=new Xn(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=Xn.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},Yn=class{constructor(e,i,s){this.scrollLeft=e,this.scrollTop=i,this.isDone=s}};function zs(t,e){let i=e-t;return function(s){return t+i*_c(s)}}function dc(t,e,i){return function(s){return s2.5*s){let r,n;return e{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},gc=140,Da=class extends bn{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new fc(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ta),this._shouldRender=!0,this.domNode=zi(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(H(this.domNode.domNode,Me.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new lc(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,s,r){this.slider=zi(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(H(this.slider.domNode,Me.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,s=i+this._scrollbarState.getSliderPosition(),r=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,s=e.offsetY;else{let n=rc(this.domNode.domNode);i=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(i,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(Ba&&l>gc){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Aa=class Ar{constructor(e,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ar(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*i),h=r>0&&r>s;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*l/r))),c=(l-a)/(r-s),_=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:c,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let e=Ar._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,s=this._scrollPosition;return i0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),i){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(r,o),1),a=Math.max(Math.min(n,l),1),c=Math.max(r,o),_=Math.max(n,l);c%h===0&&_%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Pr.INSTANCE=new Pr;var Sc=Pr,bc=class extends bn{constructor(t,e,i){super(),this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new A),this.onWillScroll=this._onWillScroll.event,this._options=Cc(e),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new vc(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new pc(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=zi(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=zi(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=zi(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new wn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=oi(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,wt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new qn(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=oi(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new qn(i))};this._mouseWheelToDispose.push(H(this._listenOnDomNode,Me.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let e=Sc.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let r=t.deltaY*this._options.mouseWheelScrollSensitivity,n=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+r===0?n=r=0:Math.abs(r)>=Math.abs(n)?n=0:r=0),this._options.flipAxes&&([r,n]=[n,r]);let o=!wt&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=r,r=0),t.browserEvent&&t.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),h={};if(r){let a=Jn*r,c=l.scrollTop-(a<0?Math.floor(a):Math.ceil(a));this._verticalScrollbar.writeScrollPosition(h,c)}if(n){let a=Jn*n,c=l.scrollLeft-(a<0?Math.floor(a):Math.ceil(a));this._horizontalScrollbar.writeScrollPosition(h,c)}h=this._scrollable.validateScrollPosition(h),(l.scrollLeft!==h.scrollLeft||l.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,s=i?" left":"",r=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),mc)}},yc=class extends bc{constructor(e,i,s){super(e,i,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Cc(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,wt&&(e.className+=" mac"),e}var $r=class extends j{constructor(e,i,s,r,n,o,l,h){super(),this._bufferService=s,this._optionsService=l,this._renderService=h,this._onRequestScrollLines=this._register(new A),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new cc({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Sn(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new yc(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(re(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(re(()=>this._styleElement.remove())),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` +`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=i-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};$r=ue([P(2,Ve),P(3,$t),P(4,_a),P(5,bi),P(6,je),P(7,It)],$r);var Ir=class extends j{constructor(e,i,s,r,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(re(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,i=e.element){if(!i)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Ir=ue([P(1,Ve),P(2,$t),P(3,Gi),P(4,It)],Ir);var xc=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,s){return i>=e.startBufferLine-this._linePadding[s||"full"]&&i<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},_t={full:0,left:0,center:0,right:0},Ft={full:0,left:0,center:0,right:0},ki={full:0,left:0,center:0,right:0},ys=class extends j{constructor(e,i,s,r,n,o,l,h){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new xc,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(re(()=>this._canvas?.remove()));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);Ft.full=this._canvas.width,Ft.left=e,Ft.center=i,Ft.right=e,this._refreshDrawHeightConstants(),ki.full=1,ki.left=1,ki.center=1+Ft.left,ki.right=1+Ft.left+Ft.center}_refreshDrawHeightConstants(){_t.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);_t.left=i,_t.center=i,_t.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ki[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_t[e.position||"full"]/2),Ft[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_t[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ys=ue([P(2,Ve),P(3,Gi),P(4,It),P(5,je),P(6,bi),P(7,$t)],ys);var E;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=` +`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(E||={});var us;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(us||={});var Pa;(t=>t.ST=`${E.ESC}\\`)(Pa||={});var Or=class{constructor(e,i,s,r,n,o){this._textarea=e,this._compositionView=i,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;i.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(i.start,this._compositionPosition.start):s=this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(e,"");this._dataAlreadySent=s,i.length>e.length?this._coreService.triggerDataEvent(s,!0):i.lengththis.updateCompositionElements(!0),0)}}};Or=ue([P(2,Ve),P(3,je),P(4,li),P(5,It)],Or);var Re=0,Te=0,De=0,ce=0,Zn={css:"#00000000",rgba:0},Se;(t=>{function e(r,n,o,l){return l!==void 0?`#${Xt(r)}${Xt(n)}${Xt(o)}${Xt(l)}`:`#${Xt(r)}${Xt(n)}${Xt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Se||={});var ie;(t=>{function e(h,a){if(ce=(a.rgba&255)/255,ce===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,_=a.rgba>>16&255,f=a.rgba>>8&255,d=h.rgba>>24&255,m=h.rgba>>16&255,y=h.rgba>>8&255;Re=d+Math.round((c-d)*ce),Te=m+Math.round((_-m)*ce),De=y+Math.round((f-y)*ce);let k=Se.toCss(Re,Te,De),R=Se.toRgba(Re,Te,De);return{css:k,rgba:R}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let _=_s.ensureContrastRatio(h.rgba,a.rgba,c);if(_)return Se.toColor(_>>24&255,_>>16&255,_>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Re,Te,De]=_s.toChannels(a),{css:Se.toCss(Re,Te,De),rgba:a}}t.opaque=r;function n(h,a){return ce=Math.round(a*255),[Re,Te,De]=_s.toChannels(h.rgba),{css:Se.toCss(Re,Te,De,ce),rgba:Se.toRgba(Re,Te,De,ce)}}t.opacity=n;function o(h,a){return ce=h.rgba&255,n(h,ce*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(ie||={});var ae;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Re=parseInt(r.slice(1,2).repeat(2),16),Te=parseInt(r.slice(2,3).repeat(2),16),De=parseInt(r.slice(3,4).repeat(2),16),Se.toColor(Re,Te,De);case 5:return Re=parseInt(r.slice(1,2).repeat(2),16),Te=parseInt(r.slice(2,3).repeat(2),16),De=parseInt(r.slice(3,4).repeat(2),16),ce=parseInt(r.slice(4,5).repeat(2),16),Se.toColor(Re,Te,De,ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Re=parseInt(n[1]),Te=parseInt(n[2]),De=parseInt(n[3]),ce=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Se.toColor(Re,Te,De,ce);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Re,Te,De,ce]=e.getImageData(0,0,1,1).data,ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Se.toRgba(Re,Te,De,ce),css:r}}t.toColor=s})(ae||={});var Ue;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),_=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+_*.0722}t.relativeLuminance2=i})(Ue||={});var _s;(t=>{function e(o,l){if(ce=(l&255)/255,ce===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,_=o>>24&255,f=o>>16&255,d=o>>8&255;return Re=_+Math.round((h-_)*ce),Te=f+Math.round((a-f)*ce),De=d+Math.round((c-d)*ce),Se.toRgba(Re,Te,De)}t.blend=e;function i(o,l,h){let a=Ue.relativeLuminance(o>>8),c=Ue.relativeLuminance(l>>8);if(xt(a,c)>8));if(m>8));return m>k?d:y}return d}let _=r(o,l,h),f=xt(a,Ue.relativeLuminance(_>>8));if(f>8));return f>m?_:d}return _}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));for(;y0||d>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),d-=Math.max(0,Math.ceil(d*.1)),m-=Math.max(0,Math.ceil(m*.1)),y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));return(f<<24|d<<16|m<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));for(;y>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(_s||={});function Xt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function xt(t,e){return t1){let c=this._getJoinedRanges(s,o,n,e,r);for(let _=0;_1){let a=this._getJoinedRanges(s,o,n,e,r);for(let c=0;c=W,C=p,x=this._workCell;if(d.length>0&&p===d[0][0]&&b){let N=d.shift(),be=this._isCellInSelection(N[0],i);for(T=N[0]+1;T=N[1],b?(w=!0,x=new kc(this._workCell,e.translateToString(!0,N[0],N[1]),N[1]-N[0]),C=N[1]-1,g=x.getWidth()):W=N[1]}let M=this._isCellInSelection(p,i),F=s&&p===o,K=u&&p>=c&&p<=_,z=!1;this._decorationService.forEachDecorationAtCell(p,i,void 0,N=>{z=!0});let pe=x.getChars()||Vt;if(pe===" "&&(x.isUnderline()||x.isOverline())&&(pe=" "),le=g*h-a.get(pe,x.isBold(),x.isItalic()),!k)k=this._document.createElement("span");else if(R&&(M&&Y||!M&&!Y&&x.bg===S)&&(M&&Y&&m.selectionForeground||x.fg===L)&&x.extended.ext===B&&K===$&&le===U&&!F&&!w&&!z&&b){x.isInvisible()?D+=Vt:D+=pe,R++;continue}else R&&(k.textContent=D),k=this._document.createElement("span"),R=0,D="";if(S=x.bg,L=x.fg,B=x.extended.ext,$=K,U=le,Y=M,w&&o>=p&&o<=C&&(o=p),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(v.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&v.push("xterm-cursor-blink"),v.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":v.push("xterm-cursor-outline");break;case"block":v.push("xterm-cursor-block");break;case"bar":v.push("xterm-cursor-bar");break;case"underline":v.push("xterm-cursor-underline");break}}if(x.isBold()&&v.push("xterm-bold"),x.isItalic()&&v.push("xterm-italic"),x.isDim()&&v.push("xterm-dim"),x.isInvisible()?D=Vt:D=x.getChars()||Vt,x.isUnderline()&&(v.push(`xterm-underline-${x.extended.underlineStyle}`),D===" "&&(D=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${ji.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let N=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&N<8&&(N+=8),k.style.textDecorationColor=m.ansi[N].css}x.isOverline()&&(v.push("xterm-overline"),D===" "&&(D=" ")),x.isStrikethrough()&&v.push("xterm-strikethrough"),K&&(k.style.textDecoration="underline");let q=x.getFgColor(),ne=x.getFgColorMode(),O=x.getBgColor(),I=x.getBgColorMode(),G=!!x.isInverse();if(G){let N=q;q=O,O=N;let be=ne;ne=I,I=be}let X,_e,Le=!1;this._decorationService.forEachDecorationAtCell(p,i,void 0,N=>{N.options.layer!=="top"&&Le||(N.backgroundColorRGB&&(I=50331648,O=N.backgroundColorRGB.rgba>>8&16777215,X=N.backgroundColorRGB),N.foregroundColorRGB&&(ne=50331648,q=N.foregroundColorRGB.rgba>>8&16777215,_e=N.foregroundColorRGB),Le=N.options.layer==="top")}),!Le&&M&&(X=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,O=X.rgba>>8&16777215,I=50331648,Le=!0,m.selectionForeground&&(ne=50331648,q=m.selectionForeground.rgba>>8&16777215,_e=m.selectionForeground)),Le&&v.push("xterm-decoration-top");let Be;switch(I){case 16777216:case 33554432:Be=m.ansi[O],v.push(`xterm-bg-${O}`);break;case 50331648:Be=Se.toColor(O>>16,O>>8&255,O&255),this._addStyle(k,`background-color:#${Qn((O>>>0).toString(16),"0",6)}`);break;case 0:default:G?(Be=m.foreground,v.push("xterm-bg-257")):Be=m.background}switch(X||x.isDim()&&(X=ie.multiplyOpacity(Be,.5)),ne){case 16777216:case 33554432:x.isBold()&&q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(q+=8),this._applyMinimumContrast(k,Be,m.ansi[q],x,X,void 0)||v.push(`xterm-fg-${q}`);break;case 50331648:let N=Se.toColor(q>>16&255,q>>8&255,q&255);this._applyMinimumContrast(k,Be,N,x,X,_e)||this._addStyle(k,`color:#${Qn(q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,Be,m.foreground,x,X,_e)||G&&v.push("xterm-fg-257")}v.length&&(k.className=v.join(" "),v.length=0),!F&&!w&&!z&&b?R++:k.textContent=D,le!==this.defaultSpacing&&(k.style.letterSpacing=`${le}px`),f.push(k),p=C}return k&&R&&(k.textContent=D),f}_applyMinimumContrast(e,i,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Ec(r.getCode()))return!1;let l=this._getContrastCache(r),h;if(!n&&!o&&(h=l.getColor(i.rgba,s.rgba)),h===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=ie.ensureContrastRatio(n||i,o||s,a),l.setColor((n||i).rgba,(o||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&i>=s[1]&&e=s[1]&&e>=r[0]&&i<=r[1]:i>s[1]&&i=s[0]&&e=s[0]}};Fr=ue([P(1,pa),P(2,je),P(3,$t),P(4,li),P(5,Gi),P(6,bi)],Fr);function Qn(t,e,i){for(;t.length0&&(this._flat[r]=l),l}let n=e;i&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;i&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let s=this._measureElements[i];return s.textContent=e.repeat(32),s.offsetWidth/32}},Tc=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,s,r=!1){if(this.selectionStart=i,this.selectionEnd=s,!i||!s||i[0]===s[0]&&i[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,l=s[1]-n,h=Math.max(o,0),a=Math.min(l,e.rows-1);if(h>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=h,this.viewportCappedEndRow=a,this.startCol=i[0],this.endCol=s[0]}isCellSelected(e,i,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&s>=this.viewportCappedStartRow&&i=this.viewportCappedStartRow&&i>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s=this.startCol&&i=this.startCol):!1}};function Dc(){return new Tc}var Hs="xterm-dom-renderer-owner-",st="xterm-rows",ts="xterm-fg-",eo="xterm-bg-",Li="xterm-focus",is="xterm-selection",Ac=1,Nr=class extends j{constructor(e,i,s,r,n,o,l,h,a,c,_,f,d,m){super(),this._terminal=e,this._document=i,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=a,this._optionsService=c,this._bufferService=_,this._coreService=f,this._coreBrowserService=d,this._themeService=m,this._terminalClass=Ac++,this._rowElements=[],this._selectionRenderModel=Dc(),this.onRequestRedraw=this._register(new A).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(st),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(is),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Mc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(y=>this._injectCss(y))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(Fr,document),this._element.classList.add(Hs+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(y=>this._handleLinkHover(y))),this._register(this._linkifier2.onHideLinkUnderline(y=>this._handleLinkLeave(y))),this._register(re(()=>{this._element.classList.remove(Hs+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Rc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${st} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${st} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${st} .xterm-dim { color: ${ie.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${r} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${is} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${is} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${is} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())i+=`${this._terminalSelector} .${ts}${o} { color: ${l.css}; }${this._terminalSelector} .${ts}${o}.xterm-dim { color: ${ie.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${eo}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${ts}257 { color: ${ie.opaque(e.background).css}; }${this._terminalSelector} .${ts}257.xterm-dim { color: ${ie.multiplyOpacity(ie.opaque(e.background),.5).css}; }${this._terminalSelector} .${eo}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let s=this._rowElements.length;s<=i;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Li),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Li),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,s),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let a=e[0]>i[0];h.appendChild(this._createSelectionElement(o,a?i[0]:e[0],a?e[0]:i[0],l-o+1))}else{let a=r===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,a,c));let _=l-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,_)),o!==l){let f=n===l?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,0,f))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,s,r=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=i;a++){let c=a+s.ydisp,_=this._rowElements[a],f=s.lines.get(c);if(!_||!f)break;_.replaceChildren(...this._rowFactory.createRow(f,c,c===r,l,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Hs}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,s,r,n,o){s<0&&(e=0),r<0&&(i=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,a=h.ybase+h.y,c=Math.min(h.x,n-1),_=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=s;m<=r;++m){let y=m+h.ydisp,k=this._rowElements[m],R=h.lines.get(y);if(!k||!R)break;k.replaceChildren(...this._rowFactory.createRow(R,y,y===a,f,d,c,_,this.dimensions.css.cell.width,this._widthCache,o?m===s?e:0:-1,o?(m===r?i:n)-1:-1))}}};Nr=ue([P(7,fn),P(8,Ds),P(9,je),P(10,Ve),P(11,li),P(12,$t),P(13,bi)],Nr);var Wr=class extends j{constructor(e,i,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new A),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new $c(this._optionsService))}catch{this._measureStrategy=this._register(new Pc(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Wr=ue([P(2,je)],Wr);var $a=class extends j{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},Pc=class extends $a{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},$c=class extends $a{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Ic=class extends j{constructor(e,i,s){super(),this._textarea=e,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Oc(this._window)),this._onDprChange=this._register(new A),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new A),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Fe.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(H(this._textarea,"focus",()=>this._isFocused=!0)),this._register(H(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Oc=class extends j{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Si),this._onDprChange=this._register(new A),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(re(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=H(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Fc=class extends j{constructor(){super(),this.linkProviders=[],this._register(re(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function yn(t,e,i){let s=i.getBoundingClientRect(),r=t.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function Nc(t,e,i,s,r,n,o,l,h){if(!n)return;let a=yn(t,e,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),s+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var zr=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,s,r,n){return Nc(window,e,i,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let s=yn(window,e,i);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};zr=ue([P(0,It),P(1,Ds)],zr);var Wc=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Ia={};Xl(Ia,{getSafariVersion:()=>Hc,isChromeOS:()=>Wa,isFirefox:()=>Oa,isIpad:()=>Uc,isIphone:()=>qc,isLegacyEdge:()=>zc,isLinux:()=>Cn,isMac:()=>xs,isNode:()=>As,isSafari:()=>Fa,isWindows:()=>Na});var As=typeof process<"u"&&"title"in process,Yi=As?"node":navigator.userAgent,Xi=As?"node":navigator.platform,Oa=Yi.includes("Firefox"),zc=Yi.includes("Edge"),Fa=/^((?!chrome|android).)*safari/i.test(Yi);function Hc(){if(!Fa)return 0;let t=Yi.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var xs=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Xi),Uc=Xi==="iPad",qc=Xi==="iPhone",Na=["Windows","Win16","Win32","WinCE"].includes(Xi),Cn=Xi.indexOf("Linux")>=0,Wa=/\bCrOS\b/.test(Yi),za=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._ir){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Kc=class extends za{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},Vc=class extends za{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ks=!As&&"requestIdleCallback"in window?Vc:Kc,jc=class{constructor(){this._queue=new ks}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Hr=class extends j{constructor(e,i,s,r,n,o,l,h,a){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new Si),this._pausedResizeTask=new jc,this._observerDisposable=this._register(new Si),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new A),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new A),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new A),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new A),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Wc((c,_)=>this._renderRows(c,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Gc(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(re(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(i),this._observerDisposable.value=re(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),i=Math.max(i,r.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,s){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,i,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Hr=ue([P(2,je),P(3,Ds),P(4,li),P(5,Gi),P(6,Ve),P(7,$t),P(8,bi)],Hr);var Gc=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Yc(t,e,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Zc(r,n,t,e,i,s)+Ps(n,e,i,s)+Qc(r,n,t,e,i,s);let o;if(n===e)return o=r>t?"D":"C",qi(Math.abs(r-t),Ui(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),h=Jc(n>e?t:r,i)+(l-1)*i.cols+1+Xc(n>e?r:t);return qi(h,Ui(o,s))}function Xc(t,e){return t-1}function Jc(t,e){return e.cols-t}function Zc(t,e,i,s,r,n){return Ps(e,s,r,n).length===0?"":qi(Ua(t,e,t,e-ai(e,r),!1,r).length,Ui("D",n))}function Ps(t,e,i,s){let r=t-ai(t,i),n=e-ai(e,i),o=Math.abs(r-n)-ed(t,e,i);return qi(o,Ui(Ha(t,e),s))}function Qc(t,e,i,s,r,n){let o;Ps(e,s,r,n).length>0?o=s-ai(s,r):o=e;let l=s,h=td(t,e,i,s,r,n);return qi(Ua(t,o,i,l,h==="C",r).length,Ui(h,n))}function ed(t,e,i){let s=0,r=t-ai(t,i),n=e-ai(e,i);for(let o=0;o=0&&t0?o=s-ai(s,r):o=e,t=i&&oe?"A":"B"}function Ua(t,e,i,s,r,n){let o=t,l=e,h="";for(;(o!==i||l!==s)&&l>=0&&ln.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,t,o),o=0,t=0,l++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,t+1),o=n.cols-1,t=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,t,o)}function Ui(t,e){let i=e?"O":"[";return E.ESC+i+t}function qi(t,e){t=Math.floor(t);let i="";for(let s=0;sthis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function to(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Us=50,sd=15,rd=50,nd=500,od=" ",ad=new RegExp(od,"g"),Ur=class extends j{constructor(e,i,s,r,n,o,l,h,a){super(),this._element=e,this._screenElement=i,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=h,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ct,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new A),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new A),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new A),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new A),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new id(this._bufferService),this._activeSelectionMode=0,this._register(re(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]n.replace(ad," ")).join(Na?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Cn&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!i?!1:this._areCoordsInSelection(i,s,r)}isCellInSelection(e,i){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,i],s,r)}_areCoordsInSelection(e,i,s){return e[1]>i[1]&&e[1]=i[0]&&e[0]=i[0]}_selectWordAtCursor(e,i){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=to(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=yn(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=s?0:(i>s&&(i-=s),i=Math.min(Math.max(i,-Us),Us),i/=Us,i/Math.abs(i)+Math.round(i*(sd-1)))}shouldForceSelection(e){return xs?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),rd)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(xs&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ithis._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let s=i;for(let r=0;i>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&i!==r&&(s+=n-1)}return s}setSelection(e,i,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),a=h,c=e[0]-h,_=0,f=0,d=0,m=0;if(l.charAt(h)===" "){for(;h>0&&l.charAt(h-1)===" ";)h--;for(;a1&&(m+=T-1,a+=T-1);R>0&&h>0&&!this._isCharWordSeparator(o.loadCell(R-1,this._workCell));){o.loadCell(R-1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,R--):S>1&&(d+=S-1,h-=S-1),h--,R--}for(;D1&&(m+=S-1,a+=S-1),a++,D++}}a++;let y=h+c-_+d,k=Math.min(this._bufferService.cols,a-h+_+f-d-m);if(!(!i&&l.slice(h,a).trim()==="")){if(s&&y===0&&o.getCodePoint(0)!==32){let R=n.lines.get(e[1]-1);if(R&&o.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let T=this._bufferService.cols-D.start;y-=T,k+=T}}}if(r&&y+k===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let R=n.lines.get(e[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(k+=D.length)}}return{start:y,length:k}}}_selectWordAt(e,i){let s=this._getWordAt(e,i);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let s=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=to(s,this._bufferService.cols)}};Ur=ue([P(3,Ve),P(4,li),P(5,gn),P(6,je),P(7,It),P(8,$t)],Ur);var io=class{constructor(){this._data={}}set(e,i,s){this._data[e]||(this._data[e]={}),this._data[e][i]=s}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},so=class{constructor(){this._color=new io,this._css=new io}setCss(e,i,s){this._css.set(e,i,s)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,s){this._color.set(e,i,s)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},ye=Object.freeze((()=>{let t=[ae.toColor("#2e3436"),ae.toColor("#cc0000"),ae.toColor("#4e9a06"),ae.toColor("#c4a000"),ae.toColor("#3465a4"),ae.toColor("#75507b"),ae.toColor("#06989a"),ae.toColor("#d3d7cf"),ae.toColor("#555753"),ae.toColor("#ef2929"),ae.toColor("#8ae234"),ae.toColor("#fce94f"),ae.toColor("#729fcf"),ae.toColor("#ad7fa8"),ae.toColor("#34e2e2"),ae.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=e[i/36%6|0],r=e[i/6%6|0],n=e[i%6];t.push({css:Se.toCss(s,r,n),rgba:Se.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;t.push({css:Se.toCss(s,s,s),rgba:Se.toRgba(s,s,s)})}return t})()),Zt=ae.toColor("#ffffff"),Ii=ae.toColor("#000000"),ro=ae.toColor("#ffffff"),no=Ii,Bi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ld=Zt,qr=class extends j{constructor(e){super(),this._optionsService=e,this._contrastCache=new so,this._halfContrastCache=new so,this._onChangeColors=this._register(new A),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Zt,background:Ii,cursor:ro,cursorAccent:no,selectionForeground:void 0,selectionBackgroundTransparent:Bi,selectionBackgroundOpaque:ie.blend(Ii,Bi),selectionInactiveBackgroundTransparent:Bi,selectionInactiveBackgroundOpaque:ie.blend(Ii,Bi),scrollbarSliderBackground:ie.opacity(Zt,.2),scrollbarSliderHoverBackground:ie.opacity(Zt,.4),scrollbarSliderActiveBackground:ie.opacity(Zt,.5),overviewRulerBorder:Zt,ansi:ye.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=Q(e.foreground,Zt),i.background=Q(e.background,Ii),i.cursor=ie.blend(i.background,Q(e.cursor,ro)),i.cursorAccent=ie.blend(i.background,Q(e.cursorAccent,no)),i.selectionBackgroundTransparent=Q(e.selectionBackground,Bi),i.selectionBackgroundOpaque=ie.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=Q(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=ie.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?Q(e.selectionForeground,Zn):void 0,i.selectionForeground===Zn&&(i.selectionForeground=void 0),ie.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=ie.opacity(i.selectionBackgroundTransparent,.3)),ie.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=ie.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=Q(e.scrollbarSliderBackground,ie.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=Q(e.scrollbarSliderHoverBackground,ie.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=Q(e.scrollbarSliderActiveBackground,ie.opacity(i.foreground,.5)),i.overviewRulerBorder=Q(e.overviewRulerBorder,ld),i.ansi=ye.slice(),i.ansi[0]=Q(e.black,ye[0]),i.ansi[1]=Q(e.red,ye[1]),i.ansi[2]=Q(e.green,ye[2]),i.ansi[3]=Q(e.yellow,ye[3]),i.ansi[4]=Q(e.blue,ye[4]),i.ansi[5]=Q(e.magenta,ye[5]),i.ansi[6]=Q(e.cyan,ye[6]),i.ansi[7]=Q(e.white,ye[7]),i.ansi[8]=Q(e.brightBlack,ye[8]),i.ansi[9]=Q(e.brightRed,ye[9]),i.ansi[10]=Q(e.brightGreen,ye[10]),i.ansi[11]=Q(e.brightYellow,ye[11]),i.ansi[12]=Q(e.brightBlue,ye[12]),i.ansi[13]=Q(e.brightMagenta,ye[13]),i.ansi[14]=Q(e.brightCyan,ye[14]),i.ansi[15]=Q(e.brightWhite,ye[15]),e.extendedAnsi){let s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;rn.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...s)}},dd={trace:0,debug:1,info:2,warn:3,error:4,off:5},ud="xterm.js: ",Kr=class extends j{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=dd[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;ithis._length)for(let i=this._length;i=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;rthis._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,s){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=i-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+i+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[e*V+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*V+0]=e|2097152|i[2]<<22):this._data[e*V+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*V+0]>>22}hasWidth(e){return this._data[e*V+0]&12582912}getFg(e){return this._data[e*V+1]}getBg(e){return this._data[e*V+2]}hasContent(e){return this._data[e*V+0]&4194303}getCodePoint(e){let i=this._data[e*V+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*V+0]&2097152}getString(e){let i=this._data[e*V+0];return i&2097152?this._combined[e]:i&2097151?Kt(i&2097151):""}isProtected(e){return this._data[e*V+2]&536870912}loadCell(e,i){return ss=e*V,i.content=this._data[ss+0],i.fg=this._data[ss+1],i.bg=this._data[ss+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*V+0]=i.content,this._data[e*V+1]=i.fg,this._data[e*V+2]=i.bg}setCellFromCodepoint(e,i,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*V+0]=i|s<<22,this._data[e*V+1]=r.fg,this._data[e*V+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[e*V+0];r&2097152?this._combined[e]+=Kt(i):r&2097151?(this._combined[e]=Kt(r&2097151)+Kt(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*V+0]=r}insertCells(e,i,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i=0;--n)this.setCell(e+i+n,this.loadCell(e+n,r));for(let n=0;nthis.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*qs=0;--e)if(this._data[e*V+0]&4194303)return e+(this._data[e*V+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*V+0]&4194303||this._data[e*V+2]&50331648)return e+(this._data[e*V+0]>>22);return 0}copyCellsFrom(e,i,s,r,n){let o=e._data;if(n)for(let h=r-1;h>=0;h--){for(let a=0;a=i&&(this._combined[a-i+s]=e._combined[a])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i>22||1}return r&&r.push(i),n}};function _d(t,e,i,s,r,n){let o=[];for(let l=0;l=l&&s0&&(k>_||c[k].getTrimmedLength()===0);k--)y++;y>0&&(o.push(l+c.length-y),o.push(y)),l+=c.length-1}return o}function fd(t,e){let i=[],s=0,r=e[s],n=0;for(let o=0;oKi(t,a,e)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;lh&&(n-=h,o++);let a=t[o].getWidth(n-1)===2;a&&n--;let c=a?i-1:i;s.push(c),l+=c}return s}function Ki(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let s=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return s&&r?i-1:i}var Ka=class Va{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Va._nextId++,this._onDispose=this.register(new A),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),oi(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ka._nextId=1;var vd=Ka,ke={},Qt=ke.B;ke[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};ke.A={"#":"£"};ke.B=void 0;ke[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ke.C=ke[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ke.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ke.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ke.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ke.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ke.E=ke[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ke.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ke.H=ke[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ke["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ao=4294967295,lo=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=me.clone(),this.savedCharset=Qt,this.markers=[],this._nullCell=ct.fromCharData([0,ha,1,0]),this._whitespaceCell=ct.fromCharData([0,Vt,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ks,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oo(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new bs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new bs),this._whitespaceCell}getBlankLine(t,e){return new Oi(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&tao?ao:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=me);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new oo(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(me),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Oi(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=_d(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(me),i);if(s.length>0){let r=fd(this.lines,s);gd(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let s=this.getNullCell(me),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let T=this.ybase+this.y;if(T>=o&&T0&&(r.push({start:o+h.length+n,newLines:d}),n+=d.length),h.push(...d);let m=c.length-1,y=c[m];y===0&&(m--,y=c[m]);let k=h.length-_-1,R=a;for(;k>=0;){let T=Math.min(R,y);if(h[m]===void 0)break;if(h[m].copyCellsFrom(h[k],R-T,y-T,T,!0),y-=T,y===0&&(m--,y=c[m]),R-=T,R===0){k--;let S=Math.max(k,0);R=Ki(h,S,this._cols)}}for(let T=0;T0;)this.ybase===0?this.y0){let o=[],l=[];for(let y=0;y=0;y--)if(_&&_.start>a+f){for(let k=_.newLines.length-1;k>=0;k--)this.lines.set(y--,_.newLines[k]);y++,o.push({index:a+1,amount:_.newLines.length}),f+=_.newLines.length,_=r[++c]}else this.lines.set(y,l[a--]);let d=0;for(let y=o.length-1;y>=0;y--)o[y].index+=d,this.lines.onInsertEmitter.fire(o[y]),d+=o[y].amount;let m=Math.max(0,h+n-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(t,e,i=0,s){let r=this.lines.get(t);return r?r.translateToString(e,i,s):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.linei.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},md=class extends j{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new A),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new lo(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lo(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ja=2,Ga=1,Vr=class extends j{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new A),this.onResize=this._onResize.event,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,ja),this.rows=Math.max(t.rawOptions.rows||0,Ga),this.buffers=this._register(new md(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,s=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==t.fg||s.getBg(0)!==t.bg)&&(s=i.getBlankLine(t,e),this._cachedBlankLine=s),s.isWrapped=e;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),s!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};Vr=ue([P(0,je)],Vr);var di={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:xs,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},wd=["normal","bold","100","200","300","400","500","600","700","800","900"],Sd=class extends j{constructor(e){super(),this._onOptionChange=this._register(new A),this.onOptionChange=this._onOptionChange.event;let i={...di};for(let s in e)if(s in i)try{let r=e[s];i[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(re(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(s=>{s===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&i()})}_setupOptions(){let e=s=>{if(!(s in di))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,r)=>{if(!(s in di))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=di[e]),!bd(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=di[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=wd.includes(i)?i:di[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function bd(t){return t==="block"||t==="underline"||t==="bar"}function Fi(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let s in t)i[s]=e<=1?t[s]:t[s]&&Fi(t[s],e-1);return i}var ho=Object.freeze({insertMode:!1}),co=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jr=class extends j{constructor(e,i,s){super(),this._bufferService=e,this._logService=i,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new A),this.onData=this._onData.event,this._onUserInput=this._register(new A),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new A),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new A),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fi(ho),this.decPrivateModes=Fi(co)}reset(){this.modes=Fi(ho),this.decPrivateModes=Fi(co)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};jr=ue([P(0,Ve),P(1,fa),P(2,je)],jr);var uo={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Ks(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Vs=String.fromCharCode,_o={DEFAULT:t=>{let e=[Ks(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Vs(e[0])}${Vs(e[1])}${Vs(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ks(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ks(t,!0)};${t.x};${t.y}${e}`}},Gr=class extends j{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new A),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(uo))this.addProtocol(s,uo[s]);for(let s of Object.keys(_o))this.addEncoding(s,_o[s]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let s=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Gr=ue([P(0,Ve),P(1,li),P(2,je)],Gr);var js=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],yd=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Ce;function Cd(t,e){let i=0,s=e.length-1,r;if(te[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=ei.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return ei.createPropertyValue(0,s,r)}},ei=class fs{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new A,this.onChange=this._onChange.event;let e=new xd;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=fs.extractWidth(l);fs.extractShouldJoin(l)&&(h-=fs.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},kd=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function fo(t){let e=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Ei=2147483647,Ld=256,Ya=class Yr{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>Ld)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new Yr;if(!e.length)return i;for(let s=Array.isArray(e[0])?1:0;s>8,r=this._subParamsIdx[i]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Ei?Ei:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Ei?Ei:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let e={};for(let i=0;i>8,r=this._subParamsIdx[i]&255;r-s>0&&(e[i]=this._subParams.slice(s,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+e,Ei):e}},Mi=[],Bd=class{constructor(){this._state=0,this._active=Mi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Mi}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Mi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Mi,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Ts(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}start(){this.reset(),this._state=1}put(e,i,s){if(this._state!==3){if(this._state===1)for(;i0&&this._put(e,i,s)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Mi,this._id=-1,this._state=0}}},Je=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=Ts(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,i}},Ri=[],Ed=class{constructor(){this._handlers=Object.create(null),this._active=Ri,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ri}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ri,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ri,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(i)}put(e,i,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ts(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Ri,this._ident=0}},Ni=new Ya;Ni.addParam(0);var go=class{constructor(t){this._handler=t,this._data="",this._params=Ni,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Ni,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ts(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Ni,this._data="",this._hitLimit=!1,i));return this._params=Ni,this._data="",this._hitLimit=!1,e}},Md=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,s,r){this.table[i<<8|e]=s<<4|r}addMany(e,i,s,r){for(let n=0;nh),i=(l,h)=>e.slice(l,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(s,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(lt,0,2,0),t.add(lt,8,5,8),t.add(lt,6,0,6),t.add(lt,11,0,11),t.add(lt,13,13,13),t}(),Td=class extends j{constructor(e=Rd){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ya,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,r)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(re(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Bd),this._dcsParser=this._register(new Ed),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;no||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=r,s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,s,r,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,i,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](this._params),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h>4){case 2:for(let d=h+1;;++d){if(d>=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=0&&(l=a[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,a,c,n,h),l;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let _=this._escHandlers[this._collect<<8|r],f=_?_.length-1:-1;for(;f>=0&&(l=_[f](),l!==!0);f--)if(l instanceof Promise)return this._preserveStack(4,_,f,n,h),l;f<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let d=h+1;;++d)if(d>=i||(r=e[d])===24||r===26||r===27||r>127&&r=i||(r=e[d])<32||r>127&&r>4:n>>8}return s}}function Gs(t,e){let i=t.toString(16),s=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Pd(t,e=16){let[i,s,r]=t;return`rgb:${Gs(i,e)}/${Gs(s,e)}/${Gs(r,e)}`}var $d={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Nt=131072,vo=10;function mo(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var wo=5e3,So=0,Id=class extends j{constructor(t,e,i,s,r,n,o,l,h=new Td){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new th,this._utf8Decoder=new ih,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=me.clone(),this._eraseAttrDataInternal=me.clone(),this._onRequestBell=this._register(new A),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new A),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new A),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new A),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new A),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new A),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new A),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new A),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new A),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new A),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new A),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new A),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Xr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:c.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,c,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:c,data:_})}),this._parser.setDcsHandlerFallback((a,c,_)=>{c==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:c,payload:_})}),this._parser.setPrintHandler((a,c,_)=>this.print(a,c,_)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(E.BEL,()=>this.bell()),this._parser.setExecuteHandler(E.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(E.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(E.BS,()=>this.backspace()),this._parser.setExecuteHandler(E.HT,()=>this.tab()),this._parser.setExecuteHandler(E.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(E.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(us.IND,()=>this.index()),this._parser.setExecuteHandler(us.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(us.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Je(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Je(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Je(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Je(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Je(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Je(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Je(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Je(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Je(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Je(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Je(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Je(a=>this.restoreCursorColor(a))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let a in ke)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new go((a,c)=>this.requestStatusString(a,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),wo))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${wo} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>Nt&&(n=this._parseStack.position+Nt)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(a=>a.charCodeAt(0)):t),this._parseBuffer.lengthNt)for(let a=n;a0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let f=this._parser.precedingJoinState;for(let d=e;dl){if(h){let R=_,D=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&_ instanceof Oi&&_.copyCellsFrom(R,D,0,k,!1);D=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(a&&(_.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(c)),_.getWidth(l-1)===2&&_.setCellFromCodepoint(l-1,0,1,c)),_.setCellFromCodepoint(this._activeBuffer.x++,s,r,c),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>mo(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new go(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Je(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let h=l;for(let a=1;a0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(E.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(E.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(E.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(E.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(E.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:c}=l,_=this._optionsService.rawOptions,f=(y,k)=>(o.triggerDataEvent(`${E.ESC}[${e?"":"?"}${y};${k}$y`),!0),d=y=>y?1:2,m=t.params[0];return e?m===2?f(m,4):m===4?f(m,d(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,d(_.convertEol)):f(m,0):m===1?f(m,d(s.applicationCursorKeys)):m===3?f(m,_.windowOptions.setWinLines?h===80?2:h===132?1:0:0):m===6?f(m,d(s.origin)):m===7?f(m,d(s.wraparound)):m===8?f(m,3):m===9?f(m,d(r==="X10")):m===12?f(m,d(_.cursorBlink)):m===25?f(m,d(!o.isCursorHidden)):m===45?f(m,d(s.reverseWraparound)):m===66?f(m,d(s.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,d(r==="VT200")):m===1002?f(m,d(r==="DRAG")):m===1003?f(m,d(r==="ANY")):m===1004?f(m,d(s.sendFocus)):m===1005?f(m,4):m===1006?f(m,d(n==="SGR")):m===1015?f(m,4):m===1016?f(m,d(n==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,d(a===c)):m===2004?f(m,d(s.bracketedPasteMode)):m===2026?f(m,d(s.synchronizedOutput)):f(m,0)}_updateAttrColor(t,e,i,s,r){return e===2?(t|=50331648,t&=-16777216,t|=ji.fromColorRGB([i,s,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=me.fg,t.bg=me.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=me.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=me.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=me.fg&16777215,s.bg&=-67108864,s.bg|=me.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${E.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=me.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!mo(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${E.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>vo&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>vo&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(bo(n))if(r==="?")e.push({type:0,index:n});else{let o=po(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),s=t.slice(e+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let s=0;s=this._specialColors.length);++s,++e)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=po(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let s=0;s=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=me.clone(),this._eraseAttrDataInternal=me.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new ct;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e(this._coreService.triggerDataEvent(`${E.ESC}${o}${E.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Xr=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){tthis.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(So=t,t=e,e=So),tthis.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Xr=ue([P(0,Ve)],Xr);function bo(t){return 0<=t&&t<256}var Od=5e7,yo=12,Fd=50,Nd=class extends j{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new A),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>Od)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,i);if(n){let l=h=>performance.now()-s>=yo?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=yo)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Fd&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Jr=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),a={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(a,h)),this._dataByLinkId.set(a.id,a),a.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,i){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==i)){let r=this._bufferService.buffer.addMarker(i);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let s=e.lines.indexOf(i);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Jr=ue([P(0,Ve)],Jr);var Co=!1,Wd=class extends j{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Si),this._onBinary=this._register(new A),this.onBinary=this._onBinary.event,this._onData=this._register(new A),this.onData=this._onData.event,this._onLineFeed=this._register(new A),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new A),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new A),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new A),this._instantiationService=new cd,this.optionsService=this._register(new Sd(e)),this._instantiationService.setService(je,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Vr)),this._instantiationService.setService(Ve,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Kr)),this._instantiationService.setService(fa,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jr)),this._instantiationService.setService(li,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Gr)),this._instantiationService.setService(_a,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ei)),this._instantiationService.setService(oh,this.unicodeService),this._charsetService=this._instantiationService.createInstance(kd),this._instantiationService.setService(nh,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Jr),this._instantiationService.setService(ga,this._oscLinkService),this._inputHandler=this._register(new Id(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Fe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Fe.forward(this._bufferService.onResize,this._onResize)),this._register(Fe.forward(this.coreService.onData,this._onData)),this._register(Fe.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Nd((i,s)=>this._inputHandler.parse(i,s))),this._register(Fe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new A),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Co&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Co=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,ja),i=Math.max(i,Ga),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(fo.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fo(this._bufferService),!1))),this._windowsWrappingHeuristics.value=re(()=>{for(let i of e)i.dispose()})}}},zd={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Hd(t,e,i,s){let r={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=E.ESC+"OA":r.key=E.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=E.ESC+"OD":r.key=E.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=E.ESC+"OC":r.key=E.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=E.ESC+"OB":r.key=E.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":E.DEL,t.altKey&&(r.key=E.ESC+r.key);break;case 9:if(t.shiftKey){r.key=E.ESC+"[Z";break}r.key=E.HT,r.cancel=!0;break;case 13:r.key=t.altKey?E.ESC+E.CR:E.CR,r.cancel=!0;break;case 27:r.key=E.ESC,t.altKey&&(r.key=E.ESC+E.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"D":e?r.key=E.ESC+"OD":r.key=E.ESC+"[D";break;case 39:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"C":e?r.key=E.ESC+"OC":r.key=E.ESC+"[C";break;case 38:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"A":e?r.key=E.ESC+"OA":r.key=E.ESC+"[A";break;case 40:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"B":e?r.key=E.ESC+"OB":r.key=E.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=E.ESC+"[2~");break;case 46:n?r.key=E.ESC+"[3;"+(n+1)+"~":r.key=E.ESC+"[3~";break;case 36:n?r.key=E.ESC+"[1;"+(n+1)+"H":e?r.key=E.ESC+"OH":r.key=E.ESC+"[H";break;case 35:n?r.key=E.ESC+"[1;"+(n+1)+"F":e?r.key=E.ESC+"OF":r.key=E.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=E.ESC+"[5;"+(n+1)+"~":r.key=E.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=E.ESC+"[6;"+(n+1)+"~":r.key=E.ESC+"[6~";break;case 112:n?r.key=E.ESC+"[1;"+(n+1)+"P":r.key=E.ESC+"OP";break;case 113:n?r.key=E.ESC+"[1;"+(n+1)+"Q":r.key=E.ESC+"OQ";break;case 114:n?r.key=E.ESC+"[1;"+(n+1)+"R":r.key=E.ESC+"OR";break;case 115:n?r.key=E.ESC+"[1;"+(n+1)+"S":r.key=E.ESC+"OS";break;case 116:n?r.key=E.ESC+"[15;"+(n+1)+"~":r.key=E.ESC+"[15~";break;case 117:n?r.key=E.ESC+"[17;"+(n+1)+"~":r.key=E.ESC+"[17~";break;case 118:n?r.key=E.ESC+"[18;"+(n+1)+"~":r.key=E.ESC+"[18~";break;case 119:n?r.key=E.ESC+"[19;"+(n+1)+"~":r.key=E.ESC+"[19~";break;case 120:n?r.key=E.ESC+"[20;"+(n+1)+"~":r.key=E.ESC+"[20~";break;case 121:n?r.key=E.ESC+"[21;"+(n+1)+"~":r.key=E.ESC+"[21~";break;case 122:n?r.key=E.ESC+"[23;"+(n+1)+"~":r.key=E.ESC+"[23~";break;case 123:n?r.key=E.ESC+"[24;"+(n+1)+"~":r.key=E.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=E.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=E.DEL:t.keyCode===219?r.key=E.ESC:t.keyCode===220?r.key=E.FS:t.keyCode===221&&(r.key=E.GS);else if((!i||s)&&t.altKey&&!t.metaKey){let o=zd[t.keyCode]?.[t.shiftKey?1:0];if(o)r.key=E.ESC+o;else if(t.keyCode>=65&&t.keyCode<=90){let l=t.ctrlKey?t.keyCode-64:t.keyCode+32,h=String.fromCharCode(l);t.shiftKey&&(h=h.toUpperCase()),r.key=E.ESC+h}else if(t.keyCode===32)r.key=E.ESC+(t.ctrlKey?E.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let l=t.code.slice(3,4);t.shiftKey||(l=l.toLowerCase()),r.key=E.ESC+l,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=E.US),t.key==="@"&&(r.key=E.NUL));break}return r}var ge=0,Ud=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ks,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ks,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),i=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n=this._array.length||this._getKey(e[i])<=this._getKey(this._array[s])?(r[n]=e[i],i++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(ge=this._search(i),ge===-1)||this._getKey(this._array[ge])!==i)return!1;do if(this._array[ge]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ge),!0;while(++gen-o),i=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ge=this._search(e),!(ge<0||ge>=this._array.length)&&this._getKey(this._array[ge])===e))do yield this._array[ge];while(++ge=this._array.length)&&this._getKey(this._array[ge])===e))do i(this._array[ge]);while(++ge=i;){let r=i+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},Ys=0,xo=0,qd=class extends j{constructor(){super(),this._decorations=new Ud(t=>t?.marker.line),this._onDecorationRegistered=this._register(new A),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new A),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(re(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new Kd(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),t>=s&&t{Ys=r.options.x??0,xo=Ys+(r.options.width??1),t>=Ys&&t=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},ko=20,Ls=class extends j{constructor(t,e,i,s){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;nthis._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new jd(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(H(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(re(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ko+1&&(this._liveRegion.textContent+=vr.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=t;r<=e;r++){let n=i.lines.get(i.ydisp+r),o=[],l=n?.translateToString(!0,void 0,void 0,o)||"",h=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||t.relatedTarget!==s)return;let o,l;if(e===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:l,offset:h})=>{let a=l instanceof Text?l.parentNode:l,c=parseInt(a?.getAttribute("aria-posinset"),10)-1;if(isNaN(c))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(a);if(!_)return console.warn("columns is null. Race condition?"),null;let f=h<_.length?_[h]:_.slice(-1)[0]+1;return f>=this._terminal.cols&&(++c,f=0),{row:c,column:f}},n=r(e),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;et;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t{oi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(H(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(H(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(H(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(H(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let s=0;s{s?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[s,r]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(s)&&(i=this._checkLinkProviderResult(s,t,i)):r.provideLinks(t.y,n=>{if(this._isMouseOut)return;let o=n?.map(l=>({link:l}));this._activeProviderReplies?.set(s,o),i=this._checkLinkProviderResult(s,t,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let s=0;st?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(t,e,i){if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(t),r=!1;for(let n=0;nthis._linkAtPosition(o.link,e));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;nthis._linkAtPosition(l.link,e));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&Gd(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,oi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,s=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return i<=r&&r<=s}_positionFromMouseEvent(t,e,i){let s=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,s,r){return{x1:t,y1:e,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Zr=ue([P(1,gn),P(2,It),P(3,Ve),P(4,va)],Zr);function Gd(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var Yd=class extends Wd{constructor(e={}){super(e),this._linkifier=this._register(new Si),this.browser=Ia,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Si),this._onCursorMove=this._register(new A),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new A),this.onKey=this._onKey.event,this._onRender=this._register(new A),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new A),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new A),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new A),this.onBell=this._onBell.event,this._onFocus=this._register(new A),this._onBlur=this._register(new A),this._onA11yCharEmitter=this._register(new A),this._onA11yTabEmitter=this._register(new A),this._onWillOpen=this._register(new A),this._setup(),this._decorationService=this._instantiationService.createInstance(qd),this._instantiationService.setService(Gi,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Fc),this._instantiationService.setService(va,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wr)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(Fe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Fe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Fe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Fe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(re(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let s,r="";switch(i.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+i.index}switch(i.type){case 0:let n=ie.toColorRGB(s==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${E.ESC}]${r};${Pd(n)}${Pa.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=Se.toColor(...i.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=Se.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ls,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=i.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(H(this.element,"copy",i=>{this.hasSelection()&&Ql(i,this._selectionService)}));let e=i=>eh(i,this.textarea,this.coreService,this.optionsService);this._register(H(this.textarea,"paste",e)),this._register(H(this.element,"paste",e)),Oa?this._register(H(this.element,"mousedown",i=>{i.button===2&&Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(H(this.element,"contextmenu",i=>{Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Cn&&this._register(H(this.element,"auxclick",i=>{i.button===1&&la(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(H(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(H(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(H(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(H(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(H(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(H(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(H(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(H(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",pr.get()),Wa||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ic,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($t,this._coreBrowserService),this._register(H(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(H(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wr,this._document,this._helperContainer),this._instantiationService.setService(Ds,this._charSizeService),this._themeService=this._instantiationService.createInstance(qr),this._instantiationService.setService(bi,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Cs),this._instantiationService.setService(pa,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Hr,this.rows,this.screenElement)),this._instantiationService.setService(It,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Or,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(zr),this._instantiationService.setService(gn,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Zr,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance($r,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ur,this.element,this.screenElement,r)),this._instantiationService.setService(lh,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Fe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Ir,this.screenElement)),this._register(H(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ls,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ys,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ys,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Nr,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function s(o){let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let h,a;switch(o.overrideType||o.type){case"mousemove":a=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":a=0,h=o.button<3?o.button:3;break;case"mousedown":a=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let c=o.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;a=c<0?0:1,h=4;break;default:return!1}return a===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:h,action:a,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(i.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(i.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(H(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(H(i,"wheel",o=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let l=E.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(l,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){aa(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,s){this._selectionService.setSelection(e,i,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=Hd(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===E.ETX||s.key===E.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let s=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?s:s&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Xd(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let s={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(s),i.dispose=()=>this._wrappedAddonDispose(s),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let s=0;s=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new ct)}translateToString(e,i,s){return this._line.translateToString(e,i,s)}},Lo=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new Zd(e)}getNullCell(){return new ct}},Qd=class extends j{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new A),this.onBufferChange=this._onBufferChange.event,this._normal=new Lo(this._core.buffers.normal,"normal"),this._alternate=new Lo(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},eu=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,s)=>e(i,s.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},tu=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},iu=["cols","rows"],ft=0,su=class extends j{constructor(t){super(),this._core=this._register(new Yd(t)),this._addonManager=this._register(new Jd),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(t){if(iu.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new eu(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new tu(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Qd(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r +`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return pr.get()},set promptLabel(t){pr.set(t)},get tooMuchOutput(){return vr.get()},set tooMuchOutput(t){vr.set(t)}}}_verifyIntegers(...t){for(ft of t)if(ft===1/0||isNaN(ft)||ft%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ft of t)if(ft&&(ft===1/0||isNaN(ft)||ft%1!==0||ft<0))throw new Error("This API only accepts positive integers")}};/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */var ru=2,nu=1,ou=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=s-l,c=r-h-e;return{cols:Math.max(ru,Math.floor(c/t.css.cell.width)),rows:Math.max(nu,Math.floor(a/t.css.cell.height))}}};/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */var au=class{constructor(t,e,i,s={}){this._terminal=t,this._regex=e,this._handler=i,this._options=s}provideLinks(t,e){let i=hu.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(i))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}};function lu(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var hu=class gs{static computeLink(e,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,l]=gs._getWindowedLineStrings(e-1,s),h=o.join(""),a,c=[];for(;a=n.exec(h);){let _=a[0];if(!lu(_))continue;let[f,d]=gs._mapStrIdx(s,l,0,a.index),[m,y]=gs._mapStrIdx(s,f,d,_.length);if(f===-1||d===-1||m===-1||y===-1)continue;let k={start:{x:d+1,y:f+1},end:{x:y,y:m+1}};c.push({range:k,text:_,activate:r})}return c}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,l="",h=[];if(s=i.buffer.active.getLine(e)){let a=s.translateToString(!0);if(s.isWrapped&&a[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),!(!s.isWrapped||l.indexOf(" ")!==-1)););h.reverse()}for(h.push(a),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),l.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),l=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let a=l;a`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function du(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var uu=class{constructor(t=du,e={}){this._handler=t,this._options=e}activate(t){this._terminal=t;let e=this._options,i=e.urlRegex||cu;this._linkProvider=this._terminal.registerLinkProvider(new au(this._terminal,i,this._handler,e))}dispose(){this._linkProvider?.dispose()}};/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */var _u=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Bo.isErrorNoTelemetry(t)?new Bo(t.message+` + +`+t.stack):new Error(t.message+` + +`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},fu=new _u;function Xs(t){gu(t)||fu.onUnexpectedError(t)}var Qr="Canceled";function gu(t){return t instanceof pu?!0:t instanceof Error&&t.name===Qr&&t.message===Qr}var pu=class extends Error{constructor(){super(Qr),this.name=this.message}},Bo=class en extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof en)return e;let i=new en;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},vu;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(vu||={});function mu(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var Xa;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Ja(...t){return Ci(()=>Hi(t))}function Ci(t){return{dispose:mu(()=>{t()})}}var Za=class Qa{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Hi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Qa.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Za.DISABLE_DISPOSED_WARNING=!1;var xn=Za,Gt=class{constructor(){this._store=new xn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Gt.None=Object.freeze({dispose(){}});var Bs=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},wu=globalThis.performance&&typeof globalThis.performance.now=="function",Su=class el{static create(e){return new el(e)}constructor(e){this._now=wu&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},kn;(t=>{t.None=()=>Gt.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=Ja(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new vt(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new vt(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new vt({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new vt({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new vt({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new vt;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new vt(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof xn?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(kn||={});var tn=class sn{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${sn._idPool++}`,sn.all.add(this)}start(e){this._stopWatch=new Su,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};tn.all=new Set,tn._idPool=0;var bu=tn,yu=-1,tl=class il{constructor(e,i,s=(il._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new Lu(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||Xs)(a),Gt.None}if(this._disposed)return Gt.None;i&&(e=e.bind(i));let r=new Js(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=xu.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Js?(this._deliveryQueue??=new Ru,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Ci(()=>{n?.(),this._removeListener(r)});return s instanceof xn?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Eu<=i.length){let n=0;for(let o=0;o0}},Ru=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rl=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),Tu;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof Du?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kn.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rl})})(Tu||={});var Du=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?rl:(this._emitter||(this._emitter=new vt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},pi="en",Zs=!1,rs,ps=pi,Eo=pi,Au,Rt,si=globalThis,Qe;typeof si.vscode<"u"&&typeof si.vscode.process<"u"?Qe=si.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Qe=process);var Pu=typeof Qe?.versions?.electron=="string",$u=Pu&&Qe?.type==="renderer";if(typeof Qe=="object"){Qe.platform,Qe.platform,Zs=Qe.platform==="linux",Zs&&Qe.env.SNAP&&Qe.env.SNAP_REVISION,Qe.env.CI||Qe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rs=pi,ps=pi;let t=Qe.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);rs=e.userLocale,Eo=e.osLocale,ps=e.resolvedLanguage||pi,Au=e.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!$u?(Rt=navigator.userAgent,Rt.indexOf("Windows")>=0,Rt.indexOf("Macintosh")>=0,(Rt.indexOf("Macintosh")>=0||Rt.indexOf("iPad")>=0||Rt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Zs=Rt.indexOf("Linux")>=0,Rt?.indexOf("Mobi")>=0,ps=globalThis._VSCODE_NLS_LANGUAGE||pi,rs=navigator.language.toLowerCase(),Eo=rs):console.error("Unable to resolve platform.");var bt=Rt,Wt=ps,Iu;(t=>{function e(){return Wt}t.value=e;function i(){return Wt.length===2?Wt==="en":Wt.length>=3?Wt[0]==="e"&&Wt[1]==="n"&&Wt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Wt==="en"}t.isDefault=s})(Iu||={});var Ou=typeof si.postMessage=="function"&&!si.importScripts;(()=>{if(Ou){let t=[];si.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),si.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Fu=!!(bt&&bt.indexOf("Chrome")>=0);bt&&bt.indexOf("Firefox")>=0;!Fu&&bt&&bt.indexOf("Safari")>=0;bt&&bt.indexOf("Edg/")>=0;bt&&bt.indexOf("Android")>=0;function nl(t,e=0,i){let s=setTimeout(()=>{t()},e);return Ci(()=>{clearTimeout(s)})}var Nu;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(Nu||={});var Mo=class nt{static fromArray(e){return new nt(i=>{i.emitMany(e)})}static fromPromise(e){return new nt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new nt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new nt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new vt,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new nt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return nt.map(this,e)}static filter(e,i){return new nt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return nt.filter(this,e)}static coalesce(e){return nt.filter(e,i=>!!i)}coalesce(){return nt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return nt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Mo.EMPTY=Mo.fromArray([]);var Wu=class extends Gt{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Bs),this._linesCacheDisposables=this._register(new Bs),this._register(Ci(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ja(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=nl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,i){this._linesCache&&(this._linesCache[e]=i)}translateBufferLineToStringWithWrap(e,i){let s=[],r=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let o=this._terminal.buffer.active.getLine(e+1),l=o?o.isWrapped:!1,h=n.translateToString(!l&&i);if(l&&o){let a=n.getCell(n.length-1);a&&a.getCode()===0&&a.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(s.push(h),l)r.push(r[r.length-1]+h.length);else break;e++,n=o}return[s.join(""),r]}},zu=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,i){return i?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(i):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Hu=class{constructor(e,i){this._terminal=e,this._lineCache=i}find(e,i,s,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let n={startRow:i,startCol:s},o=this._findInLine(e,n,r);if(!o)for(let l=i+1;l=0&&(h.startRow=c,a=this._findInLine(e,h,i,l),!a);c--);}if(!a&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=n&&(h.startRow=c,a=this._findInLine(e,h,i,l),!a);c--);return a}_isWholeWord(e,i,s){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e-1]))&&(e+s.length===i.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e+s.length]))}_findInLine(e,i,s={},r=!1){let n=i.startRow,o=i.startCol;if(this._terminal.buffer.active.getLine(n)?.isWrapped){if(r){i.startCol+=this._terminal.cols;return}return i.startRow--,i.startCol+=this._terminal.cols,this._findInLine(e,i,s)}let l=this._lineCache.getLineFromCache(n);l||(l=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,l));let[h,a]=l,c=this._bufferColsToStringOffset(n,o),_=e,f=h;s.regex||(_=s.caseSensitive?e:e.toLowerCase(),f=s.caseSensitive?h:h.toLowerCase());let d=-1;if(s.regex){let m=RegExp(_,s.caseSensitive?"g":"gi"),y;if(r)for(;y=m.exec(f.slice(0,c));)d=m.lastIndex-y[0].length,e=y[0],m.lastIndex-=e.length-1;else y=m.exec(f.slice(c)),y&&y[0].length>0&&(d=c+(m.lastIndex-y[0].length),e=y[0])}else r?c-_.length>=0&&(d=f.lastIndexOf(_,c-_.length)):d=f.indexOf(_,c);if(d>=0){if(s.wholeWord&&!this._isWholeWord(d,f,e))return;let m=0;for(;m=a[m+1];)m++;let y=m;for(;y=a[y+1];)y++;let k=d-a[m],R=d+e.length-a[y],D=this._stringLengthToBufferSize(n+m,k),T=this._stringLengthToBufferSize(n+y,R)-D+this._terminal.cols*(y-m);return{term:e,col:D,row:n+m,size:T}}}_stringLengthToBufferSize(e,i){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let r=0;r1&&(i-=o.length-1);let l=s.getCell(r+1);l&&l.getWidth()===0&&i++}return i}_bufferColsToStringOffset(e,i){let s=e,r=0,n=this._terminal.buffer.active.getLine(s);for(;i>0&&n;){for(let o=0;othis.clearHighlightDecorations()))}createHighlightDecorations(t,e){this.clearHighlightDecorations();for(let i of t){let s=this._createResultDecorations(i,e,!1);if(s)for(let r of s)this._storeDecoration(r,i)}}createActiveDecoration(t,e){let i=this._createResultDecorations(t,e,!0);if(i)return{decorations:i,match:t,dispose(){Hi(i)}}}clearHighlightDecorations(){Hi(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,e){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:e,dispose(){t.dispose()}})}_applyStyles(t,e,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),e&&(t.style.outline=`1px solid ${e}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,e,i){let s=[],r=t.col,n=t.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;n>0;){let h=Math.min(this._terminal.cols-r,n);s.push([o,r,h]),r=0,n-=h,o++}let l=[];for(let h of s){let a=this._terminal.registerMarker(h[0]),c=this._terminal.registerDecoration({marker:a,x:h[1],width:h[2],backgroundColor:i?e.activeMatchBackground:e.matchBackground,overviewRulerOptions:this._highlightedLines.has(a.line)?void 0:{color:i?e.activeMatchColorOverviewRuler:e.matchOverviewRuler,position:"center"}});if(c){let _=[];_.push(a),_.push(c.onRender(f=>this._applyStyles(f,i?e.activeMatchBorder:e.matchBorder,!1))),_.push(c.onDispose(()=>Hi(_))),l.push(c)}}return l.length===0?void 0:l}},qu=class extends Gt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new vt)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,e){this._searchResults=t.slice(0,e)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let e=0;ethis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ci(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=nl(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findNextAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_highlightAllMatches(t,e){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],s,r=this._engine.find(t,0,0,e);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._engine.find(t,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,e);this._resultTracker.updateResults(i,this._highlightLimit),e.decorations&&this._decorationManager.createHighlightDecorations(i,e.decorations)}_findNextAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}findPrevious(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findPreviousAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}_selectResult(t,e,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),e){let s=this._decorationManager.createActiveDecoration(t,e);s&&(this._resultTracker.selectedDecoration=s)}if(!i&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.rowe[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=Ms.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return Ms.createPropertyValue(0,s,r)}},Yu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ro.isErrorNoTelemetry(t)?new Ro(t.message+` + +`+t.stack):new Error(t.message+` + +`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Xu=new Yu;function er(t){Ju(t)||Xu.onUnexpectedError(t)}var rn="Canceled";function Ju(t){return t instanceof Zu?!0:t instanceof Error&&t.name===rn&&t.message===rn}var Zu=class extends Error{constructor(){super(rn),this.name=this.message}},Ro=class nn extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof nn)return e;let i=new nn;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function Qu(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var e_;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(e_||={});var ol;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function t_(...t){return ll(()=>al(t))}function ll(t){return{dispose:Qu(()=>{t()})}}var hl=class cl{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{al(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?cl.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};hl.DISABLE_DISPOSED_WARNING=!1;var Ln=hl,Es=class{constructor(){this._store=new Ln,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Es.None=Object.freeze({dispose(){}});var i_=globalThis.performance&&typeof globalThis.performance.now=="function",s_=class dl{static create(e){return new dl(e)}constructor(e){this._now=i_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},r_;(t=>{t.None=()=>Es.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=t_(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new Ht(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new Ht(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new Ht({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new Ht({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new Ht({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new Ht;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new Ht(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof Ln?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(r_||={});var on=class an{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${an._idPool++}`,an.all.add(this)}start(e){this._stopWatch=new s_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};on.all=new Set,on._idPool=0;var n_=on,o_=-1,ul=class _l{constructor(e,i,s=(_l._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new c_(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||er)(a),Es.None}if(this._disposed)return Es.None;i&&(e=e.bind(i));let r=new tr(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=l_.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof tr?(this._deliveryQueue??=new f_,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=ll(()=>{n?.(),this._removeListener(r)});return s instanceof Ln?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*u_<=i.length){let n=0;for(let o=0;o0}},f_=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ms=class vs{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ht,this.onChange=this._onChange.event;let e=new Gu;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=vs.extractWidth(l);vs.extractShouldJoin(l)&&(h-=vs.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},ir=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],g_=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],sr=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],p_=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],kt;function To(t,e){let i=0,s=e.length-1,r;if(te[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(ti&&(i=r)}return Ms.createPropertyValue(0,i,s)}},m_=class{activate(t){t.unicode.register(new v_)}dispose(){}};/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */var w_=(t,e,i,s)=>{for(var r=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=o(r)||r);return r},S_=(t,e)=>(i,s)=>e(i,s,t),b_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Do.isErrorNoTelemetry(t)?new Do(t.message+` + +`+t.stack):new Error(t.message+` + +`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},y_=new b_;function rr(t){C_(t)||y_.onUnexpectedError(t)}var ln="Canceled";function C_(t){return t instanceof x_?!0:t instanceof Error&&t.name===ln&&t.message===ln}var x_=class extends Error{constructor(){super(ln),this.name=this.message}},Do=class hn extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof hn)return e;let i=new hn;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},k_;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(k_||={});function L_(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var gl;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function vl(...t){return We(()=>pl(t))}function We(t){return{dispose:L_(()=>{t()})}}var ml=class wl{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?wl.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};ml.DISABLE_DISPOSED_WARNING=!1;var wi=ml,dt=class{constructor(){this._store=new wi,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};dt.None=Object.freeze({dispose(){}});var Ti=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Bn=typeof process<"u"&&"title"in process,$s=Bn?"node":navigator.userAgent,B_=Bn?"node":navigator.platform,E_=$s.includes("Firefox"),M_=$s.includes("Edge"),Sl=/^((?!chrome|android).)*safari/i.test($s);function R_(){if(!Sl)return 0;let t=$s.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}B_.indexOf("Linux")>=0;var T_="",Ae=0,Pe=0,$e=0,de=0,ot={css:"#00000000",rgba:0},Ke;(t=>{function e(r,n,o,l){return l!==void 0?`#${Jt(r)}${Jt(n)}${Jt(o)}${Jt(l)}`:`#${Jt(r)}${Jt(n)}${Jt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Ke||={});var Wi;(t=>{function e(h,a){if(de=(a.rgba&255)/255,de===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,_=a.rgba>>16&255,f=a.rgba>>8&255,d=h.rgba>>24&255,m=h.rgba>>16&255,y=h.rgba>>8&255;Ae=d+Math.round((c-d)*de),Pe=m+Math.round((_-m)*de),$e=y+Math.round((f-y)*de);let k=Ke.toCss(Ae,Pe,$e),R=Ke.toRgba(Ae,Pe,$e);return{css:k,rgba:R}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let _=ri.ensureContrastRatio(h.rgba,a.rgba,c);if(_)return Ke.toColor(_>>24&255,_>>16&255,_>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Ae,Pe,$e]=ri.toChannels(a),{css:Ke.toCss(Ae,Pe,$e),rgba:a}}t.opaque=r;function n(h,a){return de=Math.round(a*255),[Ae,Pe,$e]=ri.toChannels(h.rgba),{css:Ke.toCss(Ae,Pe,$e,de),rgba:Ke.toRgba(Ae,Pe,$e,de)}}t.opacity=n;function o(h,a){return de=h.rgba&255,n(h,de*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(Wi||={});var D_;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Ae=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),$e=parseInt(r.slice(3,4).repeat(2),16),Ke.toColor(Ae,Pe,$e);case 5:return Ae=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),$e=parseInt(r.slice(3,4).repeat(2),16),de=parseInt(r.slice(4,5).repeat(2),16),Ke.toColor(Ae,Pe,$e,de);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ae=parseInt(n[1]),Pe=parseInt(n[2]),$e=parseInt(n[3]),de=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ke.toColor(Ae,Pe,$e,de);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ae,Pe,$e,de]=e.getImageData(0,0,1,1).data,de!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ke.toRgba(Ae,Pe,$e,de),css:r}}t.toColor=s})(D_||={});var qe;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),_=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+_*.0722}t.relativeLuminance2=i})(qe||={});var ri;(t=>{function e(o,l){if(de=(l&255)/255,de===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,_=o>>24&255,f=o>>16&255,d=o>>8&255;return Ae=_+Math.round((h-_)*de),Pe=f+Math.round((a-f)*de),$e=d+Math.round((c-d)*de),Ke.toRgba(Ae,Pe,$e)}t.blend=e;function i(o,l,h){let a=qe.relativeLuminance(o>>8),c=qe.relativeLuminance(l>>8);if(Lt(a,c)>8));if(m>8));return m>k?d:y}return d}let _=r(o,l,h),f=Lt(a,qe.relativeLuminance(_>>8));if(f>8));return f>m?_:d}return _}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));for(;y0||d>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),d-=Math.max(0,Math.ceil(d*.1)),m-=Math.max(0,Math.ceil(m*.1)),y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));return(f<<24|d<<16|m<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));for(;y>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(ri||={});function Jt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Lt(t,e){return t=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function O_(t,e,i,s){return e===1&&i>Math.ceil(s*1.5)&&t!==void 0&&t>255&&!I_(t)&&!En(t)&&!P_(t)}function bl(t){return En(t)||$_(t)}function F_(){return{css:{canvas:ns(),cell:ns()},device:{canvas:ns(),cell:ns(),char:{width:0,height:0,left:0,top:0}}}}function ns(){return{width:0,height:0}}function N_(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var Oe=0,Ee=0,gt=!1,Bt=!1,os=!1,Ye,nr=0,W_=class{constructor(t,e,i,s,r,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,s){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Ee=0,Oe=0,Bt=!1,gt=!1,os=!1,Ye=this._themeService.colors,nr=0,t.getCode()!==0&&t.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));nr=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",r=>{r.backgroundColorRGB&&(Ee=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Oe=r.foregroundColorRGB.rgba>>8&16777215,gt=!0)}),os=this._selectionRenderModel.isCellSelected(this._terminal,e,i),os){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;case 0:default:Ee=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}Ee=ri.blend(Ee,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ee=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Bt=!0,Ye.selectionForeground&&(Oe=Ye.selectionForeground.rgba>>8&16777215,gt=!0),bl(t.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Oe=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Oe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Oe=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Oe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Oe=(this.result.fg&16777215)<<8|255;break;case 0:default:Oe=this._themeService.colors.foreground.rgba}Oe=ri.blend(Oe,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}gt=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",r=>{r.backgroundColorRGB&&(Ee=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Oe=r.foregroundColorRGB.rgba>>8&16777215,gt=!0)}),Bt&&(os?Ee=t.bg&-16777216&-134217729|Ee|50331648:Ee=t.bg&-16777216|Ee|50331648),gt&&(Oe=t.fg&-16777216&-67108865|Oe|50331648),this.result.fg&67108864&&(Bt&&!gt&&((this.result.bg&50331648)===0?Oe=this.result.fg&-134217728|Ye.background.rgba>>8&16777215&16777215|50331648:Oe=this.result.fg&-134217728|this.result.bg&67108863,gt=!0),!Bt&>&&((this.result.fg&50331648)===0?Ee=this.result.bg&-67108864|Ye.foreground.rgba>>8&16777215&16777215|50331648:Ee=this.result.bg&-67108864|this.result.fg&67108863,Bt=!0)),Ye=void 0,this.result.bg=Bt?Ee:this.result.bg,this.result.fg=gt?Oe:this.result.fg,this.result.ext&=536870911,this.result.ext|=nr<<29&3758096384}},z_=.5,yl=E_||M_?"bottom":"ideographic",H_={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},U_={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},q_={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Vi={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Vi[""]=Vi[""];Vi[""]=Vi[""];function K_(t,e,i,s,r,n,o,l){let h=H_[e];if(h)return V_(t,h,i,s,r,n),!0;let a=U_[e];if(a)return j_(t,a,i,s,r,n),!0;let c=q_[e];if(c)return G_(t,c,i,s,r,n,l),!0;let _=Vi[e];return _?(Y_(t,_,i,s,r,n,o,l),!0):!1}function V_(t,e,i,s,r,n){for(let o=0;o7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[m,y,k,R]=l.substring(5,l.length-1).split(",").map(D=>parseFloat(D));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let D=0;Dt.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function xl(t,e,i,s,r,n,o,l=0,h=0){let a=t.map(c=>parseFloat(c)||parseInt(c));if(a.length<2)throw new Error("Too few arguments for instruction");for(let c=0;cr){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},X_=class extends kl{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},J_=class extends kl{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Z_=!Bn&&"requestIdleCallback"in window?J_:X_,vi=class Ll{constructor(){this.fg=0,this.bg=0,this.extended=new Bl}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Ll;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Bl=class El{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new El(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Q_=globalThis.performance&&typeof globalThis.performance.now=="function",ef=class Ml{static create(e){return new Ml(e)}constructor(e){this._now=Q_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Pt;(t=>{t.None=()=>dt.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=vl(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new se(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new se(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new se({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new se({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new se({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new se;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new se(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof wi?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(Pt||={});var cn=class dn{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${dn._idPool++}`,dn.all.add(this)}start(e){this._stopWatch=new ef,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};cn.all=new Set,cn._idPool=0;var tf=cn,sf=-1,Rl=class Tl{constructor(e,i,s=(Tl._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],h=new af(`${o}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||rr)(h),dt.None}if(this._disposed)return dt.None;e&&(t=t.bind(e));let s=new or(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=nf.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof or?(this._deliveryQueue??=new df,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=We(()=>{r?.(),this._removeListener(s)});return i instanceof wi?i.add(n):Array.isArray(i)&&i.push(n),n},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*hf<=e.length){let r=0;for(let n=0;n0}},df=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Oo={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Di=2,Ai,Ut=class fi{constructor(e,i,s){this._document=e,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new Io,this._cacheMapCombined=new Io,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new vi,this._textureSize=512,this._onAddTextureAtlasCanvas=new se,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new se,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Al(e,this._config.deviceCellWidth*4+Di*2,this._config.deviceCellHeight+Di*2),this._tmpCtx=we(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Z_;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(fi.maxAtlasPages&&this._pages.length>=Math.max(4,fi.maxAtlasPages)){let i=this._pages.filter(a=>a.canvas.width*2<=(fi.maxTextureSize||4096)).sort((a,c)=>c.canvas.width!==a.canvas.width?c.canvas.width-a.canvas.width:c.percentageUsed-a.percentageUsed),s=-1,r=0;for(let a=0;aa.glyphs[0].texturePage).sort((a,c)=>a>c?1:-1),l=this.pages.length-n.length,h=this._mergePages(n,l);h.version++;for(let a=o.length-1;a>=0;a--)this._deletePage(o[a]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new ar(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let s=e[0].canvas.width*2,r=new ar(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,h=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=l,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let a=this._activePages.indexOf(o);a!==-1&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let i=e;i=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,s,r){if(this._config.allowTransparency)return ot;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=vi.toColorRGB(i);n=Ke.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=Wi.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Wi.opaque(n)),n}_getForegroundColor(e,i,s,r,n,o,l,h,a,c){let _=this._getMinimumContrastColor(e,i,s,r,n,o,l,a,h,c);if(_)return _;let f;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&o<8&&(o+=8),f=this._getColorFromAnsiIndex(o);break;case 50331648:let d=vi.toColorRGB(o);f=Ke.toColor(d[0],d[1],d[2]);break;case 0:default:l?f=this._config.colors.background:f=this._config.colors.foreground}return this._config.allowTransparency&&(f=Wi.opaque(f)),h&&(f=Wi.multiplyOpacity(f,z_)),f}_resolveBackgroundRgba(e,i,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,s,r,n,o,l,h,a,c){if(this._config.minimumContrastRatio===1||c)return;let _=this._getContrastCache(a),f=_.getColor(e,r);if(f!==void 0)return f||void 0;let d=this._resolveBackgroundRgba(i,s,l),m=this._resolveForegroundRgba(n,o,l,h),y=ri.ensureContrastRatio(d,m,this._config.minimumContrastRatio/(a?2:1));if(!y){_.setColor(e,r,null);return}let k=Ke.toColor(y>>24&255,y>>16&255,y>>8&255);return _.setColor(e,r,k),k}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Di*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=M?M*2-ne:M-ne;ne>=M||N===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(I+N,z),this._tmpCtx.lineTo(G,z)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(I+N,z),this._tmpCtx.moveTo(I+N+M,z),this._tmpCtx.lineTo(G,z)),ne=N_(G-I,M,ne);break;case 5:let be=.6,fe=.3,ee=G-I,He=Math.floor(be*ee),ve=Math.floor(fe*ee),hi=ee-He-ve;this._tmpCtx.setLineDash([He,ve,hi]),this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(G,z);break;case 1:default:this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(G,z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!v&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let O=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in O&&O.actualBoundingBoxDescent>0){this._tmpCtx.save();let I=new Path2D;I.rect(K,z-Math.ceil(M/2),this._config.deviceCellWidth*p,q-z+Math.ceil(M/2)),this._tmpCtx.clip(I),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(l,W,W+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+F),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*p,W+F),this._tmpCtx.stroke()}if(v||this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let M=lr(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),L,le,u);if(M)for(let F=1;F<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight-F),M=lr(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),L,le,u),!!M);F++);}if(y){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),F=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*p,W+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.stroke()}this._tmpCtx.restore();let g=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),w;if(this._config.allowTransparency?w=uf(g):w=lr(g,L,le,u),w)return Oo;let b=this._findGlyphBoundingBox(g,this._workBoundingBox,h,Y,v,W),C,x;for(;;){if(this._activePages.length===0){let M=this._createNewPage();C=M,x=M.currentRow,x.height=b.size.y;break}C=this._activePages[this._activePages.length-1],x=C.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(C=M,x=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let F of this._activePages[M].fixedRows)F.height<=x.height&&b.size.y<=F.height&&(C=this._activePages[M],x=F);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ar(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),C=this._overflowSizePage,x=this._overflowSizePage.currentRow,x.x+b.size.x>=C.canvas.width&&(x.x=0,x.y+=x.height,x.height=0);break}if(x.y+b.size.y>=C.canvas.height||x.height>b.size.y+2){let M=!1;if(C.currentRow.y+C.currentRow.height+b.size.y>=C.canvas.height){let F;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y=fi.maxAtlasPages&&x.y+b.size.y<=C.canvas.height&&x.height>=b.size.y&&x.x+b.size.x<=C.canvas.width)M=!0;else{let K=this._createNewPage();C=K,x=K.currentRow,x.height=b.size.y,M=!0}}M||(C.currentRow.height>0&&C.fixedRows.push(C.currentRow),x={x:0,y:C.currentRow.y+C.currentRow.height,height:b.size.y},C.fixedRows.push(x),C.currentRow={x:0,y:x.y+x.height,height:0})}if(x.x+b.size.x<=C.canvas.width)break;x===C.currentRow?(x.x=0,x.y+=x.height,x.height=0):C.fixedRows.splice(C.fixedRows.indexOf(x),1)}return b.texturePage=this._pages.indexOf(C),b.texturePosition.x=x.x,b.texturePosition.y=x.y,b.texturePositionClipSpace.x=x.x/C.canvas.width,b.texturePositionClipSpace.y=x.y/C.canvas.height,b.sizeClipSpace.x/=C.canvas.width,b.sizeClipSpace.y/=C.canvas.height,x.height=Math.max(x.height,b.size.y),x.x+=b.size.x,C.ctx.putImageData(g,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),C.addGlyph(b),C.version++,b}_findGlyphBoundingBox(e,i,s,r,n,o){i.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,h=r?this._config.deviceCellWidth:s,a=!1;for(let c=0;c=o;c--){for(let _=0;_=0;c--){for(let _=0;_>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,a=i.rgba>>>8&255,c=Math.floor((Math.abs(r-l)+Math.abs(n-h)+Math.abs(o-a))/12),_=!0;for(let f=0;f0)return!1;return!0}function Al(t,e,i){let s=t.createElement("canvas");return s.width=e,s.height=i,s}function _f(t,e,i,s,r,n,o,l){let h={foreground:n.foreground,background:n.background,cursor:ot,cursorAccent:ot,selectionForeground:ot,selectionBackgroundTransparent:ot,selectionBackgroundOpaque:ot,selectionInactiveBackgroundTransparent:ot,selectionInactiveBackgroundOpaque:ot,overviewRulerBorder:ot,scrollbarSliderBackground:ot,scrollbarSliderHoverBackground:ot,scrollbarSliderActiveBackground:ot,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}function Fo(t,e){for(let i=0;i=0){if(Fo(d.config,a))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),ht.splice(f,1)):d.ownedBy.splice(m,1);break}}for(let f=0;f{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=as){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=as-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=as-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},as)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Wo(t,e,i){let s=new e.ResizeObserver(r=>{let n=r.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s?.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&i(o,l)});try{s.observe(t,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return We(()=>s?.disconnect())}function pf(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var zo=class $l extends vi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Bl,this.combinedData=""}static fromCharData(e){let i=new $l;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pf(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Il=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Ol(t,e,i){let s=we(t.createProgram());if(t.attachShader(s,we(Ho(t,t.VERTEX_SHADER,e))),t.attachShader(s,we(Ho(t,t.FRAGMENT_SHADER,i))),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS))return s;console.error(t.getProgramInfoLog(s)),t.deleteProgram(s)}function Ho(t,e,i){let s=we(t.createShader(e));if(t.shaderSource(s,i),t.compileShader(s),t.getShaderParameter(s,t.COMPILE_STATUS))return s;console.error(t.getShaderInfoLog(s)),t.deleteShader(s)}function vf(t,e){let i=Math.min(t.length*2,e),s=new Float32Array(i);for(let r=0;rr.deleteProgram(this._program))),this._projectionLocation=we(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=we(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=we(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(We(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(We(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=we(r.createBuffer()),this._register(We(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,ui,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,ui,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,ui,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,ui,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,ui,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,ui,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let a=new Int32Array(Ut.maxAtlasPages);for(let c=0;cr.deleteTexture(_.texture))),r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,_.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=_}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,s,r,n,o,l,h){this._updateCell(this._vertices.attributes,t,e,i,s,r,n,o,l,h)}_updateCell(t,e,i,s,r,n,o,l,h,a){if(he=(i*this._terminal.cols+e)*qt,s===0||s===void 0){t.fill(0,he,he+qt-1-bf);return}this._atlas&&(l&&l.length>1?te=this._atlas.getRasterizedGlyphCombinedChar(l,r,n,o,!1,this._terminal.element):te=this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),hr=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==a&&te.offset.x>hr?(Pi=te.offset.x-hr,t[he]=-(te.offset.x-Pi)+this._dimensions.device.char.left,t[he+1]=-te.offset.y+this._dimensions.device.char.top,t[he+2]=(te.size.x-Pi)/this._dimensions.device.canvas.width,t[he+3]=te.size.y/this._dimensions.device.canvas.height,t[he+4]=te.texturePage,t[he+5]=te.texturePositionClipSpace.x+Pi/this._atlas.pages[te.texturePage].canvas.width,t[he+6]=te.texturePositionClipSpace.y,t[he+7]=te.sizeClipSpace.x-Pi/this._atlas.pages[te.texturePage].canvas.width,t[he+8]=te.sizeClipSpace.y):(t[he]=-te.offset.x+this._dimensions.device.char.left,t[he+1]=-te.offset.y+this._dimensions.device.char.top,t[he+2]=te.size.x/this._dimensions.device.canvas.width,t[he+3]=te.size.y/this._dimensions.device.canvas.height,t[he+4]=te.texturePage,t[he+5]=te.texturePositionClipSpace.x,t[he+6]=te.texturePositionClipSpace.y,t[he+7]=te.sizeClipSpace.x,t[he+8]=te.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&O_(s,h,te.size.x,this._dimensions.device.cell.width)&&(t[he+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*qt;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function xf(){return new Cf}var Rs=4,ms=1,ws=2,cr=3,kf=2147483648,Lf=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=xf()}resize(t,e){let i=t*e*Rs;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Bf=`#version 300 es +layout (location = 0) in vec2 a_position; +layout (location = 1) in vec2 a_size; +layout (location = 2) in vec4 a_color; +layout (location = 3) in vec2 a_unitquad; + +uniform mat4 u_projection; + +out vec4 v_color; + +void main() { + vec2 zeroToOne = a_position + (a_unitquad * a_size); + gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0); + v_color = a_color; +}`,Ef=`#version 300 es +precision lowp float; + +in vec4 v_color; + +out vec4 outColor; + +void main() { + outColor = v_color; +}`,Dt=8,dr=Dt*Float32Array.BYTES_PER_ELEMENT,Mf=20*Dt,Uo=class{constructor(){this.attributes=new Float32Array(Mf),this.count=0}},Et=0,qo=0,Ko=0,Vo=0,jo=0,Go=0,Yo=0,Rf=class extends dt{constructor(t,e,i,s){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=s,this._vertices=new Uo,this._verticesCursor=new Uo;let r=this._gl;this._program=we(Ol(r,Bf,Ef)),this._register(We(()=>r.deleteProgram(this._program))),this._projectionLocation=we(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(We(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(We(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=we(r.createBuffer()),this._register(We(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,dr,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,dr,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,dr,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(a=>{this._updateCachedColors(a),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,Il),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,s=1,r,n,o,l,h,a,c,_,f,d,m;for(r=0;r>24&255)/255,jo=(Et>>16&255)/255,Go=(Et>>8&255)/255,Yo=1,this._addRectangle(t.attributes,e,qo,Ko,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Vo,jo,Go,Yo)}_addRectangle(t,e,i,s,r,n,o,l,h,a){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=l,t[e+6]=h,t[e+7]=a}_addRectangleFloat(t,e,i,s,r,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},Tf=class extends dt{constructor(t,e,i,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(We(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=we(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,s=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Pl(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=yl,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let s=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},Df=class extends Tf{constructor(t,e,i,s,r,n,o){super(i,t,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&ff(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e=0;xi.indexOf("AppleWebKit")>=0;var Pf=xi.indexOf("Chrome")>=0;!Pf&&xi.indexOf("Safari")>=0;xi.indexOf("Electron/")>=0;xi.indexOf("Android")>=0;var ur=!1;if(typeof ti.matchMedia=="function"){let t=ti.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ti.matchMedia("(display-mode: fullscreen)");ur=t.matches,Af(ti,t,({matches:i})=>{ur&&e.matches||(ur=i)})}var mi="en",_r=!1,Nl=!1,ls,Ss=mi,Xo=mi,$f,Tt,ni=globalThis,et;typeof ni.vscode<"u"&&typeof ni.vscode.process<"u"?et=ni.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(et=process);var If=typeof et?.versions?.electron=="string",Of=If&&et?.type==="renderer";if(typeof et=="object"){et.platform,et.platform,_r=et.platform==="linux",_r&&et.env.SNAP&&et.env.SNAP_REVISION,et.env.CI||et.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ls=mi,Ss=mi;let t=et.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);ls=e.userLocale,Xo=e.osLocale,Ss=e.resolvedLanguage||mi,$f=e.languagePack?.translationsConfigFile}catch{}Nl=!0}else typeof navigator=="object"&&!Of?(Tt=navigator.userAgent,Tt.indexOf("Windows")>=0,Tt.indexOf("Macintosh")>=0,(Tt.indexOf("Macintosh")>=0||Tt.indexOf("iPad")>=0||Tt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_r=Tt.indexOf("Linux")>=0,Tt?.indexOf("Mobi")>=0,Ss=globalThis._VSCODE_NLS_LANGUAGE||mi,ls=navigator.language.toLowerCase(),Xo=ls):console.error("Unable to resolve platform.");var Jo=Nl,yt=Tt,zt=Ss,Ff;(t=>{function e(){return zt}t.value=e;function i(){return zt.length===2?zt==="en":zt.length>=3?zt[0]==="e"&&zt[1]==="n"&&zt[2]==="-":!1}t.isDefaultVariant=i;function s(){return zt==="en"}t.isDefault=s})(Ff||={});var Nf=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(Nf){let t=[];ni.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),ni.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Wf=!!(yt&&yt.indexOf("Chrome")>=0);yt&&yt.indexOf("Firefox")>=0;!Wf&&yt&&yt.indexOf("Safari")>=0;yt&&yt.indexOf("Edg/")>=0;yt&&yt.indexOf("Android")>=0;var _i=typeof navigator=="object"?navigator:{};Jo||document.queryCommandSupported&&document.queryCommandSupported("copy")||_i&&_i.clipboard&&_i.clipboard.writeText,Jo||_i&&_i.clipboard&&_i.clipboard.readText;var Mn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},fr=new Mn,Zo=new Mn,Qo=new Mn;new Array(230);var zf;(t=>{function e(l){return fr.keyCodeToStr(l)}t.toString=e;function i(l){return fr.strToKeyCode(l)}t.fromString=i;function s(l){return Zo.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return Qo.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return Zo.strToKeyCode(l)||Qo.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return fr.keyCodeToStr(l)}t.toElectronAccelerator=o})(zf||={});var Wl=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),Hf;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof Uf?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Wl})})(Hf||={});var Uf=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Wl:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},qf;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(qf||={});var ea=class at{static fromArray(e){return new at(i=>{i.emitMany(e)})}static fromPromise(e){return new at(async i=>{i.emitMany(await e)})}static fromPromises(e){return new at(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new at(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new se,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new at(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return at.map(this,e)}static filter(e,i){return new at(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return at.filter(this,e)}static coalesce(e){return at.filter(e,i=>!!i)}coalesce(){return at.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return at.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};ea.EMPTY=ea.fromArray([]);var{getWindow:Kf}=function(){let t=new Map,e={window:ti,disposables:new wi};t.set(ti.vscodeWindowId,e);let i=new se,s=new se,r=new se;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return dt.None;let l=new wi,h={window:o,disposables:l.add(new wi)};return t.set(o.vscodeWindowId,h),l.add(We(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(_n(o,jf.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:ti},getDocument(o){return Kf(o).document}}}(),Vf=class{constructor(t,e,i,s){this._node=t,this._type=e,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function _n(t,e,i,s){return new Vf(t,e,i,s)}var jf={BEFORE_UNLOAD:"beforeunload"},Gf=class extends dt{constructor(t,e,i,s,r,n,o,l,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new Ti,this._charAtlasDisposable=this._register(new Ti),this._observerDisposable=this._register(new Ti),this._model=new Lf,this._workCell=new zo,this._workCell2=new zo,this._rectangleRenderer=this._register(new Ti),this._glyphRenderer=this._register(new Ti),this._onChangeTextureAtlas=this._register(new se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new se),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new se),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let a={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",a),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new W_(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Df(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=F_(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(_n(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(_n(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,No(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Wo(this._canvas,this._coreBrowserService.window,(c,_)=>this._setCanvasDevicePixelDimensions(c,_)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=Wo(this._canvas,c,(_,f)=>this._setCanvasDevicePixelDimensions(_,f))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(We(()=>{for(let c of this._renderLayers)c.dispose();this._canvas.parentElement?.removeChild(this._canvas),No(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Rf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new yf(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=Pl(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=vl(Pt.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Pt.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new gf(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,s=this._workCell,r,n,o,l,h,a,c=0,_=!0,f,d,m,y,k,R,D,T,S;t=ta(t,i.rows-1,0),e=ta(e,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",B=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,$=B-i.buffer.ydisp,U=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Y=-1,le=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let W=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,l=i.buffer.lines.get(o),this._model.lineLengths[n]=0,m=B===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),T=0;T=c,f=T,h.length>0&&T===h[0][0]&&_){d=h.shift();let v=this._model.selection.isCellSelected(this._terminal,d[0],o);for(D=d[0]+1;D=d[1],_?(a=!0,s=new Yf(s,l.translateToString(!0,d[0],d[1]),d[1]-d[0]),f=d[1]-1):c=d[1]}if(y=s.getChars(),k=s.getCode(),D=(n*i.cols+T)*Rs,this._cellColorResolver.resolve(s,T,o,this.dimensions.device.cell.width),le&&o===B&&(T===U&&(this._model.cursor={x:U,y:$,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Y=U+s.getWidth()-1),T>=U&&T<=Y&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),k!==0&&(this._model.lineLengths[n]=T+1),!(this._model.cells[D]===k&&this._model.cells[D+ms]===this._cellColorResolver.result.bg&&this._model.cells[D+ws]===this._cellColorResolver.result.fg&&this._model.cells[D+cr]===this._cellColorResolver.result.ext)&&(W=!0,y.length>1&&(k|=kf),this._model.cells[D]=k,this._model.cells[D+ms]=this._cellColorResolver.result.bg,this._model.cells[D+ws]=this._cellColorResolver.result.fg,this._model.cells[D+cr]=this._cellColorResolver.result.ext,R=s.getWidth(),this._glyphRenderer.value.updateCell(T,n,k,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,y,R,r),a)){for(s=this._workCell,T++;T<=f;T++)S=(n*i.cols+T)*Rs,this._glyphRenderer.value.updateCell(T,n,0,0,0,0,T_,0,0),this._model.cells[S]=0,this._model.cells[S+ms]=this._cellColorResolver.result.bg,this._model.cells[S+ws]=this._cellColorResolver.result.fg,this._model.cells[S+cr]=this._cellColorResolver.result.ext;T--}}W&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},Yf=class extends vi{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function ta(t,e,i=0){return Math.max(Math.min(t,e),i)}var ia="di$target",sa="di$dependencies",gr=new Map;function Ct(t){if(gr.has(t))return gr.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Xf(e,i,r)};return e._id=t,gr.set(t,e),e}function Xf(t,e,i){e[ia]===e?e[sa].push({id:t,index:i}):(e[sa]=[{id:t,index:i}],e[ia]=e)}Ct("BufferService");Ct("CoreMouseService");Ct("CoreService");Ct("CharsetService");Ct("InstantiationService");Ct("LogService");var Jf=Ct("OptionsService");Ct("OscLinkService");Ct("UnicodeService");Ct("DecorationService");var Zf={trace:0,debug:1,info:2,warn:3,error:4,off:5},Qf="xterm.js: ",ra=class extends dt{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Zf[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;ethis.activate(t)));return}this._terminal=t;let i=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,h=r._coreBrowserService,a=r._decorationService;r._logService;let c=r._themeService;this._renderer=this._register(new Gf(t,o,l,h,i,a,s,c,this._preserveDrawingBuffer)),this._register(Pt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Pt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Pt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Pt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(We(()=>{if(this._terminal._core._store._isDisposed)return;let _=this._terminal._core._renderService;_.setRenderer(this._terminal._core._createRenderer()),_.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};class ze{aliases;usage;matches(e){const i=e.toLowerCase();return i===this.name.toLowerCase()||(this.aliases?.some(s=>i===s.toLowerCase())??!1)}writeLine(e,i,s){s?e.writeln(`${s}${i}\x1B[0m`):e.writeln(i)}writeSuccess(e,i){e.writeln(`\x1B[1;32m✓\x1B[0m ${i}`)}writeError(e,i){e.writeln(`\x1B[1;31m✗ Error:\x1B[0m ${i}`)}writeInfo(e,i){e.writeln(`\x1B[90m${i}\x1B[0m`)}startLoading(e,i){const s=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];let r=0,n=!0;const o=setInterval(()=>{if(!n){clearInterval(o);return}e.write(`\r\x1B[36m${s[r]}\x1B[0m ${i}`),r=(r+1)%s.length},80);return()=>{n=!1,clearInterval(o),e.write("\r\x1B[K")}}}class tg extends ze{constructor(e){super(),this.commands=e}name="help";description="Show available commands";aliases=["?","h"];execute({term:e,writePrompt:i}){e.writeln(""),e.writeln("\x1B[1;33mAvailable Commands:\x1B[0m"),e.writeln(""),this.commands.forEach(s=>{const r=s.aliases?.length?` (${s.aliases.join(", ")})`:"";e.writeln(` \x1B[1;36m${s.name.padEnd(15)}\x1B[0m ${s.description}${r}`)}),e.writeln(""),e.writeln("\x1B[90mTip: Use Tab for autocomplete, ↑↓ for history, Ctrl+F to search\x1B[0m"),i()}}class ig extends ze{name="clear";description="Clear terminal screen";aliases=["cls"];execute({term:e,writePrompt:i}){e.clear(),i()}}class sg extends ze{name="status";description="Show repeater status";aliases=["st"];async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching status...");try{const r=await J.get("/stats");s();const n=r.success&&r.data?r.data:r;if(n&&typeof n=="object"){this.writeSuccess(e,"Repeater Status:"),e.writeln("");for(const[o,l]of Object.entries(n))e.writeln(` \x1B[36m${o.padEnd(20)}\x1B[0m ${l}`)}else this.writeError(e,"No status data available")}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch status")}i()}}class rg extends ze{name="uptime";description="Show system uptime";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching uptime...");try{const r=await J.get("/stats");s();const o=(r.data||r).uptime_seconds||0,l=this.formatUptime(o);this.writeSuccess(e,l)}catch(r){s(),this.writeError(e,`Failed to get uptime: ${r}`)}i()}formatUptime(e){const i=Math.floor(e/86400),s=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return i>0?`${i}d ${s}h ${r}m`:s>0?`${s}h ${r}m`:`${r}m`}}class ng extends ze{name="packets";description="Show packet statistics";isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching packet stats...");try{const r=await J.get("/stats");s();const n=r.data||r;this.writeLine(e,""),this.isMobile()?(this.writeLine(e," \x1B[1;36mPacket Statistics\x1B[0m"),this.writeLine(e," \x1B[90mRX:\x1B[0m "+(n.rx_count||0)),this.writeLine(e," \x1B[90mTX:\x1B[0m "+(n.tx_count||0)),this.writeLine(e," \x1B[90mForward:\x1B[0m "+(n.forwarded_count||0)),this.writeLine(e," \x1B[90mDropped:\x1B[0m "+(n.dropped_count||0))):(this.writeLine(e," \x1B[36m┌──────────┬──────────┐\x1B[0m"),this.writeLine(e," \x1B[36m│\x1B[0m \x1B[1mMetric\x1B[0m \x1B[36m│\x1B[0m \x1B[1mCount\x1B[0m \x1B[36m│\x1B[0m"),this.writeLine(e," \x1B[36m├──────────┼──────────┤\x1B[0m"),this.writeLine(e,` \x1B[36m│\x1B[0m RX \x1B[36m│\x1B[0m ${String(n.rx_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m TX \x1B[36m│\x1B[0m ${String(n.tx_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m Forward \x1B[36m│\x1B[0m ${String(n.forwarded_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m Dropped \x1B[36m│\x1B[0m ${String(n.dropped_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e," \x1B[36m└──────────┴──────────┘\x1B[0m")),this.writeLine(e,"")}catch(r){s(),this.writeError(e,`Failed to get packet stats: ${r}`)}i()}}class og extends ze{name="board";description="Show board information";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching board info...");try{const r=await J.get("/stats");s();const o=(r.data||r).board_info||"pyMC_Repeater (Linux/RPi)";this.writeSuccess(e,o)}catch{s(),this.writeSuccess(e,"pyMC_Repeater (Linux/RPi)")}i()}}class ag extends ze{name="advert";description="Send neighbor advert immediately";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Sending advert...");try{const r=await J.post("/send_advert",{},{timeout:1e4});s(),r.success?this.writeSuccess(e,r.data||"Advert sent successfully"):this.writeError(e,r.error||"Failed to send advert")}catch(r){s(),this.writeError(e,`Failed to send advert: ${r}`)}i()}}class lg extends ze{name="get";description="Get configuration values (name, freq, tx, mode, duty, etc.)";matches(e){const i=e.toLowerCase();return i==="get"||i.startsWith("get ")}async execute({term:e,args:i,writePrompt:s}){const r=i[0]?.toLowerCase();if(!r){this.writeError(e,"Usage: get "),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeLine(e,""),this.writeLine(e," \x1B[36mname\x1B[0m Node name"),this.writeLine(e," \x1B[36mrole\x1B[0m Node role"),this.writeLine(e," \x1B[36mlat\x1B[0m Latitude"),this.writeLine(e," \x1B[36mlon\x1B[0m Longitude"),this.writeLine(e," \x1B[36mfreq\x1B[0m Frequency (MHz)"),this.writeLine(e," \x1B[36mtx\x1B[0m TX power (dBm)"),this.writeLine(e," \x1B[36mbw\x1B[0m Bandwidth (kHz)"),this.writeLine(e," \x1B[36msf\x1B[0m Spreading factor"),this.writeLine(e," \x1B[36mcr\x1B[0m Coding rate"),this.writeLine(e," \x1B[36mradio\x1B[0m All radio settings"),this.writeLine(e," \x1B[36mtxdelay\x1B[0m TX delay factor"),this.writeLine(e," \x1B[36mdirect.txdelay\x1B[0m Direct TX delay"),this.writeLine(e," \x1B[36mrxdelay\x1B[0m RX delay base"),this.writeLine(e," \x1B[36maf\x1B[0m Airtime factor"),this.writeLine(e," \x1B[36mmode\x1B[0m Repeater mode"),this.writeLine(e," \x1B[36mrepeat\x1B[0m Repeat on/off"),this.writeLine(e," \x1B[36mflood.max\x1B[0m Max flood hops"),this.writeLine(e," \x1B[36madvert.interval\x1B[0m Advert interval"),this.writeLine(e," \x1B[36mduty\x1B[0m Duty cycle enabled"),this.writeLine(e," \x1B[36mduty.max\x1B[0m Max airtime %"),this.writeLine(e," \x1B[36mpublic.key\x1B[0m Public key"),this.writeLine(e,""),s();return}const n=this.startLoading(e,"Fetching configuration...");try{const o=await J.get("/stats");n();const l=o.data||o,h=l.config||{},a=h.radio||{},c=h.repeater||{},_=h.delays||{},f=h.duty_cycle||{};let d="";switch(r){case"name":d=h.node_name||"Unknown";break;case"role":d="repeater";break;case"lat":d=c.latitude!=null?String(c.latitude):"not set";break;case"lon":d=c.longitude!=null?String(c.longitude):"not set";break;case"freq":d=a.frequency?`${(a.frequency/1e6).toFixed(3)} MHz`:"?";break;case"tx":d=a.tx_power!=null?`${a.tx_power}dBm`:"?";break;case"bw":d=a.bandwidth?`${a.bandwidth/1e3} kHz`:"?";break;case"sf":d=a.spreading_factor!=null?String(a.spreading_factor):"?";break;case"cr":d=a.coding_rate!=null?`4/${a.coding_rate}`:"?";break;case"radio":if(a.frequency){this.writeSuccess(e,"Radio Configuration:"),this.writeLine(e,""),this.writeLine(e,` \x1B[36mFrequency:\x1B[0m ${(a.frequency/1e6).toFixed(3)} MHz`),this.writeLine(e,` \x1B[36mBandwidth:\x1B[0m ${a.bandwidth/1e3} kHz`),this.writeLine(e,` \x1B[36mSpreading Factor:\x1B[0m ${a.spreading_factor}`),this.writeLine(e,` \x1B[36mCoding Rate:\x1B[0m 4/${a.coding_rate}`),this.writeLine(e,` \x1B[36mTX Power:\x1B[0m ${a.tx_power}dBm`),this.writeLine(e,""),s();return}else d="Radio configuration not available";break;case"af":case"txdelay":d=_.tx_delay_factor!=null?String(_.tx_delay_factor):"\x1B[90mnot set (default: 1.0)\x1B[0m";break;case"direct.txdelay":d=_.direct_tx_delay_factor!=null?String(_.direct_tx_delay_factor):"\x1B[90mnot set (default: 0.5)\x1B[0m";break;case"rxdelay":d=_.rx_delay_base!=null?`${_.rx_delay_base}s`:"\x1B[90mnot set (default: 0.0s)\x1B[0m";break;case"mode":d=c.mode!=null?c.mode:"\x1B[90mnot set (default: forward)\x1B[0m";break;case"repeat":c.mode!=null?d=c.mode==="forward"?"on":"off":d="\x1B[90mnot set (default: on)\x1B[0m";break;case"flood.max":d=c.max_flood_hops!=null?String(c.max_flood_hops):"\x1B[90mnot set (default: 3)\x1B[0m";break;case"flood.advert.interval":d=c.send_advert_interval_hours!=null?`${c.send_advert_interval_hours}h`:"\x1B[90mnot set\x1B[0m";break;case"advert.interval":d=c.advert_interval_minutes!=null?`${c.advert_interval_minutes}m`:"\x1B[90mnot set (default: 120m)\x1B[0m";break;case"duty":case"duty.enabled":d=f.enforcement_enabled!=null?f.enforcement_enabled?"on":"off":"\x1B[90mnot set (default: off)\x1B[0m";break;case"duty.max":d=f.max_airtime_percent!=null?`${f.max_airtime_percent}%`:"\x1B[90mnot set\x1B[0m";break;case"public.key":d=l.public_key||"\x1B[90mnot available\x1B[0m";break;case"prv.key":this.writeWarning(e,"Private key not exposed via API for security"),this.writeInfo(e,"Check /etc/pymc_repeater/config.yaml"),s();return;case"guest.password":case"allow.read.only":this.writeWarning(e,"Security settings not exposed via API"),this.writeInfo(e,"Check /etc/pymc_repeater/config.yaml"),s();return;default:this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeInfo(e," Identity: name, role, lat, lon"),this.writeInfo(e," Radio: freq, tx, bw, sf, cr, radio"),this.writeInfo(e," Timing: txdelay, direct.txdelay, rxdelay, af"),this.writeInfo(e," Repeater: mode, repeat, flood.max, advert.interval"),this.writeInfo(e," Duty: duty, duty.max"),this.writeInfo(e," Security: public.key"),s();return}this.writeSuccess(e,d)}catch(o){n(),this.writeError(e,`Failed to get ${r}: ${o}`)}s()}writeWarning(e,i){e.writeln(`\x1B[1;33m⚠ Warning:\x1B[0m ${i}`)}}class hg extends ze{name="set";description="Set configuration values (tx, txdelay, mode, duty, etc.)";matches(e){const i=e.toLowerCase();return i==="set"||i.startsWith("set ")}async execute({term:e,args:i,writePrompt:s}){const r=i[0]?.toLowerCase(),n=i.slice(1).join(" ").trim();if(!r){this.writeError(e,"Usage: set "),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeLine(e,""),this.writeLine(e," \x1B[33mRadio:\x1B[0m"),this.writeLine(e," \x1B[36mtx <2-30>\x1B[0m TX power in dBm"),this.writeLine(e," \x1B[36mfreq \x1B[0m Frequency (100-1000 MHz) *restart required*"),this.writeLine(e," \x1B[36mbw \x1B[0m Bandwidth (7.8-500 kHz) *restart required*"),this.writeLine(e," \x1B[36msf <5-12>\x1B[0m Spreading factor *restart required*"),this.writeLine(e," \x1B[36mcr <5-8>\x1B[0m Coding rate (for 4/5 to 4/8) *restart required*"),this.writeLine(e,""),this.writeLine(e," \x1B[33mTiming:\x1B[0m"),this.writeLine(e," \x1B[36mtxdelay <0.0-5.0>\x1B[0m TX delay factor"),this.writeLine(e," \x1B[36mdirect.txdelay <0.0-5.0>\x1B[0m Direct TX delay factor"),this.writeLine(e," \x1B[36mrxdelay \x1B[0m RX delay base (>= 0)"),this.writeLine(e,""),this.writeLine(e," \x1B[33mIdentity:\x1B[0m"),this.writeLine(e," \x1B[36mname \x1B[0m Node name"),this.writeLine(e," \x1B[36mlat <-90 to 90>\x1B[0m Latitude"),this.writeLine(e," \x1B[36mlon <-180 to 180>\x1B[0m Longitude"),this.writeLine(e,""),this.writeLine(e," \x1B[33mRepeater:\x1B[0m"),this.writeLine(e," \x1B[36mmode \x1B[0m Repeater mode"),this.writeLine(e," \x1B[36mduty \x1B[0m Duty cycle enforcement"),this.writeLine(e," \x1B[36mflood.max <0-64>\x1B[0m Max flood hops"),this.writeLine(e," \x1B[36madvert.interval \x1B[0m Local advert interval"),this.writeLine(e,""),s();return}const o=this.startLoading(e,"Updating configuration...");try{let l;switch(r){case"tx":{const a=parseInt(n);if(isNaN(a)||a<2||a>30){o(),this.writeError(e,"TX power must be 2-30 dBm"),s();return}l=await J.post("/update_radio_config",{tx_power:a},{timeout:3e4});break}case"freq":{const a=parseFloat(n);if(isNaN(a)||a<100||a>1e3){o(),this.writeError(e,"Frequency must be 100-1000 MHz"),s();return}l=await J.post("/update_radio_config",{frequency:a*1e6},{timeout:3e4});break}case"bw":{const a=parseFloat(n),c=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500];if(isNaN(a)||!c.includes(a)){o(),this.writeError(e,`Bandwidth must be one of: ${c.join(", ")} kHz`),s();return}l=await J.post("/update_radio_config",{bandwidth:a*1e3},{timeout:3e4});break}case"sf":{const a=parseInt(n);if(isNaN(a)||a<5||a>12){o(),this.writeError(e,"Spreading factor must be 5-12"),s();return}l=await J.post("/update_radio_config",{spreading_factor:a},{timeout:3e4});break}case"cr":{const a=parseInt(n);if(isNaN(a)||a<5||a>8){o(),this.writeError(e,"Coding rate must be 5-8 (for 4/5 to 4/8)"),s();return}l=await J.post("/update_radio_config",{coding_rate:a},{timeout:3e4});break}case"af":case"txdelay":{const a=parseFloat(n);if(isNaN(a)||a<0||a>5){o(),this.writeError(e,"TX delay factor must be 0.0-5.0"),s();return}l=await J.post("/update_radio_config",{tx_delay_factor:a},{timeout:3e4});break}case"direct.txdelay":{const a=parseFloat(n);if(isNaN(a)||a<0||a>5){o(),this.writeError(e,"Direct TX delay factor must be 0.0-5.0"),s();return}l=await J.post("/update_radio_config",{direct_tx_delay_factor:a},{timeout:3e4});break}case"rxdelay":{const a=parseFloat(n);if(isNaN(a)||a<0){o(),this.writeError(e,"RX delay must be >= 0"),s();return}l=await J.post("/update_radio_config",{rx_delay_base:a},{timeout:3e4});break}case"name":{if(!n.trim()){o(),this.writeError(e,"Node name cannot be empty"),s();return}l=await J.post("/update_radio_config",{node_name:n.trim()},{timeout:3e4});break}case"lat":{const a=parseFloat(n);if(isNaN(a)||a<-90||a>90){o(),this.writeError(e,"Latitude must be -90 to 90"),s();return}l=await J.post("/update_radio_config",{latitude:a},{timeout:3e4});break}case"lon":{const a=parseFloat(n);if(isNaN(a)||a<-180||a>180){o(),this.writeError(e,"Longitude must be -180 to 180"),s();return}l=await J.post("/update_radio_config",{longitude:a},{timeout:3e4});break}case"mode":{const a=n.toLowerCase();if(a!=="forward"&&a!=="monitor"){o(),this.writeError(e,'Mode must be "forward" or "monitor"'),this.writeLine(e,""),this.writeInfo(e,"Valid values:"),this.writeLine(e," \x1B[36mforward\x1B[0m - Forward packets"),this.writeLine(e," \x1B[36mmonitor\x1B[0m - Monitor only (no forwarding)"),s();return}l=await J.post("/set_mode",{mode:a},{timeout:3e4}),l.data&&(l.data.applied=[`mode=${a}`],l.data.persisted=!0,l.data.live_update=!0);break}case"duty":{const a=n.toLowerCase();if(a!=="on"&&a!=="off"){o(),this.writeError(e,'Duty cycle must be "on" or "off"'),this.writeLine(e,""),this.writeInfo(e,"Valid values:"),this.writeLine(e," \x1B[36mon\x1B[0m - Enable duty cycle enforcement"),this.writeLine(e," \x1B[36moff\x1B[0m - Disable duty cycle enforcement"),s();return}const c=a==="on";l=await J.post("/set_duty_cycle",{enabled:c},{timeout:3e4}),l.data&&(l.data.applied=[`duty=${a}`],l.data.persisted=!0,l.data.live_update=!0);break}case"flood.max":{const a=parseInt(n);if(isNaN(a)||a<0||a>64){o(),this.writeError(e,"Max flood hops must be 0-64"),s();return}l=await J.post("/update_radio_config",{max_flood_hops:a},{timeout:3e4});break}case"flood.advert.interval":{const a=parseInt(n);if(isNaN(a)||a!==0&&(a<3||a>48)){o(),this.writeError(e,"Flood advert interval must be 0 (off) or 3-48 hours"),s();return}l=await J.post("/update_radio_config",{flood_advert_interval_hours:a},{timeout:3e4});break}case"advert.interval":{const a=parseInt(n);if(isNaN(a)||a!==0&&(a<1||a>10080)){o(),this.writeError(e,"Advert interval must be 0 (off) or 1-10080 minutes"),s();return}l=await J.post("/update_radio_config",{advert_interval_minutes:a},{timeout:3e4});break}case"log":o(),this.writeWarning(e,"Log level configuration not yet implemented"),this.writeInfo(e,"Backend endpoint /set_log_level does not exist"),s();return;default:o(),this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,""),this.writeInfo(e,'Type "set" without arguments to see available parameters'),s();return}o();const h=l.data||l;l.success?(h.applied&&h.applied.length>0?this.writeSuccess(e,`Configuration updated: ${h.applied.join(", ")}`):this.writeSuccess(e,"Configuration updated"),h.restart_required?(this.writeLine(e,""),this.writeWarning(e,"⚠ Service restart required for changes to take effect"),this.writeInfo(e,"Run: sudo systemctl restart pymc_repeater")):h.message&&!h.live_update&&(this.writeLine(e,""),this.writeInfo(e,h.message))):this.writeError(e,l.error||"Failed to update configuration")}catch(l){o(),this.writeError(e,`Failed to update ${r}: ${l}`)}this.writeLine(e,""),s()}writeWarning(e,i){e.writeln(`\x1B[1;33m⚠ Warning:\x1B[0m ${i}`)}}class cg extends ze{name="identities";description="List all identities";aliases=["id","ids"];isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching identities...");try{const r=await J.getIdentities();s();let n=[];if(r.success&&r.data){const o=r.data,l=o.registered||[],h=o.configured||[];n=h.length>0?h:l}else Array.isArray(r)&&(n=r);n.length===0?this.writeInfo(e,"No identities found"):(this.writeSuccess(e,`Found \x1B[1m${n.length}\x1B[0m identit${n.length===1?"y":"ies"}`),e.writeln(""),this.isMobile()?n.forEach((o,l)=>{e.writeln(`\x1B[1;36m[${l+1}] ${o.name||"Unnamed"}\x1B[0m`),e.writeln(` \x1B[90mType:\x1B[0m ${o.type||"-"}`),e.writeln(` \x1B[90mHash:\x1B[0m ${o.hash||"-"}`),e.writeln(` \x1B[90mAddress:\x1B[0m ${o.address||"-"}`),e.writeln(` \x1B[90mRegistered:\x1B[0m ${o.registered?"\x1B[32myes\x1B[0m":"\x1B[31mno\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.name||"Unnamed").padEnd(27),c=(o.type||"-").padEnd(13),_=(o.hash||"-").padEnd(4),f=(o.address||"-").padEnd(7),d=(o.registered?"yes":"no").padEnd(10);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴─────────────────────────────┴───────────────┴──────┴─────────┴────────────┘\x1B[0m")))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch identities")}i()}}class dg extends ze{name="keys";description="List transport keys";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching transport keys...");try{const r=await J.getTransportKeys();s();const n=r.success&&r.data?r.data:r,o=Array.isArray(n)?n:[];o.length===0?this.writeInfo(e,"No transport keys found"):(this.writeSuccess(e,`Found \x1B[1m${o.length}\x1B[0m transport key${o.length===1?"":"s"}`),e.writeln(""),o.forEach((l,h)=>{e.writeln(`\x1B[36m${(h+1).toString().padStart(2)}.\x1B[0m \x1B[1m${l.name||"Unnamed"}\x1B[0m`),l.flood_policy&&e.writeln(` Policy: \x1B[90m${l.flood_policy}\x1B[0m`),l.parent_id&&e.writeln(` Parent: \x1B[90m${l.parent_id}\x1B[0m`),h{if(e.writeln(`\x1B[1;36m[${l+1}] ${o.node_name||"Unknown"}\x1B[0m`),e.writeln(` \x1B[90mPubKey:\x1B[0m ${o.pubkey?.substring(0,8)||"----"}`),e.writeln(` \x1B[90mType:\x1B[0m ${o.contact_type||"-"}`),o.last_seen){const h=new Date(o.last_seen*1e3).toLocaleString("en-US",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});e.writeln(` \x1B[90mLast Seen:\x1B[0m ${h}`)}o.rssi&&e.writeln(` \x1B[90mRSSI:\x1B[0m ${o.rssi}`),o.snr&&e.writeln(` \x1B[90mSNR:\x1B[0m ${o.snr}`),e.writeln(` \x1B[90mAdverts:\x1B[0m ${o.advert_count||0}`),e.writeln(` \x1B[90mDirect:\x1B[0m ${o.zero_hop?"\x1B[32myes\x1B[0m":"\x1B[31mno\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.node_name||"Unknown").padEnd(20),c=(o.pubkey?.substring(0,4)||"----").padEnd(6),_=(o.contact_type||"-").padEnd(12),f=o.last_seen?new Date(o.last_seen*1e3).toLocaleString("en-US",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).padEnd(20):"-".padEnd(20),d=(o.rssi?`${o.rssi}`:"-").padEnd(8),m=(o.snr?`${o.snr}`:"-").padEnd(4),y=(o.advert_count?.toString()||"0").padEnd(6),k=(o.zero_hop?"yes":"no").padEnd(6);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m ${m} \x1B[36m│\x1B[0m ${y} \x1B[36m│\x1B[0m ${k} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴──────────────────────┴────────┴──────────────┴──────────────────────┴──────────┴──────┴────────┴────────┘\x1B[0m")),n.length>10&&(e.writeln(""),e.writeln(`\x1B[90m... and ${n.length-10} more neighbors\x1B[0m`)))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch neighbors")}i()}}class _g extends ze{name="acl";description="Show ACL statistics";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching ACL stats...");try{const r=await J.getACLStats();s();const n=r.success&&r.data?r.data:r;if(n&&typeof n=="object"){this.writeSuccess(e,"ACL Statistics:"),e.writeln("");const o=(l,h=" ")=>{if(typeof l=="object"&&l!==null&&!Array.isArray(l))for(const[a,c]of Object.entries(l))typeof c=="object"&&c!==null?(e.writeln(`${h}\x1B[90m${a}:\x1B[0m`),o(c,h+" ")):e.writeln(`${h}\x1B[90m${a.padEnd(18)}\x1B[0m ${c}`);else e.writeln(`${h}${l}`)};for(const[l,h]of Object.entries(n))typeof h=="object"&&h!==null?(e.writeln(` \x1B[36m${l}\x1B[0m`),o(h," ")):e.writeln(` \x1B[36m${l.padEnd(20)}\x1B[0m ${h}`)}else this.writeError(e,"No ACL data available")}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch ACL stats")}i()}}class fg extends ze{name="rooms";description="List room servers";isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching room stats...");try{const r=await J.getRoomStats();s();let n=[];r.success&&r.data?n=r.data.rooms||(Array.isArray(r.data)?r.data:[]):Array.isArray(r)&&(n=r),n.length===0?this.writeInfo(e,"No room servers found"):(this.writeSuccess(e,`Found \x1B[1m${n.length}\x1B[0m room server${n.length===1?"":"s"}`),e.writeln(""),this.isMobile()?n.forEach((o,l)=>{e.writeln(`\x1B[1;36m[${l+1}] ${o.room_name||"Unnamed"}\x1B[0m`),e.writeln(` \x1B[90mMessages:\x1B[0m ${o.total_messages||0}`),e.writeln(` \x1B[90mTotal Clients:\x1B[0m ${o.total_clients||0}`),e.writeln(` \x1B[90mActive Clients:\x1B[0m ${o.active_clients||0}`),e.writeln(` \x1B[90mSync:\x1B[0m ${o.sync_running?"\x1B[32mrunning\x1B[0m":"\x1B[31mstopped\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.room_name||"Unnamed").padEnd(27),c=(o.total_messages?.toString()||"0").padEnd(8),_=(o.total_clients?.toString()||"0").padEnd(12),f=(o.active_clients?.toString()||"0").padEnd(14),d=(o.sync_running?"running":"stopped").padEnd(8);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴─────────────────────────────┴──────────┴──────────────┴────────────────┴──────────┘\x1B[0m")))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch room stats")}i()}}class gg extends ze{name="restart";description="Restart the pymc-repeater service";aliases=["reboot"];matches(e){const i=e.toLowerCase();return i==="restart"||i==="reboot"}async execute({term:e,writePrompt:i}){this.writeLine(e,""),this.writeLine(e,"\x1B[33m⚠️ This will restart the repeater service!\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"Attempting to restart service...");const s=this.startLoading(e,"Restarting...");try{const r=await J.post("/restart_service",{},{timeout:1e4});s(),r.success?(this.writeLine(e,""),this.writeSuccess(e,r.message||"Service restart initiated"),this.writeLine(e,""),this.writeInfo(e,"The service will restart momentarily. You may need to refresh this page.")):(this.writeLine(e,""),this.writeError(e,"Restart failed: "+(r.error||r.message||"Unknown error")),this.writeLine(e,""),this.writeInfo(e,"You may need to manually restart: sudo systemctl restart pymc-repeater"))}catch(r){s(),this.writeLine(e,"");const n=r;if(n.code==="ERR_NETWORK"||n.message?.includes("Network error")||n.message?.includes("ECONNRESET")||n.code==="ECONNRESET"){this.writeSuccess(e,"Service restart initiated successfully"),this.writeLine(e,""),await this.waitForServiceRestart(e,i);return}else n.code==="ECONNABORTED"||n.message?.includes("timeout")?(this.writeLine(e,"\x1B[33m⚠️ Request timed out - service may be restarting\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"Refresh the page in a few seconds to reconnect.")):n.response?.status===403||n.response?.status===401?(this.writeError(e,"Permission denied. Polkit rules may need configuration."),this.writeLine(e,""),this.writeInfo(e,"Run: sudo bash -c 'mkdir -p /etc/polkit-1/rules.d && cat > /etc/polkit-1/rules.d/10-pymc-repeater.rules <0;a--)e.write(`\r\x1B[36m⏳\x1B[0m Restarting service... ${a}s`),await new Promise(c=>setTimeout(c,1e3));e.write("\r\x1B[K");let o=4,l=0;const h="\r\x1B[36m⏳\x1B[0m Verifying restart (attempt ";for(;o<20;){l++,e.write(`${h}${l})... `);try{if((await fetch(`${window.location.protocol}//${window.location.host}/api/stats`,{signal:AbortSignal.timeout(3e3)})).ok){e.write("\r\x1B[K"),this.writeLine(e,""),this.writeSuccess(e,`Service is back online! (took ~${o}s)`),this.writeLine(e,""),i();return}}catch(a){const c=a;c.code&&!["ERR_NETWORK","ECONNREFUSED","ECONNRESET"].includes(c.code)&&e.write(`[${c.code}] `)}await new Promise(a=>setTimeout(a,1*1e3)),o+=1}e.write("\r\x1B[K"),this.writeLine(e,""),this.writeLine(e,"\x1B[33m⚠️ Service did not respond within 20 seconds\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"The service may still be starting. Try: status"),this.writeLine(e,""),i()}}class pg extends ze{name="ping";description="Ping a neighbor node to measure latency and signal quality";usage="ping [timeout_seconds]";async execute({term:e,args:i,writePrompt:s}){if(i.length===0){this.writeError(e,"Missing target node"),e.writeln(""),this.writeInfo(e,`Usage: ${this.usage}`),e.writeln(""),this.writeInfo(e,"Examples:"),this.writeInfo(e," ping MyNeighbor - Ping node by name"),this.writeInfo(e," ping 0xb5 - Ping node by pubkey hash"),this.writeInfo(e," ping MyNeighbor 20 - Ping with 20s timeout"),s();return}const r=i[0],n=i.length>1?parseInt(i[1]):10;if(isNaN(n)||n<1||n>60){this.writeError(e,"Invalid timeout. Must be between 1-60 seconds"),s();return}let o=null;const l=r.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(l)o=`0x${l[2].padStart(2,"0")}`;else{const a=this.startLoading(e,"Resolving target...");try{const c=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];let _=!1;for(const f of c)try{const d=await J.get("/adverts_by_contact_type",{contact_type:f,hours:168}),m=d.success&&d.data?d.data:d,k=(Array.isArray(m)?m:[]).find(R=>R.node_name&&R.node_name.toLowerCase()===r.toLowerCase());if(k&&k.pubkey){o=`0x${k.pubkey.substring(0,2)}`,_=!0;break}}catch{continue}if(a(),!_){this.writeError(e,`Node '${r}' not found in neighbors`),e.writeln(""),this.writeInfo(e,"Try: neighbors - to list available nodes"),s();return}}catch(c){a(),this.writeError(e,`Failed to resolve target: ${c}`),s();return}}this.writeLine(e,`\x1B[36mPinging ${r} (${o}) with ${n}s timeout...\x1B[0m`),e.writeln("");const h=this.startLoading(e,"Waiting for response...");try{const a=await J.pingNeighbor(o,n);if(h(),a.success&&a.data){const c=a.data;this.writeSuccess(e,`Reply from ${r} (${c.target_id})`),e.writeln("");let _="\x1B[32m";if(c.rtt_ms>500?_="\x1B[31m":c.rtt_ms>250&&(_="\x1B[33m"),e.writeln(` \x1B[1mRound-Trip Time:\x1B[0m ${_}${c.rtt_ms.toFixed(2)} ms\x1B[0m`),e.writeln(` \x1B[1mRSSI:\x1B[0m ${c.rssi} dBm`),e.writeln(` \x1B[1mSNR:\x1B[0m ${c.snr_db} dB`),c.path&&c.path.length>0){const m=c.path.join(" → "),y=c.path.length;e.writeln(` \x1B[1mPath:\x1B[0m ${m}`),e.writeln(` \x1B[1mHops:\x1B[0m ${y}`)}e.writeln("");let f="Excellent",d="\x1B[32m";c.rtt_ms>500||c.rssi<-120?(f="Poor",d="\x1B[31m"):c.rtt_ms>250||c.rssi<-100?(f="Fair",d="\x1B[33m"):(c.rtt_ms>100||c.rssi<-80)&&(f="Good",d="\x1B[36m"),e.writeln(` \x1B[1mLink Quality:\x1B[0m ${d}${f}\x1B[0m`)}else this.writeError(e,a.error||"Ping failed")}catch(a){h(),this.writeError(e,`Ping failed: ${a.message||a}`)}e.writeln(""),s()}}async function na(){try{const t=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"],e=[];for(const i of t)try{const s=await J.get("/adverts_by_contact_type",{contact_type:i,hours:168}),r=s.success&&s.data?s.data:s;(Array.isArray(r)?r:[]).forEach(o=>{o.node_name&&!e.includes(o.node_name)&&e.push(o.node_name)})}catch{continue}return e.sort()}catch{return[]}}class vg{commands=[];constructor(){const e=new ig,i=new sg,s=new rg,r=new ng,n=new og,o=new ag,l=new lg,h=new hg,a=new cg,c=new dg,_=new ug,f=new _g,d=new fg,m=new gg,y=new pg,k=new tg([e,i,s,r,n,o,l,h,a,c,_,f,d,m,y]);this.commands=[k,e,i,s,r,n,o,l,h,a,c,_,f,d,m,y]}findCommand(e){return this.commands.find(i=>i.matches(e))}getAllCommands(){return this.commands}getCommandNames(){return this.commands.map(e=>e.name)}}const mg={class:"space-y-4 md:space-y-6"},wg={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-3 md:p-4"},Sg={class:"flex items-center justify-between"},bg={class:"flex items-center gap-2 md:gap-3"},yg=["title"],Cg={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},xg={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},kg={class:"hidden sm:inline"},Lg=["title"],Bg={class:"hidden sm:inline"},Eg=["title"],Mg={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Rg={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Tg={class:"hidden sm:inline"},Dg={key:0,class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-4"},Ag={class:"flex items-center gap-3"},Pg=["onKeydown"],$g={key:1,class:"absolute top-4 right-4 bg-black/80 backdrop-blur-sm px-3 py-2 rounded-lg border border-primary/30 flex items-center gap-2"},Ig=zl({name:"TerminalView",__name:"Terminal",setup(t){const{theme:e}=Ul(),i={background:"#1A1E1F",foreground:"#e0e0e0",cursor:"#00d9ff",cursorAccent:"#000000",selectionBackground:"#00d9ff40",selectionForeground:"#ffffff",black:"#000000",red:"#ff6b6b",green:"#51cf66",yellow:"#ffd93d",blue:"#00d9ff",magenta:"#e599f7",cyan:"#00d9ff",white:"#e0e0e0",brightBlack:"#6c757d",brightRed:"#ff8787",brightGreen:"#69db7c",brightYellow:"#ffe066",brightBlue:"#74c0fc",brightMagenta:"#f3a6ff",brightCyan:"#3bc9db",brightWhite:"#ffffff"},s={background:"#F3F4F6",foreground:"#1f2937",cursor:"#0D7377",cursorAccent:"#ffffff",selectionBackground:"#0D737740",selectionForeground:"#000000",black:"#1f2937",red:"#dc2626",green:"#15803d",yellow:"#a16207",blue:"#0D7377",magenta:"#7c3aed",cyan:"#0e7490",white:"#f3f4f6",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#0891b2",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"},r=ut(null),n=ut(null),o=ut(null),l=ut(""),h=ut(!1),a=ut(!1),c=ut(!1),_=ut(!1),f=ut(!1);ut(0);let d=null,m=null,y=null,k="";const R=[];let D=-1,T="";const S=new vg,L=S.getCommandNames();let B=[],$=0;const U={get:["name","role","lat","lon","freq","tx","bw","sf","cr","radio","txdelay","direct.txdelay","rxdelay","af","mode","repeat","flood.max","advert.interval","duty","duty.max","public.key"],set:["tx","freq","bw","sf","cr","txdelay","direct.txdelay","rxdelay","name","lat","lon","mode","duty","flood.max","advert.interval","flood.advert.interval"],ping:[]},Y={set:{mode:["forward","monitor"],duty:["on","off"]}},le={get:{name:"Node name",role:"Node role",lat:"Latitude",lon:"Longitude",freq:"Frequency (MHz)",tx:"TX power (dBm)",bw:"Bandwidth (kHz)",sf:"Spreading factor",cr:"Coding rate",radio:"All radio settings",txdelay:"TX delay factor","direct.txdelay":"Direct TX delay",rxdelay:"RX delay base",af:"Airtime factor",mode:"Repeater mode",repeat:"Repeat on/off","flood.max":"Max flood hops","advert.interval":"Advert interval",duty:"Duty cycle enabled","duty.max":"Max airtime %","public.key":"Public key"},set:{tx:"TX power (2-30 dBm)",freq:"Frequency (100-1000 MHz) *restart required*",bw:"Bandwidth (7.8-500 kHz) *restart required*",sf:"Spreading factor (5-12) *restart required*",cr:"Coding rate (5-8) *restart required*",txdelay:"TX delay factor (0.0-5.0)","direct.txdelay":"Direct TX delay (0.0-5.0)",rxdelay:"RX delay base (>= 0)",name:"Node name",lat:"Latitude (-90 to 90)",lon:"Longitude (-180 to 180)",mode:"Repeater mode (forward/monitor)",duty:"Duty cycle (on/off)","flood.max":"Max flood hops (0-64)","advert.interval":"Advert interval (0 or 1-10080 mins)","flood.advert.interval":"Flood advert (0 or 3-48 hrs)"},ping:{}};Hl(()=>{if(!r.value)return;c.value=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);const O=window.innerWidth<768;d=new su({cursorBlink:!1,cursorStyle:"underline",cursorWidth:3,fontFamily:'"JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace',fontSize:O?11:13,fontWeight:"400",fontWeightBold:"700",lineHeight:1.3,letterSpacing:.5,smoothScrollDuration:50,scrollSensitivity:3,fastScrollSensitivity:5,allowProposedApi:!0,screenReaderMode:c.value,theme:e.value==="dark"?i:s,scrollback:1e4,tabStopWidth:4,macOptionIsMeta:!0}),m=new ou,d.loadAddon(m);try{const fe=new eg;d.loadAddon(fe)}catch{console.warn("WebGL addon failed to load, falling back to canvas renderer")}const I=new uu((fe,ee)=>{window.open(ee,"_blank")});d.loadAddon(I);const G=new m_;if(d.loadAddon(G),d.unicode.activeVersion="11",y=new Ku,d.loadAddon(y),d.open(r.value),m.fit(),d.focus(),c.value&&n.value){const fe=n.value,ee=()=>{fe.focus({preventScroll:!1})};r.value?.addEventListener("click",ee),r.value?.addEventListener("touchstart",ee),fe.addEventListener("input",()=>{setTimeout(()=>{d?.scrollToBottom()},10)}),Rn(()=>{r.value?.removeEventListener("click",ee),r.value?.removeEventListener("touchstart",ee)})}const X=e.value==="dark"?"\x1B[1;37m":"\x1B[1;90m",_e=(e.value==="dark","\x1B[1;36m"),Le=(e.value==="dark","\x1B[90m"),Be="\x1B[36m",N="\x1B[0m";d.writeln(""),d.writeln(`${X} ██████ ██ ██ ███ ███ ██████${N}`),d.writeln(`${X} ██ ██ ██ ██ ████ ████ ██ ${N}`),d.writeln(`${X} ██████ ████ ██ ████ ██ ██ ${N}`),d.writeln(`${X} ██ ██ ██ ██ ██ ██ ${N}`),d.writeln(`${X} ██ ██ ██ ██ ██████${N}`),d.writeln(""),d.writeln(`${_e} Repeater Terminal${N}`),d.writeln(""),d.writeln(`${Le} Type ${Be}help${Le} for available commands${N}`),d.writeln(""),W(),d.onData(fe=>{p(fe)});const be=new ResizeObserver(()=>{m?.fit()});be.observe(r.value),Rn(()=>{be.disconnect(),d?.dispose()})});const W=()=>{d?.write(`\r +\x1B[1;36m❯\x1B[0m `)},v=O=>{if(!(!d||!O)){d.write(`\x1B[90m${O}\x1B[0m`);for(let I=0;I{if(!(!d||!T)){for(let O=0;O{if(!d)return;const I=O.charCodeAt(0);if(I===13){u(),d.write(`\r +`),k.trim()?(w(k.trim()),R.push(k.trim()),D=R.length):W(),k="";return}if(I===127){k.length>0&&(u(),k=k.slice(0,-1),d.write("\b \b"),g());return}if(I===3){u(),d.write(`^C\r +`),k="",W();return}if(I===12){d.clear(),k="",W();return}if(I===6){h.value=!h.value;return}if(O==="\x1B[A"){R.length>0&&D>0&&(u(),D--,d.write("\r\x1B[K"),W(),k=R[D],d.write(k));return}if(O==="\x1B[B"){u(),D2&&Y[_e]){const N=X[1]?.toLowerCase(),be=X.slice(2).join(" ").toLowerCase(),fe=Y[_e][N];if(fe){const ee=fe.filter(He=>He.toLowerCase().startsWith(be));if(ee.length===1){const He=X.slice(2).join(" "),ve=ee[0].slice(He.length);k+=ve,d.write(ve)}else ee.length>1&&(d.write(`\r +\r +\x1B[33mAvailable values:\x1B[0m\r +\r +`),ee.forEach(He=>{d.writeln(` \x1B[36m${He}\x1B[0m`)}),W(),d.write(k));return}}if(X.length>1&&U[_e]){if(_e==="ping"){const fe=X.slice(1).join(" ").toLowerCase(),ee=Date.now();ee-$>3e4&&na().then(ve=>{B=ve,$=ee,U.ping=ve});const He=B.filter(ve=>ve.toLowerCase().startsWith(fe));if(He.length===1){const ve=X.slice(1).join(" "),hi=He[0].slice(ve.length)+" ";k+=hi,d.write(hi)}else He.length>1?(d.write(`\r +\r +\x1B[33mAvailable neighbors:\x1B[0m\r +\r +`),He.forEach(ve=>{d.writeln(` \x1B[36m${ve}\x1B[0m`)}),W(),d.write(k)):B.length===0&&fe===""&&(d.write(`\r +\r +\x1B[33mFetching neighbors...\x1B[0m\r +`),na().then(ve=>{B=ve,$=ee,U.ping=ve,d.write(`\r +\x1B[33mAvailable neighbors:\x1B[0m\r +\r +`),ve.forEach(hi=>{d.writeln(` \x1B[36m${hi}\x1B[0m`)}),W(),d.write(k)}).catch(()=>{d.write(`\r +\x1B[31mFailed to fetch neighbors\x1B[0m\r +`),W(),d.write(k)}));return}const N=X.slice(1).join(" ").toLowerCase(),be=U[_e].filter(fe=>fe.toLowerCase().startsWith(N));if(be.length===1){const fe=X.slice(1).join(" "),ee=be[0].slice(fe.length)+" ";k+=ee,d.write(ee)}else if(be.length>1){d.write(`\r +\r +\x1B[33mAvailable parameters:\x1B[0m\r +\r +`);const fe=le[_e]||{};be.forEach(ee=>{const He=fe[ee]||"",ve=ee.padEnd(20);d.writeln(` \x1B[36m${ve}\x1B[0m\x1B[90m${He}\x1B[0m`)}),W(),d.write(k)}return}const Be=S.getAllCommands().filter(N=>!!(N.name.toLowerCase().startsWith(G)||N.aliases?.some(be=>be.toLowerCase().startsWith(G))));if(Be.length===1){const N=Be[0].name.slice(k.length)+" ";k+=N,d.write(N)}else Be.length>1&&(d.write(`\r +\r +\x1B[33mAvailable commands:\x1B[0m\r +\r +`),Be.forEach(N=>{const be=N.aliases&&N.aliases.length>0?` (${N.aliases.join(", ")})`:"";d.writeln(` \x1B[36m${N.name.padEnd(15)}\x1B[0m ${N.description}${be}`)}),W(),d.write(k));return}I>=32&&I<127&&(u(),k+=O,d.write(O),c.value||g())},g=()=>{if(k.length===0){T="";return}const O=L.filter(I=>I.startsWith(k.toLowerCase()));O.length===1&&O[0]!==k?(T=O[0].slice(k.length),v(T)):T=""},w=async O=>{if(!d)return;const I=O.trim(),[G,...X]=I.split(/\s+/),_e=S.findCommand(G);if(_e)try{await _e.execute({term:d,args:X,writePrompt:W})}catch(Le){console.error("Command execution error:",Le),d.writeln(`\x1B[1;31m✗ Error:\x1B[0m ${Le instanceof Error?Le.message:"Command failed"}`),W()}else d.writeln(`\x1B[1;31m✗ Unknown command:\x1B[0m ${G}`),d.writeln("\x1B[90mType \x1B[36mhelp\x1B[90m for available commands\x1B[0m"),W()},b=()=>{!y||!l.value||y.findNext(l.value,{caseSensitive:!1})},C=()=>{!y||!l.value||y.findPrevious(l.value,{caseSensitive:!1})},x=()=>{h.value=!1,l.value="",d?.focus()},M=async()=>{if(o.value){if(_.value)try{document.exitFullscreen&&await document.exitFullscreen(),_.value=!1}catch(O){console.error("Failed to exit fullscreen:",O)}else try{o.value.requestFullscreen&&await o.value.requestFullscreen(),_.value=!0,setTimeout(()=>{c.value&&n.value?n.value.focus():d&&d.focus()},100)}catch(O){console.error("Failed to enter fullscreen:",O)}setTimeout(()=>{m?.fit()},100)}},F=()=>{f.value=!f.value,f.value&&c.value&&setTimeout(()=>{window.scrollTo(0,1)},100),setTimeout(()=>{c.value&&n.value?n.value.focus():d?.focus(),m?.fit()},150)},K=()=>{f.value=!1,setTimeout(()=>{m?.fit()},100)};ql(e,O=>{d&&(d.options.theme=O==="dark"?i:s)}),typeof document<"u"&&(document.addEventListener("fullscreenchange",()=>{_.value=!!document.fullscreenElement,setTimeout(()=>m?.fit(),100)}),document.addEventListener("keydown",O=>{O.key==="Escape"&&f.value&&!_.value&&K()}),document.addEventListener("keydown",O=>{O.key==="Escape"&&f.value&&!_.value&&K()}));const z=()=>{c.value&&n.value&&n.value.focus()},pe=O=>{const I=O.target,G=I.value;if(G&&d){const X=G.slice(-1);p(X)}I.value=""},q=()=>{d&&p("\r"),n.value&&(n.value.value="")},ne=()=>{d&&p(""),n.value&&(n.value.value="")};return(O,I)=>(it(),tt("div",mg,[Z("div",wg,[Z("div",Sg,[I[8]||(I[8]=Z("div",null,[Z("h1",{class:"text-content-primary dark:text-content-primary text-lg md:text-xl font-semibold"},"Terminal"),Z("p",{class:"text-content-secondary dark:text-content-muted text-sm hidden md:block"},"Interactive command-line interface")],-1)),Z("div",bg,[c.value?(it(),tt("button",{key:0,onClick:F,class:"flex items-center gap-2 px-3 py-2 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:f.value?"Exit fullscreen":"Enter fullscreen"},[f.value?(it(),tt("svg",xg,I[3]||(I[3]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(it(),tt("svg",Cg,I[2]||(I[2]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"},null,-1)]))),Z("span",kg,Is(f.value?"Exit":"Fullscreen"),1)],8,yg)):Yt("",!0),c.value?Yt("",!0):(it(),tt("button",{key:1,onClick:F,class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:f.value?"Exit full window":"Full window"},[I[4]||(I[4]=Z("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})],-1)),Z("span",Bg,Is(f.value?"Exit Window":"Full Window"),1)],8,Lg)),c.value?Yt("",!0):(it(),tt("button",{key:2,onClick:M,class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:_.value?"Exit fullscreen":"Fullscreen"},[_.value?(it(),tt("svg",Rg,I[6]||(I[6]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(it(),tt("svg",Mg,I[5]||(I[5]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"},null,-1)]))),Z("span",Tg,Is(_.value?"Exit Full":"Fullscreen"),1)],8,Eg)),Z("button",{onClick:I[0]||(I[0]=G=>h.value=!h.value),class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-primary/20 hover:bg-primary/30 text-primary border border-primary/50 rounded-lg transition-colors"},I[7]||(I[7]=[Z("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1),Z("span",{class:"hidden sm:inline"},"Search",-1)]))])])]),h.value?(it(),tt("div",Dg,[Z("div",Ag,[Kl(Z("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>l.value=G),onKeydown:[Ji(b,["enter"]),Ji(x,["esc"])],type:"text",placeholder:"Search terminal output...",class:"flex-1 px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 outline-none focus:border-primary/50 transition-colors"},null,544),[[Vl,l.value]]),Z("button",{onClick:C,class:"px-3 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary transition-colors",title:"Previous (Shift+Enter)"}," ↑ "),Z("button",{onClick:b,class:"px-3 py-2 bg-primary/20 hover:bg-primary/30 border border-primary/50 rounded-lg text-primary transition-colors",title:"Next (Enter)"}," ↓ "),Z("button",{onClick:x,class:"px-3 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary transition-colors"}," ✕ ")])])):Yt("",!0),Z("div",{ref_key:"terminalContainerRef",ref:o,class:Tn(["bg-surface dark:bg-surface-elevated/80 backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden relative",{"fullscreen-terminal":_.value,"full-window-terminal":f.value}])},[f.value&&!_.value?(it(),tt("button",{key:0,onClick:K,class:"absolute top-4 right-4 z-50 p-2 bg-black/80 backdrop-blur-sm hover:bg-black/90 text-white border border-white/20 rounded-lg transition-colors",title:"Exit full window (ESC)"},I[9]||(I[9]=[Z("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))):Yt("",!0),Z("div",{ref_key:"terminalRef",ref:r,class:Tn(["terminal-container",{"fullscreen-content":_.value}]),onClick:z,onTouchstart:z},[c.value?(it(),tt("input",{key:0,ref_key:"mobileInputRef",ref:n,type:"text",class:"mobile-keyboard-input",onInput:pe,onKeydown:[Ji(jl(q,["prevent"]),["enter"]),Ji(ne,["delete"])],inputmode:"text",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false"},null,40,Pg)):Yt("",!0)],34),a.value?(it(),tt("div",$g,I[10]||(I[10]=[Z("div",{class:"w-2 h-2 bg-primary rounded-full animate-pulse"},null,-1),Z("span",{class:"text-primary text-sm font-medium"},"Processing...",-1)]))):Yt("",!0)],2)]))}}),wv=Gl(Ig,[["__scopeId","data-v-7ea2281b"]]);export{wv as default}; diff --git a/repeater/web/html/assets/Terminal-NOfYg9Od.css b/repeater/web/html/assets/Terminal-NOfYg9Od.css new file mode 100644 index 0000000..8ca38fc --- /dev/null +++ b/repeater/web/html/assets/Terminal-NOfYg9Od.css @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2014 The xterm.js authors. All rights reserved. + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * https://github.com/chjj/term.js + * @license MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + * The original design remains. The terminal itself + * has been extended to include xterm CSI codes, among + * other features. + */.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::-moz-selection{color:transparent}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;-moz-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:-moz-fit-content;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.terminal-container[data-v-7ea2281b]{height:calc(100vh - 220px);min-height:400px;min-height:calc(100dvh - 220px);background-color:var(--color-surface)}@media (max-width: 768px){.terminal-container[data-v-7ea2281b]{height:calc(100vh - 140px);min-height:300px;min-height:calc(100dvh - 140px)}}@media (max-width: 640px){.terminal-container[data-v-7ea2281b]{height:calc(100vh - 120px);min-height:250px;min-height:calc(100dvh - 120px)}}[data-v-7ea2281b] .xterm{padding:1.5rem;height:100%!important}@media (max-width: 768px){[data-v-7ea2281b] .xterm{padding:1rem}}@media (max-width: 640px){[data-v-7ea2281b] .xterm{padding:.75rem}}[data-v-7ea2281b] .xterm-viewport,[data-v-7ea2281b] .xterm-screen{background-color:transparent!important}[data-v-7ea2281b] .xterm-selection{background-color:#00d9ff4d!important}kbd[data-v-7ea2281b]{font-family:Menlo,Monaco,Courier New,monospace;box-shadow:0 2px 4px #0003}.mobile-keyboard-input[data-v-7ea2281b]{position:absolute;bottom:0;left:0;width:1px;height:1px;opacity:.01;border:none;padding:0;margin:0;pointer-events:none;z-index:9999}.fullscreen-terminal[data-v-7ea2281b]{position:fixed!important;inset:0!important;width:100vw!important;height:100vh!important;height:100dvh!important;margin:0!important;border-radius:0!important;z-index:9999!important;background-color:var(--color-surface)!important}.fullscreen-content[data-v-7ea2281b]{height:100%!important;min-height:100%!important}.fullscreen-terminal[data-v-7ea2281b] .xterm{padding:2rem}@media (max-width: 768px){.fullscreen-terminal[data-v-7ea2281b] .xterm{padding:1rem}}.full-window-terminal[data-v-7ea2281b]{position:fixed!important;inset:0;width:100vw!important;height:100vh!important;height:100dvh!important;max-width:100vw!important;max-height:100vh!important;max-height:100dvh!important;z-index:9998;border-radius:0!important;margin:0!important;overflow:hidden;background-color:var(--color-surface)!important}.full-window-terminal .terminal-container[data-v-7ea2281b]{height:100vh!important;height:100dvh!important;width:100vw!important;overflow:auto}.full-window-terminal[data-v-7ea2281b] .xterm{padding:1rem;height:100%!important}@media (max-width: 768px){.full-window-terminal[data-v-7ea2281b]{touch-action:none}.full-window-terminal .terminal-container[data-v-7ea2281b]{overscroll-behavior:none}.full-window-terminal[data-v-7ea2281b] .xterm{padding:.75rem}} diff --git a/repeater/web/html/assets/_commonjsHelpers-CqkleIqs.js b/repeater/web/html/assets/_commonjsHelpers-CqkleIqs.js new file mode 100644 index 0000000..dbbfc19 --- /dev/null +++ b/repeater/web/html/assets/_commonjsHelpers-CqkleIqs.js @@ -0,0 +1 @@ +function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}export{e as g}; diff --git a/repeater/web/html/assets/chart-B185MtDy.js b/repeater/web/html/assets/chart-B185MtDy.js new file mode 100644 index 0000000..e3e48ba --- /dev/null +++ b/repeater/web/html/assets/chart-B185MtDy.js @@ -0,0 +1,18 @@ +/*! + * @kurkle/color v0.3.4 + * https://github.com/kurkle/color#readme + * (c) 2024 Jukka Kurkela + * Released under the MIT License + */function ae(i){return i+.5|0}const ut=(i,t,e)=>Math.max(Math.min(i,e),t);function Ut(i){return ut(ae(i*2.55),0,255)}function mt(i){return ut(ae(i*255),0,255)}function ct(i){return ut(ae(i/2.55)/100,0,1)}function Mi(i){return ut(ae(i*100),0,100)}const Z={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ze=[..."0123456789ABCDEF"],In=i=>Ze[i&15],Fn=i=>Ze[(i&240)>>4]+Ze[i&15],he=i=>(i&240)>>4===(i&15),zn=i=>he(i.r)&&he(i.g)&&he(i.b)&&he(i.a);function Bn(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Z[i[1]]*17,g:255&Z[i[2]]*17,b:255&Z[i[3]]*17,a:t===5?Z[i[4]]*17:255}:(t===7||t===9)&&(e={r:Z[i[1]]<<4|Z[i[2]],g:Z[i[3]]<<4|Z[i[4]],b:Z[i[5]]<<4|Z[i[6]],a:t===9?Z[i[7]]<<4|Z[i[8]]:255})),e}const Wn=(i,t)=>i<255?t(i):"";function Hn(i){var t=zn(i)?In:Fn;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Wn(i.a,t):void 0}const Vn=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Vs(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function Nn(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function jn(i,t,e){const s=Vs(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function $n(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-r):h/(o+r),l=$n(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function ai(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(mt)}function li(i,t,e){return ai(Vs,i,t,e)}function Yn(i,t,e){return ai(jn,i,t,e)}function Xn(i,t,e){return ai(Nn,i,t,e)}function Ns(i){return(i%360+360)%360}function Un(i){const t=Vn.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?Ut(+t[5]):mt(+t[5]));const n=Ns(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Yn(n,o,r):t[1]==="hsv"?s=Xn(n,o,r):s=li(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Kn(i,t){var e=ri(i);e[0]=Ns(e[0]+t),e=li(e),i.r=e[0],i.g=e[1],i.b=e[2]}function qn(i){if(!i)return;const t=ri(i),e=t[0],s=Mi(t[1]),n=Mi(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${ct(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const Si={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},ki={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Gn(){const i={},t=Object.keys(ki),e=Object.keys(Si);let s,n,o,r,a;for(s=0;s>16&255,o>>8&255,o&255]}return i}let de;function Jn(i){de||(de=Gn(),de.transparent=[0,0,0,0]);const t=de[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Zn=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Qn(i){const t=Zn.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?Ut(r):ut(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?Ut(s):ut(s,0,255)),n=255&(t[4]?Ut(n):ut(n,0,255)),o=255&(t[6]?Ut(o):ut(o,0,255)),{r:s,g:n,b:o,a:e}}}function to(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${ct(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const Be=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Rt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function eo(i,t,e){const s=Rt(ct(i.r)),n=Rt(ct(i.g)),o=Rt(ct(i.b));return{r:mt(Be(s+e*(Rt(ct(t.r))-s))),g:mt(Be(n+e*(Rt(ct(t.g))-n))),b:mt(Be(o+e*(Rt(ct(t.b))-o))),a:i.a+e*(t.a-i.a)}}function fe(i,t,e){if(i){let s=ri(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=li(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function js(i,t){return i&&Object.assign(t||{},i)}function wi(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=mt(i[3]))):(t=js(i,{r:0,g:0,b:0,a:1}),t.a=mt(t.a)),t}function io(i){return i.charAt(0)==="r"?Qn(i):Un(i)}class te{constructor(t){if(t instanceof te)return t;const e=typeof t;let s;e==="object"?s=wi(t):e==="string"&&(s=Bn(t)||Jn(t)||io(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=js(this._rgb);return t&&(t.a=ct(t.a)),t}set rgb(t){this._rgb=wi(t)}rgbString(){return this._valid?to(this._rgb):void 0}hexString(){return this._valid?Hn(this._rgb):void 0}hslString(){return this._valid?qn(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=eo(this._rgb,t._rgb,e)),this}clone(){return new te(this.rgb)}alpha(t){return this._rgb.a=mt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=ae(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return fe(this._rgb,2,t),this}darken(t){return fe(this._rgb,2,-t),this}saturate(t){return fe(this._rgb,1,t),this}desaturate(t){return fe(this._rgb,1,-t),this}rotate(t){return Kn(this._rgb,t),this}}/*! + * Chart.js v4.5.1 + * https://www.chartjs.org + * (c) 2025 Chart.js Contributors + * Released under the MIT License + */function rt(){}const so=(()=>{let i=0;return()=>i++})();function T(i){return i==null}function H(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function C(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function U(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function it(i,t){return U(i)?i:t}function P(i,t){return typeof i>"u"?t:i}const no=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,$s=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function I(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function R(i,t,e,s){let n,o,r;if(H(i))for(o=i.length,n=0;ni,x:i=>i.x,y:i=>i.y};function ao(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function lo(i){const t=ao(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Dt(i,t){return(Pi[t]||(Pi[t]=lo(t)))(i)}function ci(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ie=i=>typeof i<"u",bt=i=>typeof i=="function",Di=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function co(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const L=Math.PI,z=2*L,ho=z+L,De=Number.POSITIVE_INFINITY,fo=L/180,V=L/2,yt=L/4,Oi=L*2/3,Xs=Math.log10,ot=Math.sign;function Jt(i,t,e){return Math.abs(i-t)n-o).pop(),t}function go(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function Ft(i){return!go(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function po(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function mo(i,t,e){let s,n,o;for(s=0,n=i.length;sl&&c=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function hi(i,t,e){e=e||(r=>i[r]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const wt=(i,t,e,s)=>hi(i,e,s?n=>{const o=i[n][t];return oi[n][t]hi(i,e,s=>i[s][t]>=e);function vo(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+ci(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function Ti(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(Ks.forEach(o=>{delete i[o]}),delete i._chartjs)}function qs(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Gs=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Js(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Gs.call(window,()=>{s=!1,i.apply(t,e)}))}}function So(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const di=i=>i==="start"?"left":i==="end"?"right":"center",$=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,ko=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function Zs(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,h=r.axis,{min:d,max:f,minDefined:u,maxDefined:p}=r.getUserBounds();if(u){if(n=Math.min(wt(l,h,d).lo,e?s:wt(t,h,r.getPixelForValue(d)).lo),c){const g=l.slice(0,n+1).reverse().findIndex(m=>!T(m[a.axis]));n-=Math.max(0,g)}n=Y(n,0,s-1)}if(p){let g=Math.max(wt(l,r.axis,f,!0).hi+1,e?0:wt(t,h,r.getPixelForValue(f),!0).hi+1);if(c){const m=l.slice(g-1).findIndex(b=>!T(b[a.axis]));g+=Math.max(0,m)}o=Y(g,n,s)-n}else o=s-n}return{start:n,count:o}}function Qs(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const ue=i=>i===0||i===1,Ri=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*z/e)),Li=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*z/e)+1,Zt={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*V)+1,easeOutSine:i=>Math.sin(i*V),easeInOutSine:i=>-.5*(Math.cos(L*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>ue(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>ue(i)?i:Ri(i,.075,.3),easeOutElastic:i=>ue(i)?i:Li(i,.075,.3),easeInOutElastic(i){return ue(i)?i:i<.5?.5*Ri(i*2,.1125,.45):.5+.5*Li(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-Zt.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?Zt.easeInBounce(i*2)*.5:Zt.easeOutBounce(i*2-1)*.5+.5};function fi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ei(i){return fi(i)?i:new te(i)}function We(i){return fi(i)?i:new te(i).saturate(.5).darken(.1).hexString()}const wo=["x","y","borderWidth","radius","tension"],Po=["color","borderColor","backgroundColor"];function Do(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Po},numbers:{type:"number",properties:wo}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Oo(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ii=new Map;function Co(i,t){t=t||{};const e=i+JSON.stringify(t);let s=Ii.get(e);return s||(s=new Intl.NumberFormat(i,t),Ii.set(e,s)),s}function ui(i,t,e){return Co(t,e).format(i)}const Ao={values(i){return H(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=To(i,e)}const r=Xs(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),ui(i,s,l)}};function To(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var tn={formatters:Ao};function Ro(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:tn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ot=Object.create(null),ti=Object.create(null);function Qt(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;ss.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>We(n.backgroundColor),this.hoverBorderColor=(s,n)=>We(n.borderColor),this.hoverColor=(s,n)=>We(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return He(this,t,e)}get(t){return Qt(this,t)}describe(t,e){return He(ti,t,e)}override(t,e){return He(Ot,t,e)}route(t,e,s,n){const o=Qt(this,t),r=Qt(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[n];return C(l)?Object.assign({},c,l):P(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var W=new Lo({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Do,Oo,Ro]);function Eo(i){return!i||T(i.size)||T(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Fi(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function vt(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function zi(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function ei(i,t,e,s){en(i,t,e,s,null)}function en(i,t,e,s,n){let o,r,a,l,c,h,d,f;const u=t.pointStyle,p=t.rotation,g=t.radius;let m=(p||0)*fo;if(u&&typeof u=="object"&&(o=u.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(m),i.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),u){default:n?i.ellipse(e,s,n/2,g,0,0,z):i.arc(e,s,g,0,z),i.closePath();break;case"triangle":h=n?n/2:g,i.moveTo(e+Math.sin(m)*h,s-Math.cos(m)*g),m+=Oi,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*g),m+=Oi,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*g),i.closePath();break;case"rectRounded":c=g*.516,l=g-c,r=Math.cos(m+yt)*l,d=Math.cos(m+yt)*(n?n/2-c:l),a=Math.sin(m+yt)*l,f=Math.sin(m+yt)*(n?n/2-c:l),i.arc(e-d,s-a,c,m-L,m-V),i.arc(e+f,s-r,c,m-V,m),i.arc(e+d,s+a,c,m,m+V),i.arc(e-f,s+r,c,m+V,m+L),i.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}m+=yt;case"rectRot":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,f=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+f,s-r),i.lineTo(e+d,s+a),i.lineTo(e-f,s+r),i.closePath();break;case"crossRot":m+=yt;case"cross":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,f=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r);break;case"star":d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,f=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r),m+=yt,d=Math.cos(m)*(n?n/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,f=Math.sin(m)*(n?n/2:g),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r);break;case"line":r=n?n/2:Math.cos(m)*g,a=Math.sin(m)*g,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(m)*(n?n/2:g),s+Math.sin(m)*g);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function ne(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,zo(i,o),l=0;l+i||0;function gi(i,t){const e={},s=C(t),n=s?Object.keys(t):t,o=C(i)?s?r=>P(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=jo(o(r));return e}function sn(i){return gi(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Et(i){return gi(i,["topLeft","topRight","bottomLeft","bottomRight"])}function tt(i){const t=sn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function X(i,t){i=i||{},t=t||W.font;let e=P(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=P(i.style,t.style);s&&!(""+s).match(Vo)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:P(i.family,t.family),lineHeight:No(P(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:P(i.weight,t.weight),string:""};return n.string=Eo(n),n}function ge(i,t,e,s){let n,o,r;for(n=0,o=i.length;ne&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function Ct(i,t){return Object.assign(Object.create(i),t)}function pi(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=an("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>pi([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return on(a,l,()=>Zo(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Wi(a).includes(l)},ownKeys(a){return Wi(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function zt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:nn(i,s),setContext:o=>zt(i,o,e,s),override:o=>zt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return on(o,r,()=>Xo(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function nn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:bt(e)?e:()=>e,isIndexable:bt(s)?s:()=>s}}const Yo=(i,t)=>i?i+ci(t):t,mi=(i,t)=>C(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function on(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function Xo(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return bt(a)&&r.isScriptable(t)&&(a=Uo(t,a,i,e)),H(a)&&a.length&&(a=Ko(t,a,i,r.isIndexable)),mi(t,a)&&(a=zt(a,n,o&&o[t],r)),a}function Uo(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||s);return a.delete(i),mi(i,l)&&(l=bi(n._scopes,n,i,l)),l}function Ko(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(C(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=bi(c,n,i,h);t.push(zt(d,o,r&&r[i],a))}}return t}function rn(i,t,e){return bt(i)?i(t,e):i}const qo=(i,t)=>i===!0?t:typeof i=="string"?Dt(t,i):void 0;function Go(i,t,e,s,n){for(const o of t){const r=qo(e,o);if(r){i.add(r);const a=rn(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s<"u"&&e!==s)return null}return!1}function bi(i,t,e,s){const n=t._rootScopes,o=rn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=Bi(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=Bi(a,r,o,l,s),l===null)?!1:pi(Array.from(a),[""],n,o,()=>Jo(t,e,s))}function Bi(i,t,e,s,n){for(;e;)e=Go(i,t,e,s,n);return e}function Jo(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return H(n)&&C(e)?e:n||{}}function Zo(i,t,e,s){let n;for(const o of t)if(n=an(Yo(o,i),e),typeof n<"u")return mi(i,n)?bi(e,s,i,n):n}function an(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function Wi(i){let t=i._keys;return t||(t=i._keys=Qo(i._scopes)),t}function Qo(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const tr=Number.EPSILON||1e-14,Bt=(i,t)=>ti==="x"?"y":"x";function er(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=Qe(o,n),l=Qe(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,f=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+f*(r.x-n.x),y:o.y+f*(r.y-n.y)}}}function ir(i,t,e){const s=i.length;let n,o,r,a,l,c=Bt(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")nr(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function ar(i,t){return Ee(i).getPropertyValue(t)}const lr=["top","right","bottom","left"];function Pt(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=lr[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const cr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function hr(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(cr(n,o,i.target))a=n,l=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function St(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=Ee(e),o=n.boxSizing==="border-box",r=Pt(n,"padding"),a=Pt(n,"border","width"),{x:l,y:c,box:h}=hr(i,e),d=r.left+(h&&a.left),f=r.top+(h&&a.top);let{width:u,height:p}=t;return o&&(u-=r.width+a.width,p-=r.height+a.height),{x:Math.round((l-d)/u*e.width/s),y:Math.round((c-f)/p*e.height/s)}}function dr(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&xi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=Ee(o),l=Pt(a,"border","width"),c=Pt(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=Ce(a.maxWidth,o,"clientWidth"),n=Ce(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||De,maxHeight:n||De}}const gt=i=>Math.round(i*10)/10;function fr(i,t,e,s){const n=Ee(i),o=Pt(n,"margin"),r=Ce(n.maxWidth,i,"clientWidth")||De,a=Ce(n.maxHeight,i,"clientHeight")||De,l=dr(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=Pt(n,"border","width"),u=Pt(n,"padding");c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=gt(Math.min(c,r,l.maxWidth)),h=gt(Math.min(h,a,l.maxHeight)),c&&!h&&(h=gt(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=gt(Math.floor(h*s))),{width:c,height:h}}function Hi(i,t,e){const s=t||1,n=gt(i.height*s),o=gt(i.width*s);i.height=gt(i.height),i.width=gt(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const ur=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};_i()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function Vi(i,t){const e=ar(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function kt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function gr(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function pr(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=kt(i,n,e),a=kt(n,o,e),l=kt(o,t,e),c=kt(r,a,e),h=kt(a,l,e);return kt(c,h,e)}const mr=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},br=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function It(i,t,e){return i?mr(t,e):br()}function cn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function hn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function dn(i){return i==="angle"?{between:se,compare:_o,normalize:J}:{between:dt,compare:(t,e)=>t-e,normalize:t=>t}}function Ni({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function _r(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=dn(s),l=t.length;let{start:c,end:h,loop:d}=i,f,u;if(d){for(c+=l,h+=l,f=0,u=l;fl(n,v,b)&&a(n,v)!==0,x=()=>a(o,b)===0||l(o,v,b),M=()=>g||y(),S=()=>!g||x();for(let k=h,w=h;k<=d;++k)_=t[k%r],!_.skip&&(b=c(_[s]),b!==v&&(g=l(b,n,o),m===null&&M()&&(m=a(b,n)===0?k:w),m!==null&&S()&&(p.push(Ni({start:m,end:k,loop:f,count:r,style:u})),m=null),w=k,v=b));return m!==null&&p.push(Ni({start:m,end:d,loop:f,count:r,style:u})),p}function un(i,t){const e=[],s=i.segments;for(let n=0;nn&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function yr(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function vr(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=xr(e,n,o,s);if(s===!0)return ji(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Gs.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var at=new wr;const Yi="transparent",Pr={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Ei(i||Yi),n=s.valid&&Ei(t||Yi);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Dr{constructor(t,e,s,n){const o=e[s];n=ge([t.to,n,o,t.from]);const r=ge([t.from,o,n]);this._active=!0,this._fn=t.fn||Pr[t.type||typeof r],this._easing=Zt[t.easing]||Zt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ge([t.to,e,n,t.from]),this._from=ge([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!C(o))return;const r={};for(const a of e)r[a]=o[a];(H(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=Cr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Or(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,a);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new Dr(f,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return at.add(this._chart,s),!0}}function Or(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function qi(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=Lr(o,r,s),d=t.length;let f;for(let u=0;ue[s].axis===t).shift()}function Fr(i,t){return Ct(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function zr(i,t,e){return Ct(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Nt(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const je=i=>i==="reset"||i==="none",Gi=(i,t)=>t?i:Object.assign({},i),Br=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:mn(e,!0),values:null};class le{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ve(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Nt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,f,u,p)=>d==="x"?f:d==="r"?p:u,o=e.xAxisID=P(s.xAxisID,Ne(t,"x")),r=e.yAxisID=P(s.yAxisID,Ne(t,"y")),a=e.rAxisID=P(s.rAxisID,Ne(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ti(this._data,this),t._stacked&&Nt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(C(e)){const n=this._cachedMeta;this._data=Rr(e,n)}else if(s!==e){if(s){Ti(s,this);const n=this._cachedMeta;Nt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Mo(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Ve(e.vScale,e),e.stack!==s.stack&&(n=!0,Nt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(qi(this,e._parsed),e._stacked=Ve(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{H(n[t])?f=this.parseArrayData(s,n,t,e):C(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const u=()=>d[a]===null||c&&d[a]g||d=0;--f)if(!p()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),g=c.resolveNamedOptions(f,u,p,d);return g.$shared&&(g.$shared=l,o[r]=Object.freeze(Gi(g,l))),g}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new pn(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||je(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){je(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!je(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;an-o))}return i._cache.$bar}function Hr(i){const t=i.iScale,e=Wr(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(ie(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n0?n[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function bn(i,t,e,s){return H(i)?jr(i,t,e,s):t[e.axis]=e.parse(i,s),t}function Ji(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,d,f;for(c=e,h=e+s;c=e?1:-1)}function Yr(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.baseh.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const d=h._parsed.find(u=>u[s.axis]===l),f=d&&d[h.vScale.axis];if(T(f)||isNaN(f))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[P(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;ose(v,a,l,!0)?1:Math.max(y,y*e,x,x*e),p=(v,y,x)=>se(v,a,l,!0)?-1:Math.min(y,y*e,x,x*e),g=u(0,c,d),m=u(V,h,f),b=p(L,c,d),_=p(L+V,h,f);s=(g-b)/2,n=(m-_)/2,o=-(g+b)/2,r=-(m+_)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}class uc extends le{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{const d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:s,borderRadius:r&&(a||d.borderRadius),index:c}}):[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(C(s[t])){const{key:l="value"}=this._parsing;o=c=>+Dt(s[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?z*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ui(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,r,a,l;if(!t){for(n=0,o=s.data.datasets.length;n0&&this.getParsed(e-1);for(let x=0;x=_){S.skip=!0;continue}const k=this.getParsed(x),w=T(k[u]),D=S[f]=r.getPixelForValue(k[f],x),O=S[u]=o||w?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[u],x);S.skip=isNaN(D)||isNaN(O)||w,S.stop=x>0&&Math.abs(k[f]-y[f])>m,g&&(S.parsed=k,S.raw=c.data[x]),d&&(S.options=h||this.resolveDataElementOptions(x,M.active?"active":n)),b||this.updateElement(M,x,S,n),y=k}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class pc extends le{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,r=this.getParsed(t),a=n.getLabelForValue(r.x),l=o.getLabelForValue(r.y);return{label:s[t]||"",value:"("+a+", "+l+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:r}=Zs(e,s,n);if(this._drawStart=o,this._drawCount=r,Qs(e)&&(o=0,r=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=s;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),f=this.includeOptions(n,d),u=r.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,b=Ft(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||n==="none";let v=e>0&&this.getParsed(e-1);for(let y=e;y0&&Math.abs(M[u]-v[u])>b,m&&(S.parsed=M,S.raw=c.data[y]),f&&(S.options=d||this.resolveDataElementOptions(y,x.active?"active":n)),_||this.updateElement(x,y,S,n),v=M}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const s=t.dataset,n=s.options&&s.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,r)/2}}function Mt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class yi{static override(t){Object.assign(yi.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Mt()}parse(){return Mt()}format(){return Mt()}add(){return Mt()}diff(){return Mt()}startOf(){return Mt()}endOf(){return Mt()}}var Gr={_date:yi};function Jr(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?yo:wt;if(s){if(n._sharedOptions){const h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){const f=c(o,t,e-d),u=c(o,t,e+d);return{lo:f.lo,hi:u.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:d}=n._cachedMeta,{_parsed:f}=i,u=f.slice(0,h.lo+1).reverse().findIndex(g=>!T(g[d.axis]));h.lo-=Math.max(0,u);const p=f.slice(h.hi).findIndex(g=>!T(g[d.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function Ie(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var ea={modes:{index(i,t,e,s){const n=St(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Ye(i,n,o,s,r):Xe(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=St(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Ye(i,n,o,s,r):Xe(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function es(i,t){return i.filter(e=>_n.indexOf(e.pos)===-1&&e.box.axis===t)}function $t(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function ia(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=$t(jt(t,"left"),!0),n=$t(jt(t,"right")),o=$t(jt(t,"top"),!0),r=$t(jt(t,"bottom")),a=es(t,"x"),l=es(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:jt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function is(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function xn(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function ra(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!C(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&xn(r,o.getPadding());const a=Math.max(0,t.outerWidth-is(r,i,"left","right")),l=Math.max(0,t.outerHeight-is(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function aa(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function la(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function Kt(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),f=Object.assign({},n);xn(f,tt(s));const u=Object.assign({maxPadding:f,w:o,h:r,x:n.left,y:n.top},n),p=na(l.concat(c),d);Kt(a.fullSize,u,d,p),Kt(l,u,d,p),Kt(c,u,d,p)&&Kt(l,u,d,p),aa(u),ss(a.leftAndTop,u,d,p),u.x+=u.w,u.y+=u.h,ss(a.rightAndBottom,u,d,p),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},R(a.chartArea,g=>{const m=g.box;Object.assign(m,i.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class yn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class ca extends yn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Se="$chartjs",ha={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ns=i=>i===null||i==="";function da(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Se]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",ns(n)){const o=Vi(i,"width");o!==void 0&&(i.width=o)}if(ns(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Vi(i,"height");o!==void 0&&(i.height=o)}return i}const vn=ur?{passive:!0}:!1;function fa(i,t,e){i&&i.addEventListener(t,e,vn)}function ua(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,vn)}function ga(i,t){const e=ha[i.type]||i.type,{x:s,y:n}=St(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Ae(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function pa(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ae(a.addedNodes,s),r=r&&!Ae(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function ma(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ae(a.removedNodes,s),r=r&&!Ae(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const re=new Map;let os=0;function Mn(){const i=window.devicePixelRatio;i!==os&&(os=i,re.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ba(i,t){re.size||window.addEventListener("resize",Mn),re.set(i,t)}function _a(i){re.delete(i),re.size||window.removeEventListener("resize",Mn)}function xa(i,t,e){const s=i.canvas,n=s&&xi(s);if(!n)return;const o=Js((a,l)=>{const c=n.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),ba(i,o),r}function Ue(i,t,e){e&&e.disconnect(),t==="resize"&&_a(i)}function ya(i,t,e){const s=i.canvas,n=Js(o=>{i.ctx!==null&&e(ga(o,i))},i);return fa(s,t,n),n}class va extends yn{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(da(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Se])return!1;const s=e[Se].initial;["height","width"].forEach(o=>{const r=s[o];T(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Se],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:pa,detach:ma,resize:xa}[e]||ya;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:Ue,detach:Ue,resize:Ue}[e]||ua)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return fr(t,e,s,n)}isAttached(t){const e=t&&xi(t);return!!(e&&e.isConnected)}}function Ma(i){return!_i()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?ca:va}class ft{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Ft(this.x)&&Ft(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}function Sa(i,t){const e=i.options.ticks,s=ka(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Pa(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return Da(t,c,o,r/n),c;const h=wa(o,t,n);if(r>0){let d,f;const u=r>1?Math.round((l-a)/(r-1)):null;for(_e(t,c,h,T(u)?0:a-u,a),d=0,f=r-1;dn)return l}return Math.max(n,1)}function Pa(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,rs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,as=(i,t)=>Math.min(t||i,i);function ls(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;or+a)))return l}function Ta(i,t){R(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;os?s:e,s=n&&e>s?e:s,{min:it(e,it(s,e)),max:it(s,it(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=$o(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,f=h.highest.height,u=Y(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:u/(s-1),d+6>a&&(a=u/(s-(t.offset?.5:1)),l=this.maxHeight-Yt(t.grid)-e.padding-cs(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),r=bo(Math.min(Math.asin(Y((h.highest.height+6)/a,-1,1)),Math.asin(Y(l/c,-1,1))-Math.asin(Y(f/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=cs(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=Yt(o)+l):(t.height=this.maxHeight,t.width=Yt(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,p=ht(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const b=s.mirror?0:m*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*d.width+m*f.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,u=0;l?c?(f=n*t.width,u=s*e.height):(f=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,u=e.width/2),this.paddingLeft=Math.max((f-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e({width:r[w]||0,height:a[w]||0});return{first:k(0),last:k(e-1),widest:k(M),highest:k(S),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return xo(this._alignToPixels?vt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*n?a/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=Yt(o),u=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(F){return vt(s,F,g)};let _,v,y,x,M,S,k,w,D,O,A,N;if(r==="top")_=b(this.bottom),S=this.bottom-f,w=_-m,O=b(t.top)+m,N=t.bottom;else if(r==="bottom")_=b(this.top),O=t.top,N=b(t.bottom)-m,S=_+m,w=this.top+f;else if(r==="left")_=b(this.right),M=this.right-f,k=_-m,D=b(t.left)+m,A=t.right;else if(r==="right")_=b(this.left),D=t.left,A=b(t.right)-m,M=_+m,k=this.left+f;else if(e==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(C(r)){const F=Object.keys(r)[0],B=r[F];_=b(this.chart.scales[F].getPixelForValue(B))}O=t.top,N=t.bottom,S=_+m,w=S+f}else if(e==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(C(r)){const F=Object.keys(r)[0],B=r[F];_=b(this.chart.scales[F].getPixelForValue(B))}M=_-m,k=M-f,D=t.left,A=t.right}const G=P(n.ticks.maxTicksLimit,d),E=Math.max(1,Math.ceil(d/G));for(v=0;v0&&(xt-=_t/2);break}ce={left:xt,top:Vt,width:_t+Tt.width,height:Ht+Tt.height,color:E.backdropColor}}m.push({label:y,font:w,textOffset:A,options:{rotation:g,color:B,strokeColor:et,strokeWidth:j,textAlign:At,textBaseline:N,translation:[x,M],backdrop:ce}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ht(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");W.route(o,n,l,a)})}function Ba(i){return"id"in i&&"defaults"in i}class Wa{constructor(){this.controllers=new xe(le,"datasets",!0),this.elements=new xe(ft,"elements"),this.plugins=new xe(Object,"plugins"),this.scales=new xe(Wt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):R(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=ci(t);I(s["before"+n],[],s),e[t](s),I(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function Va(i){const t={},e=[],s=Object.keys(nt.plugins.items);for(let o=0;o1&&hs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function ds(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function Ka(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return ds(i,"x",e[0])||ds(i,"y",e[0])}return{}}function qa(i,t){const e=Ot[i.type]||{scales:{}},s=t.scales||{},n=ii(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!C(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=si(r,a,Ka(r,i),W.scales[a.type]),c=Xa(l,n),h=e.scales||{};o[r]=Gt(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||ii(a,t),h=(Ot[a]||{}).scales||{};Object.keys(h).forEach(d=>{const f=Ya(d,l),u=r[f+"AxisID"]||f;o[u]=o[u]||Object.create(null),Gt(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];Gt(a,[W.scales[a.type],W.scale])}),o}function Sn(i){const t=i.options||(i.options={});t.plugins=P(t.plugins,{}),t.scales=qa(i,t)}function kn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Ga(i){return i=i||{},i.data=kn(i.data),Sn(i),i}const fs=new Map,wn=new Set;function ye(i,t){let e=fs.get(i);return e||(e=t(),fs.set(i,e),wn.add(e)),e}const Xt=(i,t,e)=>{const s=Dt(t,e);s!==void 0&&i.add(s)};class Ja{constructor(t){this._config=Ga(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=kn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Sn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ye(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ye(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ye(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return ye(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>Xt(l,t,d))),h.forEach(d=>Xt(l,n,d)),h.forEach(d=>Xt(l,Ot[o]||{},d)),h.forEach(d=>Xt(l,W,d)),h.forEach(d=>Xt(l,ti,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),wn.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Ot[e]||{},W.datasets[e]||{},{type:e},W,ti]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=us(this._resolverCache,t,n);let l=r;if(Qa(r,e)){o.$shared=!1,s=bt(s)?s():s;const c=this.createResolver(t,s,a);l=zt(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=us(this._resolverCache,t,s);return C(e)?zt(o,e,void 0,n):o}}function us(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:pi(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Za=i=>C(i)&&Object.getOwnPropertyNames(i).some(t=>bt(i[t]));function Qa(i,t){const{isScriptable:e,isIndexable:s}=nn(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(bt(a)||Za(a))||r&&H(a))return!0}return!1}var tl="4.5.1";const el=["top","bottom","left","right","chartArea"];function gs(i,t){return i==="top"||i==="bottom"||el.indexOf(i)===-1&&t==="x"}function ps(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function ms(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),I(e&&e.onComplete,[i],t)}function il(i){const t=i.chart,e=t.options.animation;I(e&&e.onProgress,[i],t)}function Pn(i){return _i()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const ke={},bs=i=>{const t=Pn(i);return Object.values(ke).filter(e=>e.canvas===t).pop()};function sl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function nl(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}class ol{static defaults=W;static instances=ke;static overrides=Ot;static registry=nt;static version=tl;static getChart=bs;static register(...t){nt.add(...t),_s()}static unregister(...t){nt.remove(...t),_s()}constructor(t,e){const s=this.config=new Ja(e),n=Pn(t),o=bs(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ma(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=so(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ha,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=So(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],ke[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}at.listen(this,"complete",ms),at.listen(this,"progress",il),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return T(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Hi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return zi(this.canvas,this.ctx),this}stop(){return at.stop(this),this}resize(t,e){at.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Hi(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};R(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=si(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),R(o,r=>{const a=r.options,l=a.id,c=si(l,a),h=P(a.type,r.dtype);(a.position===void 0||gs(a.position,c)!==gs(r.dposition))&&(a.position=r.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const f=nt.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),R(n,(r,a)=>{r||delete s[a]}),R(s,r=>{Q.configure(this,r,r.options),Q.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ps("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){R(this.scales,t=>{Q.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Di(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;sl(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Q.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],R(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=gn(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&Re(e,n),t.controller.draw(),n&&Le(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return ne(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=ea.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);ie(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),at.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};R(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){R(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},R(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!we(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=co(t),c=nl(t,this._lastEvent,s,l);s&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const h=!we(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function _s(){return R(ol.instances,i=>i._plugins.invalidate())}function rl(i,t,e){const{startAngle:s,x:n,y:o,outerRadius:r,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/r,J(s-e));if(i.beginPath(),i.arc(n,o,r-c/2,s+d/2,e-d/2),a>0){const f=Math.min(c/a,J(s-e));i.arc(n,o,a+c/2,e-f/2,s+f/2,!0)}else{const f=Math.min(c/2,r*J(s-e));if(h==="round")i.arc(n,o,f,e-L/2,s+L/2,!0);else if(h==="bevel"){const u=2*f*f,p=-u*Math.cos(e+L/2)+n,g=-u*Math.sin(e+L/2)+o,m=u*Math.cos(s+L/2)+n,b=u*Math.sin(s+L/2)+o;i.lineTo(p,g),i.lineTo(m,b)}}i.closePath(),i.moveTo(0,0),i.rect(0,0,i.canvas.width,i.canvas.height),i.clip("evenodd")}function al(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=n/a;i.beginPath(),i.arc(o,r,a,s-c,e+c),l>n?(c=n/l,i.arc(o,r,l,e+c,s-c,!0)):i.arc(o,r,n,e+V,s-V),i.closePath(),i.clip()}function ll(i){return gi(i,["outerStart","outerEnd","innerStart","innerEnd"])}function cl(i,t,e,s){const n=ll(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,s*t/2),a=l=>{const c=(e-Math.min(o,l))*s/2;return Y(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:Y(n.innerStart,0,r),innerEnd:Y(n.innerEnd,0,r)}}function Lt(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function Te(i,t,e,s,n,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),f=h>0?h+s+e+c:0;let u=0;const p=n-l;if(s){const E=h>0?h-s:0,F=d>0?d-s:0,B=(E+F)/2,et=B!==0?p*B/(B+s):p;u=(p-et)/2}const g=Math.max(.001,p*d-e/L)/d,m=(p-g)/2,b=l+m+u,_=n-m-u,{outerStart:v,outerEnd:y,innerStart:x,innerEnd:M}=cl(t,f,d,_-b),S=d-v,k=d-y,w=b+v/S,D=_-y/k,O=f+x,A=f+M,N=b+x/O,G=_-M/A;if(i.beginPath(),o){const E=(w+D)/2;if(i.arc(r,a,d,w,E),i.arc(r,a,d,E,D),y>0){const j=Lt(k,D,r,a);i.arc(j.x,j.y,y,D,_+V)}const F=Lt(A,_,r,a);if(i.lineTo(F.x,F.y),M>0){const j=Lt(A,G,r,a);i.arc(j.x,j.y,M,_+V,G+Math.PI)}const B=(_-M/f+(b+x/f))/2;if(i.arc(r,a,f,_-M/f,B,!0),i.arc(r,a,f,B,b+x/f,!0),x>0){const j=Lt(O,N,r,a);i.arc(j.x,j.y,x,N+Math.PI,b-V)}const et=Lt(S,b,r,a);if(i.lineTo(et.x,et.y),v>0){const j=Lt(S,w,r,a);i.arc(j.x,j.y,v,b-V,w)}}else{i.moveTo(r,a);const E=Math.cos(w)*d+r,F=Math.sin(w)*d+a;i.lineTo(E,F);const B=Math.cos(D)*d+r,et=Math.sin(D)*d+a;i.lineTo(B,et)}i.closePath()}function hl(i,t,e,s,n){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){Te(i,t,e,s,l,n);for(let c=0;c=L&&u===0&&h!=="miter"&&rl(i,t,g),o||(Te(i,t,e,s,g,n),i.stroke())}class mc extends ft{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,s){const n=this.getProps(["x","y"],s),{angle:o,distance:r}=Us(n,{x:t,y:e}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,u=P(d,l-a),p=se(o,a,l)&&a!==l,g=u>=z||p,m=dt(r,c+f,h+f);return g&&m}getCenterPoint(t){const{x:e,y:s,startAngle:n,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(r+a+c+l)/2;return{x:e+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:s}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=s>z?Math.floor(s/z):0,s===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*n,Math.sin(a)*n);const l=1-Math.sin(Math.min(L,s||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,hl(t,this,c,o,r),dl(t,this,c,o,r),t.restore()}}function Dn(i,t,e=t){i.lineCap=P(e.borderCapStyle,t.borderCapStyle),i.setLineDash(P(e.borderDash,t.borderDash)),i.lineDashOffset=P(e.borderDashOffset,t.borderDashOffset),i.lineJoin=P(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=P(e.borderWidth,t.borderWidth),i.strokeStyle=P(e.borderColor,t.borderColor)}function fl(i,t,e){i.lineTo(e.x,e.y)}function ul(i){return i.stepped?Io:i.tension||i.cubicInterpolationMode==="monotone"?Fo:fl}function On(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=na&&o>a;return{count:s,start:l,loop:t.loop,ilen:c(r+(c?a-y:y))%o,v=()=>{g!==m&&(i.lineTo(h,m),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(u=n[_(0)],i.moveTo(u.x,u.y)),f=0;f<=a;++f){if(u=n[_(f)],u.skip)continue;const y=u.x,x=u.y,M=y|0;M===p?(xm&&(m=x),h=(d*h+y)/++d):(v(),i.lineTo(y,x),p=M,d=0,g=m=x),b=x}v()}function ni(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?pl:gl}function ml(i){return i.stepped?gr:i.tension||i.cubicInterpolationMode==="monotone"?pr:kt}function bl(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Dn(i,t.options),i.stroke(n)}function _l(i,t,e,s){const{segments:n,options:o}=t,r=ni(t);for(const a of n)Dn(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const xl=typeof Path2D=="function";function yl(i,t,e,s){xl&&!t.options.segment?bl(i,t,e,s):_l(i,t,e,s)}class vi extends ft{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;rr(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=vr(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=un(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=ml(s);let c,h;for(c=0,h=r.length;c{a=Fe(r,a,n);const l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Fe(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function ys(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function An(i,t){let e=[],s=!1;return H(i)?(s=!0,e=i):e=Dl(i,t),e.length?new vi({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function vs(i){return i&&i.fill!==!1}function Ol(i,t,e){let n=i[t].fill;const o=[t];let r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!U(n))return n;if(r=i[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Cl(i,t,e){const s=Ll(i);if(C(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return U(n)&&Math.floor(n)===n?Al(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Al(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function Tl(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:C(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Rl(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:C(i)?s=i.value:s=t.getBaseValue(),s}function Ll(i){const t=i.options,e=t.fill;let s=P(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function El(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,r=s.points,a=Il(t,e);a.push(An({x:null,y:t.bottom},s));for(let l=0;l=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&Ge(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const s=i.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const o=s[n].$filler;vs(o)&&Ge(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!vs(s)||e.drawTime!=="beforeDatasetDraw"||Ge(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ws=(i,t)=>{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},Yl=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Ps extends ft{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=I(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=X(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ws(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,u=-h;return this.legendItems.forEach((p,g)=>{const m=s+e/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*a>r)&&(d+=h,c[c.length-(g>0?0:1)]=0,u+=h,f++),l[g]={left:0,top:u,row:f,width:m,height:n},c[c.length-1]+=m+a}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let d=a,f=0,u=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:_,itemHeight:v}=Xl(s,e,o,m,n);b>0&&u+v+2*a>h&&(d+=f+a,c.push({width:f,height:u}),p+=f+a,g++,f=u=0),l[b]={left:p,top:u,col:g,width:_,height:v},f=Math.max(f,_),u+=v+a}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=It(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=$(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=$(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=$(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=$(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Re(t,this),this._draw(),Le(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=W.color,l=It(t.rtl,this.left,this.width),c=X(r.font),{padding:h}=r,d=c.size,f=d/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=ws(r,d),b=function(M,S,k){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();const w=P(k.lineWidth,1);if(n.fillStyle=P(k.fillStyle,a),n.lineCap=P(k.lineCap,"butt"),n.lineDashOffset=P(k.lineDashOffset,0),n.lineJoin=P(k.lineJoin,"miter"),n.lineWidth=w,n.strokeStyle=P(k.strokeStyle,a),n.setLineDash(P(k.lineDash,[])),r.usePointStyle){const D={radius:g*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:w},O=l.xPlus(M,p/2),A=S+f;en(n,D,O,A,r.pointStyleWidth&&p)}else{const D=S+Math.max((d-g)/2,0),O=l.leftForLtr(M,p),A=Et(k.borderRadius);n.beginPath(),Object.values(A).some(N=>N!==0)?Oe(n,{x:O,y:D,w:p,h:g,radius:A}):n.rect(O,D,p,g),n.fill(),w!==0&&n.stroke()}n.restore()},_=function(M,S,k){oe(n,k.text,M,S+m/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?u={x:$(o,this.left+h,this.right-s[0]),y:this.top+h+y,line:0}:u={x:this.left+h,y:$(o,this.top+y+h,this.bottom-e[0].height),line:0},cn(this.ctx,t.textDirection);const x=m+h;this.legendItems.forEach((M,S)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const k=n.measureText(M.text).width,w=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),D=p+f+k;let O=u.x,A=u.y;l.setWidth(this.width),v?S>0&&O+D+h>this.right&&(A=u.y+=x,u.line++,O=u.x=$(o,this.left+h,this.right-s[u.line])):S>0&&A+x>this.bottom&&(O=u.x=O+e[u.line].width+h,u.line++,A=u.y=$(o,this.top+y+h,this.bottom-e[u.line].height));const N=l.x(O);if(b(N,A,M),O=ko(w,O+p+f,v?O+D:this.right,t.rtl),_(l.x(O),A,M),v)u.x+=D+h;else if(typeof M.text!="string"){const G=c.lineHeight;u.y+=Rn(M,G)+h}else u.y+=x}),hn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=X(e.font),n=tt(e.padding);if(!e.display)return;const o=It(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=$(t.align,d,this.right-f);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+$(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const u=$(a,d,d+f);r.textAlign=o.textAlign(di(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,oe(r,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=X(t.font),s=tt(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(dt(t,this.left,this.right)&&dt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function Kl(i,t,e){let s=i;return typeof t.text!="string"&&(s=Rn(t,e)),s}function Rn(i,t){const e=i.text?i.text.length:0;return t*e}function ql(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var yc={id:"legend",_element:Ps,start(i,t,e){const s=i.legend=new Ps({ctx:i.ctx,options:e,chart:i});Q.configure(i,s,e),Q.addBox(i,s)},stop(i){Q.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;Q.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=tt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class Ln extends ft{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=H(s.text)?s.text.length:1;this._padding=tt(s.padding);const o=n*X(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,d;return this.isHorizontal()?(h=$(a,s,o),d=e+t,c=o-s):(r.position==="left"?(h=s+t,d=$(a,n,e),l=L*-.5):(h=o-t,d=$(a,e,n),l=L*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=X(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);oe(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:di(e.align),textBaseline:"middle",translation:[r,a]})}}function Gl(i,t){const e=new Ln({ctx:i.ctx,options:t,chart:i});Q.configure(i,e,t),Q.addBox(i,e),i.titleBlock=e}var vc={id:"title",_element:Ln,start(i,t,e){Gl(i,e)},stop(i){const t=i.titleBlock;Q.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;Q.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const qt={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;ta+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o-1?i.split(` +`):i}function Jl(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Ds(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=X(t.bodyFont),c=X(t.titleFont),h=X(t.footerFont),d=o.length,f=n.length,u=s.length,p=tt(t.padding);let g=p.height,m=0,b=s.reduce((y,x)=>y+x.before.length+x.lines.length+x.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const y=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=u*y+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let _=0;const v=function(y){m=Math.max(m,e.measureText(y).width+_)};return e.save(),e.font=c.string,R(i.title,v),e.font=l.string,R(i.beforeBody.concat(i.afterBody),v),_=t.displayColors?r+2+t.boxPadding:0,R(s,y=>{R(y.before,v),R(y.lines,v),R(y.after,v)}),_=0,e.font=h.string,R(i.footer,v),e.restore(),m+=p.width,{width:m,height:g}}function Zl(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function Ql(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function tc(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Ql(c,i,t,e)&&(c="center"),c}function Os(i,t,e){const s=e.yAlign||t.yAlign||Zl(i,e);return{xAlign:e.xAlign||t.xAlign||tc(i,t,e,s),yAlign:s}}function ec(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function ic(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Cs(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:u}=Et(r);let p=ec(t,a);const g=ic(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,f)+n:a==="right"&&(p+=Math.max(d,u)+n),{x:Y(p,0,s.width-t.width),y:Y(g,0,s.height-t.height)}}function ve(i,t,e){const s=tt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function As(i){return st([],lt(i))}function sc(i,t,e){return Ct(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ts(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const En={beforeTitle:rt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?En[t].call(e,s):n}class Rs extends ft{static positioners=qt;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new pn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=sc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=K(s,"beforeTitle",this,t),o=K(s,"title",this,t),r=K(s,"afterTitle",this,t);let a=[];return a=st(a,lt(n)),a=st(a,lt(o)),a=st(a,lt(r)),a}getBeforeBody(t,e){return As(K(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return R(t,o=>{const r={before:[],lines:[],after:[]},a=Ts(s,o);st(r.before,lt(K(a,"beforeLabel",this,o))),st(r.lines,K(a,"label",this,o)),st(r.after,lt(K(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return As(K(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=K(s,"beforeFooter",this,t),o=K(s,"footer",this,t),r=K(s,"afterFooter",this,t);let a=[];return a=st(a,lt(n)),a=st(a,lt(o)),a=st(a,lt(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,d,f,s))),t.itemSort&&(a=a.sort((h,d)=>t.itemSort(h,d,s))),R(a,h=>{const d=Ts(t.callbacks,h);n.push(K(d,"labelColor",this,h)),o.push(K(d,"labelPointStyle",this,h)),r.push(K(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=qt[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=Ds(this,s),c=Object.assign({},a,l),h=Os(this.chart,s,c),d=Cs(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Et(a),{x:f,y:u}=t,{width:p,height:g}=e;let m,b,_,v,y,x;return o==="center"?(y=u+g/2,n==="left"?(m=f,b=m-r,v=y+r,x=y-r):(m=f+p,b=m+r,v=y-r,x=y+r),_=m):(n==="left"?b=f+Math.max(l,h)+r:n==="right"?b=f+p-Math.max(c,d)-r:b=this.caretX,o==="top"?(v=u,y=v-r,m=b-r,_=b+r):(v=u+g,y=v+r,m=b+r,_=b-r),x=v),{x1:m,x2:b,x3:_,y1:v,y2:y,y3:x}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=It(s.rtl,this.x,this.width);for(t.x=ve(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=X(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Oe(t,{x:g,y:p,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Oe(t,{x:m,y:p+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=X(s.bodyFont);let f=d.lineHeight,u=0;const p=It(s.rtl,this.x,this.width),g=function(k){e.fillText(k,p.x(t.x+u),t.y+f/2),t.y+=f+o},m=p.textAlign(r);let b,_,v,y,x,M,S;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=ve(this,m,s),e.fillStyle=s.bodyColor,R(this.beforeBody,g),u=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,y=0,M=n.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=qt[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Ds(this,t),l=Object.assign({},r,this._size),c=Os(e,t,l),h=Cs(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=tt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),cn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),hn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!we(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!we(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=qt[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}var Mc={id:"tooltip",_element:Rs,positioners:qt,afterInit(i,t,e){e&&(i.tooltip=new Rs({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:En},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const nc=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function oc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return nc(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const rc=(i,t)=>i===null?null:Y(Math.round(i),0,t);function Ls(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function ac(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,u=o||1,p=h-1,{min:g,max:m}=t,b=!T(r),_=!T(a),v=!T(c),y=(m-g)/(d+1);let x=Ci((m-g)/p/u)*u,M,S,k,w;if(x<1e-14&&!b&&!_)return[{value:g},{value:m}];w=Math.ceil(m/x)-Math.floor(g/x),w>p&&(x=Ci(w*x/p/u)*u),T(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),n==="ticks"?(S=Math.floor(g/x)*x,k=Math.ceil(m/x)*x):(S=g,k=m),b&&_&&o&&po((a-r)/o,x/1e3)?(w=Math.round(Math.min((a-r)/x,h)),x=(a-r)/w,S=r,k=a):v?(S=b?r:S,k=_?a:k,w=c-1,x=(k-S)/w):(w=(k-S)/x,Jt(w,Math.round(w),x/1e3)?w=Math.round(w):w=Math.ceil(w));const D=Math.max(Ai(x),Ai(S));M=Math.pow(10,T(l)?D:l),S=Math.round(S*M)/M,k=Math.round(k*M)/M;let O=0;for(b&&(f&&S!==r?(e.push({value:r}),Sa)break;e.push({value:A})}return _&&f&&k!==a?e.length&&Jt(e[e.length-1].value,a,Es(a,y,i))?e[e.length-1].value=a:e.push({value:a}):(!_||k===a)&&e.push({value:k}),e}function Es(i,t,{horizontal:e,minRotation:s}){const n=ht(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class lc extends Wt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return T(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=ot(n),c=ot(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=ac(n,o);return t.bounds==="ticks"&&mo(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return ui(t,this.chart.options.locale,this.options.ticks.format)}}class kc extends lc{static id="linear";static defaults={ticks:{callback:tn.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=U(t)?t:0,this.max=U(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=ht(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const ze={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},q=Object.keys(ze);function Is(i,t){return i-t}function Fs(i,t){if(T(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),U(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(Ft(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function zs(i,t,e,s){const n=q.length;for(let o=q.indexOf(i);o=q.indexOf(e);o--){const r=q[o];if(ze[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return q[e?q.indexOf(e):0]}function hc(i){for(let t=q.indexOf(i)+1,e=q.length;t=t?e[s]:e[n];i[o]=!0}}function dc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function Ws(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=Y(e,0,r),s=Y(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||zs(o.minUnit,e,s,this._getLabelCapacity(e)),a=P(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Ft(l)||l===!0,h={};let d=e,f,u;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const p=n.ticks.source==="data"&&this.getDataTimestamps();for(f=d,u=0;f+g)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],d=c&&a[c],f=s[e],u=c&&d&&f&&f.major;return this._adapter.format(t,n||(u?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=wt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=wt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class wc extends Hs{static id="timeseries";static defaults=Hs.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Me(e,this.min),this._tableRange=Me(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Me(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Me(this._table,s*this._tableRange+this._minPos,!0)}}export{mc as A,fc as B,ol as C,uc as D,kc as L,bc as P,pc as S,Hs as T,Sc as a,vi as b,gc as c,Mc as d,yc as e,_c as f,Gr as g,xc as i,vc as p}; diff --git a/repeater/web/html/assets/chartjs-adapter-date-fns-kwjCs6JU.css b/repeater/web/html/assets/chartjs-adapter-date-fns-kwjCs6JU.css new file mode 100644 index 0000000..11a5362 --- /dev/null +++ b/repeater/web/html/assets/chartjs-adapter-date-fns-kwjCs6JU.css @@ -0,0 +1 @@ +.sparkline-card[data-v-257cbdca]{background:#ffffffbf;border:1px solid rgba(0,0,0,.06);border-radius:12px;padding:12px 14px;-webkit-backdrop-filter:blur(50px);backdrop-filter:blur(50px);overflow:hidden;transition:background .3s ease,border-color .3s ease,box-shadow .3s ease;box-shadow:0 4px 16px #0000000a,0 1px 3px #00000005}.dark .sparkline-card[data-v-257cbdca]{background:#0006;border:1px solid rgba(255,255,255,.05);box-shadow:0 4px 16px #0003}.card-header[data-v-257cbdca]{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}.card-title[data-v-257cbdca]{color:#4b5563b3;font-size:11px;font-weight:500;text-transform:uppercase;letter-spacing:.05em;transition:color .3s ease}.dark .card-title[data-v-257cbdca]{color:#fff9}.card-subtitle[data-v-257cbdca]{color:#4b556380;font-size:9px;font-weight:400;margin-top:2px;transition:color .3s ease}.dark .card-subtitle[data-v-257cbdca]{color:#fff6}.card-value[data-v-257cbdca]{font-size:22px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}.card-chart[data-v-257cbdca]{width:100%;height:28px;overflow:hidden}.chart-svg[data-v-257cbdca]{width:100%;height:100%}.chart-loader[data-v-257cbdca]{display:flex;align-items:center;justify-content:center;height:100%}.loader-spinner[data-v-257cbdca]{width:18px;height:18px;border:2px solid rgba(255,255,255,.2);border-radius:50%;animation:spin-257cbdca 1s linear infinite}.chart-text[data-v-257cbdca]{display:flex;align-items:center;justify-content:center;height:100%}.percent-value[data-v-257cbdca]{font-size:20px;font-weight:500;color:#ffffff80;font-variant-numeric:tabular-nums}.sparkline-path[data-v-257cbdca]{transition:d 1s ease-out}@keyframes spin-257cbdca{to{transform:rotate(360deg)}}@media (min-width: 1024px){.sparkline-card[data-v-257cbdca]{padding:14px 16px}.card-header[data-v-257cbdca]{margin-bottom:10px}.card-title[data-v-257cbdca]{font-size:12px}.card-value[data-v-257cbdca]{font-size:26px}.card-chart[data-v-257cbdca]{height:32px}.percent-value[data-v-257cbdca]{font-size:24px}} diff --git a/repeater/web/html/assets/chartjs-adapter-date-fns.esm-BTd89PGn.js b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-BTd89PGn.js new file mode 100644 index 0000000..788b741 --- /dev/null +++ b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-BTd89PGn.js @@ -0,0 +1,6 @@ +import{a as Ae,c as j,b as O,e as I,g as U,t as Z,n as ye,F as ge,p as Y,x as Ge}from"./index-C2DY4pTz.js";import{g as Ve}from"./chart-B185MtDy.js";const ze={class:"sparkline-card"},je={class:"card-header"},Ue={class:"card-title"},Ze={key:0,class:"card-subtitle"},Je={key:0,class:"card-chart"},Ke={key:0,class:"chart-loader"},Se={key:1,class:"chart-text"},et={class:"percent-value"},tt=["id","viewBox"],nt=["d","fill"],rt=["d","stroke"],J=100,K=40,at=Ae({name:"SparklineChart",__name:"Sparkline",props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0},variant:{default:"smooth"},loading:{type:Boolean,default:!1},centerText:{default:""},subtitle:{default:""}},setup(r){const e=r,t=i=>{if(i.length<3)return i;const d=Math.min(15,Math.max(3,Math.floor(i.length*.2))),f=[];for(let D=0;DR+H,0)/k.length)}const y=Math.min(10,f.length),T=f.length/y,N=[];for(let D=0;D!e.data||e.data.length===0?[]:e.variant==="smooth"?t(e.data):e.data),a=i=>{if(i.length<2)return"";const d=Math.max(...i),f=Math.min(...i),y=d-f||1,T=e.variant==="classic"?4:2;let N="";return i.forEach((D,P)=>{const l=P/(i.length-1)*J,w=(D-f)/y,k=T+(K-T*2)*(1-w);if(P===0)N+=`M ${l.toFixed(2)} ${k.toFixed(2)}`;else{const H=((P-1)/(i.length-1)*J+l)/2;N+=` Q ${H.toFixed(2)} ${k.toFixed(2)} ${l.toFixed(2)} ${k.toFixed(2)}`}}),N},s=j(()=>a(n.value)),o=j(()=>s.value?`${s.value} L ${J} ${K} L 0 ${K} Z`:""),c=j(()=>`sparkline-${e.title.replace(/\s+/g,"-").toLowerCase()}`);return(i,d)=>(Y(),O("div",ze,[I("div",je,[I("div",null,[I("p",Ue,Z(i.title),1),i.subtitle?(Y(),O("p",Ze,Z(i.subtitle),1)):U("",!0)]),I("span",{class:"card-value",style:ye({color:i.color})},Z(typeof i.value=="number"?i.value.toLocaleString():i.value),5)]),i.showChart?(Y(),O("div",Je,[i.loading&&i.variant==="classic"?(Y(),O("div",Ke,[I("div",{class:"loader-spinner",style:ye({borderTopColor:i.color})},null,4)])):i.centerText?(Y(),O("div",Se,[I("span",et,Z(i.centerText),1)])):(Y(),O("svg",{key:2,id:c.value,class:"chart-svg",viewBox:`0 0 ${J} ${K}`,preserveAspectRatio:"none"},[i.variant==="classic"?(Y(),O(ge,{key:0},[n.value.length>1?(Y(),O("path",{key:0,d:o.value,fill:i.color,"fill-opacity":"0.8",class:"sparkline-path"},null,8,nt)):U("",!0)],64)):(Y(),O(ge,{key:1},[n.value.length>1?(Y(),O("path",{key:0,d:s.value,stroke:i.color,"stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round",fill:"none",class:"sparkline-path"},null,8,rt)):U("",!0)],64))],8,tt))])):U("",!0)]))}}),Vr=Ge(at,[["__scopeId","data-v-257cbdca"]]),Te=6048e5,st=864e5,G=6e4,V=36e5,ot=1e3,pe=Symbol.for("constructDateFrom");function p(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&pe in r?r[pe](e):r instanceof Date?new r.constructor(e):new Date(e)}function u(r,e){return p(e||r,r)}function ne(r,e,t){const n=u(r,t?.in);return isNaN(e)?p(t?.in||r,NaN):(e&&n.setDate(n.getDate()+e),n)}function ce(r,e,t){const n=u(r,t?.in);if(isNaN(e))return p(r,NaN);if(!e)return n;const a=n.getDate(),s=p(r,n.getTime());s.setMonth(n.getMonth()+e+1,0);const o=s.getDate();return a>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),a),n)}function ue(r,e,t){return p(r,+u(r)+e)}function it(r,e,t){return ue(r,e*V)}let ct={};function F(){return ct}function W(r,e){const t=F(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=u(r,e?.in),s=a.getDay(),o=(s=s.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function ee(r){const e=u(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function C(r,...e){const t=p.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function se(r,e){const t=u(r,e?.in);return t.setHours(0,0,0,0),t}function Oe(r,e,t){const[n,a]=C(t?.in,r,e),s=se(n),o=se(a),c=+s-ee(s),i=+o-ee(o);return Math.round((c-i)/st)}function ut(r,e){const t=Pe(r,e),n=p(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Q(n)}function dt(r,e,t){const n=u(r,t?.in);return n.setTime(n.getTime()+e*G),n}function lt(r,e,t){return ce(r,e*3,t)}function ft(r,e,t){return ue(r,e*1e3)}function ht(r,e,t){return ne(r,e*7,t)}function mt(r,e,t){return ce(r,e*12,t)}function A(r,e){const t=+u(r)-+u(e);return t<0?-1:t>0?1:t}function wt(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Ye(r){return!(!wt(r)&&typeof r!="number"||isNaN(+u(r)))}function yt(r,e,t){const[n,a]=C(t?.in,r,e),s=n.getFullYear()-a.getFullYear(),o=n.getMonth()-a.getMonth();return s*12+o}function gt(r,e,t){const[n,a]=C(t?.in,r,e);return n.getFullYear()-a.getFullYear()}function ve(r,e,t){const[n,a]=C(t?.in,r,e),s=be(n,a),o=Math.abs(Oe(n,a));n.setDate(n.getDate()-s*o);const c=+(be(n,a)===-s),i=s*(o-c);return i===0?0:i}function be(r,e){const t=r.getFullYear()-e.getFullYear()||r.getMonth()-e.getMonth()||r.getDate()-e.getDate()||r.getHours()-e.getHours()||r.getMinutes()-e.getMinutes()||r.getSeconds()-e.getSeconds()||r.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}function z(r){return e=>{const n=(r?Math[r]:Math.trunc)(e);return n===0?0:n}}function pt(r,e,t){const[n,a]=C(t?.in,r,e),s=(+n-+a)/V;return z(t?.roundingMethod)(s)}function de(r,e){return+u(r)-+u(e)}function bt(r,e,t){const n=de(r,e)/G;return z(t?.roundingMethod)(n)}function _e(r,e){const t=u(r,e?.in);return t.setHours(23,59,59,999),t}function We(r,e){const t=u(r,e?.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function xt(r,e){const t=u(r,e?.in);return+_e(t,e)==+We(t,e)}function Ne(r,e,t){const[n,a,s]=C(t?.in,r,r,e),o=A(a,s),c=Math.abs(yt(a,s));if(c<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*c);let i=A(a,s)===-o;xt(n)&&c===1&&A(n,s)===1&&(i=!1);const d=o*(c-+i);return d===0?0:d}function Mt(r,e,t){const n=Ne(r,e,t)/3;return z(t?.roundingMethod)(n)}function Dt(r,e,t){const n=de(r,e)/1e3;return z(t?.roundingMethod)(n)}function kt(r,e,t){const n=ve(r,e,t)/7;return z(t?.roundingMethod)(n)}function Tt(r,e,t){const[n,a]=C(t?.in,r,e),s=A(n,a),o=Math.abs(gt(n,a));n.setFullYear(1584),a.setFullYear(1584);const c=A(n,a)===-s,i=s*(o-+c);return i===0?0:i}function Pt(r,e){const t=u(r,e?.in),n=t.getMonth(),a=n-n%3;return t.setMonth(a,1),t.setHours(0,0,0,0),t}function Ot(r,e){const t=u(r,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function Yt(r,e){const t=u(r,e?.in),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}function Ee(r,e){const t=u(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function vt(r,e){const t=u(r,e?.in);return t.setMinutes(59,59,999),t}function _t(r,e){const t=F(),n=t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=u(r,e?.in),s=a.getDay(),o=(s{let n;const a=Ht[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function re(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Ft={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},It={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Lt={date:re({formats:Ft,defaultWidth:"full"}),time:re({formats:Ct,defaultWidth:"full"}),dateTime:re({formats:It,defaultWidth:"full"})},Qt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Rt=(r,e,t,n)=>Qt[r];function B(r){return(e,t)=>{const n=t?.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,c=t?.width?String(t.width):o;a=r.formattingValues[c]||r.formattingValues[o]}else{const o=r.defaultWidth,c=t?.width?String(t.width):r.defaultWidth;a=r.values[c]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(e):e;return a[s]}}const Bt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Xt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},At={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Vt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zt=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},jt={ordinalNumber:zt,era:B({values:Bt,defaultWidth:"wide"}),quarter:B({values:Xt,defaultWidth:"wide",argumentCallback:r=>r-1}),month:B({values:$t,defaultWidth:"wide"}),day:B({values:At,defaultWidth:"wide"}),dayPeriod:B({values:Gt,defaultWidth:"wide",formattingValues:Vt,defaultFormattingWidth:"wide"})};function X(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(a);if(!s)return null;const o=s[0],c=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],i=Array.isArray(c)?Zt(c,y=>y.test(o)):Ut(c,y=>y.test(o));let d;d=r.valueCallback?r.valueCallback(i):i,d=t.valueCallback?t.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function Ut(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Zt(r,e){for(let t=0;t{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],s=e.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const c=e.slice(a.length);return{value:o,rest:c}}}const Kt=/^(\d+)(th|st|nd|rd)?/i,St=/\d+/i,en={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},tn={any:[/^b/i,/^(a|c)/i]},nn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},rn={any:[/1/i,/2/i,/3/i,/4/i]},an={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},sn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},on={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},cn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},un={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dn={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ln={ordinalNumber:Jt({matchPattern:Kt,parsePattern:St,valueCallback:r=>parseInt(r,10)}),era:X({matchPatterns:en,defaultMatchWidth:"wide",parsePatterns:tn,defaultParseWidth:"any"}),quarter:X({matchPatterns:nn,defaultMatchWidth:"wide",parsePatterns:rn,defaultParseWidth:"any",valueCallback:r=>r+1}),month:X({matchPatterns:an,defaultMatchWidth:"wide",parsePatterns:sn,defaultParseWidth:"any"}),day:X({matchPatterns:on,defaultMatchWidth:"wide",parsePatterns:cn,defaultParseWidth:"any"}),dayPeriod:X({matchPatterns:un,defaultMatchWidth:"any",parsePatterns:dn,defaultParseWidth:"any"})},He={code:"en-US",formatDistance:qt,formatLong:Lt,formatRelative:Rt,localize:jt,match:ln,options:{weekStartsOn:0,firstWeekContainsDate:1}};function fn(r,e){const t=u(r,e?.in);return Oe(t,Ee(t))+1}function qe(r,e){const t=u(r,e?.in),n=+Q(t)-+ut(t);return Math.round(n/Te)+1}function le(r,e){const t=u(r,e?.in),n=t.getFullYear(),a=F(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=p(e?.in||r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const c=W(o,e),i=p(e?.in||r,0);i.setFullYear(n,0,s),i.setHours(0,0,0,0);const d=W(i,e);return+t>=+c?n+1:+t>=+d?n:n-1}function hn(r,e){const t=F(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,a=le(r,e),s=p(e?.in||r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),W(s,e)}function Fe(r,e){const t=u(r,e?.in),n=+W(t,e)-+hn(t,e);return Math.round(n/Te)+1}function m(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const E={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return m(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):m(t+1,2)},d(r,e){return m(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return m(r.getHours()%12||12,e.length)},H(r,e){return m(r.getHours(),e.length)},m(r,e){return m(r.getMinutes(),e.length)},s(r,e){return m(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return m(a,e.length)}},L={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xe={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return E.y(r,e)},Y:function(r,e,t,n){const a=le(r,n),s=a>0?a:1-a;if(e==="YY"){const o=s%100;return m(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):m(s,e.length)},R:function(r,e){const t=Pe(r);return m(t,e.length)},u:function(r,e){const t=r.getFullYear();return m(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return m(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return m(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return E.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return m(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=Fe(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):m(a,e.length)},I:function(r,e,t){const n=qe(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):m(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):E.d(r,e)},D:function(r,e,t){const n=fn(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):m(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return m(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return m(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return m(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=L.noon:n===0?a=L.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=L.evening:n>=12?a=L.afternoon:n>=4?a=L.morning:a=L.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return E.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):E.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):m(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):m(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):E.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):E.s(r,e)},S:function(r,e){return E.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return De(n);case"XXXX":case"XX":return q(n);case"XXXXX":case"XXX":default:return q(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return De(n);case"xxxx":case"xx":return q(n);case"xxxxx":case"xxx":default:return q(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Me(n,":");case"OOOO":default:return"GMT"+q(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Me(n,":");case"zzzz":default:return"GMT"+q(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return m(n,e.length)},T:function(r,e,t){return m(+r,e.length)}};function Me(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+m(s,2)}function De(r,e){return r%60===0?(r>0?"-":"+")+m(Math.abs(r)/60,2):q(r,e)}function q(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=m(Math.trunc(n/60),2),s=m(n%60,2);return t+a+e+s}const ke=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Ce=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},mn=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return ke(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ke(n,e)).replace("{{time}}",Ce(a,e))},oe={p:Ce,P:mn},wn=/^D+$/,yn=/^Y+$/,gn=["D","DD","YY","YYYY"];function Ie(r){return wn.test(r)}function Le(r){return yn.test(r)}function ie(r,e,t){const n=pn(r,e,t);if(console.warn(n),gn.includes(r))throw new RangeError(n)}function pn(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const bn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mn=/^'([^]*?)'?$/,Dn=/''/g,kn=/[a-zA-Z]/;function Tn(r,e,t){const n=F(),a=t?.locale??n.locale??He,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,c=u(r,t?.in);if(!Ye(c))throw new RangeError("Invalid time value");let i=e.match(xn).map(f=>{const y=f[0];if(y==="p"||y==="P"){const T=oe[y];return T(f,a.formatLong)}return f}).join("").match(bn).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const y=f[0];if(y==="'")return{isToken:!1,value:Pn(f)};if(xe[y])return{isToken:!0,value:f};if(y.match(kn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:f}});a.localize.preprocessor&&(i=a.localize.preprocessor(c,i));const d={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return i.map(f=>{if(!f.isToken)return f.value;const y=f.value;(!t?.useAdditionalWeekYearTokens&&Le(y)||!t?.useAdditionalDayOfYearTokens&&Ie(y))&&ie(y,e,String(r));const T=xe[y[0]];return T(c,y,a.localize,d)}).join("")}function Pn(r){const e=r.match(Mn);return e?e[1].replace(Dn,"'"):r}function On(){return Object.assign({},F())}function Yn(r,e){const t=u(r,e?.in).getDay();return t===0?7:t}function vn(r,e){const t=_n(e)?new e(0):p(e,0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}function _n(r){return typeof r=="function"&&r.prototype?.constructor===r}const Wn=10;class Qe{subPriority=0;validate(e,t){return!0}}class Nn extends Qe{constructor(e,t,n,a,s){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=a,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class En extends Qe{priority=Wn;subPriority=-1;constructor(e,t){super(),this.context=e||(n=>p(t,n))}set(e,t){return t.timestampIsSet?e:p(e,vn(e,this.context))}}class h{run(e,t,n,a){const s=this.parse(e,t,n,a);return s?{setter:new Nn(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,n){return!0}}class Hn extends h{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const x={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},v={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function M(r,e){return r&&{value:e(r.value),rest:r.rest}}function g(r,e){const t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function _(r,e){const t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};const n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*V+s*G+o*ot),rest:e.slice(t[0].length)}}function Re(r){return g(x.anyDigitsSigned,r)}function b(r,e){switch(r){case 1:return g(x.singleDigit,e);case 2:return g(x.twoDigits,e);case 3:return g(x.threeDigits,e);case 4:return g(x.fourDigits,e);default:return g(new RegExp("^\\d{1,"+r+"}"),e)}}function te(r,e){switch(r){case 1:return g(x.singleDigitSigned,e);case 2:return g(x.twoDigitsSigned,e);case 3:return g(x.threeDigitsSigned,e);case 4:return g(x.fourDigitsSigned,e);default:return g(new RegExp("^-?\\d{1,"+r+"}"),e)}}function fe(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Be(r,e){const t=e>0,n=t?e:1-e;let a;if(n<=50)a=r||100;else{const s=n+50,o=Math.trunc(s/100)*100,c=r>=s%100;a=r+o-(c?100:0)}return t?a:1-a}function Xe(r){return r%400===0||r%4===0&&r%100!==0}class qn extends h{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="yy"});switch(t){case"y":return M(b(4,e),a);case"yo":return M(n.ordinalNumber(e,{unit:"year"}),a);default:return M(b(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const a=e.getFullYear();if(n.isTwoDigitYear){const o=Be(n.year,a);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const s=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class Fn extends h{priority=130;parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="YY"});switch(t){case"Y":return M(b(4,e),a);case"Yo":return M(n.ordinalNumber(e,{unit:"year"}),a);default:return M(b(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,a){const s=le(e,a);if(n.isTwoDigitYear){const c=Be(n.year,s);return e.setFullYear(c,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),W(e,a)}const o=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(o,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),W(e,a)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class Cn extends h{priority=130;parse(e,t){return te(t==="R"?4:t.length,e)}set(e,t,n){const a=p(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Q(a)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class In extends h{priority=130;parse(e,t){return te(t==="u"?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class Ln extends h{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return b(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Qn extends h{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return b(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Rn extends h{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"M":return M(g(x.month,e),a);case"MM":return M(b(2,e),a);case"Mo":return M(n.ordinalNumber(e,{unit:"month"}),a);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class Bn extends h{priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"L":return M(g(x.month,e),a);case"LL":return M(b(2,e),a);case"Lo":return M(n.ordinalNumber(e,{unit:"month"}),a);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function Xn(r,e,t){const n=u(r,t?.in),a=Fe(n,t)-e;return n.setDate(n.getDate()-a*7),u(n,t?.in)}class $n extends h{priority=100;parse(e,t,n){switch(t){case"w":return g(x.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,a){return W(Xn(e,n,a),a)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function An(r,e,t){const n=u(r,t?.in),a=qe(n,t)-e;return n.setDate(n.getDate()-a*7),n}class Gn extends h{priority=100;parse(e,t,n){switch(t){case"I":return g(x.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return Q(An(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const Vn=[31,28,31,30,31,30,31,31,30,31,30,31],zn=[31,29,31,30,31,30,31,31,30,31,30,31];class jn extends h{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return g(x.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return b(t.length,e)}}validate(e,t){const n=e.getFullYear(),a=Xe(n),s=e.getMonth();return a?t>=1&&t<=zn[s]:t>=1&&t<=Vn[s]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class Un extends h{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return g(x.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return b(t.length,e)}}validate(e,t){const n=e.getFullYear();return Xe(n)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function he(r,e,t){const n=F(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=u(r,t?.in),o=s.getDay(),i=(e%7+7)%7,d=7-a,f=e<0||e>6?e-(o+d)%7:(i+d)%7-(o+d)%7;return ne(s,f,t)}class Zn extends h{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class Jn extends h{priority=90;parse(e,t,n,a){const s=o=>{const c=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+c};switch(t){case"e":case"ee":return M(b(t.length,e),s);case"eo":return M(n.ordinalNumber(e,{unit:"day"}),s);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Kn extends h{priority=90;parse(e,t,n,a){const s=o=>{const c=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+c};switch(t){case"c":case"cc":return M(b(t.length,e),s);case"co":return M(n.ordinalNumber(e,{unit:"day"}),s);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Sn(r,e,t){const n=u(r,t?.in),a=Yn(n,t),s=e-a;return ne(n,s,t)}class er extends h{priority=90;parse(e,t,n){const a=s=>s===0?7:s;switch(t){case"i":case"ii":return b(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return M(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiii":return M(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return M(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return M(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Sn(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class tr extends h{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class nr extends h{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class rr extends h{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class ar extends h{priority=70;parse(e,t,n){switch(t){case"h":return g(x.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const a=e.getHours()>=12;return a&&n<12?e.setHours(n+12,0,0,0):!a&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class sr extends h{priority=70;parse(e,t,n){switch(t){case"H":return g(x.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class or extends h{priority=70;parse(e,t,n){switch(t){case"K":return g(x.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class ir extends h{priority=70;parse(e,t,n){switch(t){case"k":return g(x.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const a=n<=24?n%24:n;return e.setHours(a,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class cr extends h{priority=60;parse(e,t,n){switch(t){case"m":return g(x.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]}class ur extends h{priority=50;parse(e,t,n){switch(t){case"s":return g(x.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]}class dr extends h{priority=30;parse(e,t){const n=a=>Math.trunc(a*Math.pow(10,-t.length+3));return M(b(t.length,e),n)}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]}class lr extends h{priority=10;parse(e,t){switch(t){case"X":return _(v.basicOptionalMinutes,e);case"XX":return _(v.basic,e);case"XXXX":return _(v.basicOptionalSeconds,e);case"XXXXX":return _(v.extendedOptionalSeconds,e);case"XXX":default:return _(v.extended,e)}}set(e,t,n){return t.timestampIsSet?e:p(e,e.getTime()-ee(e)-n)}incompatibleTokens=["t","T","x"]}class fr extends h{priority=10;parse(e,t){switch(t){case"x":return _(v.basicOptionalMinutes,e);case"xx":return _(v.basic,e);case"xxxx":return _(v.basicOptionalSeconds,e);case"xxxxx":return _(v.extendedOptionalSeconds,e);case"xxx":default:return _(v.extended,e)}}set(e,t,n){return t.timestampIsSet?e:p(e,e.getTime()-ee(e)-n)}incompatibleTokens=["t","T","X"]}class hr extends h{priority=40;parse(e){return Re(e)}set(e,t,n){return[p(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class mr extends h{priority=20;parse(e){return Re(e)}set(e,t,n){return[p(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}const wr={G:new Hn,y:new qn,Y:new Fn,R:new Cn,u:new In,Q:new Ln,q:new Qn,M:new Rn,L:new Bn,w:new $n,I:new Gn,d:new jn,D:new Un,E:new Zn,e:new Jn,c:new Kn,i:new er,a:new tr,b:new nr,B:new rr,h:new ar,H:new sr,K:new or,k:new ir,m:new cr,s:new ur,S:new dr,X:new lr,x:new fr,t:new hr,T:new mr},yr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pr=/^'([^]*?)'?$/,br=/''/g,xr=/\S/,Mr=/[a-zA-Z]/;function Dr(r,e,t,n){const a=()=>p(n?.in||t,NaN),s=On(),o=n?.locale??s.locale??He,c=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return r?a():u(t,n?.in);const d={firstWeekContainsDate:c,weekStartsOn:i,locale:o},f=[new En(n?.in,t)],y=e.match(gr).map(l=>{const w=l[0];if(w in oe){const k=oe[w];return k(l,o.formatLong)}return l}).join("").match(yr),T=[];for(let l of y){!n?.useAdditionalWeekYearTokens&&Le(l)&&ie(l,e,r),!n?.useAdditionalDayOfYearTokens&&Ie(l)&&ie(l,e,r);const w=l[0],k=wr[w];if(k){const{incompatibleTokens:R}=k;if(Array.isArray(R)){const me=T.find(we=>R.includes(we.token)||we.token===w);if(me)throw new RangeError(`The format string mustn't contain \`${me.fullToken}\` and \`${l}\` at the same time`)}else if(k.incompatibleTokens==="*"&&T.length>0)throw new RangeError(`The format string mustn't contain \`${l}\` and any other token at the same time`);T.push({token:w,fullToken:l});const H=k.run(r,l,o.match,d);if(!H)return a();f.push(H.setter),r=H.rest}else{if(w.match(Mr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");if(l==="''"?l="'":w==="'"&&(l=kr(l)),r.indexOf(l)===0)r=r.slice(l.length);else return a()}}if(r.length>0&&xr.test(r))return a();const N=f.map(l=>l.priority).sort((l,w)=>w-l).filter((l,w,k)=>k.indexOf(l)===w).map(l=>f.filter(w=>w.priority===l).sort((w,k)=>k.subPriority-w.subPriority)).map(l=>l[0]);let D=u(t,n?.in);if(isNaN(+D))return a();const P={};for(const l of N){if(!l.validate(D,d))return a();const w=l.set(D,P,d);Array.isArray(w)?(D=w[0],Object.assign(P,w[1])):D=w}return D}function kr(r){return r.match(pr)[1].replace(br,"'")}function Tr(r,e){const t=u(r,e?.in);return t.setMinutes(0,0,0),t}function Pr(r,e){const t=u(r,e?.in);return t.setSeconds(0,0),t}function Or(r,e){const t=u(r,e?.in);return t.setMilliseconds(0),t}function Yr(r,e){const t=()=>p(e?.in,NaN),n=e?.additionalDigits??2,a=Nr(r);let s;if(a.date){const d=Er(a.date,n);s=Hr(d.restDateString,d.year)}if(!s||isNaN(+s))return t();const o=+s;let c=0,i;if(a.time&&(c=qr(a.time),isNaN(c)))return t();if(a.timezone){if(i=Fr(a.timezone),isNaN(i))return t()}else{const d=new Date(o+c),f=u(0,e?.in);return f.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),f.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),f}return u(o+c+i,e?.in)}const S={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},vr=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,_r=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Wr=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Nr(r){const e={},t=r.split(S.dateTimeDelimiter);let n;if(t.length>2)return e;if(/:/.test(t[0])?n=t[0]:(e.date=t[0],n=t[1],S.timeZoneDelimiter.test(e.date)&&(e.date=r.split(S.timeZoneDelimiter)[0],n=r.substr(e.date.length,r.length))),n){const a=S.timezone.exec(n);a?(e.time=n.replace(a[1],""),e.timezone=a[1]):e.time=n}return e}function Er(r,e){const t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=r.match(t);if(!n)return{year:NaN,restDateString:""};const a=n[1]?parseInt(n[1]):null,s=n[2]?parseInt(n[2]):null;return{year:s===null?a:s*100,restDateString:r.slice((n[1]||n[2]).length)}}function Hr(r,e){if(e===null)return new Date(NaN);const t=r.match(vr);if(!t)return new Date(NaN);const n=!!t[4],a=$(t[1]),s=$(t[2])-1,o=$(t[3]),c=$(t[4]),i=$(t[5])-1;if(n)return Rr(e,c,i)?Cr(e,c,i):new Date(NaN);{const d=new Date(0);return!Lr(e,s,o)||!Qr(e,a)?new Date(NaN):(d.setUTCFullYear(e,s,Math.max(a,o)),d)}}function $(r){return r?parseInt(r):1}function qr(r){const e=r.match(_r);if(!e)return NaN;const t=ae(e[1]),n=ae(e[2]),a=ae(e[3]);return Br(t,n,a)?t*V+n*G+a*1e3:NaN}function ae(r){return r&&parseFloat(r.replace(",","."))||0}function Fr(r){if(r==="Z")return 0;const e=r.match(Wr);if(!e)return 0;const t=e[1]==="+"?-1:1,n=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return Xr(n,a)?t*(n*V+a*G):NaN}function Cr(r,e,t){const n=new Date(0);n.setUTCFullYear(r,0,4);const a=n.getUTCDay()||7,s=(e-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+s),n}const Ir=[31,null,31,30,31,30,31,31,30,31,30,31];function $e(r){return r%400===0||r%4===0&&r%100!==0}function Lr(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Ir[e]||($e(r)?29:28))}function Qr(r,e){return e>=1&&e<=($e(r)?366:365)}function Rr(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function Br(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}function Xr(r,e){return e>=0&&e<=59}/*! + * chartjs-adapter-date-fns v3.0.0 + * https://www.chartjs.org + * (c) 2022 chartjs-adapter-date-fns Contributors + * Released under the MIT license + */const $r={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Ve._date.override({_id:"date-fns",formats:function(){return $r},parse:function(r,e){if(r===null||typeof r>"u")return null;const t=typeof r;return t==="number"||r instanceof Date?r=u(r):t==="string"&&(typeof e=="string"?r=Dr(r,e,new Date,this.options):r=Yr(r,this.options)),Ye(r)?r.getTime():null},format:function(r,e){return Tn(r,e,this.options)},add:function(r,e,t){switch(t){case"millisecond":return ue(r,e);case"second":return ft(r,e);case"minute":return dt(r,e);case"hour":return it(r,e);case"day":return ne(r,e);case"week":return ht(r,e);case"month":return ce(r,e);case"quarter":return lt(r,e);case"year":return mt(r,e);default:return r}},diff:function(r,e,t){switch(t){case"millisecond":return de(r,e);case"second":return Dt(r,e);case"minute":return bt(r,e);case"hour":return pt(r,e);case"day":return ve(r,e);case"week":return kt(r,e);case"month":return Ne(r,e);case"quarter":return Mt(r,e);case"year":return Tt(r,e);default:return 0}},startOf:function(r,e,t){switch(e){case"second":return Or(r);case"minute":return Pr(r);case"hour":return Tr(r);case"day":return se(r);case"week":return W(r);case"isoWeek":return W(r,{weekStartsOn:+t});case"month":return Ot(r);case"quarter":return Pt(r);case"year":return Ee(r);default:return r}},endOf:function(r,e){switch(e){case"second":return Et(r);case"minute":return Wt(r);case"hour":return vt(r);case"day":return _e(r);case"week":return _t(r);case"month":return We(r);case"quarter":return Nt(r);case"year":return Yt(r);default:return r}}});export{Vr as S}; diff --git a/repeater/web/html/assets/index-C2DY4pTz.js b/repeater/web/html/assets/index-C2DY4pTz.js new file mode 100644 index 0000000..97c0482 --- /dev/null +++ b/repeater/web/html/assets/index-C2DY4pTz.js @@ -0,0 +1,35 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Setup-CbTFhVaK.js","assets/Setup-RshMWyiL.css","assets/Login-l9pwpiS6.js","assets/Login-BiyTDci2.css","assets/Dashboard-DMnus2lM.js","assets/chart-B185MtDy.js","assets/useSignalQuality-D9wfbwdb.js","assets/preferences-DtwbSSgO.js","assets/Dashboard-QP8Te5jj.css","assets/Neighbors-BhwSlX3P.js","assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js","assets/Neighbors-Dm-0E9wE.css","assets/leaflet-Dgihpmma.css","assets/Statistics-D8GGvrdt.js","assets/chartjs-adapter-date-fns.esm-BTd89PGn.js","assets/chartjs-adapter-date-fns-kwjCs6JU.css","assets/plotly.min-DO11Gp-n.js","assets/Statistics-D4QKs0bR.css","assets/SystemStats-C7xzR_wP.js","assets/SystemStats-B8-MXEai.css","assets/Configuration-BFp_Zwgj.js","assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-BIwbENrM.js","assets/Configuration-DCyoN75P.css","assets/CADCalibration-sfiSWhAM.js","assets/CADCalibration-DnmufMQ0.css","assets/RoomServers-IKqFauvg.js","assets/Terminal-DYn8WA9j.js","assets/Terminal-NOfYg9Od.css"])))=>i.map(i=>d[i]); +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/** +* @vue/shared v3.5.18 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**//*! #__NO_SIDE_EFFECTS__ */function ao(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const we={},Cn=[],Et=()=>{},Vc=()=>!1,Zr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),lo=e=>e.startsWith("onUpdate:"),Ie=Object.assign,co=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Bc=Object.prototype.hasOwnProperty,Ce=(e,t)=>Bc.call(e,t),ae=Array.isArray,_n=e=>ir(e)==="[object Map]",zr=e=>ir(e)==="[object Set]",Uo=e=>ir(e)==="[object Date]",de=e=>typeof e=="function",Te=e=>typeof e=="string",St=e=>typeof e=="symbol",xe=e=>e!==null&&typeof e=="object",ha=e=>(xe(e)||de(e))&&de(e.then)&&de(e.catch),ma=Object.prototype.toString,ir=e=>ma.call(e),Hc=e=>ir(e).slice(8,-1),ga=e=>ir(e)==="[object Object]",uo=e=>Te(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Un=ao(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Jr=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},jc=/-(\w)/g,ut=Jr(e=>e.replace(jc,(t,n)=>n?n.toUpperCase():"")),Uc=/\B([A-Z])/g,Xt=Jr(e=>e.replace(Uc,"-$1").toLowerCase()),Yr=Jr(e=>e.charAt(0).toUpperCase()+e.slice(1)),gs=Jr(e=>e?`on${Yr(e)}`:""),zt=(e,t)=>!Object.is(e,t),kr=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Lr=e=>{const t=parseFloat(e);return isNaN(t)?e:t},qc=e=>{const t=Te(e)?Number(e):NaN;return isNaN(t)?e:t};let qo;const Qr=()=>qo||(qo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function On(e){if(ae(e)){const t={};for(let n=0;n{if(n){const r=n.split(Wc);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function le(e){let t="";if(Te(e))t=e;else if(ae(e))for(let n=0;nxn(n,t))}const va=e=>!!(e&&e.__v_isRef===!0),X=e=>Te(e)?e:e==null?"":ae(e)||xe(e)&&(e.toString===ma||!de(e.toString))?va(e)?X(e.value):JSON.stringify(e,ba,2):String(e),ba=(e,t)=>va(t)?ba(e,t.value):_n(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ys(r,o)+" =>"]=s,n),{})}:zr(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ys(n))}:St(t)?ys(t):xe(t)&&!ae(t)&&!ga(t)?String(t):t,ys=(e,t="")=>{var n;return St(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/** +* @vue/reactivity v3.5.18 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Ve;class Ca{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ve,!t&&Ve&&(this.index=(Ve.scopes||(Ve.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0&&--this._on===0&&(Ve=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n0)return;if(Kn){let t=Kn;for(Kn=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;qn;){let t=qn;for(qn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Sa(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Aa(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),ho(r),eu(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Vs(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ra(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ra(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Xn)||(e.globalVersion=Xn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Vs(e))))return;e.flags|=2;const t=e.dep,n=Ee,r=dt;Ee=e,dt=!0;try{Sa(e);const s=e.fn(e._value);(t.version===0||zt(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ee=n,dt=r,Aa(e),e.flags&=-3}}function ho(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)ho(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function eu(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let dt=!0;const Ta=[];function It(){Ta.push(dt),dt=!1}function Dt(){const e=Ta.pop();dt=e===void 0?!0:e}function Ko(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ee;Ee=void 0;try{t()}finally{Ee=n}}}let Xn=0;class tu{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class mo{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Ee||!dt||Ee===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ee)n=this.activeLink=new tu(Ee,this),Ee.deps?(n.prevDep=Ee.depsTail,Ee.depsTail.nextDep=n,Ee.depsTail=n):Ee.deps=Ee.depsTail=n,Oa(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Ee.depsTail,n.nextDep=void 0,Ee.depsTail.nextDep=n,Ee.depsTail=n,Ee.deps===n&&(Ee.deps=r)}return n}trigger(t){this.version++,Xn++,this.notify(t)}notify(t){fo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{po()}}}function Oa(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Oa(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Nr=new WeakMap,cn=Symbol(""),Bs=Symbol(""),er=Symbol("");function Be(e,t,n){if(dt&&Ee){let r=Nr.get(e);r||Nr.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new mo),s.map=r,s.key=n),s.track()}}function Mt(e,t,n,r,s,o){const i=Nr.get(e);if(!i){Xn++;return}const a=c=>{c&&c.trigger()};if(fo(),t==="clear")i.forEach(a);else{const c=ae(e),u=c&&uo(n);if(c&&n==="length"){const l=Number(r);i.forEach((d,f)=>{(f==="length"||f===er||!St(f)&&f>=l)&&a(d)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(er)),t){case"add":c?u&&a(i.get("length")):(a(i.get(cn)),_n(e)&&a(i.get(Bs)));break;case"delete":c||(a(i.get(cn)),_n(e)&&a(i.get(Bs)));break;case"set":_n(e)&&a(i.get(cn));break}}po()}function nu(e,t){const n=Nr.get(e);return n&&n.get(t)}function gn(e){const t=ye(e);return t===e?t:(Be(t,"iterate",er),lt(e)?t:t.map(De))}function Xr(e){return Be(e=ye(e),"iterate",er),e}const ru={__proto__:null,[Symbol.iterator](){return bs(this,Symbol.iterator,De)},concat(...e){return gn(this).concat(...e.map(t=>ae(t)?gn(t):t))},entries(){return bs(this,"entries",e=>(e[1]=De(e[1]),e))},every(e,t){return Rt(this,"every",e,t,void 0,arguments)},filter(e,t){return Rt(this,"filter",e,t,n=>n.map(De),arguments)},find(e,t){return Rt(this,"find",e,t,De,arguments)},findIndex(e,t){return Rt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Rt(this,"findLast",e,t,De,arguments)},findLastIndex(e,t){return Rt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Rt(this,"forEach",e,t,void 0,arguments)},includes(...e){return Cs(this,"includes",e)},indexOf(...e){return Cs(this,"indexOf",e)},join(e){return gn(this).join(e)},lastIndexOf(...e){return Cs(this,"lastIndexOf",e)},map(e,t){return Rt(this,"map",e,t,void 0,arguments)},pop(){return In(this,"pop")},push(...e){return In(this,"push",e)},reduce(e,...t){return Wo(this,"reduce",e,t)},reduceRight(e,...t){return Wo(this,"reduceRight",e,t)},shift(){return In(this,"shift")},some(e,t){return Rt(this,"some",e,t,void 0,arguments)},splice(...e){return In(this,"splice",e)},toReversed(){return gn(this).toReversed()},toSorted(e){return gn(this).toSorted(e)},toSpliced(...e){return gn(this).toSpliced(...e)},unshift(...e){return In(this,"unshift",e)},values(){return bs(this,"values",De)}};function bs(e,t,n){const r=Xr(e),s=r[t]();return r!==e&&!lt(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.value&&(o.value=n(o.value)),o}),s}const su=Array.prototype;function Rt(e,t,n,r,s,o){const i=Xr(e),a=i!==e&&!lt(e),c=i[t];if(c!==su[t]){const d=c.apply(e,o);return a?De(d):d}let u=n;i!==e&&(a?u=function(d,f){return n.call(this,De(d),f,e)}:n.length>2&&(u=function(d,f){return n.call(this,d,f,e)}));const l=c.call(i,u,r);return a&&s?s(l):l}function Wo(e,t,n,r){const s=Xr(e);let o=n;return s!==e&&(lt(e)?n.length>3&&(o=function(i,a,c){return n.call(this,i,a,c,e)}):o=function(i,a,c){return n.call(this,i,De(a),c,e)}),s[t](o,...r)}function Cs(e,t,n){const r=ye(e);Be(r,"iterate",er);const s=r[t](...n);return(s===-1||s===!1)&&vo(n[0])?(n[0]=ye(n[0]),r[t](...n)):s}function In(e,t,n=[]){It(),fo();const r=ye(e)[t].apply(e,n);return po(),Dt(),r}const ou=ao("__proto__,__v_isRef,__isVue"),Ma=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(St));function iu(e){St(e)||(e=String(e));const t=ye(this);return Be(t,"has",e),t.hasOwnProperty(e)}class Pa{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?gu:Da:o?Ia:Na).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=ae(t);if(!s){let c;if(i&&(c=ru[n]))return c;if(n==="hasOwnProperty")return iu}const a=Reflect.get(t,n,Le(t)?t:r);return(St(n)?Ma.has(n):ou(n))||(s||Be(t,"get",n),o)?a:Le(a)?i&&uo(n)?a:a.value:xe(a)?s?Fa(a):ar(a):a}}class La extends Pa{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];if(!this._isShallow){const c=Yt(o);if(!lt(r)&&!Yt(r)&&(o=ye(o),r=ye(r)),!ae(t)&&Le(o)&&!Le(r))return c?!1:(o.value=r,!0)}const i=ae(t)&&uo(n)?Number(n)e,yr=e=>Reflect.getPrototypeOf(e);function du(e,t,n){return function(...r){const s=this.__v_raw,o=ye(s),i=_n(o),a=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,u=s[e](...r),l=n?Hs:t?Ir:De;return!t&&Be(o,"iterate",c?Bs:cn),{next(){const{value:d,done:f}=u.next();return f?{value:d,done:f}:{value:a?[l(d[0]),l(d[1])]:l(d),done:f}},[Symbol.iterator](){return this}}}}function vr(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function fu(e,t){const n={get(s){const o=this.__v_raw,i=ye(o),a=ye(s);e||(zt(s,a)&&Be(i,"get",s),Be(i,"get",a));const{has:c}=yr(i),u=t?Hs:e?Ir:De;if(c.call(i,s))return u(o.get(s));if(c.call(i,a))return u(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&Be(ye(s),"iterate",cn),Reflect.get(s,"size",s)},has(s){const o=this.__v_raw,i=ye(o),a=ye(s);return e||(zt(s,a)&&Be(i,"has",s),Be(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,c=ye(a),u=t?Hs:e?Ir:De;return!e&&Be(c,"iterate",cn),a.forEach((l,d)=>s.call(o,u(l),u(d),i))}};return Ie(n,e?{add:vr("add"),set:vr("set"),delete:vr("delete"),clear:vr("clear")}:{add(s){!t&&!lt(s)&&!Yt(s)&&(s=ye(s));const o=ye(this);return yr(o).has.call(o,s)||(o.add(s),Mt(o,"add",s,s)),this},set(s,o){!t&&!lt(o)&&!Yt(o)&&(o=ye(o));const i=ye(this),{has:a,get:c}=yr(i);let u=a.call(i,s);u||(s=ye(s),u=a.call(i,s));const l=c.call(i,s);return i.set(s,o),u?zt(o,l)&&Mt(i,"set",s,o):Mt(i,"add",s,o),this},delete(s){const o=ye(this),{has:i,get:a}=yr(o);let c=i.call(o,s);c||(s=ye(s),c=i.call(o,s)),a&&a.call(o,s);const u=o.delete(s);return c&&Mt(o,"delete",s,void 0),u},clear(){const s=ye(this),o=s.size!==0,i=s.clear();return o&&Mt(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=du(s,e,t)}),n}function go(e,t){const n=fu(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(Ce(n,s)&&s in r?n:r,s,o)}const pu={get:go(!1,!1)},hu={get:go(!1,!0)},mu={get:go(!0,!1)};const Na=new WeakMap,Ia=new WeakMap,Da=new WeakMap,gu=new WeakMap;function yu(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function vu(e){return e.__v_skip||!Object.isExtensible(e)?0:yu(Hc(e))}function ar(e){return Yt(e)?e:yo(e,!1,lu,pu,Na)}function $a(e){return yo(e,!1,uu,hu,Ia)}function Fa(e){return yo(e,!0,cu,mu,Da)}function yo(e,t,n,r,s){if(!xe(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=vu(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function Jt(e){return Yt(e)?Jt(e.__v_raw):!!(e&&e.__v_isReactive)}function Yt(e){return!!(e&&e.__v_isReadonly)}function lt(e){return!!(e&&e.__v_isShallow)}function vo(e){return e?!!e.__v_raw:!1}function ye(e){const t=e&&e.__v_raw;return t?ye(t):e}function bo(e){return!Ce(e,"__v_skip")&&Object.isExtensible(e)&&Fs(e,"__v_skip",!0),e}const De=e=>xe(e)?ar(e):e,Ir=e=>xe(e)?Fa(e):e;function Le(e){return e?e.__v_isRef===!0:!1}function ne(e){return Va(e,!1)}function bu(e){return Va(e,!0)}function Va(e,t){return Le(e)?e:new Cu(e,t)}class Cu{constructor(t,n){this.dep=new mo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ye(t),this._value=n?t:De(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||lt(t)||Yt(t);t=r?t:ye(t),zt(t,n)&&(this._rawValue=t,this._value=r?t:De(t),this.dep.trigger())}}function ue(e){return Le(e)?e.value:e}const _u={get:(e,t,n)=>t==="__v_raw"?e:ue(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Le(s)&&!Le(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Ba(e){return Jt(e)?e:new Proxy(e,_u)}function wu(e){const t=ae(e)?new Array(e.length):{};for(const n in e)t[n]=ku(e,n);return t}class xu{constructor(t,n,r){this._object=t,this._key=n,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return nu(ye(this._object),this._key)}}function ku(e,t,n){const r=e[t];return Le(r)?r:new xu(e,t,n)}class Eu{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new mo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Xn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ee!==this)return Ea(this,!0),!0}get value(){const t=this.dep.track();return Ra(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Su(e,t,n=!1){let r,s;return de(e)?r=e:(r=e.get,s=e.set),new Eu(r,s,n)}const br={},Dr=new WeakMap;let rn;function Au(e,t=!1,n=rn){if(n){let r=Dr.get(n);r||Dr.set(n,r=[]),r.push(e)}}function Ru(e,t,n=we){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:c}=n,u=R=>s?R:lt(R)||s===!1||s===0?Pt(R,1):Pt(R);let l,d,f,y,g=!1,b=!1;if(Le(e)?(d=()=>e.value,g=lt(e)):Jt(e)?(d=()=>u(e),g=!0):ae(e)?(b=!0,g=e.some(R=>Jt(R)||lt(R)),d=()=>e.map(R=>{if(Le(R))return R.value;if(Jt(R))return u(R);if(de(R))return c?c(R,2):R()})):de(e)?t?d=c?()=>c(e,2):e:d=()=>{if(f){It();try{f()}finally{Dt()}}const R=rn;rn=l;try{return c?c(e,3,[y]):e(y)}finally{rn=R}}:d=Et,t&&s){const R=d,H=s===!0?1/0:s;d=()=>Pt(R(),H)}const x=wa(),k=()=>{l.stop(),x&&x.active&&co(x.effects,l)};if(o&&t){const R=t;t=(...H)=>{R(...H),k()}}let L=b?new Array(e.length).fill(br):br;const E=R=>{if(!(!(l.flags&1)||!l.dirty&&!R))if(t){const H=l.run();if(s||g||(b?H.some((ee,G)=>zt(ee,L[G])):zt(H,L))){f&&f();const ee=rn;rn=l;try{const G=[H,L===br?void 0:b&&L[0]===br?[]:L,y];L=H,c?c(t,3,G):t(...G)}finally{rn=ee}}}else l.run()};return a&&a(E),l=new xa(d),l.scheduler=i?()=>i(E,!1):E,y=R=>Au(R,!1,l),f=l.onStop=()=>{const R=Dr.get(l);if(R){if(c)c(R,4);else for(const H of R)H();Dr.delete(l)}},t?r?E(!0):L=l.run():i?i(E.bind(null,!0),!0):l.run(),k.pause=l.pause.bind(l),k.resume=l.resume.bind(l),k.stop=k,k}function Pt(e,t=1/0,n){if(t<=0||!xe(e)||e.__v_skip||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,Le(e))Pt(e.value,t,n);else if(ae(e))for(let r=0;r{Pt(r,t,n)});else if(ga(e)){for(const r in e)Pt(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Pt(e[r],t,n)}return e}/** +* @vue/runtime-core v3.5.18 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function lr(e,t,n,r){try{return r?e(...r):e()}catch(s){cr(s,t,n)}}function ft(e,t,n,r){if(de(e)){const s=lr(e,t,n,r);return s&&ha(s)&&s.catch(o=>{cr(o,t,n)}),s}if(ae(e)){const s=[];for(let o=0;o>>1,s=We[r],o=tr(s);o=tr(n)?We.push(e):We.splice(Ou(t),0,e),e.flags|=1,ja()}}function ja(){$r||($r=Ha.then(qa))}function Mu(e){ae(e)?wn.push(...e):Ut&&e.id===-1?Ut.splice(vn+1,0,e):e.flags&1||(wn.push(e),e.flags|=1),ja()}function Go(e,t,n=wt+1){for(;ntr(n)-tr(r));if(wn.length=0,Ut){Ut.push(...t);return}for(Ut=t,vn=0;vne.id==null?e.flags&2?-1:1/0:e.id;function qa(e){try{for(wt=0;wt{r._d&&li(-1);const o=Fr(t);let i;try{i=e(...s)}finally{Fr(o),r._d&&li(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function ph(e,t){if(rt===null)return e;const n=as(rt),r=e.dirs||(e.dirs=[]);for(let s=0;se.__isTeleport,Wn=e=>e&&(e.disabled||e.disabled===""),Zo=e=>e&&(e.defer||e.defer===""),zo=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jo=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,js=(e,t)=>{const n=e&&e.to;return Te(n)?t?t(n):null:n},Za={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,c,u){const{mc:l,pc:d,pbc:f,o:{insert:y,querySelector:g,createText:b,createComment:x}}=u,k=Wn(t.props);let{shapeFlag:L,children:E,dynamicChildren:R}=t;if(e==null){const H=t.el=b(""),ee=t.anchor=b("");y(H,n,r),y(ee,n,r);const G=(T,q)=>{L&16&&(s&&s.isCE&&(s.ce._teleportTarget=T),l(E,T,q,s,o,i,a,c))},J=()=>{const T=t.target=js(t.props,g),q=za(T,t,b,y);T&&(i!=="svg"&&zo(T)?i="svg":i!=="mathml"&&Jo(T)&&(i="mathml"),k||(G(T,q),Er(t,!1)))};k&&(G(n,ee),Er(t,!0)),Zo(t.props)?(t.el.__isMounted=!1,qe(()=>{J(),delete t.el.__isMounted},o)):J()}else{if(Zo(t.props)&&e.el.__isMounted===!1){qe(()=>{Za.process(e,t,n,r,s,o,i,a,c,u)},o);return}t.el=e.el,t.targetStart=e.targetStart;const H=t.anchor=e.anchor,ee=t.target=e.target,G=t.targetAnchor=e.targetAnchor,J=Wn(e.props),T=J?n:ee,q=J?H:G;if(i==="svg"||zo(ee)?i="svg":(i==="mathml"||Jo(ee))&&(i="mathml"),R?(f(e.dynamicChildren,R,T,s,o,i,a),Eo(e,t,!0)):c||d(e,t,T,q,s,o,i,a,!1),k)J?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Cr(t,n,H,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const $=t.target=js(t.props,g);$&&Cr(t,$,null,u,0)}else J&&Cr(t,ee,G,u,1);Er(t,k)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:c,targetStart:u,targetAnchor:l,target:d,props:f}=e;if(d&&(s(u),s(l)),o&&s(c),i&16){const y=o||!Wn(f);for(let g=0;g{e.isMounted=!0}),ns(()=>{e.isUnmounting=!0}),e}const it=[Function,Array],Ya={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:it,onEnter:it,onAfterEnter:it,onEnterCancelled:it,onBeforeLeave:it,onLeave:it,onAfterLeave:it,onLeaveCancelled:it,onBeforeAppear:it,onAppear:it,onAfterAppear:it,onAppearCancelled:it},Qa=e=>{const t=e.subTree;return t.component?Qa(t.component):t},Iu={name:"BaseTransition",props:Ya,setup(e,{slots:t}){const n=is(),r=Ja();return()=>{const s=t.default&&_o(t.default(),!0);if(!s||!s.length)return;const o=Xa(s),i=ye(e),{mode:a}=i;if(r.isLeaving)return _s(o);const c=Yo(o);if(!c)return _s(o);let u=nr(c,i,r,n,d=>u=d);c.type!==Ge&&fn(c,u);let l=n.subTree&&Yo(n.subTree);if(l&&l.type!==Ge&&!sn(c,l)&&Qa(n).type!==Ge){let d=nr(l,i,r,n);if(fn(l,d),a==="out-in"&&c.type!==Ge)return r.isLeaving=!0,d.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,l=void 0},_s(o);a==="in-out"&&c.type!==Ge?d.delayLeave=(f,y,g)=>{const b=el(r,l);b[String(l.key)]=l,f[qt]=()=>{y(),f[qt]=void 0,delete u.delayedLeave,l=void 0},u.delayedLeave=()=>{g(),delete u.delayedLeave,l=void 0}}:l=void 0}else l&&(l=void 0);return o}}};function Xa(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ge){t=n;break}}return t}const Du=Iu;function el(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function nr(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:c,onEnter:u,onAfterEnter:l,onEnterCancelled:d,onBeforeLeave:f,onLeave:y,onAfterLeave:g,onLeaveCancelled:b,onBeforeAppear:x,onAppear:k,onAfterAppear:L,onAppearCancelled:E}=t,R=String(e.key),H=el(n,e),ee=(T,q)=>{T&&ft(T,r,9,q)},G=(T,q)=>{const $=q[1];ee(T,q),ae(T)?T.every(v=>v.length<=1)&&$():T.length<=1&&$()},J={mode:i,persisted:a,beforeEnter(T){let q=c;if(!n.isMounted)if(o)q=x||c;else return;T[qt]&&T[qt](!0);const $=H[R];$&&sn(e,$)&&$.el[qt]&&$.el[qt](),ee(q,[T])},enter(T){let q=u,$=l,v=d;if(!n.isMounted)if(o)q=k||u,$=L||l,v=E||d;else return;let O=!1;const N=T[_r]=Q=>{O||(O=!0,Q?ee(v,[T]):ee($,[T]),J.delayedLeave&&J.delayedLeave(),T[_r]=void 0)};q?G(q,[T,N]):N()},leave(T,q){const $=String(e.key);if(T[_r]&&T[_r](!0),n.isUnmounting)return q();ee(f,[T]);let v=!1;const O=T[qt]=N=>{v||(v=!0,q(),N?ee(b,[T]):ee(g,[T]),T[qt]=void 0,H[$]===e&&delete H[$])};H[$]=e,y?G(y,[T,O]):O()},clone(T){const q=nr(T,t,n,r,s);return s&&s(q),q}};return J}function _s(e){if(ur(e))return e=Qt(e),e.children=null,e}function Yo(e){if(!ur(e))return Ga(e.type)&&e.children?Xa(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&de(n.default))return n.default()}}function fn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,fn(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function _o(e,t=!1,n){let r=[],s=0;for(let o=0;o1)for(let o=0;oGn(g,t&&(ae(t)?t[b]:t),n,r,s));return}if(Zn(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Gn(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?as(r.component):r.el,i=s?null:o,{i:a,r:c}=e,u=t&&t.r,l=a.refs===we?a.refs={}:a.refs,d=a.setupState,f=ye(d),y=d===we?()=>!1:g=>Ce(f,g);if(u!=null&&u!==c&&(Te(u)?(l[u]=null,y(u)&&(d[u]=null)):Le(u)&&(u.value=null)),de(c))lr(c,a,12,[i,l]);else{const g=Te(c),b=Le(c);if(g||b){const x=()=>{if(e.f){const k=g?y(c)?d[c]:l[c]:c.value;s?ae(k)&&co(k,o):ae(k)?k.includes(o)||k.push(o):g?(l[c]=[o],y(c)&&(d[c]=l[c])):(c.value=[o],e.k&&(l[e.k]=c.value))}else g?(l[c]=i,y(c)&&(d[c]=i)):b&&(c.value=i,e.k&&(l[e.k]=i))};i?(x.id=-1,qe(x,n)):x()}}}const Qo=e=>e.nodeType===8;Qr().requestIdleCallback;Qr().cancelIdleCallback;function $u(e,t){if(Qo(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Qo(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const Zn=e=>!!e.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function Fu(e){de(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:s=200,hydrate:o,timeout:i,suspensible:a=!0,onError:c}=e;let u=null,l,d=0;const f=()=>(d++,u=null,y()),y=()=>{let g;return u||(g=u=t().catch(b=>{if(b=b instanceof Error?b:new Error(String(b)),c)return new Promise((x,k)=>{c(b,()=>x(f()),()=>k(b),d+1)});throw b}).then(b=>g!==u&&u?u:(b&&(b.__esModule||b[Symbol.toStringTag]==="Module")&&(b=b.default),l=b,b)))};return ht({name:"AsyncComponentWrapper",__asyncLoader:y,__asyncHydrate(g,b,x){let k=!1;(b.bu||(b.bu=[])).push(()=>k=!0);const L=()=>{k||x()},E=o?()=>{const R=o(L,H=>$u(g,H));R&&(b.bum||(b.bum=[])).push(R)}:L;l?E():y().then(()=>!b.isUnmounted&&E())},get __asyncResolved(){return l},setup(){const g=$e;if(wo(g),l)return()=>ws(l,g);const b=E=>{u=null,cr(E,g,13,!r)};if(a&&g.suspense||kn)return y().then(E=>()=>ws(E,g)).catch(E=>(b(E),()=>r?ve(r,{error:E}):null));const x=ne(!1),k=ne(),L=ne(!!s);return s&&setTimeout(()=>{L.value=!1},s),i!=null&&setTimeout(()=>{if(!x.value&&!k.value){const E=new Error(`Async component timed out after ${i}ms.`);b(E),k.value=E}},i),y().then(()=>{x.value=!0,g.parent&&ur(g.parent.vnode)&&g.parent.update()}).catch(E=>{b(E),k.value=E}),()=>{if(x.value&&l)return ws(l,g);if(k.value&&r)return ve(r,{error:k.value});if(n&&!L.value)return ve(n)}}})}function ws(e,t){const{ref:n,props:r,children:s,ce:o}=t.vnode,i=ve(e,r,s);return i.ref=n,i.ce=o,delete t.vnode.ce,i}const ur=e=>e.type.__isKeepAlive;function Vu(e,t){tl(e,"a",t)}function Bu(e,t){tl(e,"da",t)}function tl(e,t,n=$e){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(ts(t,r,n),n){let s=n.parent;for(;s&&s.parent;)ur(s.parent.vnode)&&Hu(r,t,n,s),s=s.parent}}function Hu(e,t,n,r){const s=ts(t,e,r,!0);rs(()=>{co(r[t],s)},n)}function ts(e,t,n=$e,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{It();const a=dr(n),c=ft(t,n,e,i);return a(),Dt(),c});return r?s.unshift(o):s.push(o),o}}const Ft=e=>(t,n=$e)=>{(!kn||e==="sp")&&ts(e,(...r)=>t(...r),n)},ju=Ft("bm"),Mn=Ft("m"),Uu=Ft("bu"),nl=Ft("u"),ns=Ft("bum"),rs=Ft("um"),qu=Ft("sp"),Ku=Ft("rtg"),Wu=Ft("rtc");function Gu(e,t=$e){ts("ec",e,t)}const rl="components";function sl(e,t){return il(rl,e,!0,t)||e}const ol=Symbol.for("v-ndc");function Zt(e){return Te(e)?il(rl,e,!1)||e:e||ol}function il(e,t,n=!0,r=!1){const s=rt||$e;if(s){const o=s.type;{const a=N1(o,!1);if(a&&(a===t||a===ut(t)||a===Yr(ut(t))))return o}const i=Xo(s[e]||o[e],t)||Xo(s.appContext[e],t);return!i&&r?o:i}}function Xo(e,t){return e&&(e[t]||e[ut(t)]||e[Yr(ut(t))])}function at(e,t,n,r){let s;const o=n,i=ae(e);if(i||Te(e)){const a=i&&Jt(e);let c=!1,u=!1;a&&(c=!lt(e),u=Yt(e),e=Xr(e)),s=new Array(e.length);for(let l=0,d=e.length;lt(a,c,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let c=0,u=a.length;ce?El(e)?as(e):Us(e.parent):null,zn=Ie(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Us(e.parent),$root:e=>Us(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ll(e),$forceUpdate:e=>e.f||(e.f=()=>{Co(e.update)}),$nextTick:e=>e.n||(e.n=es.bind(e.proxy)),$watch:e=>m1.bind(e)}),xs=(e,t)=>e!==we&&!e.__isScriptSetup&&Ce(e,t),Zu={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:c}=e;let u;if(t[0]!=="$"){const y=i[t];if(y!==void 0)switch(y){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(xs(r,t))return i[t]=1,r[t];if(s!==we&&Ce(s,t))return i[t]=2,s[t];if((u=e.propsOptions[0])&&Ce(u,t))return i[t]=3,o[t];if(n!==we&&Ce(n,t))return i[t]=4,n[t];qs&&(i[t]=0)}}const l=zn[t];let d,f;if(l)return t==="$attrs"&&Be(e.attrs,"get",""),l(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==we&&Ce(n,t))return i[t]=4,n[t];if(f=c.config.globalProperties,Ce(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return xs(s,t)?(s[t]=n,!0):r!==we&&Ce(r,t)?(r[t]=n,!0):Ce(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,propsOptions:o}},i){let a;return!!n[i]||e!==we&&Ce(e,i)||xs(t,i)||(a=o[0])&&Ce(a,i)||Ce(r,i)||Ce(zn,i)||Ce(s.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ce(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ei(e){return ae(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let qs=!0;function zu(e){const t=ll(e),n=e.proxy,r=e.ctx;qs=!1,t.beforeCreate&&ti(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:c,inject:u,created:l,beforeMount:d,mounted:f,beforeUpdate:y,updated:g,activated:b,deactivated:x,beforeDestroy:k,beforeUnmount:L,destroyed:E,unmounted:R,render:H,renderTracked:ee,renderTriggered:G,errorCaptured:J,serverPrefetch:T,expose:q,inheritAttrs:$,components:v,directives:O,filters:N}=t;if(u&&Ju(u,r,null),i)for(const j in i){const I=i[j];de(I)&&(r[j]=I.bind(n))}if(s){const j=s.call(n,n);xe(j)&&(e.data=ar(j))}if(qs=!0,o)for(const j in o){const I=o[j],pe=de(I)?I.bind(n,n):de(I.get)?I.get.bind(n,n):Et,Fe=!de(I)&&de(I.set)?I.set.bind(n):Et,Me=ie({get:pe,set:Fe});Object.defineProperty(r,j,{enumerable:!0,configurable:!0,get:()=>Me.value,set:Re=>Me.value=Re})}if(a)for(const j in a)al(a[j],r,n,j);if(c){const j=de(c)?c.call(n):c;Reflect.ownKeys(j).forEach(I=>{Sr(I,j[I])})}l&&ti(l,e,"c");function se(j,I){ae(I)?I.forEach(pe=>j(pe.bind(n))):I&&j(I.bind(n))}if(se(ju,d),se(Mn,f),se(Uu,y),se(nl,g),se(Vu,b),se(Bu,x),se(Gu,J),se(Wu,ee),se(Ku,G),se(ns,L),se(rs,R),se(qu,T),ae(q))if(q.length){const j=e.exposed||(e.exposed={});q.forEach(I=>{Object.defineProperty(j,I,{get:()=>n[I],set:pe=>n[I]=pe,enumerable:!0})})}else e.exposed||(e.exposed={});H&&e.render===Et&&(e.render=H),$!=null&&(e.inheritAttrs=$),v&&(e.components=v),O&&(e.directives=O),T&&wo(e)}function Ju(e,t,n=Et){ae(e)&&(e=Ks(e));for(const r in e){const s=e[r];let o;xe(s)?"default"in s?o=ct(s.from||r,s.default,!0):o=ct(s.from||r):o=ct(s),Le(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function ti(e,t,n){ft(ae(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function al(e,t,n,r){let s=r.includes(".")?Cl(n,r):()=>n[r];if(Te(e)){const o=t[e];de(o)&&Lt(s,o)}else if(de(e))Lt(s,e.bind(n));else if(xe(e))if(ae(e))e.forEach(o=>al(o,t,n,r));else{const o=de(e.handler)?e.handler.bind(n):t[e.handler];de(o)&&Lt(s,o,e)}}function ll(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let c;return a?c=a:!s.length&&!n&&!r?c=t:(c={},s.length&&s.forEach(u=>Vr(c,u,i,!0)),Vr(c,t,i)),xe(t)&&o.set(t,c),c}function Vr(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Vr(e,o,n,!0),s&&s.forEach(i=>Vr(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Yu[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Yu={data:ni,props:ri,emits:ri,methods:jn,computed:jn,beforeCreate:Ue,created:Ue,beforeMount:Ue,mounted:Ue,beforeUpdate:Ue,updated:Ue,beforeDestroy:Ue,beforeUnmount:Ue,destroyed:Ue,unmounted:Ue,activated:Ue,deactivated:Ue,errorCaptured:Ue,serverPrefetch:Ue,components:jn,directives:jn,watch:Xu,provide:ni,inject:Qu};function ni(e,t){return t?e?function(){return Ie(de(e)?e.call(this,this):e,de(t)?t.call(this,this):t)}:t:e}function Qu(e,t){return jn(Ks(e),Ks(t))}function Ks(e){if(ae(e)){const t={};for(let n=0;n1)return n&&de(t)?t.call(r&&r.proxy):t}}function n1(){return!!(is()||un)}const ul={},dl=()=>Object.create(ul),fl=e=>Object.getPrototypeOf(e)===ul;function r1(e,t,n,r=!1){const s={},o=dl();e.propsDefaults=Object.create(null),pl(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:$a(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function s1(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=ye(s),[c]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const l=e.vnode.dynamicProps;for(let d=0;d{c=!0;const[f,y]=hl(d,t,!0);Ie(i,f),y&&a.push(...y)};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}if(!o&&!c)return xe(e)&&r.set(e,Cn),Cn;if(ae(o))for(let l=0;le==="_"||e==="__"||e==="_ctx"||e==="$stable",ko=e=>ae(e)?e.map(xt):[xt(e)],i1=(e,t,n)=>{if(t._n)return t;const r=Pu((...s)=>ko(t(...s)),n);return r._c=!1,r},ml=(e,t,n)=>{const r=e._ctx;for(const s in e){if(xo(s))continue;const o=e[s];if(de(o))t[s]=i1(s,o,r);else if(o!=null){const i=ko(o);t[s]=()=>i}}},gl=(e,t)=>{const n=ko(t);e.slots.default=()=>n},yl=(e,t,n)=>{for(const r in t)(n||!xo(r))&&(e[r]=t[r])},a1=(e,t,n)=>{const r=e.slots=dl();if(e.vnode.shapeFlag&32){const s=t.__;s&&Fs(r,"__",s,!0);const o=t._;o?(yl(r,t,n),n&&Fs(r,"_",o,!0)):ml(t,r)}else t&&gl(e,t)},l1=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=we;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:yl(s,t,n):(o=!t.$stable,ml(t,s)),i=t}else t&&(gl(e,t),i={default:1});if(o)for(const a in s)!xo(a)&&i[a]==null&&delete s[a]},qe=w1;function c1(e){return u1(e)}function u1(e,t){const n=Qr();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:c,setText:u,setElementText:l,parentNode:d,nextSibling:f,setScopeId:y=Et,insertStaticContent:g}=e,b=(p,m,C,S=null,P=null,A=null,W=void 0,U=null,B=!!m.dynamicChildren)=>{if(p===m)return;p&&!sn(p,m)&&(S=w(p),Re(p,P,A,!0),p=null),m.patchFlag===-2&&(B=!1,m.dynamicChildren=null);const{type:V,ref:oe,shapeFlag:Z}=m;switch(V){case os:x(p,m,C,S);break;case Ge:k(p,m,C,S);break;case Ar:p==null&&L(m,C,S,W);break;case Se:v(p,m,C,S,P,A,W,U,B);break;default:Z&1?H(p,m,C,S,P,A,W,U,B):Z&6?O(p,m,C,S,P,A,W,U,B):(Z&64||Z&128)&&V.process(p,m,C,S,P,A,W,U,B,te)}oe!=null&&P?Gn(oe,p&&p.ref,A,m||p,!m):oe==null&&p&&p.ref!=null&&Gn(p.ref,null,A,p,!0)},x=(p,m,C,S)=>{if(p==null)r(m.el=a(m.children),C,S);else{const P=m.el=p.el;m.children!==p.children&&u(P,m.children)}},k=(p,m,C,S)=>{p==null?r(m.el=c(m.children||""),C,S):m.el=p.el},L=(p,m,C,S)=>{[p.el,p.anchor]=g(p.children,m,C,S,p.el,p.anchor)},E=({el:p,anchor:m},C,S)=>{let P;for(;p&&p!==m;)P=f(p),r(p,C,S),p=P;r(m,C,S)},R=({el:p,anchor:m})=>{let C;for(;p&&p!==m;)C=f(p),s(p),p=C;s(m)},H=(p,m,C,S,P,A,W,U,B)=>{m.type==="svg"?W="svg":m.type==="math"&&(W="mathml"),p==null?ee(m,C,S,P,A,W,U,B):T(p,m,P,A,W,U,B)},ee=(p,m,C,S,P,A,W,U)=>{let B,V;const{props:oe,shapeFlag:Z,transition:re,dirs:ce}=p;if(B=p.el=i(p.type,A,oe&&oe.is,oe),Z&8?l(B,p.children):Z&16&&J(p.children,B,null,S,P,ks(p,A),W,U),ce&&en(p,null,S,"created"),G(B,p,p.scopeId,W,S),oe){for(const ke in oe)ke!=="value"&&!Un(ke)&&o(B,ke,null,oe[ke],A,S);"value"in oe&&o(B,"value",null,oe.value,A),(V=oe.onVnodeBeforeMount)&&bt(V,S,p)}ce&&en(p,null,S,"beforeMount");const ge=d1(P,re);ge&&re.beforeEnter(B),r(B,m,C),((V=oe&&oe.onVnodeMounted)||ge||ce)&&qe(()=>{V&&bt(V,S,p),ge&&re.enter(B),ce&&en(p,null,S,"mounted")},P)},G=(p,m,C,S,P)=>{if(C&&y(p,C),S)for(let A=0;A{for(let V=B;V{const U=m.el=p.el;let{patchFlag:B,dynamicChildren:V,dirs:oe}=m;B|=p.patchFlag&16;const Z=p.props||we,re=m.props||we;let ce;if(C&&tn(C,!1),(ce=re.onVnodeBeforeUpdate)&&bt(ce,C,m,p),oe&&en(m,p,C,"beforeUpdate"),C&&tn(C,!0),(Z.innerHTML&&re.innerHTML==null||Z.textContent&&re.textContent==null)&&l(U,""),V?q(p.dynamicChildren,V,U,C,S,ks(m,P),A):W||I(p,m,U,null,C,S,ks(m,P),A,!1),B>0){if(B&16)$(U,Z,re,C,P);else if(B&2&&Z.class!==re.class&&o(U,"class",null,re.class,P),B&4&&o(U,"style",Z.style,re.style,P),B&8){const ge=m.dynamicProps;for(let ke=0;ke{ce&&bt(ce,C,m,p),oe&&en(m,p,C,"updated")},S)},q=(p,m,C,S,P,A,W)=>{for(let U=0;U{if(m!==C){if(m!==we)for(const A in m)!Un(A)&&!(A in C)&&o(p,A,m[A],null,P,S);for(const A in C){if(Un(A))continue;const W=C[A],U=m[A];W!==U&&A!=="value"&&o(p,A,U,W,P,S)}"value"in C&&o(p,"value",m.value,C.value,P)}},v=(p,m,C,S,P,A,W,U,B)=>{const V=m.el=p?p.el:a(""),oe=m.anchor=p?p.anchor:a("");let{patchFlag:Z,dynamicChildren:re,slotScopeIds:ce}=m;ce&&(U=U?U.concat(ce):ce),p==null?(r(V,C,S),r(oe,C,S),J(m.children||[],C,oe,P,A,W,U,B)):Z>0&&Z&64&&re&&p.dynamicChildren?(q(p.dynamicChildren,re,C,P,A,W,U),(m.key!=null||P&&m===P.subTree)&&Eo(p,m,!0)):I(p,m,C,oe,P,A,W,U,B)},O=(p,m,C,S,P,A,W,U,B)=>{m.slotScopeIds=U,p==null?m.shapeFlag&512?P.ctx.activate(m,C,S,W,B):N(m,C,S,P,A,W,B):Q(p,m,B)},N=(p,m,C,S,P,A,W)=>{const U=p.component=T1(p,S,P);if(ur(p)&&(U.ctx.renderer=te),O1(U,!1,W),U.asyncDep){if(P&&P.registerDep(U,se,W),!p.el){const B=U.subTree=ve(Ge);k(null,B,m,C),p.placeholder=B.el}}else se(U,p,m,C,P,A,W)},Q=(p,m,C)=>{const S=m.component=p.component;if(C1(p,m,C))if(S.asyncDep&&!S.asyncResolved){j(S,m,C);return}else S.next=m,S.update();else m.el=p.el,S.vnode=m},se=(p,m,C,S,P,A,W)=>{const U=()=>{if(p.isMounted){let{next:Z,bu:re,u:ce,parent:ge,vnode:ke}=p;{const yt=vl(p);if(yt){Z&&(Z.el=ke.el,j(p,Z,W)),yt.asyncDep.then(()=>{p.isUnmounted||U()});return}}let _e=Z,Ze;tn(p,!1),Z?(Z.el=ke.el,j(p,Z,W)):Z=ke,re&&kr(re),(Ze=Z.props&&Z.props.onVnodeBeforeUpdate)&&bt(Ze,ge,Z,ke),tn(p,!0);const ze=ii(p),gt=p.subTree;p.subTree=ze,b(gt,ze,d(gt.el),w(gt),p,P,A),Z.el=ze.el,_e===null&&_1(p,ze.el),ce&&qe(ce,P),(Ze=Z.props&&Z.props.onVnodeUpdated)&&qe(()=>bt(Ze,ge,Z,ke),P)}else{let Z;const{el:re,props:ce}=m,{bm:ge,m:ke,parent:_e,root:Ze,type:ze}=p,gt=Zn(m);tn(p,!1),ge&&kr(ge),!gt&&(Z=ce&&ce.onVnodeBeforeMount)&&bt(Z,_e,m),tn(p,!0);{Ze.ce&&Ze.ce._def.shadowRoot!==!1&&Ze.ce._injectChildStyle(ze);const yt=p.subTree=ii(p);b(null,yt,C,S,p,P,A),m.el=yt.el}if(ke&&qe(ke,P),!gt&&(Z=ce&&ce.onVnodeMounted)){const yt=m;qe(()=>bt(Z,_e,yt),P)}(m.shapeFlag&256||_e&&Zn(_e.vnode)&&_e.vnode.shapeFlag&256)&&p.a&&qe(p.a,P),p.isMounted=!0,m=C=S=null}};p.scope.on();const B=p.effect=new xa(U);p.scope.off();const V=p.update=B.run.bind(B),oe=p.job=B.runIfDirty.bind(B);oe.i=p,oe.id=p.uid,B.scheduler=()=>Co(oe),tn(p,!0),V()},j=(p,m,C)=>{m.component=p;const S=p.vnode.props;p.vnode=m,p.next=null,s1(p,m.props,S,C),l1(p,m.children,C),It(),Go(p),Dt()},I=(p,m,C,S,P,A,W,U,B=!1)=>{const V=p&&p.children,oe=p?p.shapeFlag:0,Z=m.children,{patchFlag:re,shapeFlag:ce}=m;if(re>0){if(re&128){Fe(V,Z,C,S,P,A,W,U,B);return}else if(re&256){pe(V,Z,C,S,P,A,W,U,B);return}}ce&8?(oe&16&&D(V,P,A),Z!==V&&l(C,Z)):oe&16?ce&16?Fe(V,Z,C,S,P,A,W,U,B):D(V,P,A,!0):(oe&8&&l(C,""),ce&16&&J(Z,C,S,P,A,W,U,B))},pe=(p,m,C,S,P,A,W,U,B)=>{p=p||Cn,m=m||Cn;const V=p.length,oe=m.length,Z=Math.min(V,oe);let re;for(re=0;reoe?D(p,P,A,!0,!1,Z):J(m,C,S,P,A,W,U,B,Z)},Fe=(p,m,C,S,P,A,W,U,B)=>{let V=0;const oe=m.length;let Z=p.length-1,re=oe-1;for(;V<=Z&&V<=re;){const ce=p[V],ge=m[V]=B?Kt(m[V]):xt(m[V]);if(sn(ce,ge))b(ce,ge,C,null,P,A,W,U,B);else break;V++}for(;V<=Z&&V<=re;){const ce=p[Z],ge=m[re]=B?Kt(m[re]):xt(m[re]);if(sn(ce,ge))b(ce,ge,C,null,P,A,W,U,B);else break;Z--,re--}if(V>Z){if(V<=re){const ce=re+1,ge=cere)for(;V<=Z;)Re(p[V],P,A,!0),V++;else{const ce=V,ge=V,ke=new Map;for(V=ge;V<=re;V++){const et=m[V]=B?Kt(m[V]):xt(m[V]);et.key!=null&&ke.set(et.key,V)}let _e,Ze=0;const ze=re-ge+1;let gt=!1,yt=0;const Nn=new Array(ze);for(V=0;V=ze){Re(et,P,A,!0);continue}let vt;if(et.key!=null)vt=ke.get(et.key);else for(_e=ge;_e<=re;_e++)if(Nn[_e-ge]===0&&sn(et,m[_e])){vt=_e;break}vt===void 0?Re(et,P,A,!0):(Nn[vt-ge]=V+1,vt>=yt?yt=vt:gt=!0,b(et,m[vt],C,null,P,A,W,U,B),Ze++)}const Bo=gt?f1(Nn):Cn;for(_e=Bo.length-1,V=ze-1;V>=0;V--){const et=ge+V,vt=m[et],Ho=m[et+1],jo=et+1{const{el:A,type:W,transition:U,children:B,shapeFlag:V}=p;if(V&6){Me(p.component.subTree,m,C,S);return}if(V&128){p.suspense.move(m,C,S);return}if(V&64){W.move(p,m,C,te);return}if(W===Se){r(A,m,C);for(let Z=0;ZU.enter(A),P);else{const{leave:Z,delayLeave:re,afterLeave:ce}=U,ge=()=>{p.ctx.isUnmounted?s(A):r(A,m,C)},ke=()=>{Z(A,()=>{ge(),ce&&ce()})};re?re(A,ge,ke):ke()}else r(A,m,C)},Re=(p,m,C,S=!1,P=!1)=>{const{type:A,props:W,ref:U,children:B,dynamicChildren:V,shapeFlag:oe,patchFlag:Z,dirs:re,cacheIndex:ce}=p;if(Z===-2&&(P=!1),U!=null&&(It(),Gn(U,null,C,p,!0),Dt()),ce!=null&&(m.renderCache[ce]=void 0),oe&256){m.ctx.deactivate(p);return}const ge=oe&1&&re,ke=!Zn(p);let _e;if(ke&&(_e=W&&W.onVnodeBeforeUnmount)&&bt(_e,m,p),oe&6)z(p.component,C,S);else{if(oe&128){p.suspense.unmount(C,S);return}ge&&en(p,null,m,"beforeUnmount"),oe&64?p.type.remove(p,m,C,te,S):V&&!V.hasOnce&&(A!==Se||Z>0&&Z&64)?D(V,m,C,!1,!0):(A===Se&&Z&384||!P&&oe&16)&&D(B,m,C),S&&ot(p)}(ke&&(_e=W&&W.onVnodeUnmounted)||ge)&&qe(()=>{_e&&bt(_e,m,p),ge&&en(p,null,m,"unmounted")},C)},ot=p=>{const{type:m,el:C,anchor:S,transition:P}=p;if(m===Se){Xe(C,S);return}if(m===Ar){R(p);return}const A=()=>{s(C),P&&!P.persisted&&P.afterLeave&&P.afterLeave()};if(p.shapeFlag&1&&P&&!P.persisted){const{leave:W,delayLeave:U}=P,B=()=>W(C,A);U?U(p.el,A,B):B()}else A()},Xe=(p,m)=>{let C;for(;p!==m;)C=f(p),s(p),p=C;s(m)},z=(p,m,C)=>{const{bum:S,scope:P,job:A,subTree:W,um:U,m:B,a:V,parent:oe,slots:{__:Z}}=p;oi(B),oi(V),S&&kr(S),oe&&ae(Z)&&Z.forEach(re=>{oe.renderCache[re]=void 0}),P.stop(),A&&(A.flags|=8,Re(W,p,m,C)),U&&qe(U,m),qe(()=>{p.isUnmounted=!0},m),m&&m.pendingBranch&&!m.isUnmounted&&p.asyncDep&&!p.asyncResolved&&p.suspenseId===m.pendingId&&(m.deps--,m.deps===0&&m.resolve())},D=(p,m,C,S=!1,P=!1,A=0)=>{for(let W=A;W{if(p.shapeFlag&6)return w(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const m=f(p.anchor||p.el),C=m&&m[Wa];return C?f(C):m};let Y=!1;const K=(p,m,C)=>{p==null?m._vnode&&Re(m._vnode,null,null,!0):b(m._vnode||null,p,m,null,null,null,C),m._vnode=p,Y||(Y=!0,Go(),Ua(),Y=!1)},te={p:b,um:Re,m:Me,r:ot,mt:N,mc:J,pc:I,pbc:q,n:w,o:e};return{render:K,hydrate:void 0,createApp:t1(K)}}function ks({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function tn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function d1(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Eo(e,t,n=!1){const r=e.children,s=t.children;if(ae(r)&&ae(s))for(let o=0;o>1,e[n[a]]0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function vl(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:vl(t)}function oi(e){if(e)for(let t=0;tct(p1);function Lt(e,t,n){return bl(e,t,n)}function bl(e,t,n=we){const{immediate:r,deep:s,flush:o,once:i}=n,a=Ie({},n),c=t&&r||!t&&o!=="post";let u;if(kn){if(o==="sync"){const y=h1();u=y.__watcherHandles||(y.__watcherHandles=[])}else if(!c){const y=()=>{};return y.stop=Et,y.resume=Et,y.pause=Et,y}}const l=$e;a.call=(y,g,b)=>ft(y,l,g,b);let d=!1;o==="post"?a.scheduler=y=>{qe(y,l&&l.suspense)}:o!=="sync"&&(d=!0,a.scheduler=(y,g)=>{g?y():Co(y)}),a.augmentJob=y=>{t&&(y.flags|=4),d&&(y.flags|=2,l&&(y.id=l.uid,y.i=l))};const f=Ru(e,t,a);return kn&&(u?u.push(f):c&&f()),f}function m1(e,t,n){const r=this.proxy,s=Te(e)?e.includes(".")?Cl(r,e):()=>r[e]:e.bind(r,r);let o;de(t)?o=t:(o=t.handler,n=t);const i=dr(this),a=bl(s,o.bind(r),n);return i(),a}function Cl(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;st==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${ut(t)}Modifiers`]||e[`${Xt(t)}Modifiers`];function y1(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||we;let s=n;const o=t.startsWith("update:"),i=o&&g1(r,t.slice(7));i&&(i.trim&&(s=n.map(l=>Te(l)?l.trim():l)),i.number&&(s=n.map(Lr)));let a,c=r[a=gs(t)]||r[a=gs(ut(t))];!c&&o&&(c=r[a=gs(Xt(t))]),c&&ft(c,e,6,s);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,ft(u,e,6,s)}}function _l(e,t,n=!1){const r=t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!de(e)){const c=u=>{const l=_l(u,t,!0);l&&(a=!0,Ie(i,l))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!a?(xe(e)&&r.set(e,null),null):(ae(o)?o.forEach(c=>i[c]=null):Ie(i,o),xe(e)&&r.set(e,i),i)}function ss(e,t){return!e||!Zr(t)?!1:(t=t.slice(2).replace(/Once$/,""),Ce(e,t[0].toLowerCase()+t.slice(1))||Ce(e,Xt(t))||Ce(e,t))}function ii(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:c,render:u,renderCache:l,props:d,data:f,setupState:y,ctx:g,inheritAttrs:b}=e,x=Fr(e);let k,L;try{if(n.shapeFlag&4){const R=s||r,H=R;k=xt(u.call(H,R,l,d,y,f,g)),L=a}else{const R=t;k=xt(R.length>1?R(d,{attrs:a,slots:i,emit:c}):R(d,null)),L=t.props?a:v1(a)}}catch(R){Jn.length=0,cr(R,e,1),k=ve(Ge)}let E=k;if(L&&b!==!1){const R=Object.keys(L),{shapeFlag:H}=E;R.length&&H&7&&(o&&R.some(lo)&&(L=b1(L,o)),E=Qt(E,L,!1,!0))}return n.dirs&&(E=Qt(E,null,!1,!0),E.dirs=E.dirs?E.dirs.concat(n.dirs):n.dirs),n.transition&&fn(E,n.transition),k=E,Fr(x),k}const v1=e=>{let t;for(const n in e)(n==="class"||n==="style"||Zr(n))&&((t||(t={}))[n]=e[n]);return t},b1=(e,t)=>{const n={};for(const r in e)(!lo(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function C1(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:c}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?ai(r,i,u):!!i;if(c&8){const l=t.dynamicProps;for(let d=0;de.__isSuspense;function w1(e,t){t&&t.pendingBranch?ae(e)?t.effects.push(...e):t.effects.push(e):Mu(e)}const Se=Symbol.for("v-fgt"),os=Symbol.for("v-txt"),Ge=Symbol.for("v-cmt"),Ar=Symbol.for("v-stc"),Jn=[];let st=null;function M(e=!1){Jn.push(st=e?null:[])}function x1(){Jn.pop(),st=Jn[Jn.length-1]||null}let rr=1;function li(e,t=!1){rr+=e,e<0&&st&&t&&(st.hasOnce=!0)}function xl(e){return e.dynamicChildren=rr>0?st||Cn:null,x1(),rr>0&&st&&st.push(e),e}function F(e,t,n,r,s,o){return xl(h(e,t,n,r,s,o,!0))}function nt(e,t,n,r,s){return xl(ve(e,t,n,r,s,!0))}function Br(e){return e?e.__v_isVNode===!0:!1}function sn(e,t){return e.type===t.type&&e.key===t.key}const kl=({key:e})=>e??null,Rr=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Te(e)||Le(e)||de(e)?{i:rt,r:e,k:t,f:!!n}:e:null);function h(e,t=null,n=null,r=0,s=null,o=e===Se?0:1,i=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&kl(t),ref:t&&Rr(t),scopeId:Ka,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:rt};return a?(So(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=Te(n)?8:16),rr>0&&!i&&st&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&st.push(c),c}const ve=k1;function k1(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===ol)&&(e=Ge),Br(e)){const a=Qt(e,t,!0);return n&&So(a,n),rr>0&&!o&&st&&(a.shapeFlag&6?st[st.indexOf(e)]=a:st.push(a)),a.patchFlag=-2,a}if(I1(e)&&(e=e.__vccOpts),t){t=E1(t);let{class:a,style:c}=t;a&&!Te(a)&&(t.class=le(a)),xe(c)&&(vo(c)&&!ae(c)&&(c=Ie({},c)),t.style=On(c))}const i=Te(e)?1:wl(e)?128:Ga(e)?64:xe(e)?4:de(e)?2:0;return h(e,t,n,r,s,i,o,!0)}function E1(e){return e?vo(e)||fl(e)?Ie({},e):e:null}function Qt(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:c}=e,u=t?S1(s||{},t):s,l={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&kl(u),ref:t&&t.ref?n&&o?ae(o)?o.concat(Rr(t)):[o,Rr(t)]:Rr(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Se?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Qt(e.ssContent),ssFallback:e.ssFallback&&Qt(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&fn(l,c.clone(l)),l}function Pe(e=" ",t=0){return ve(os,null,e,t)}function At(e,t){const n=ve(Ar,null,e);return n.staticCount=t,n}function me(e="",t=!1){return t?(M(),nt(Ge,null,e)):ve(Ge,null,e)}function xt(e){return e==null||typeof e=="boolean"?ve(Ge):ae(e)?ve(Se,null,e.slice()):Br(e)?Kt(e):ve(os,null,String(e))}function Kt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Qt(e)}function So(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(ae(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),So(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!fl(t)?t._ctx=rt:s===3&&rt&&(rt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else de(t)?(t={default:t,_ctx:rt},n=32):(t=String(t),r&64?(n=16,t=[Pe(t)]):n=8);e.children=t,e.shapeFlag|=n}function S1(...e){const t={};for(let n=0;n$e||rt;let Hr,Gs;{const e=Qr(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};Hr=t("__VUE_INSTANCE_SETTERS__",n=>$e=n),Gs=t("__VUE_SSR_SETTERS__",n=>kn=n)}const dr=e=>{const t=$e;return Hr(e),e.scope.on(),()=>{e.scope.off(),Hr(t)}},ci=()=>{$e&&$e.scope.off(),Hr(null)};function El(e){return e.vnode.shapeFlag&4}let kn=!1;function O1(e,t=!1,n=!1){t&&Gs(t);const{props:r,children:s}=e.vnode,o=El(e);r1(e,r,o,t),a1(e,s,n||t);const i=o?M1(e,t):void 0;return t&&Gs(!1),i}function M1(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Zu);const{setup:r}=n;if(r){It();const s=e.setupContext=r.length>1?L1(e):null,o=dr(e),i=lr(r,e,0,[e.props,s]),a=ha(i);if(Dt(),o(),(a||e.sp)&&!Zn(e)&&wo(e),a){if(i.then(ci,ci),t)return i.then(c=>{ui(e,c)}).catch(c=>{cr(c,e,0)});e.asyncDep=i}else ui(e,i)}else Sl(e)}function ui(e,t,n){de(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:xe(t)&&(e.setupState=Ba(t)),Sl(e)}function Sl(e,t,n){const r=e.type;e.render||(e.render=r.render||Et);{const s=dr(e);It();try{zu(e)}finally{Dt(),s()}}}const P1={get(e,t){return Be(e,"get",""),e[t]}};function L1(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,P1),slots:e.slots,emit:e.emit,expose:t}}function as(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ba(bo(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in zn)return zn[n](e)},has(t,n){return n in t||n in zn}})):e.proxy}function N1(e,t=!0){return de(e)?e.displayName||e.name:e.name||t&&e.__name}function I1(e){return de(e)&&"__vccOpts"in e}const ie=(e,t)=>Su(e,t,kn);function Ao(e,t,n){const r=arguments.length;return r===2?xe(t)&&!ae(t)?Br(t)?ve(e,null,[t]):ve(e,t):ve(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Br(n)&&(n=[n]),ve(e,t,n))}const D1="3.5.18";/** +* @vue/runtime-dom v3.5.18 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Zs;const di=typeof window<"u"&&window.trustedTypes;if(di)try{Zs=di.createPolicy("vue",{createHTML:e=>e})}catch{}const Al=Zs?e=>Zs.createHTML(e):e=>e,$1="http://www.w3.org/2000/svg",F1="http://www.w3.org/1998/Math/MathML",Ot=typeof document<"u"?document:null,fi=Ot&&Ot.createElement("template"),V1={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Ot.createElementNS($1,e):t==="mathml"?Ot.createElementNS(F1,e):n?Ot.createElement(e,{is:n}):Ot.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Ot.createTextNode(e),createComment:e=>Ot.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ot.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{fi.innerHTML=Al(r==="svg"?`${e}`:r==="mathml"?`${e}`:e);const a=fi.content;if(r==="svg"||r==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Vt="transition",Dn="animation",En=Symbol("_vtc"),Rl={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Tl=Ie({},Ya,Rl),B1=e=>(e.displayName="Transition",e.props=Tl,e),hh=B1((e,{slots:t})=>Ao(Du,Ol(e),t)),nn=(e,t=[])=>{ae(e)?e.forEach(n=>n(...t)):e&&e(...t)},pi=e=>e?ae(e)?e.some(t=>t.length>1):e.length>1:!1;function Ol(e){const t={};for(const v in e)v in Rl||(t[v]=e[v]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:u=i,appearToClass:l=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:y=`${n}-leave-to`}=e,g=H1(s),b=g&&g[0],x=g&&g[1],{onBeforeEnter:k,onEnter:L,onEnterCancelled:E,onLeave:R,onLeaveCancelled:H,onBeforeAppear:ee=k,onAppear:G=L,onAppearCancelled:J=E}=t,T=(v,O,N,Q)=>{v._enterCancelled=Q,Ht(v,O?l:a),Ht(v,O?u:i),N&&N()},q=(v,O)=>{v._isLeaving=!1,Ht(v,d),Ht(v,y),Ht(v,f),O&&O()},$=v=>(O,N)=>{const Q=v?G:L,se=()=>T(O,v,N);nn(Q,[O,se]),hi(()=>{Ht(O,v?c:o),_t(O,v?l:a),pi(Q)||mi(O,r,b,se)})};return Ie(t,{onBeforeEnter(v){nn(k,[v]),_t(v,o),_t(v,i)},onBeforeAppear(v){nn(ee,[v]),_t(v,c),_t(v,u)},onEnter:$(!1),onAppear:$(!0),onLeave(v,O){v._isLeaving=!0;const N=()=>q(v,O);_t(v,d),v._enterCancelled?(_t(v,f),zs()):(zs(),_t(v,f)),hi(()=>{v._isLeaving&&(Ht(v,d),_t(v,y),pi(R)||mi(v,r,x,N))}),nn(R,[v,N])},onEnterCancelled(v){T(v,!1,void 0,!0),nn(E,[v])},onAppearCancelled(v){T(v,!0,void 0,!0),nn(J,[v])},onLeaveCancelled(v){q(v),nn(H,[v])}})}function H1(e){if(e==null)return null;if(xe(e))return[Es(e.enter),Es(e.leave)];{const t=Es(e);return[t,t]}}function Es(e){return qc(e)}function _t(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[En]||(e[En]=new Set)).add(t)}function Ht(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[En];n&&(n.delete(t),n.size||(e[En]=void 0))}function hi(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let j1=0;function mi(e,t,n,r){const s=e._endId=++j1,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:c}=Ml(e,t);if(!i)return r();const u=i+"end";let l=0;const d=()=>{e.removeEventListener(u,f),o()},f=y=>{y.target===e&&++l>=c&&d()};setTimeout(()=>{l(n[g]||"").split(", "),s=r(`${Vt}Delay`),o=r(`${Vt}Duration`),i=gi(s,o),a=r(`${Dn}Delay`),c=r(`${Dn}Duration`),u=gi(a,c);let l=null,d=0,f=0;t===Vt?i>0&&(l=Vt,d=i,f=o.length):t===Dn?u>0&&(l=Dn,d=u,f=c.length):(d=Math.max(i,u),l=d>0?i>u?Vt:Dn:null,f=l?l===Vt?o.length:c.length:0);const y=l===Vt&&/\b(transform|all)(,|$)/.test(r(`${Vt}Property`).toString());return{type:l,timeout:d,propCount:f,hasTransform:y}}function gi(e,t){for(;e.lengthyi(n)+yi(e[r])))}function yi(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function zs(){return document.body.offsetHeight}function U1(e,t,n){const r=e[En];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const jr=Symbol("_vod"),Pl=Symbol("_vsh"),mh={beforeMount(e,{value:t},{transition:n}){e[jr]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):$n(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),$n(e,!0),r.enter(e)):r.leave(e,()=>{$n(e,!1)}):$n(e,t))},beforeUnmount(e,{value:t}){$n(e,t)}};function $n(e,t){e.style.display=t?e[jr]:"none",e[Pl]=!t}const q1=Symbol(""),K1=/(^|;)\s*display\s*:/;function W1(e,t,n){const r=e.style,s=Te(n);let o=!1;if(n&&!s){if(t)if(Te(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Tr(r,a,"")}else for(const i in t)n[i]==null&&Tr(r,i,"");for(const i in n)i==="display"&&(o=!0),Tr(r,i,n[i])}else if(s){if(t!==n){const i=r[q1];i&&(n+=";"+i),r.cssText=n,o=K1.test(n)}}else t&&e.removeAttribute("style");jr in e&&(e[jr]=o?r.display:"",e[Pl]&&(r.display="none"))}const vi=/\s*!important$/;function Tr(e,t,n){if(ae(n))n.forEach(r=>Tr(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=G1(e,t);vi.test(n)?e.setProperty(Xt(r),n.replace(vi,""),"important"):e[r]=n}}const bi=["Webkit","Moz","ms"],Ss={};function G1(e,t){const n=Ss[t];if(n)return n;let r=ut(t);if(r!=="filter"&&r in e)return Ss[t]=r;r=Yr(r);for(let s=0;sAs||(Y1.then(()=>As=0),As=Date.now());function X1(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ft(ed(r,n.value),t,5,[r])};return n.value=e,n.attached=Q1(),n}function ed(e,t){if(ae(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Ei=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,td=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?U1(e,r,i):t==="style"?W1(e,n,r):Zr(t)?lo(t)||z1(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):nd(e,t,r,i))?(wi(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&_i(e,t,r,i,o,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!Te(r))?wi(e,ut(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),_i(e,t,r,i))};function nd(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ei(t)&&de(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ei(t)&&Te(n)?!1:t in e}const Ll=new WeakMap,Nl=new WeakMap,Ur=Symbol("_moveCb"),Si=Symbol("_enterCb"),rd=e=>(delete e.props.mode,e),sd=rd({name:"TransitionGroup",props:Ie({},Tl,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=is(),r=Ja();let s,o;return nl(()=>{if(!s.length)return;const i=e.moveClass||`${e.name||"v"}-move`;if(!ld(s[0].el,n.vnode.el,i)){s=[];return}s.forEach(od),s.forEach(id);const a=s.filter(ad);zs(),a.forEach(c=>{const u=c.el,l=u.style;_t(u,i),l.transform=l.webkitTransform=l.transitionDuration="";const d=u[Ur]=f=>{f&&f.target!==u||(!f||/transform$/.test(f.propertyName))&&(u.removeEventListener("transitionend",d),u[Ur]=null,Ht(u,i))};u.addEventListener("transitionend",d)}),s=[]}),()=>{const i=ye(e),a=Ol(i);let c=i.tag||Se;if(s=[],o)for(let u=0;u{a.split(/\s+/).forEach(c=>c&&r.classList.remove(c))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const o=t.nodeType===1?t:t.parentNode;o.appendChild(r);const{hasTransform:i}=Ml(r);return o.removeChild(r),i}const Sn=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ae(t)?n=>kr(t,n):t};function cd(e){e.target.composing=!0}function Ai(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Nt=Symbol("_assign"),yh={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Nt]=Sn(s);const o=r||s.props&&s.props.type==="number";Gt(e,t?"change":"input",i=>{if(i.target.composing)return;let a=e.value;n&&(a=a.trim()),o&&(a=Lr(a)),e[Nt](a)}),n&&Gt(e,"change",()=>{e.value=e.value.trim()}),t||(Gt(e,"compositionstart",cd),Gt(e,"compositionend",Ai),Gt(e,"change",Ai))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Nt]=Sn(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?Lr(e.value):e.value,c=t??"";a!==c&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===c)||(e.value=c))}},vh={created(e,{value:t},n){e.checked=xn(t,n.props.value),e[Nt]=Sn(n),Gt(e,"change",()=>{e[Nt](sr(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Nt]=Sn(r),t!==n&&(e.checked=xn(t,r.props.value))}},bh={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=zr(t);Gt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Lr(sr(i)):sr(i));e[Nt](e.multiple?s?new Set(o):o:o[0]),e._assigning=!0,es(()=>{e._assigning=!1})}),e[Nt]=Sn(r)},mounted(e,{value:t}){Ri(e,t)},beforeUpdate(e,t,n){e[Nt]=Sn(n)},updated(e,{value:t}){e._assigning||Ri(e,t)}};function Ri(e,t){const n=e.multiple,r=ae(t);if(!(n&&!r&&!zr(t))){for(let s=0,o=e.options.length;sString(u)===String(a)):i.selected=Qc(t,a)>-1}else i.selected=t.has(a);else if(xn(sr(i),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function sr(e){return"_value"in e?e._value:e.value}const ud=["ctrl","shift","alt","meta"],dd={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>ud.some(n=>e[`${n}Key`]&&!t.includes(n))},Js=(e,t)=>{const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(s,...o)=>{for(let i=0;i{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=s=>{if(!("key"in s))return;const o=Xt(s.key);if(t.some(i=>i===o||fd[i]===o))return e(s)})},pd=Ie({patchProp:td},V1);let Ti;function hd(){return Ti||(Ti=c1(pd))}const md=(...e)=>{const t=hd().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=yd(r);if(!s)return;const o=t._component;!de(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,gd(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t};function gd(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function yd(e){return Te(e)?document.querySelector(e):e}/*! + * pinia v3.0.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let Il;const ls=e=>Il=e,Dl=Symbol();function Ys(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Yn;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Yn||(Yn={}));function vd(){const e=_a(!0),t=e.run(()=>ne({}));let n=[],r=[];const s=bo({install(o){ls(s),s._a=o,o.provide(Dl,s),o.config.globalProperties.$pinia=s,r.forEach(i=>n.push(i)),r=[]},use(o){return this._a?n.push(o):r.push(o),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return s}const $l=()=>{};function Oi(e,t,n,r=$l){e.add(t);const s=()=>{e.delete(t)&&r()};return!n&&wa()&&Xc(s),s}function yn(e,...t){e.forEach(n=>{n(...t)})}const bd=e=>e(),Mi=Symbol(),Rs=Symbol();function Qs(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],s=e[n];Ys(s)&&Ys(r)&&e.hasOwnProperty(n)&&!Le(r)&&!Jt(r)?e[n]=Qs(s,r):e[n]=r}return e}const Cd=Symbol();function _d(e){return!Ys(e)||!Object.prototype.hasOwnProperty.call(e,Cd)}const{assign:jt}=Object;function wd(e){return!!(Le(e)&&e.effect)}function xd(e,t,n,r){const{state:s,actions:o,getters:i}=t,a=n.state.value[e];let c;function u(){a||(n.state.value[e]=s?s():{});const l=wu(n.state.value[e]);return jt(l,o,Object.keys(i||{}).reduce((d,f)=>(d[f]=bo(ie(()=>{ls(n);const y=n._s.get(e);return i[f].call(y,y)})),d),{}))}return c=Fl(e,u,t,n,r,!0),c}function Fl(e,t,n={},r,s,o){let i;const a=jt({actions:{}},n),c={deep:!0};let u,l,d=new Set,f=new Set,y;const g=r.state.value[e];!o&&!g&&(r.state.value[e]={}),ne({});let b;function x(J){let T;u=l=!1,typeof J=="function"?(J(r.state.value[e]),T={type:Yn.patchFunction,storeId:e,events:y}):(Qs(r.state.value[e],J),T={type:Yn.patchObject,payload:J,storeId:e,events:y});const q=b=Symbol();es().then(()=>{b===q&&(u=!0)}),l=!0,yn(d,T,r.state.value[e])}const k=o?function(){const{state:T}=n,q=T?T():{};this.$patch($=>{jt($,q)})}:$l;function L(){i.stop(),d.clear(),f.clear(),r._s.delete(e)}const E=(J,T="")=>{if(Mi in J)return J[Rs]=T,J;const q=function(){ls(r);const $=Array.from(arguments),v=new Set,O=new Set;function N(j){v.add(j)}function Q(j){O.add(j)}yn(f,{args:$,name:q[Rs],store:H,after:N,onError:Q});let se;try{se=J.apply(this&&this.$id===e?this:H,$)}catch(j){throw yn(O,j),j}return se instanceof Promise?se.then(j=>(yn(v,j),j)).catch(j=>(yn(O,j),Promise.reject(j))):(yn(v,se),se)};return q[Mi]=!0,q[Rs]=T,q},R={_p:r,$id:e,$onAction:Oi.bind(null,f),$patch:x,$reset:k,$subscribe(J,T={}){const q=Oi(d,J,T.detached,()=>$()),$=i.run(()=>Lt(()=>r.state.value[e],v=>{(T.flush==="sync"?l:u)&&J({storeId:e,type:Yn.direct,events:y},v)},jt({},c,T)));return q},$dispose:L},H=ar(R);r._s.set(e,H);const G=(r._a&&r._a.runWithContext||bd)(()=>r._e.run(()=>(i=_a()).run(()=>t({action:E}))));for(const J in G){const T=G[J];if(Le(T)&&!wd(T)||Jt(T))o||(g&&_d(T)&&(Le(T)?T.value=g[J]:Qs(T,g[J])),r.state.value[e][J]=T);else if(typeof T=="function"){const q=E(T,J);G[J]=q,a.actions[J]=T}}return jt(H,G),jt(ye(H),G),Object.defineProperty(H,"$state",{get:()=>r.state.value[e],set:J=>{x(T=>{jt(T,J)})}}),r._p.forEach(J=>{jt(H,i.run(()=>J({store:H,app:r._a,pinia:r,options:a})))}),g&&o&&n.hydrate&&n.hydrate(H.$state,g),u=!0,l=!0,H}/*! #__NO_SIDE_EFFECTS__ */function Ro(e,t,n){let r;const s=typeof t=="function";r=s?n:t;function o(i,a){const c=n1();return i=i||(c?ct(Dl,null):null),i&&ls(i),i=Il,i._s.has(e)||(s?Fl(e,t,r,i):xd(e,r,i)),i._s.get(e)}return o.$id=e,o}/*! + * vue-router v4.6.3 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */const bn=typeof document<"u";function Vl(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function kd(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Vl(e.default)}const be=Object.assign;function Ts(e,t){const n={};for(const r in t){const s=t[r];n[r]=pt(s)?s.map(e):e(s)}return n}const Qn=()=>{},pt=Array.isArray;function Pi(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Bl=/#/g,Ed=/&/g,Sd=/\//g,Ad=/=/g,Rd=/\?/g,Hl=/\+/g,Td=/%5B/g,Od=/%5D/g,jl=/%5E/g,Md=/%60/g,Ul=/%7B/g,Pd=/%7C/g,ql=/%7D/g,Ld=/%20/g;function To(e){return e==null?"":encodeURI(""+e).replace(Pd,"|").replace(Td,"[").replace(Od,"]")}function Nd(e){return To(e).replace(Ul,"{").replace(ql,"}").replace(jl,"^")}function Xs(e){return To(e).replace(Hl,"%2B").replace(Ld,"+").replace(Bl,"%23").replace(Ed,"%26").replace(Md,"`").replace(Ul,"{").replace(ql,"}").replace(jl,"^")}function Id(e){return Xs(e).replace(Ad,"%3D")}function Dd(e){return To(e).replace(Bl,"%23").replace(Rd,"%3F")}function $d(e){return Dd(e).replace(Sd,"%2F")}function or(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Fd=/\/$/,Vd=e=>e.replace(Fd,"");function Os(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let c=t.indexOf("?");return c=a>=0&&c>a?-1:c,c>=0&&(r=t.slice(0,c),o=t.slice(c,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Ud(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:or(i)}}function Bd(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Li(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Hd(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&An(t.matched[r],n.matched[s])&&Kl(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function An(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Kl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!jd(e[n],t[n]))return!1;return!0}function jd(e,t){return pt(e)?Ni(e,t):pt(t)?Ni(t,e):e===t}function Ni(e,t){return pt(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Ud(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Bt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let eo=function(e){return e.pop="pop",e.push="push",e}({}),Ms=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function qd(e){if(!e)if(bn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Vd(e)}const Kd=/^[^#]+#/;function Wd(e,t){return e.replace(Kd,"#")+t}function Gd(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const cs=()=>({left:window.scrollX,top:window.scrollY});function Zd(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Gd(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ii(e,t){return(history.state?history.state.position-t:-1)+e}const to=new Map;function zd(e,t){to.set(e,t)}function Jd(e){const t=to.get(e);return to.delete(e),t}function Yd(e){return typeof e=="string"||e&&typeof e=="object"}function Wl(e){return typeof e=="string"||typeof e=="symbol"}let Oe=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const Gl=Symbol("");Oe.MATCHER_NOT_FOUND+"",Oe.NAVIGATION_GUARD_REDIRECT+"",Oe.NAVIGATION_ABORTED+"",Oe.NAVIGATION_CANCELLED+"",Oe.NAVIGATION_DUPLICATED+"";function Rn(e,t){return be(new Error,{type:e,[Gl]:!0},t)}function Tt(e,t){return e instanceof Error&&Gl in e&&(t==null||!!(e.type&t))}const Qd=["params","query","hash"];function Xd(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Qd)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function ef(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;rs&&Xs(s)):[r&&Xs(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function tf(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=pt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const nf=Symbol(""),$i=Symbol(""),us=Symbol(""),Oo=Symbol(""),no=Symbol("");function Fn(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Wt(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,c)=>{const u=f=>{f===!1?c(Rn(Oe.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?c(f):Yd(f)?c(Rn(Oe.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(i&&r.enterCallbacks[s]===i&&typeof f=="function"&&i.push(f),a())},l=o(()=>e.call(r&&r.instances[s],t,n,u));let d=Promise.resolve(l);e.length<3&&(d=d.then(u)),d.catch(f=>c(f))})}function Ps(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let c=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(Vl(c)){const u=(c.__vccOpts||c)[t];u&&o.push(Wt(u,n,r,i,a,s))}else{let u=c();o.push(()=>u.then(l=>{if(!l)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const d=kd(l)?l.default:l;i.mods[a]=l,i.components[a]=d;const f=(d.__vccOpts||d)[t];return f&&Wt(f,n,r,i,a,s)()}))}}return o}function rf(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;iAn(u,a))?r.push(a):n.push(a));const c=e.matched[i];c&&(t.matched.find(u=>An(u,c))||s.push(c))}return[n,r,s]}/*! + * vue-router v4.6.3 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let sf=()=>location.protocol+"//"+location.host;function Zl(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),Li(a,"")}return Li(n,e)+r+s}function of(e,t,n,r){let s=[],o=[],i=null;const a=({state:f})=>{const y=Zl(e,location),g=n.value,b=t.value;let x=0;if(f){if(n.value=y,t.value=f,i&&i===g){i=null;return}x=b?f.position-b.position:0}else r(y);s.forEach(k=>{k(n.value,g,{delta:x,type:eo.pop,direction:x?x>0?Ms.forward:Ms.back:Ms.unknown})})};function c(){i=n.value}function u(f){s.push(f);const y=()=>{const g=s.indexOf(f);g>-1&&s.splice(g,1)};return o.push(y),y}function l(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(be({},f.state,{scroll:cs()}),"")}}function d(){for(const f of o)f();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",l),document.removeEventListener("visibilitychange",l)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",l),document.addEventListener("visibilitychange",l),{pauseListeners:c,listen:u,destroy:d}}function Fi(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?cs():null}}function af(e){const{history:t,location:n}=window,r={value:Zl(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(c,u,l){const d=e.indexOf("#"),f=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+c:sf()+e+c;try{t[l?"replaceState":"pushState"](u,"",f),s.value=u}catch(y){console.error(y),n[l?"replace":"assign"](f)}}function i(c,u){o(c,be({},t.state,Fi(s.value.back,c,s.value.forward,!0),u,{position:s.value.position}),!0),r.value=c}function a(c,u){const l=be({},s.value,t.state,{forward:c,scroll:cs()});o(l.current,l,!0),o(c,be({},Fi(r.value,c,null),{position:l.position+1},u),!1),r.value=c}return{location:r,state:s,push:a,replace:i}}function lf(e){e=qd(e);const t=af(e),n=of(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=be({location:"",base:e,go:r,createHref:Wd.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}let an=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Ne=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e}(Ne||{});const cf={type:an.Static,value:""},uf=/[a-zA-Z0-9_]/;function df(e){if(!e)return[[]];if(e==="/")return[[cf]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${n})/"${u}": ${y}`)}let n=Ne.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,c,u="",l="";function d(){u&&(n===Ne.Static?o.push({type:an.Static,value:u}):n===Ne.Param||n===Ne.ParamRegExp||n===Ne.ParamRegExpEnd?(o.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:an.Param,value:u,regexp:l,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function f(){u+=c}for(;at.length?t.length===1&&t[0]===Ke.Static+Ke.Segment?1:-1:0}function zl(e,t){let n=0;const r=e.score,s=t.score;for(;n0&&t[t.length-1]<0}const gf={strict:!1,end:!0,sensitive:!1};function yf(e,t,n){const r=hf(df(e.path),n),s=be(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function vf(e,t){const n=[],r=new Map;t=Pi(gf,t);function s(d){return r.get(d)}function o(d,f,y){const g=!y,b=ji(d);b.aliasOf=y&&y.record;const x=Pi(t,d),k=[b];if("alias"in d){const R=typeof d.alias=="string"?[d.alias]:d.alias;for(const H of R)k.push(ji(be({},b,{components:y?y.record.components:b.components,path:H,aliasOf:y?y.record:b})))}let L,E;for(const R of k){const{path:H}=R;if(f&&H[0]!=="/"){const ee=f.record.path,G=ee[ee.length-1]==="/"?"":"/";R.path=f.record.path+(H&&G+H)}if(L=yf(R,f,x),y?y.alias.push(L):(E=E||L,E!==L&&E.alias.push(L),g&&d.name&&!Ui(L)&&i(d.name)),Jl(L)&&c(L),b.children){const ee=b.children;for(let G=0;G{i(E)}:Qn}function i(d){if(Wl(d)){const f=r.get(d);f&&(r.delete(d),n.splice(n.indexOf(f),1),f.children.forEach(i),f.alias.forEach(i))}else{const f=n.indexOf(d);f>-1&&(n.splice(f,1),d.record.name&&r.delete(d.record.name),d.children.forEach(i),d.alias.forEach(i))}}function a(){return n}function c(d){const f=_f(d,n);n.splice(f,0,d),d.record.name&&!Ui(d)&&r.set(d.record.name,d)}function u(d,f){let y,g={},b,x;if("name"in d&&d.name){if(y=r.get(d.name),!y)throw Rn(Oe.MATCHER_NOT_FOUND,{location:d});x=y.record.name,g=be(Hi(f.params,y.keys.filter(E=>!E.optional).concat(y.parent?y.parent.keys.filter(E=>E.optional):[]).map(E=>E.name)),d.params&&Hi(d.params,y.keys.map(E=>E.name))),b=y.stringify(g)}else if(d.path!=null)b=d.path,y=n.find(E=>E.re.test(b)),y&&(g=y.parse(b),x=y.record.name);else{if(y=f.name?r.get(f.name):n.find(E=>E.re.test(f.path)),!y)throw Rn(Oe.MATCHER_NOT_FOUND,{location:d,currentLocation:f});x=y.record.name,g=be({},f.params,d.params),b=y.stringify(g)}const k=[];let L=y;for(;L;)k.unshift(L.record),L=L.parent;return{name:x,path:b,params:g,matched:k,meta:Cf(k)}}e.forEach(d=>o(d));function l(){n.length=0,r.clear()}return{addRoute:o,resolve:u,removeRoute:i,clearRoutes:l,getRoutes:a,getRecordMatcher:s}}function Hi(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function ji(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:bf(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function bf(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Ui(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Cf(e){return e.reduce((t,n)=>be(t,n.meta),{})}function _f(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;zl(e,t[o])<0?r=o:n=o+1}const s=wf(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function wf(e){let t=e;for(;t=t.parent;)if(Jl(t)&&zl(e,t)===0)return t}function Jl({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function qi(e){const t=ct(us),n=ct(Oo),r=ie(()=>{const c=ue(e.to);return t.resolve(c)}),s=ie(()=>{const{matched:c}=r.value,{length:u}=c,l=c[u-1],d=n.matched;if(!l||!d.length)return-1;const f=d.findIndex(An.bind(null,l));if(f>-1)return f;const y=Ki(c[u-2]);return u>1&&Ki(l)===y&&d[d.length-1].path!==y?d.findIndex(An.bind(null,c[u-2])):f}),o=ie(()=>s.value>-1&&Af(n.params,r.value.params)),i=ie(()=>s.value>-1&&s.value===n.matched.length-1&&Kl(n.params,r.value.params));function a(c={}){if(Sf(c)){const u=t[ue(e.replace)?"replace":"push"](ue(e.to)).catch(Qn);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:ie(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function xf(e){return e.length===1?e[0]:e}const kf=ht({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:qi,setup(e,{slots:t}){const n=ar(qi(e)),{options:r}=ct(us),s=ie(()=>({[Wi(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Wi(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&xf(t.default(n));return e.custom?o:Ao("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Ef=kf;function Sf(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Af(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!pt(s)||s.length!==r.length||r.some((o,i)=>o!==s[i]))return!1}return!0}function Ki(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Wi=(e,t,n)=>e??t??n,Rf=ht({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=ct(no),s=ie(()=>e.route||r.value),o=ct($i,0),i=ie(()=>{let u=ue(o);const{matched:l}=s.value;let d;for(;(d=l[u])&&!d.components;)u++;return u}),a=ie(()=>s.value.matched[i.value]);Sr($i,ie(()=>i.value+1)),Sr(nf,a),Sr(no,s);const c=ne();return Lt(()=>[c.value,a.value,e.name],([u,l,d],[f,y,g])=>{l&&(l.instances[d]=u,y&&y!==l&&u&&u===f&&(l.leaveGuards.size||(l.leaveGuards=y.leaveGuards),l.updateGuards.size||(l.updateGuards=y.updateGuards))),u&&l&&(!y||!An(l,y)||!f)&&(l.enterCallbacks[d]||[]).forEach(b=>b(u))},{flush:"post"}),()=>{const u=s.value,l=e.name,d=a.value,f=d&&d.components[l];if(!f)return Gi(n.default,{Component:f,route:u});const y=d.props[l],g=y?y===!0?u.params:typeof y=="function"?y(u):y:null,x=Ao(f,be({},g,t,{onVnodeUnmounted:k=>{k.component.isUnmounted&&(d.instances[l]=null)},ref:c}));return Gi(n.default,{Component:x,route:u})||x}}});function Gi(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Tf=Rf;function Of(e){const t=vf(e.routes,e),n=e.parseQuery||ef,r=e.stringifyQuery||Di,s=e.history,o=Fn(),i=Fn(),a=Fn(),c=bu(Bt);let u=Bt;bn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const l=Ts.bind(null,w=>""+w),d=Ts.bind(null,$d),f=Ts.bind(null,or);function y(w,Y){let K,te;return Wl(w)?(K=t.getRecordMatcher(w),te=Y):te=w,t.addRoute(te,K)}function g(w){const Y=t.getRecordMatcher(w);Y&&t.removeRoute(Y)}function b(){return t.getRoutes().map(w=>w.record)}function x(w){return!!t.getRecordMatcher(w)}function k(w,Y){if(Y=be({},Y||c.value),typeof w=="string"){const C=Os(n,w,Y.path),S=t.resolve({path:C.path},Y),P=s.createHref(C.fullPath);return be(C,S,{params:f(S.params),hash:or(C.hash),redirectedFrom:void 0,href:P})}let K;if(w.path!=null)K=be({},w,{path:Os(n,w.path,Y.path).path});else{const C=be({},w.params);for(const S in C)C[S]==null&&delete C[S];K=be({},w,{params:d(C)}),Y.params=d(Y.params)}const te=t.resolve(K,Y),he=w.hash||"";te.params=l(f(te.params));const p=Bd(r,be({},w,{hash:Nd(he),path:te.path})),m=s.createHref(p);return be({fullPath:p,hash:he,query:r===Di?tf(w.query):w.query||{}},te,{redirectedFrom:void 0,href:m})}function L(w){return typeof w=="string"?Os(n,w,c.value.path):be({},w)}function E(w,Y){if(u!==w)return Rn(Oe.NAVIGATION_CANCELLED,{from:Y,to:w})}function R(w){return G(w)}function H(w){return R(be(L(w),{replace:!0}))}function ee(w,Y){const K=w.matched[w.matched.length-1];if(K&&K.redirect){const{redirect:te}=K;let he=typeof te=="function"?te(w,Y):te;return typeof he=="string"&&(he=he.includes("?")||he.includes("#")?he=L(he):{path:he},he.params={}),be({query:w.query,hash:w.hash,params:he.path!=null?{}:w.params},he)}}function G(w,Y){const K=u=k(w),te=c.value,he=w.state,p=w.force,m=w.replace===!0,C=ee(K,te);if(C)return G(be(L(C),{state:typeof C=="object"?be({},he,C.state):he,force:p,replace:m}),Y||K);const S=K;S.redirectedFrom=Y;let P;return!p&&Hd(r,te,K)&&(P=Rn(Oe.NAVIGATION_DUPLICATED,{to:S,from:te}),Me(te,te,!0,!1)),(P?Promise.resolve(P):q(S,te)).catch(A=>Tt(A)?Tt(A,Oe.NAVIGATION_GUARD_REDIRECT)?A:Fe(A):I(A,S,te)).then(A=>{if(A){if(Tt(A,Oe.NAVIGATION_GUARD_REDIRECT))return G(be({replace:m},L(A.to),{state:typeof A.to=="object"?be({},he,A.to.state):he,force:p}),Y||S)}else A=v(S,te,!0,m,he);return $(S,te,A),A})}function J(w,Y){const K=E(w,Y);return K?Promise.reject(K):Promise.resolve()}function T(w){const Y=Xe.values().next().value;return Y&&typeof Y.runWithContext=="function"?Y.runWithContext(w):w()}function q(w,Y){let K;const[te,he,p]=rf(w,Y);K=Ps(te.reverse(),"beforeRouteLeave",w,Y);for(const C of te)C.leaveGuards.forEach(S=>{K.push(Wt(S,w,Y))});const m=J.bind(null,w,Y);return K.push(m),D(K).then(()=>{K=[];for(const C of o.list())K.push(Wt(C,w,Y));return K.push(m),D(K)}).then(()=>{K=Ps(he,"beforeRouteUpdate",w,Y);for(const C of he)C.updateGuards.forEach(S=>{K.push(Wt(S,w,Y))});return K.push(m),D(K)}).then(()=>{K=[];for(const C of p)if(C.beforeEnter)if(pt(C.beforeEnter))for(const S of C.beforeEnter)K.push(Wt(S,w,Y));else K.push(Wt(C.beforeEnter,w,Y));return K.push(m),D(K)}).then(()=>(w.matched.forEach(C=>C.enterCallbacks={}),K=Ps(p,"beforeRouteEnter",w,Y,T),K.push(m),D(K))).then(()=>{K=[];for(const C of i.list())K.push(Wt(C,w,Y));return K.push(m),D(K)}).catch(C=>Tt(C,Oe.NAVIGATION_CANCELLED)?C:Promise.reject(C))}function $(w,Y,K){a.list().forEach(te=>T(()=>te(w,Y,K)))}function v(w,Y,K,te,he){const p=E(w,Y);if(p)return p;const m=Y===Bt,C=bn?history.state:{};K&&(te||m?s.replace(w.fullPath,be({scroll:m&&C&&C.scroll},he)):s.push(w.fullPath,he)),c.value=w,Me(w,Y,K,m),Fe()}let O;function N(){O||(O=s.listen((w,Y,K)=>{if(!z.listening)return;const te=k(w),he=ee(te,z.currentRoute.value);if(he){G(be(he,{replace:!0,force:!0}),te).catch(Qn);return}u=te;const p=c.value;bn&&zd(Ii(p.fullPath,K.delta),cs()),q(te,p).catch(m=>Tt(m,Oe.NAVIGATION_ABORTED|Oe.NAVIGATION_CANCELLED)?m:Tt(m,Oe.NAVIGATION_GUARD_REDIRECT)?(G(be(L(m.to),{force:!0}),te).then(C=>{Tt(C,Oe.NAVIGATION_ABORTED|Oe.NAVIGATION_DUPLICATED)&&!K.delta&&K.type===eo.pop&&s.go(-1,!1)}).catch(Qn),Promise.reject()):(K.delta&&s.go(-K.delta,!1),I(m,te,p))).then(m=>{m=m||v(te,p,!1),m&&(K.delta&&!Tt(m,Oe.NAVIGATION_CANCELLED)?s.go(-K.delta,!1):K.type===eo.pop&&Tt(m,Oe.NAVIGATION_ABORTED|Oe.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),$(te,p,m)}).catch(Qn)}))}let Q=Fn(),se=Fn(),j;function I(w,Y,K){Fe(w);const te=se.list();return te.length?te.forEach(he=>he(w,Y,K)):console.error(w),Promise.reject(w)}function pe(){return j&&c.value!==Bt?Promise.resolve():new Promise((w,Y)=>{Q.add([w,Y])})}function Fe(w){return j||(j=!w,N(),Q.list().forEach(([Y,K])=>w?K(w):Y()),Q.reset()),w}function Me(w,Y,K,te){const{scrollBehavior:he}=e;if(!bn||!he)return Promise.resolve();const p=!K&&Jd(Ii(w.fullPath,0))||(te||!K)&&history.state&&history.state.scroll||null;return es().then(()=>he(w,Y,p)).then(m=>m&&Zd(m)).catch(m=>I(m,w,Y))}const Re=w=>s.go(w);let ot;const Xe=new Set,z={currentRoute:c,listening:!0,addRoute:y,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:x,getRoutes:b,resolve:k,options:e,push:R,replace:H,go:Re,back:()=>Re(-1),forward:()=>Re(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:se.add,isReady:pe,install(w){w.component("RouterLink",Ef),w.component("RouterView",Tf),w.config.globalProperties.$router=z,Object.defineProperty(w.config.globalProperties,"$route",{enumerable:!0,get:()=>ue(c)}),bn&&!ot&&c.value===Bt&&(ot=!0,R(s.location).catch(te=>{}));const Y={};for(const te in Bt)Object.defineProperty(Y,te,{get:()=>c.value[te],enumerable:!0});w.provide(us,z),w.provide(Oo,$a(Y)),w.provide(no,c);const K=w.unmount;Xe.add(w),w.unmount=function(){Xe.delete(w),Xe.size<1&&(u=Bt,O&&O(),O=null,c.value=Bt,ot=!1,j=!1),K()}}};function D(w){return w.reduce((Y,K)=>Y.then(()=>T(K)),Promise.resolve())}return z}function Mo(){return ct(us)}function Po(e){return ct(Oo)}const Mf="/assets/meshcore-DQNtEl5I.svg";function Yl(e,t){return function(){return e.apply(t,arguments)}}const{toString:Pf}=Object.prototype,{getPrototypeOf:Lo}=Object,{iterator:ds,toStringTag:Ql}=Symbol,fs=(e=>t=>{const n=Pf.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),mt=e=>(e=e.toLowerCase(),t=>fs(t)===e),ps=e=>t=>typeof t===e,{isArray:Pn}=Array,Tn=ps("undefined");function fr(e){return e!==null&&!Tn(e)&&e.constructor!==null&&!Tn(e.constructor)&&Ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xl=mt("ArrayBuffer");function Lf(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Xl(e.buffer),t}const Nf=ps("string"),Ye=ps("function"),ec=ps("number"),pr=e=>e!==null&&typeof e=="object",If=e=>e===!0||e===!1,Or=e=>{if(fs(e)!=="object")return!1;const t=Lo(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ql in e)&&!(ds in e)},Df=e=>{if(!pr(e)||fr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},$f=mt("Date"),Ff=mt("File"),Vf=mt("Blob"),Bf=mt("FileList"),Hf=e=>pr(e)&&Ye(e.pipe),jf=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ye(e.append)&&((t=fs(e))==="formdata"||t==="object"&&Ye(e.toString)&&e.toString()==="[object FormData]"))},Uf=mt("URLSearchParams"),[qf,Kf,Wf,Gf]=["ReadableStream","Request","Response","Headers"].map(mt),Zf=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Pn(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ln=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nc=e=>!Tn(e)&&e!==ln;function ro(){const{caseless:e,skipUndefined:t}=nc(this)&&this||{},n={},r=(s,o)=>{const i=e&&tc(n,o)||o;Or(n[i])&&Or(s)?n[i]=ro(n[i],s):Or(s)?n[i]=ro({},s):Pn(s)?n[i]=s.slice():(!t||!Tn(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s(hr(t,(s,o)=>{n&&Ye(s)?e[o]=Yl(s,n):e[o]=s},{allOwnKeys:r}),e),Jf=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Yf=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Qf=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&Lo(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Xf=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},e2=e=>{if(!e)return null;if(Pn(e))return e;let t=e.length;if(!ec(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},t2=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Lo(Uint8Array)),n2=(e,t)=>{const r=(e&&e[ds]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},r2=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},s2=mt("HTMLFormElement"),o2=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Zi=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),i2=mt("RegExp"),rc=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};hr(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},a2=e=>{rc(e,(t,n)=>{if(Ye(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Ye(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},l2=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return Pn(e)?r(e):r(String(e).split(t)),n},c2=()=>{},u2=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function d2(e){return!!(e&&Ye(e.append)&&e[Ql]==="FormData"&&e[ds])}const f2=e=>{const t=new Array(10),n=(r,s)=>{if(pr(r)){if(t.indexOf(r)>=0)return;if(fr(r))return r;if(!("toJSON"in r)){t[s]=r;const o=Pn(r)?[]:{};return hr(r,(i,a)=>{const c=n(i,s+1);!Tn(c)&&(o[a]=c)}),t[s]=void 0,o}}return r};return n(e,0)},p2=mt("AsyncFunction"),h2=e=>e&&(pr(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),sc=((e,t)=>e?setImmediate:t?((n,r)=>(ln.addEventListener("message",({source:s,data:o})=>{s===ln&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ln.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ye(ln.postMessage)),m2=typeof queueMicrotask<"u"?queueMicrotask.bind(ln):typeof process<"u"&&process.nextTick||sc,g2=e=>e!=null&&Ye(e[ds]),_={isArray:Pn,isArrayBuffer:Xl,isBuffer:fr,isFormData:jf,isArrayBufferView:Lf,isString:Nf,isNumber:ec,isBoolean:If,isObject:pr,isPlainObject:Or,isEmptyObject:Df,isReadableStream:qf,isRequest:Kf,isResponse:Wf,isHeaders:Gf,isUndefined:Tn,isDate:$f,isFile:Ff,isBlob:Vf,isRegExp:i2,isFunction:Ye,isStream:Hf,isURLSearchParams:Uf,isTypedArray:t2,isFileList:Bf,forEach:hr,merge:ro,extend:zf,trim:Zf,stripBOM:Jf,inherits:Yf,toFlatObject:Qf,kindOf:fs,kindOfTest:mt,endsWith:Xf,toArray:e2,forEachEntry:n2,matchAll:r2,isHTMLForm:s2,hasOwnProperty:Zi,hasOwnProp:Zi,reduceDescriptors:rc,freezeMethods:a2,toObjectSet:l2,toCamelCase:o2,noop:c2,toFiniteNumber:u2,findKey:tc,global:ln,isContextDefined:nc,isSpecCompliantForm:d2,toJSONObject:f2,isAsyncFn:p2,isThenable:h2,setImmediate:sc,asap:m2,isIterable:g2};function fe(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}_.inherits(fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_.toJSONObject(this.config),code:this.code,status:this.status}}});const oc=fe.prototype,ic={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ic[e]={value:e}});Object.defineProperties(fe,ic);Object.defineProperty(oc,"isAxiosError",{value:!0});fe.from=(e,t,n,r,s,o)=>{const i=Object.create(oc);_.toFlatObject(e,i,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return fe.call(i,a,c,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const y2=null;function so(e){return _.isPlainObject(e)||_.isArray(e)}function ac(e){return _.endsWith(e,"[]")?e.slice(0,-2):e}function zi(e,t,n){return e?e.concat(t).map(function(s,o){return s=ac(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function v2(e){return _.isArray(e)&&!e.some(so)}const b2=_.toFlatObject(_,{},null,function(t){return/^is[A-Z]/.test(t)});function hs(e,t,n){if(!_.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=_.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,x){return!_.isUndefined(x[b])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(t);if(!_.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(_.isDate(g))return g.toISOString();if(_.isBoolean(g))return g.toString();if(!c&&_.isBlob(g))throw new fe("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(g)||_.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function l(g,b,x){let k=g;if(g&&!x&&typeof g=="object"){if(_.endsWith(b,"{}"))b=r?b:b.slice(0,-2),g=JSON.stringify(g);else if(_.isArray(g)&&v2(g)||(_.isFileList(g)||_.endsWith(b,"[]"))&&(k=_.toArray(g)))return b=ac(b),k.forEach(function(E,R){!(_.isUndefined(E)||E===null)&&t.append(i===!0?zi([b],R,o):i===null?b:b+"[]",u(E))}),!1}return so(g)?!0:(t.append(zi(x,b,o),u(g)),!1)}const d=[],f=Object.assign(b2,{defaultVisitor:l,convertValue:u,isVisitable:so});function y(g,b){if(!_.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(g),_.forEach(g,function(k,L){(!(_.isUndefined(k)||k===null)&&s.call(t,k,_.isString(L)?L.trim():L,b,f))===!0&&y(k,b?b.concat(L):[L])}),d.pop()}}if(!_.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ji(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function No(e,t){this._pairs=[],e&&hs(e,this,t)}const lc=No.prototype;lc.append=function(t,n){this._pairs.push([t,n])};lc.toString=function(t){const n=t?function(r){return t.call(this,r,Ji)}:Ji;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function C2(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function cc(e,t,n){if(!t)return e;const r=n&&n.encode||C2;_.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=_.isURLSearchParams(t)?t.toString():new No(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Yi{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_.forEach(this.handlers,function(r){r!==null&&t(r)})}}const uc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_2=typeof URLSearchParams<"u"?URLSearchParams:No,w2=typeof FormData<"u"?FormData:null,x2=typeof Blob<"u"?Blob:null,k2={isBrowser:!0,classes:{URLSearchParams:_2,FormData:w2,Blob:x2},protocols:["http","https","file","blob","url","data"]},Io=typeof window<"u"&&typeof document<"u",oo=typeof navigator=="object"&&navigator||void 0,E2=Io&&(!oo||["ReactNative","NativeScript","NS"].indexOf(oo.product)<0),S2=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",A2=Io&&window.location.href||"http://localhost",R2=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Io,hasStandardBrowserEnv:E2,hasStandardBrowserWebWorkerEnv:S2,navigator:oo,origin:A2},Symbol.toStringTag,{value:"Module"})),He={...R2,...k2};function T2(e,t){return hs(e,new He.classes.URLSearchParams,{visitor:function(n,r,s,o){return He.isNode&&_.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function O2(e){return _.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function M2(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r=n.length;return i=!i&&_.isArray(s)?s.length:i,c?(_.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!_.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&_.isArray(s[i])&&(s[i]=M2(s[i])),!a)}if(_.isFormData(e)&&_.isFunction(e.entries)){const n={};return _.forEachEntry(e,(r,s)=>{t(O2(r),s,n,0)}),n}return null}function P2(e,t,n){if(_.isString(e))try{return(t||JSON.parse)(e),_.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const mr={transitional:uc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=_.isObject(t);if(o&&_.isHTMLForm(t)&&(t=new FormData(t)),_.isFormData(t))return s?JSON.stringify(dc(t)):t;if(_.isArrayBuffer(t)||_.isBuffer(t)||_.isStream(t)||_.isFile(t)||_.isBlob(t)||_.isReadableStream(t))return t;if(_.isArrayBufferView(t))return t.buffer;if(_.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return T2(t,this.formSerializer).toString();if((a=_.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return hs(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),P2(t)):t}],transformResponse:[function(t){const n=this.transitional||mr.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(_.isResponse(t)||_.isReadableStream(t))return t;if(t&&_.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?fe.from(a,fe.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:He.classes.FormData,Blob:He.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],e=>{mr.headers[e]={}});const L2=_.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),N2=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&L2[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Qi=Symbol("internals");function Vn(e){return e&&String(e).trim().toLowerCase()}function Mr(e){return e===!1||e==null?e:_.isArray(e)?e.map(Mr):String(e)}function I2(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const D2=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ls(e,t,n,r,s){if(_.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!_.isString(t)){if(_.isString(r))return t.indexOf(r)!==-1;if(_.isRegExp(r))return r.test(t)}}function $2(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function F2(e,t){const n=_.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let Qe=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(a,c,u){const l=Vn(c);if(!l)throw new Error("header name must be a non-empty string");const d=_.findKey(s,l);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||c]=Mr(a))}const i=(a,c)=>_.forEach(a,(u,l)=>o(u,l,c));if(_.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(_.isString(t)&&(t=t.trim())&&!D2(t))i(N2(t),n);else if(_.isObject(t)&&_.isIterable(t)){let a={},c,u;for(const l of t){if(!_.isArray(l))throw TypeError("Object iterator must return a key-value pair");a[u=l[0]]=(c=a[u])?_.isArray(c)?[...c,l[1]]:[c,l[1]]:l[1]}i(a,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Vn(t),t){const r=_.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return I2(s);if(_.isFunction(n))return n.call(this,s,r);if(_.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Vn(t),t){const r=_.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Ls(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=Vn(i),i){const a=_.findKey(r,i);a&&(!n||Ls(r,r[a],a,n))&&(delete r[a],s=!0)}}return _.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Ls(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return _.forEach(this,(s,o)=>{const i=_.findKey(r,o);if(i){n[i]=Mr(s),delete n[o];return}const a=t?$2(o):String(o).trim();a!==o&&delete n[o],n[a]=Mr(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return _.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&_.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Qi]=this[Qi]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=Vn(i);r[a]||(F2(s,i),r[a]=!0)}return _.isArray(t)?t.forEach(o):o(t),this}};Qe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(Qe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});_.freezeMethods(Qe);function Ns(e,t){const n=this||mr,r=t||n,s=Qe.from(r.headers);let o=r.data;return _.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function fc(e){return!!(e&&e.__CANCEL__)}function Ln(e,t,n){fe.call(this,e??"canceled",fe.ERR_CANCELED,t,n),this.name="CanceledError"}_.inherits(Ln,fe,{__CANCEL__:!0});function pc(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new fe("Request failed with status code "+n.status,[fe.ERR_BAD_REQUEST,fe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function V2(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function B2(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=r[o];i||(i=u),n[s]=c,r[s]=u;let d=o,f=0;for(;d!==s;)f+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),d=l-n;d>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const qr=(e,t,n=3)=>{let r=0;const s=B2(50,250);return H2(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,c=i-r,u=s(c),l=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},Xi=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ea=e=>(...t)=>_.asap(()=>e(...t)),j2=He.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,He.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(He.origin),He.navigator&&/(msie|trident)/i.test(He.navigator.userAgent)):()=>!0,U2=He.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];_.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),_.isString(r)&&a.push(`path=${r}`),_.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),_.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function q2(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function K2(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function hc(e,t,n){let r=!q2(t);return e&&(r||n==!1)?K2(e,t):t}const ta=e=>e instanceof Qe?{...e}:e;function pn(e,t){t=t||{};const n={};function r(u,l,d,f){return _.isPlainObject(u)&&_.isPlainObject(l)?_.merge.call({caseless:f},u,l):_.isPlainObject(l)?_.merge({},l):_.isArray(l)?l.slice():l}function s(u,l,d,f){if(_.isUndefined(l)){if(!_.isUndefined(u))return r(void 0,u,d,f)}else return r(u,l,d,f)}function o(u,l){if(!_.isUndefined(l))return r(void 0,l)}function i(u,l){if(_.isUndefined(l)){if(!_.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function a(u,l,d){if(d in t)return r(u,l);if(d in e)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,l,d)=>s(ta(u),ta(l),d,!0)};return _.forEach(Object.keys({...e,...t}),function(l){const d=c[l]||s,f=d(e[l],t[l],l);_.isUndefined(f)&&d!==a||(n[l]=f)}),n}const mc=e=>{const t=pn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Qe.from(i),t.url=cc(hc(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),_.isFormData(n)){if(He.hasStandardBrowserEnv||He.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(_.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([l,d])=>{u.includes(l.toLowerCase())&&i.set(l,d)})}}if(He.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(t)),r||r!==!1&&j2(t.url))){const c=s&&o&&U2.read(o);c&&i.set(s,c)}return t},W2=typeof XMLHttpRequest<"u",G2=W2&&function(e){return new Promise(function(n,r){const s=mc(e);let o=s.data;const i=Qe.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,l,d,f,y,g;function b(){y&&y(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function k(){if(!x)return;const E=Qe.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:E,config:e,request:x};pc(function(G){n(G),b()},function(G){r(G),b()},H),x=null}"onloadend"in x?x.onloadend=k:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(k)},x.onabort=function(){x&&(r(new fe("Request aborted",fe.ECONNABORTED,e,x)),x=null)},x.onerror=function(R){const H=R&&R.message?R.message:"Network Error",ee=new fe(H,fe.ERR_NETWORK,e,x);ee.event=R||null,r(ee),x=null},x.ontimeout=function(){let R=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const H=s.transitional||uc;s.timeoutErrorMessage&&(R=s.timeoutErrorMessage),r(new fe(R,H.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,e,x)),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&_.forEach(i.toJSON(),function(R,H){x.setRequestHeader(H,R)}),_.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),a&&a!=="json"&&(x.responseType=s.responseType),u&&([f,g]=qr(u,!0),x.addEventListener("progress",f)),c&&x.upload&&([d,y]=qr(c),x.upload.addEventListener("progress",d),x.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(l=E=>{x&&(r(!E||E.type?new Ln(null,e,x):E),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const L=V2(s.url);if(L&&He.protocols.indexOf(L)===-1){r(new fe("Unsupported protocol "+L+":",fe.ERR_BAD_REQUEST,e));return}x.send(o||null)})},Z2=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,a();const l=u instanceof Error?u:this.reason;r.abort(l instanceof fe?l:new Ln(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new fe(`timeout ${t} of ms exceeded`,fe.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>_.asap(a),c}},z2=function*(e,t){let n=e.byteLength;if(n{const s=J2(e,t);let o=0,i,a=c=>{i||(i=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await s.next();if(u){a(),c.close();return}let d=l.byteLength;if(n){let f=o+=d;n(f)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},ra=64*1024,{isFunction:wr}=_,Q2=(({Request:e,Response:t})=>({Request:e,Response:t}))(_.global),{ReadableStream:sa,TextEncoder:oa}=_.global,ia=(e,...t)=>{try{return!!e(...t)}catch{return!1}},X2=e=>{e=_.merge.call({skipUndefined:!0},Q2,e);const{fetch:t,Request:n,Response:r}=e,s=t?wr(t):typeof fetch=="function",o=wr(n),i=wr(r);if(!s)return!1;const a=s&&wr(sa),c=s&&(typeof oa=="function"?(g=>b=>g.encode(b))(new oa):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=o&&a&&ia(()=>{let g=!1;const b=new n(He.origin,{body:new sa,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!b}),l=i&&a&&ia(()=>_.isReadableStream(new r("").body)),d={stream:l&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!d[g]&&(d[g]=(b,x)=>{let k=b&&b[g];if(k)return k.call(b);throw new fe(`Response type '${g}' is not supported`,fe.ERR_NOT_SUPPORT,x)})});const f=async g=>{if(g==null)return 0;if(_.isBlob(g))return g.size;if(_.isSpecCompliantForm(g))return(await new n(He.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(_.isArrayBufferView(g)||_.isArrayBuffer(g))return g.byteLength;if(_.isURLSearchParams(g)&&(g=g+""),_.isString(g))return(await c(g)).byteLength},y=async(g,b)=>{const x=_.toFiniteNumber(g.getContentLength());return x??f(b)};return async g=>{let{url:b,method:x,data:k,signal:L,cancelToken:E,timeout:R,onDownloadProgress:H,onUploadProgress:ee,responseType:G,headers:J,withCredentials:T="same-origin",fetchOptions:q}=mc(g),$=t||fetch;G=G?(G+"").toLowerCase():"text";let v=Z2([L,E&&E.toAbortSignal()],R),O=null;const N=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let Q;try{if(ee&&u&&x!=="get"&&x!=="head"&&(Q=await y(J,k))!==0){let Me=new n(b,{method:"POST",body:k,duplex:"half"}),Re;if(_.isFormData(k)&&(Re=Me.headers.get("content-type"))&&J.setContentType(Re),Me.body){const[ot,Xe]=Xi(Q,qr(ea(ee)));k=na(Me.body,ra,ot,Xe)}}_.isString(T)||(T=T?"include":"omit");const se=o&&"credentials"in n.prototype,j={...q,signal:v,method:x.toUpperCase(),headers:J.normalize().toJSON(),body:k,duplex:"half",credentials:se?T:void 0};O=o&&new n(b,j);let I=await(o?$(O,q):$(b,j));const pe=l&&(G==="stream"||G==="response");if(l&&(H||pe&&N)){const Me={};["status","statusText","headers"].forEach(z=>{Me[z]=I[z]});const Re=_.toFiniteNumber(I.headers.get("content-length")),[ot,Xe]=H&&Xi(Re,qr(ea(H),!0))||[];I=new r(na(I.body,ra,ot,()=>{Xe&&Xe(),N&&N()}),Me)}G=G||"text";let Fe=await d[_.findKey(d,G)||"text"](I,g);return!pe&&N&&N(),await new Promise((Me,Re)=>{pc(Me,Re,{data:Fe,headers:Qe.from(I.headers),status:I.status,statusText:I.statusText,config:g,request:O})})}catch(se){throw N&&N(),se&&se.name==="TypeError"&&/Load failed|fetch/i.test(se.message)?Object.assign(new fe("Network Error",fe.ERR_NETWORK,g,O),{cause:se.cause||se}):fe.from(se,se&&se.code,g,O)}}},e0=new Map,gc=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,c,u,l=e0;for(;a--;)c=o[a],u=l.get(c),u===void 0&&l.set(c,u=a?new Map:X2(t)),l=u;return u};gc();const Do={http:y2,xhr:G2,fetch:{get:gc}};_.forEach(Do,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const aa=e=>`- ${e}`,t0=e=>_.isFunction(e)||e===null||e===!1;function n0(e,t){e=_.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since : +`+i.map(aa).join(` +`):" "+aa(i[0]):"as no adapter specified";throw new fe("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const yc={getAdapter:n0,adapters:Do};function Is(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ln(null,e)}function la(e){return Is(e),e.headers=Qe.from(e.headers),e.data=Ns.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yc.getAdapter(e.adapter||mr.adapter,e)(e).then(function(r){return Is(e),r.data=Ns.call(e,e.transformResponse,r),r.headers=Qe.from(r.headers),r},function(r){return fc(r)||(Is(e),r&&r.response&&(r.response.data=Ns.call(e,e.transformResponse,r.response),r.response.headers=Qe.from(r.response.headers))),Promise.reject(r)})}const vc="1.13.2",ms={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ms[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ca={};ms.transitional=function(t,n,r){function s(o,i){return"[Axios v"+vc+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(t===!1)throw new fe(s(i," has been removed"+(n?" in "+n:"")),fe.ERR_DEPRECATED);return n&&!ca[i]&&(ca[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}};ms.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function r0(e,t,n){if(typeof e!="object")throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const a=e[o],c=a===void 0||i(a,o,e);if(c!==!0)throw new fe("option "+o+" must be "+c,fe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new fe("Unknown option "+o,fe.ERR_BAD_OPTION)}}const Pr={assertOptions:r0,validators:ms},Ct=Pr.validators;let dn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Yi,response:new Yi}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=pn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Pr.assertOptions(r,{silentJSONParsing:Ct.transitional(Ct.boolean),forcedJSONParsing:Ct.transitional(Ct.boolean),clarifyTimeoutError:Ct.transitional(Ct.boolean)},!1),s!=null&&(_.isFunction(s)?n.paramsSerializer={serialize:s}:Pr.assertOptions(s,{encode:Ct.function,serialize:Ct.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Pr.assertOptions(n,{baseUrl:Ct.spelling("baseURL"),withXsrfToken:Ct.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&_.merge(o.common,o[n.method]);o&&_.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Qe.concat(i,o);const a=[];let c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(c=c&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let l,d=0,f;if(!c){const g=[la.bind(this),void 0];for(g.unshift(...a),g.push(...u),f=g.length,l=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new Ln(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new bc(function(s){t=s}),cancel:t}}};function o0(e){return function(n){return e.apply(null,n)}}function i0(e){return _.isObject(e)&&e.isAxiosError===!0}const io={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(io).forEach(([e,t])=>{io[t]=e});function Cc(e){const t=new dn(e),n=Yl(dn.prototype.request,t);return _.extend(n,dn.prototype,t,{allOwnKeys:!0}),_.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Cc(pn(e,s))},n}const Ae=Cc(mr);Ae.Axios=dn;Ae.CanceledError=Ln;Ae.CancelToken=s0;Ae.isCancel=fc;Ae.VERSION=vc;Ae.toFormData=hs;Ae.AxiosError=fe;Ae.Cancel=Ae.CanceledError;Ae.all=function(t){return Promise.all(t)};Ae.spread=o0;Ae.isAxiosError=i0;Ae.mergeConfig=pn;Ae.AxiosHeaders=Qe;Ae.formToJSON=e=>dc(_.isHTMLForm(e)?new FormData(e):e);Ae.getAdapter=yc.getAdapter;Ae.HttpStatusCode=io;Ae.default=Ae;const{Axios:xh,AxiosError:kh,CanceledError:Eh,isCancel:Sh,CancelToken:Ah,VERSION:Rh,all:Th,Cancel:Oh,isAxiosError:Mh,spread:Ph,toFormData:Lh,AxiosHeaders:Nh,HttpStatusCode:Ih,formToJSON:Dh,getAdapter:$h,mergeConfig:Fh}=Ae,$o="pymc_jwt_token",ua="pymc_client_id";function a0(){let e=localStorage.getItem(ua);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(ua,e)),e}function hn(){return localStorage.getItem($o)}function l0(e){localStorage.setItem($o,e)}function mn(){localStorage.removeItem($o)}function _c(){return hn()!==null}function Fo(e){try{const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(n).split("").map(s=>"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(r)}catch{return null}}function wc(){const e=hn();if(!e)return!0;const t=Fo(e);return!t||!t.exp?!0:Date.now()>=t.exp*1e3-3e4}function xc(){const e=hn();if(!e)return!1;const t=Fo(e);if(!t||!t.exp)return!1;const n=t.exp*1e3-Date.now();return n>0&&n<3e5}function c0(){const e=hn();if(!e)return null;const t=Fo(e);return!t||!t.sub?null:t.sub}const u0="modulepreload",d0=function(e){return"/"+e},da={},Je=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(l=>Promise.resolve(l).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");s=c(n.map(u=>{if(u=d0(u),u in da)return;da[u]=!0;const l=u.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const f=document.createElement("link");if(f.rel=l?"stylesheet":u0,l||(f.as="script"),f.crossOrigin="",f.href=u,a&&f.setAttribute("nonce",a),document.head.appendChild(f),l)return new Promise((y,g)=>{f.addEventListener("load",y),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},$t=Of({history:lf("/"),routes:[{path:"/setup",name:"setup",component:()=>Je(()=>import("./Setup-CbTFhVaK.js"),__vite__mapDeps([0,1])),meta:{requiresAuth:!1,requiresSetup:!1}},{path:"/login",name:"login",component:()=>Je(()=>import("./Login-l9pwpiS6.js"),__vite__mapDeps([2,3])),meta:{requiresAuth:!1}},{path:"/",name:"dashboard",component:()=>Je(()=>import("./Dashboard-DMnus2lM.js"),__vite__mapDeps([4,5,6,7,8])),meta:{requiresAuth:!0}},{path:"/neighbors",name:"neighbors",component:()=>Je(()=>import("./Neighbors-BhwSlX3P.js"),__vite__mapDeps([9,6,10,11,7,12,13])),meta:{requiresAuth:!0}},{path:"/statistics",name:"statistics",component:()=>Je(()=>import("./Statistics-D8GGvrdt.js"),__vite__mapDeps([14,15,5,16,7,17,11,18])),meta:{requiresAuth:!0}},{path:"/system-stats",name:"system-stats",component:()=>Je(()=>import("./SystemStats-C7xzR_wP.js"),__vite__mapDeps([19,15,5,16,20])),meta:{requiresAuth:!0}},{path:"/configuration",name:"configuration",component:()=>Je(()=>import("./Configuration-BFp_Zwgj.js"),__vite__mapDeps([21,22,7,23,13])),meta:{requiresAuth:!0}},{path:"/cad-calibration",name:"cad-calibration",component:()=>Je(()=>import("./CADCalibration-sfiSWhAM.js"),__vite__mapDeps([24,17,11,25])),meta:{requiresAuth:!0}},{path:"/sessions",name:"sessions",component:()=>Je(()=>import("./Sessions-BycQoG5Z.js"),[]),meta:{requiresAuth:!0}},{path:"/room-servers",name:"room-servers",component:()=>Je(()=>import("./RoomServers-IKqFauvg.js"),__vite__mapDeps([26,7,22])),meta:{requiresAuth:!0}},{path:"/logs",name:"logs",component:()=>Je(()=>import("./Logs-BeEVtJ2E.js"),[]),meta:{requiresAuth:!0}},{path:"/terminal",name:"terminal",component:()=>Je(()=>import("./Terminal-DYn8WA9j.js"),__vite__mapDeps([27,28])),meta:{requiresAuth:!0}},{path:"/help",name:"help",component:()=>Je(()=>import("./Help-BBcBoX4k.js"),[]),meta:{requiresAuth:!0}}]});async function fa(){try{const e=await fetch("/api/needs_setup",{headers:{Accept:"application/json"}});if(!e.ok)return console.error("Setup check failed:",e.status),!1;const t=await e.json();return console.log("Setup status check:",t),t.needs_setup===!0}catch(e){return console.error("Error checking setup status:",e),!1}}$t.beforeEach(async(e,t,n)=>{const r=e.meta.requiresAuth!==!1,s=_c();if(e.path!=="/setup"&&await fa()){n("/setup");return}if(e.path==="/setup"&&!await fa()){n("/login");return}r&&!s?n("/login"):e.path==="/login"&&s?n("/"):n()});const f0="/api",Kr="";let Ds=!1,Bn=null;async function kc(){return Ds&&Bn||(Ds=!0,Bn=(async()=>{try{const e=hn();if(!e)throw new Error("No token to refresh");const t=a0(),n=await Ae.post(`${Kr}/auth/refresh`,{client_id:t},{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(n.data.success&&n.data.token){const r=n.data.token;return l0(r),console.log("Token refreshed successfully"),r}else throw new Error("Token refresh failed")}catch(e){throw console.error("Token refresh error:",e),mn(),$t.push("/login"),e}finally{Ds=!1,Bn=null}})()),Bn}const on=Ae.create({baseURL:f0,timeout:5e3,headers:{"Content-Type":"application/json"}}),Ec=Ae.create({baseURL:Kr,timeout:5e3,headers:{"Content-Type":"application/json"}});Ec.interceptors.request.use(async e=>{if(e.url?.includes("/auth/login")||e.url?.includes("/auth/refresh"))return e;const t=hn();if(t){if(xc())try{const n=await kc();return e.headers.Authorization=`Bearer ${n}`,e}catch(n){return Promise.reject(n)}if(wc())return mn(),$t.push("/login"),Promise.reject(new Error("Token expired"));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error("Auth API Request Error:",e),Promise.reject(e)));Ec.interceptors.response.use(e=>e,e=>(e.response?.status===401&&(mn(),$t.currentRoute.value.path!=="/login"&&$t.push("/login")),console.error("Auth API Response Error:",e.response?.data||e.message),Promise.reject(e)));on.interceptors.request.use(async e=>{if(e.url?.includes("/auth/login"))return e;const t=hn();if(t){if(xc())try{const n=await kc();return e.headers.Authorization=`Bearer ${n}`,e}catch(n){return Promise.reject(n)}if(wc())return mn(),$t.push("/login"),Promise.reject(new Error("Token expired"));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error("API Request Error:",e),Promise.reject(e)));on.interceptors.response.use(e=>e,e=>(e.response?.status===401&&(mn(),$t.currentRoute.value.path!=="/login"&&$t.push("/login")),console.error("API Response Error:",e.response?.data||e.message),Promise.reject(e)));class tt{static async get(t,n){try{return(await on.get(t,{params:n})).data}catch(r){throw this.handleError(r)}}static async post(t,n,r){try{return(await on.post(t,n,r)).data}catch(s){throw this.handleError(s)}}static async put(t,n,r){try{return(await on.put(t,n,r)).data}catch(s){throw this.handleError(s)}}static async delete(t,n){try{return(await on.delete(t,n)).data}catch(r){throw this.handleError(r)}}static async getTransportKeys(){return this.get("transport_keys")}static async sendAdvert(){return this.post("send_advert",{},{headers:{"Content-Type":"application/json"}})}static async createTransportKey(t,n,r,s,o){const i={name:t,flood_policy:n,parent_id:s,last_used:o};return r!==void 0&&(i.transport_key=r),this.post("transport_keys",i)}static async getTransportKey(t){return this.get(`transport_key/${t}`)}static async updateTransportKey(t,n,r,s,o,i){return this.put(`transport_key/${t}`,{name:n,flood_policy:r,transport_key:s,parent_id:o,last_used:i})}static async deleteTransportKey(t){return this.delete(`transport_key/${t}`)}static async updateGlobalFloodPolicy(t){return this.post("global_flood_policy",{global_flood_allow:t})}static async getLogs(){try{return(await on.get("logs")).data}catch(t){throw this.handleError(t)}}static async deleteAdvert(t){return this.delete(`advert/${t}`)}static async pingNeighbor(t,n=10){return this.post("ping_neighbor",{target_id:t,timeout:n})}static async getIdentities(){return this.get("identities")}static async getIdentity(t){return this.get("identity",{name:t})}static async createIdentity(t){return this.post("create_identity",t)}static async updateIdentity(t){return this.put("update_identity",t)}static async deleteIdentity(t){return this.delete(`delete_identity?name=${encodeURIComponent(t)}`)}static async sendRoomServerAdvert(t){return this.post("send_room_server_advert",{name:t})}static async getACLInfo(){return this.get("acl_info")}static async getACLClients(t){return this.get("acl_clients",t)}static async removeACLClient(t){return this.post("acl_remove_client",t)}static async getACLStats(){return this.get("acl_stats")}static async getRoomMessages(t){return this.get("room_messages",t)}static async postRoomMessage(t){return this.post("room_post_message",t)}static async deleteRoomMessage(t){return this.delete(`room_message?room_name=${encodeURIComponent(t.room_name)}&message_id=${t.message_id}`)}static async clearRoomMessages(t){return this.delete(`room_messages?room_name=${encodeURIComponent(t)}`)}static async getRoomStats(t){return this.get("room_stats",t?{room_name:t}:void 0)}static async getRoomClients(t){return this.get("room_clients",{room_name:t})}static handleError(t){if(Ae.isAxiosError(t)){if(t.response){const n=t.response.data?.error||t.response.data?.message||`HTTP ${t.response.status}`;return new Error(n)}else if(t.request)return new Error("Network error - no response received")}return new Error(t instanceof Error?t.message:"Unknown error occurred")}}const gr=Ro("system",()=>{const e=ne(null),t=ne(!1),n=ne(null),r=ne(null),s=ne("forward"),o=ne(!0),i=ne(0),a=ne(10),c=ne(!1),u=ie(()=>e.value?.config?.node_name??"Unknown"),l=ie(()=>{const N=e.value?.public_key;return!N||N==="Unknown"?"Unknown":N.length>=16?`${N.slice(0,8)} ... ${N.slice(-8)}`:`${N}`}),d=ie(()=>e.value!==null),f=ie(()=>e.value?.version??"Unknown"),y=ie(()=>e.value?.core_version??"Unknown"),g=ie(()=>e.value?.noise_floor_dbm??null),b=ie(()=>a.value>0?Math.min(i.value/a.value*100,100):0),x=ie(()=>s.value==="monitor"?{text:"Monitor Mode",title:"Monitoring only - not forwarding packets"}:o.value?{text:"Active",title:"Forwarding with duty cycle enforcement"}:{text:"No Limits",title:"Forwarding without duty cycle enforcement"}),k=ie(()=>s.value==="monitor"?{active:!1,warning:!0}:{active:!0,warning:!1}),L=ie(()=>o.value?{active:!0,warning:!1}:{active:!1,warning:!0}),E=N=>{c.value=N};async function R(){try{t.value=!0,n.value=null;const N=await tt.get("/stats");if(N.success&&N.data)return e.value=N.data,r.value=new Date,H(N.data),N.data;if(N&&"version"in N){const Q=N;return e.value=Q,r.value=new Date,H(Q),Q}else throw new Error(N.error||"Failed to fetch stats")}catch(N){throw n.value=N instanceof Error?N.message:"Unknown error occurred",console.error("Error fetching stats:",N),N}finally{t.value=!1}}function H(N){if(N.config){const se=N.config.repeater?.mode;(se==="forward"||se==="monitor")&&(s.value=se);const j=N.config.duty_cycle;if(j){o.value=j.enforcement_enabled!==!1;const I=j.max_airtime_percent;typeof I=="number"?a.value=I:I&&typeof I=="object"&&"parsedValue"in I&&(a.value=I.parsedValue||10)}}const Q=N.utilization_percent;typeof Q=="number"?i.value=Q:Q&&typeof Q=="object"&&"parsedValue"in Q&&(i.value=Q.parsedValue||0)}async function ee(N){try{const Q=await tt.post("/set_mode",{mode:N});if(Q.success)return s.value=N,!0;throw new Error(Q.error||"Failed to set mode")}catch(Q){throw n.value=Q instanceof Error?Q.message:"Unknown error occurred",console.error("Error setting mode:",Q),Q}}async function G(N){try{const Q=await tt.post("/set_duty_cycle",{enabled:N});if(Q.success)return o.value=N,!0;throw new Error(Q.error||"Failed to set duty cycle")}catch(Q){throw n.value=Q instanceof Error?Q.message:"Unknown error occurred",console.error("Error setting duty cycle:",Q),Q}}async function J(){try{const N=await tt.post("/send_advert",{},{timeout:1e4});if(N.success)return console.log("Advertisement sent successfully:",N.data),!0;throw new Error(N.error||"Failed to send advert")}catch(N){throw n.value=N instanceof Error?N.message:"Unknown error occurred",console.error("Error sending advert:",N),N}}async function T(){const N=s.value==="forward"?"monitor":"forward";return await ee(N)}async function q(){return await G(!o.value)}function $(N){e.value=N,r.value=new Date,H(N)}async function v(N=5e3,Q=!1){Q||await R();let se=null;return Q||(se=setInterval(async()=>{try{await R()}catch(j){console.error("Auto-refresh error:",j)}},N)),()=>{se&&clearInterval(se)}}function O(){e.value=null,n.value=null,r.value=null,t.value=!1,s.value="forward",o.value=!0,i.value=0,a.value=10}return{stats:e,isLoading:t,error:n,lastUpdated:r,currentMode:s,dutyCycleEnabled:o,dutyCycleUtilization:i,dutyCycleMax:a,cadCalibrationRunning:c,nodeName:u,pubKey:l,hasStats:d,version:f,coreVersion:y,noiseFloorDbm:g,dutyCyclePercentage:b,statusBadge:x,modeButtonState:k,dutyCycleButtonState:L,fetchStats:R,setMode:ee,setDutyCycle:G,sendAdvert:J,toggleMode:T,toggleDutyCycle:q,startAutoRefresh:v,updateRealtimeStats:$,reset:O,setCadCalibrationRunning:E}}),Sc=Ro("packets",()=>{const e=ne(null),t=ne(null),n=ne([]),r=ne([]),s=ne(null),o=ne(!1),i=ne(null),a=ne(null),c=ne([]),u=ne([]),l=ne(null),d=ne({rx:0,tx:0,drop:0}),f=ne({rx:0,tx:0,drop:0}),y=ie(()=>e.value!==null),g=ie(()=>t.value!==null),b=ie(()=>n.value.length>0),x=ie(()=>r.value.length>0),k=ie(()=>s.value?.avg_noise_floor??0),L=ie(()=>e.value?.total_packets??0),E=ie(()=>e.value?.avg_rssi??0),R=ie(()=>e.value?.avg_snr??0),H=ie(()=>t.value?.uptime_seconds??0),ee=ie(()=>{if(!e.value?.packet_types)return[];const z=e.value.packet_types,D=z.reduce((w,Y)=>w+Y.count,0);return z.map(w=>({type:w.type.toString(),count:w.count,percentage:D>0?w.count/D*100:0}))}),G=ie(()=>{const z={};return n.value.forEach(D=>{z[D.type]||(z[D.type]=[]),z[D.type].push(D)}),z});async function J(){try{const z=await tt.get("/stats");if(z.success&&z.data){t.value=z.data;const D=new Date;return u.value.push({timestamp:D,stats:z.data}),u.value.length>50&&(u.value=u.value.slice(-50)),z.data}else if(z&&"version"in z){const D=z;t.value=D;const w=new Date;return u.value.push({timestamp:w,stats:D}),u.value.length>50&&(u.value=u.value.slice(-50)),D}else throw new Error(z.error||"Failed to fetch system stats")}catch(z){throw i.value=z instanceof Error?z.message:"Unknown error occurred",console.error("Error fetching system stats:",z),z}}async function T(z={hours:24}){try{const D=await tt.get("/noise_floor_history",z);if(D.success&&D.data&&D.data.history)return r.value=D.data.history,a.value=new Date,D.data.history;throw new Error(D.error||"Failed to fetch noise floor history")}catch(D){throw i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching noise floor history:",D),D}}async function q(z={hours:24}){try{const D=await tt.get("/noise_floor_stats",z);if(D.success&&D.data&&D.data.stats)return s.value=D.data.stats,a.value=new Date,D.data.stats;throw new Error(D.error||"Failed to fetch noise floor stats")}catch(D){throw i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching noise floor stats:",D),D}}const $=ie(()=>!r.value||!Array.isArray(r.value)?[]:r.value.slice(-50).map(z=>z.noise_floor_dbm));async function v(z={hours:24}){try{o.value=!0,i.value=null;const D=await tt.get("/packet_stats",z);if(D.success&&D.data){e.value=D.data;const w=new Date;c.value.push({timestamp:w,stats:D.data}),c.value.length>50&&(c.value=c.value.slice(-50)),a.value=w}else throw new Error(D.error||"Failed to fetch packet stats")}catch(D){i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching packet stats:",D)}finally{o.value=!1}}async function O(z={limit:100}){try{o.value=!0,i.value=null;const D=await tt.get("/recent_packets",z);if(D.success&&D.data)n.value=D.data,a.value=new Date;else throw new Error(D.error||"Failed to fetch recent packets")}catch(D){i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching recent packets:",D)}finally{o.value=!1}}async function N(z){try{o.value=!0,i.value=null;const D=await tt.get("/filtered_packets",z);if(D.success&&D.data)return n.value=D.data,a.value=new Date,D.data;throw new Error(D.error||"Failed to fetch filtered packets")}catch(D){throw i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching filtered packets:",D),D}finally{o.value=!1}}async function Q(z){try{o.value=!0,i.value=null;const D=await tt.get("/packet_by_hash",{packet_hash:z});if(D.success&&D.data)return D.data;throw new Error(D.error||"Packet not found")}catch(D){throw i.value=D instanceof Error?D.message:"Unknown error occurred",console.error("Error fetching packet by hash:",D),D}finally{o.value=!1}}const se=ie(()=>{if(!l.value?.series)return{totalPackets:[],transmittedPackets:[],droppedPackets:[],currentRates:d.value};const z=l.value.series.find(te=>te.type==="rx_count"),D=l.value.series.find(te=>te.type==="tx_count"),w=z?.data||[],Y=D?.data||[],K=w.map((te,he)=>{const p=Y[he];return p?Math.max(0,te[1]-p[1]):te[1]});return{totalPackets:w.map(te=>te[1]),transmittedPackets:Y.map(te=>te[1]),droppedPackets:K,currentRates:d.value}}),j=ie(()=>{const z=c.value,D=u.value;return{totalPackets:z.map(w=>w.stats.total_packets),transmittedPackets:z.map(w=>w.stats.transmitted_packets),droppedPackets:z.map(w=>w.stats.dropped_packets),avgRssi:z.map(w=>w.stats.avg_rssi),uptimeHours:D.map(w=>Math.floor((w.stats.uptime_seconds||0)/3600))}});async function I(z=3e4){await Promise.all([J(),v(),O(),T({hours:1}),q({hours:1})]);const D=setInterval(async()=>{try{await Promise.all([J(),v(),O(),T({hours:1}),q({hours:1})])}catch(w){console.error("Auto-refresh error:",w)}},z);return()=>clearInterval(D)}async function pe(){try{const z=await tt.get("/metrics_graph_data",{hours:24,resolution:"average",metrics:"rx_count,tx_count"});z?.success&&z.data&&(l.value=z.data)}catch(z){console.error("Failed to fetch sparkline data:",z)}}async function Fe(){await pe()}function Me(){pe()}function Re(){e.value=null,t.value=null,n.value=[],r.value=[],s.value=null,c.value=[],u.value=[],l.value=null,d.value={rx:0,tx:0,drop:0},f.value={rx:0,tx:0,drop:0},i.value=null,a.value=null,o.value=!1}function ot(z){n.value.unshift(z),n.value.length>1e3&&(n.value=n.value.slice(0,1e3))}function Xe(z){if(z.packet_stats){e.value=z.packet_stats;const D=new Date;c.value.push({timestamp:D,stats:z.packet_stats}),c.value.length>50&&(c.value=c.value.slice(-50))}if(z.system_stats){t.value=z.system_stats;const D=new Date;u.value.push({timestamp:D,stats:z.system_stats}),u.value.length>50&&(u.value=u.value.slice(-50))}a.value=new Date}return{packetStats:e,systemStats:t,recentPackets:n,noiseFloorHistory:r,noiseFloorStats:s,packetStatsHistory:c,systemStatsHistory:u,isLoading:o,error:i,lastUpdated:a,hasPacketStats:y,hasSystemStats:g,hasRecentPackets:b,hasNoiseFloorData:x,currentNoiseFloor:k,totalPackets:L,averageRSSI:E,averageSNR:R,uptime:H,packetTypeBreakdown:ee,recentPacketsByType:G,sparklineData:se,legacySparklineData:j,noiseFloorSparklineData:$,interpolatedRates:d,fetchSystemStats:J,fetchPacketStats:v,fetchRecentPackets:O,fetchFilteredPackets:N,getPacketByHash:Q,fetchNoiseFloorHistory:T,fetchNoiseFloorStats:q,startAutoRefresh:I,initializeSparklineHistory:Fe,interpolateRates:Me,reset:Re,addRealtimePacket:ot,updateRealtimeStats:Xe}}),p0=Ro("websocket",()=>{const e=ne(null),t=ne(!1),n=ne(0),r=ne(null),s=ne(Date.now()),o=Sc(),i=gr();function a(){let u;{const l=window.location.protocol==="https:"?"wss:":"ws:",d=Kr?.trim()?new URL(Kr).host:window.location.host;u=`${l}//${d}/ws/packets`}e.value=new WebSocket(u),e.value.onopen=()=>{console.log("[WebSocket] Connected"),t.value=!0,n.value=0,s.value=Date.now(),r.value&&clearInterval(r.value),r.value=window.setInterval(()=>{e.value?.readyState===WebSocket.OPEN&&(e.value.send(JSON.stringify({type:"ping"})),Date.now()-s.value>6e4&&(console.warn("[WebSocket] No pong received, reconnecting..."),c(),a()))},3e4)},e.value.onmessage=l=>{try{const d=JSON.parse(l.data);d.type==="packet"?o.addRealtimePacket(d.data):d.type==="packet_stats"?o.updateRealtimeStats(d.data):d.type==="system_stats"?i.updateRealtimeStats(d.data):(d.type==="pong"||d.type==="ping")&&(s.value=Date.now(),d.type==="ping"&&e.value?.readyState===WebSocket.OPEN&&e.value.send(JSON.stringify({type:"pong"})))}catch(d){console.error("[WebSocket] Parse error:",d)}},e.value.onerror=()=>{if(console.log("[WebSocket] Error"),t.value=!1,e.value=null,r.value&&(clearInterval(r.value),r.value=null),n.value<20){const l=Math.min(1e3*Math.pow(2,Math.min(n.value,5)),3e4);console.log(`[WebSocket] Reconnecting in ${l}ms (attempt ${n.value+1})`),n.value++,setTimeout(a,l)}else console.error("[WebSocket] Max reconnection attempts reached")},e.value.onclose=()=>{console.log("[WebSocket] Disconnected"),t.value=!1,e.value=null,r.value&&(clearInterval(r.value),r.value=null),n.value=0,setTimeout(a,3e3)}}function c(){e.value&&(e.value.close(),e.value=null),t.value=!1}return{isConnected:t,connect:a,disconnect:c}}),je=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},h0={},m0={width:"23",height:"25",viewBox:"0 0 23 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g0(e,t){return M(),F("svg",m0,t[0]||(t[0]=[h("path",{d:"M2.84279 2.25795C2.90709 1.12053 3.17879 0.625914 3.95795 0.228723C4.79631 -0.198778 6.11858 0.000168182 7.67449 0.788054C8.34465 1.12757 8.41289 1.13448 9.58736 0.983905C11.1485 0.783681 13.1582 0.784388 14.5991 0.985738C15.6887 1.13801 15.7603 1.1304 16.4321 0.790174C18.6406 -0.328212 20.3842 -0.255036 21.0156 0.982491C21.3308 1.6002 21.3893 3.20304 21.1449 4.52503C21.0094 5.25793 21.0238 5.34943 21.3502 5.83037C23.6466 9.21443 21.9919 14.6998 18.0569 16.7469C17.7558 16.9036 17.502 17.0005 17.2952 17.0795C16.6602 17.3219 16.4674 17.3956 16.7008 18.5117C16.8132 19.0486 16.9486 20.3833 17.0018 21.478C17.098 23.4567 17.0966 23.4705 16.7495 23.8742C16.2772 24.4233 15.5963 24.4326 15.135 23.8962C14.8341 23.5464 14.8047 23.3812 14.8047 22.0315C14.8047 20.037 14.5861 18.7113 14.0695 17.5753C13.4553 16.2235 13.9106 15.7194 15.3154 15.4173C17.268 14.9973 18.793 13.7923 19.643 11.9978C20.4511 10.2921 20.5729 7.93485 19.1119 6.50124C18.6964 6.00746 18.6674 5.56022 18.9641 4.21159C19.075 3.70754 19.168 3.05725 19.1707 2.76637C19.1749 2.30701 19.1331 2.23764 18.8509 2.23764C18.6724 2.23764 17.9902 2.49736 17.3352 2.81474L16.2897 3.32145C16.1947 3.36751 16.0883 3.38522 15.9834 3.37318C13.3251 3.06805 10.7991 3.06334 8.12774 3.37438C8.02244 3.38663 7.91563 3.36892 7.82025 3.32263L6.77535 2.81559C6.12027 2.49764 5.43813 2.23764 5.25963 2.23764C4.84693 2.23764 4.84072 2.54233 5.2169 4.35258C5.44669 5.45816 5.60133 5.70451 4.93703 6.58851C3.94131 7.91359 3.69258 9.55902 4.22654 11.2878C4.89952 13.4664 6.54749 14.9382 8.86436 15.4292C10.261 15.7253 10.6261 16.1115 10.0928 17.713C9.67293 18.9734 9.40748 19.2982 8.79738 19.2982C7.97649 19.2982 7.46228 18.5871 7.74527 17.843C7.86991 17.5151 7.83283 17.4801 7.06383 17.1996C4.71637 16.3437 2.9209 14.4254 2.10002 11.8959C1.46553 9.94098 1.74471 7.39642 2.76257 5.85843C3.10914 5.33477 3.1145 5.29036 2.95277 4.28787C2.86126 3.72037 2.81177 2.80699 2.84279 2.25795Z",fill:"currentColor"},null,-1),h("path",{d:"M2.02306 16.5589C1.68479 16.0516 0.999227 15.9144 0.491814 16.2527C-0.0155884 16.591 -0.152708 17.2765 0.185564 17.7839C0.435301 18.1586 0.734065 18.4663 0.987777 18.72C1.03455 18.7668 1.08 18.8119 1.12438 18.856C1.3369 19.0671 1.52455 19.2535 1.71302 19.4748C2.12986 19.964 2.54572 20.623 2.78206 21.8047C2.88733 22.3311 3.26569 22.6147 3.47533 22.7386C3.70269 22.8728 3.9511 22.952 4.15552 23.0036C4.57369 23.109 5.08133 23.1638 5.56309 23.1957C6.09196 23.2308 6.665 23.2422 7.17743 23.2453C7.1778 23.8547 7.67202 24.3487 8.28162 24.3487C8.89146 24.3487 9.38582 23.8543 9.38582 23.2445V22.1403C9.38582 21.5305 8.89146 21.0361 8.28162 21.0361C8.17753 21.0361 8.06491 21.0364 7.94562 21.0369C7.29761 21.0389 6.45295 21.0414 5.70905 20.9922C5.35033 20.9684 5.05544 20.9347 4.8392 20.8936C4.50619 19.5863 3.96821 18.7165 3.39415 18.0426C3.14038 17.7448 2.87761 17.4842 2.66387 17.2722C2.62385 17.2326 2.58556 17.1946 2.54935 17.1584C2.30273 16.9118 2.1414 16.7365 2.02306 16.5589Z",fill:"currentColor"},null,-1)]))}const y0=je(h0,[["render",g0]]),v0={},b0={width:"17",height:"24",viewBox:"0 0 17 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C0(e,t){return M(),F("svg",b0,t[0]||(t[0]=[At('',12)]))}const _0=je(v0,[["render",C0]]),w0={class:"glass-card p-5 relative overflow-hidden"},x0={key:0,class:"absolute inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-10 rounded-lg"},k0={class:"flex items-baseline gap-2 mb-4"},E0={class:"text-content-primary dark:text-content-primary text-2xl font-medium"},S0=["viewBox"],A0=["y1","y2"],R0=["cx","cy"],$s=200,Hn=50,xr=4,T0=ht({__name:"RFNoiseFloor",props:{limit:{default:void 0}},setup(e){const t=e,n=Sc(),r=gr(),s=ne(null),o=(l,d)=>{const f=d/100*(l.length-1),y=Math.floor(f),g=Math.ceil(f);return y===g?l[y]:l[y]+(l[g]-l[y])*(f-y)},i=ie(()=>{const l=u.value;if(l.length===0)return[];const d=[...l].sort((E,R)=>E-R),f=o(d,2.5),y=o(d,97.5),g=y-f,b=Math.max(g*.05,.5),x=f-b,k=y+b,L=k-x||1;return l.map((E,R)=>{const H=xr+R/Math.max(l.length-1,1)*($s-xr*2),G=(Math.max(x,Math.min(k,E))-x)/L,J=Hn-xr-G*(Hn-xr*2);return{x:H,y:J}})}),a=async()=>{try{const l={hours:1};t.limit&&(l.limit=t.limit),await Promise.all([n.fetchNoiseFloorHistory(l),n.fetchNoiseFloorStats({hours:1})])}catch(l){console.error("Error fetching noise floor data:",l)}};Mn(()=>{a(),s.value=window.setInterval(a,5e3)}),ns(()=>{s.value&&clearInterval(s.value)});const c=ie(()=>{const l=n.noiseFloorSparklineData;return l&&l.length>0?l[l.length-1]:n.noiseFloorStats?.avg_noise_floor??-116}),u=ie(()=>n.noiseFloorSparklineData);return(l,d)=>(M(),F("div",w0,[ue(r).cadCalibrationRunning?(M(),F("div",x0,d[0]||(d[0]=[At('
CAD Calibration

In Progress

',1)]))):me("",!0),d[2]||(d[2]=h("p",{class:"text-content-secondary dark:text-content-muted text-xs uppercase mb-2"},"RF NOISE FLOOR",-1)),h("div",k0,[h("span",E0,X(c.value),1),d[1]||(d[1]=h("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase"},"dBm",-1))]),(M(),F("svg",{class:"w-full h-[50px]",viewBox:`0 0 ${$s} ${Hn}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},[(M(),F(Se,null,at(3,f=>h("line",{key:"grid-"+f,x1:0,y1:f*Hn/4,x2:$s,y2:f*Hn/4,stroke:"rgba(255, 255, 255, 0.1)","stroke-width":"1"},null,8,A0)),64)),(M(!0),F(Se,null,at(i.value,(f,y)=>(M(),F("circle",{key:"point-"+y,cx:f.x,cy:f.y,r:"2.5",fill:"rgba(245, 158, 11, 0.8)",class:"transition-all duration-300"},null,8,R0))),128))],8,S0))]))}}),Ac=je(T0,[["__scopeId","data-v-5a27fd6f"]]),O0=Object.freeze(Object.defineProperty({__proto__:null,default:Ac},Symbol.toStringTag,{value:"Module"})),M0={},P0={width:"800px",height:"800px",viewBox:"0 -1.5 20 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"w-full h-full"};function L0(e,t){return M(),F("svg",P0,t[0]||(t[0]=[h("g",{id:"Page-1",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[h("g",{transform:"translate(-420.000000, -3641.000000)",fill:"currentColor"},[h("g",{id:"icons",transform:"translate(56.000000, 160.000000)"},[h("path",{d:"M378.195439,3483.828 L376.781439,3485.242 C378.195439,3486.656 378.294439,3489.588 376.880439,3491.002 L378.294439,3492.417 C380.415439,3490.295 380.316439,3485.949 378.195439,3483.828 M381.023439,3481 L379.609439,3482.414 C382.438439,3485.242 382.537439,3491.002 379.708439,3493.831 L381.122439,3495.245 C385.365439,3491.002 384.559439,3484.535 381.023439,3481 M375.432439,3486.737 C375.409439,3486.711 375.392439,3486.682 375.367439,3486.656 L375.363439,3486.66 C374.582439,3485.879 373.243439,3485.952 372.536439,3486.659 C371.829439,3487.366 371.831439,3488.778 372.538439,3489.485 C372.547439,3489.494 372.558439,3489.499 372.567439,3489.508 C372.590439,3489.534 372.607439,3489.563 372.632439,3489.588 L372.636439,3489.585 C373.201439,3490.15 373.000439,3488.284 373.000439,3498 L375.000439,3498 C375.000439,3488.058 374.753439,3490.296 375.463439,3489.586 C376.170439,3488.879 376.168439,3487.467 375.461439,3486.76 C375.452439,3486.751 375.441439,3486.746 375.432439,3486.737 M371.119439,3485.242 L369.705439,3483.828 C367.584439,3485.949 367.683439,3490.295 369.804439,3492.417 L371.218439,3491.002 C369.804439,3489.588 369.705439,3486.656 371.119439,3485.242 M368.390439,3493.831 L366.976439,3495.245 C363.440439,3491.709 362.634439,3485.242 366.877439,3481 L368.291439,3482.414 C365.462439,3485.242 365.561439,3491.002 368.390439,3493.831",id:"radio_tower-[#1019]"})])])],-1)]))}const N0=je(M0,[["render",L0]]),I0={class:"text-center"},D0={class:"relative flex items-center justify-center mb-8"},$0={class:"relative w-32 h-32"},F0={class:"absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"},V0={key:0,class:"absolute inset-0 flex items-center justify-center"},B0={key:1,class:"absolute inset-0 flex items-center justify-center"},H0={key:2,class:"absolute inset-0"},j0={class:"mb-6"},U0={key:0,class:"text-content-primary dark:text-content-primary text-lg"},q0={key:1,class:"text-accent-green text-lg font-medium"},K0={key:2,class:"text-secondary text-lg"},W0={key:3,class:"text-accent-red text-lg"},G0={key:4,class:"text-content-secondary dark:text-content-muted"},Z0={key:5,class:"mt-3"},z0={key:0,class:"text-secondary text-sm"},J0={key:1,class:"text-accent-red text-sm"},Y0={key:0,class:"flex gap-3"},Q0={key:1,class:"text-content-muted text-sm"},X0=ht({name:"AdvertModal",__name:"AdvertModal",props:{isOpen:{type:Boolean},isLoading:{type:Boolean},isSuccess:{type:Boolean},error:{default:null}},emits:["close","send"],setup(e,{emit:t}){const n=e,r=t,s=ne(!1),o=ne(!1),i=ne(!1);Lt(()=>n.isOpen,l=>{l?(s.value=!0,setTimeout(()=>{o.value=!0},50)):(o.value=!1,i.value=!1,setTimeout(()=>{s.value=!1},300))},{immediate:!0}),Lt(()=>n.isLoading,l=>{l||setTimeout(()=>{i.value=!1},1e3)});const a=()=>{n.isLoading||r("close")},c=()=>{n.isLoading||(i.value=!0,r("send"))},u=l=>l?.includes("Network error - no response received")||l?.includes("timeout");return(l,d)=>(M(),nt(Nu,{to:"body"},[s.value?(M(),F("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:Js(a,["self"])},[h("div",{class:le(["absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-300",o.value?"opacity-100":"opacity-0"])},null,2),h("div",{class:le(["relative bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-8 max-w-md w-full transform transition-all duration-300 border border-stroke-subtle dark:border-white/10",o.value?"scale-100 opacity-100":"scale-95 opacity-0"])},[l.isLoading?me("",!0):(M(),F("button",{key:0,onClick:a,class:"absolute top-4 right-4 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors p-2"},d[0]||(d[0]=[h("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))),h("div",I0,[d[6]||(d[6]=h("h2",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-6"},"Send Advertisement",-1)),h("div",D0,[h("div",$0,[h("div",F0,[ve(N0,{class:le(["w-16 h-16 transition-all duration-500",[l.isLoading?"animate-pulse":"",l.isSuccess?"text-accent-green":l.error&&!u(l.error)?"text-accent-red":"text-primary"]]),style:On({filter:l.isLoading?"drop-shadow(0 0 8px currentColor)":l.isSuccess?"drop-shadow(0 0 8px #A5E5B6)":l.error&&!u(l.error)?"drop-shadow(0 0 8px #FB787B)":"drop-shadow(0 0 4px #AAE8E8)"})},null,8,["class","style"])]),l.isLoading||l.isSuccess?(M(),F("div",V0,[h("div",{class:le(["absolute w-16 h-16 rounded-full border-2 animate-ping",[l.isSuccess?"border-accent-green/60":"border-primary/60"]]),style:{"animation-duration":"1.5s"}},null,2),h("div",{class:le(["absolute w-24 h-24 rounded-full border-2 animate-ping",[l.isSuccess?"border-accent-green/40":"border-primary/40"]]),style:{"animation-duration":"2s","animation-delay":"0.3s"}},null,2),h("div",{class:le(["absolute w-32 h-32 rounded-full border-2 animate-ping",[l.isSuccess?"border-accent-green/20":"border-primary/20"]]),style:{"animation-duration":"2.5s","animation-delay":"0.6s"}},null,2)])):me("",!0),i.value?(M(),F("div",B0,d[1]||(d[1]=[h("div",{class:"absolute w-8 h-8 rounded-full border-4 border-secondary animate-ping-fast"},null,-1),h("div",{class:"absolute w-16 h-16 rounded-full border-3 border-secondary/70 animate-ping-fast",style:{"animation-delay":"0.1s"}},null,-1),h("div",{class:"absolute w-24 h-24 rounded-full border-2 border-secondary/50 animate-ping-fast",style:{"animation-delay":"0.2s"}},null,-1),h("div",{class:"absolute w-32 h-32 rounded-full border-2 border-secondary/30 animate-ping-fast",style:{"animation-delay":"0.3s"}},null,-1)]))):me("",!0),l.isLoading||l.isSuccess?(M(),F("div",H0,[h("div",{class:le(["absolute top-2 right-2 w-4 h-4 rounded-full transition-all duration-500 animate-pulse",[l.isSuccess?"bg-accent-green shadow-lg shadow-accent-green/50":"bg-primary/70 shadow-lg shadow-primary/30"]]),style:{"animation-delay":"0.5s"}},d[2]||(d[2]=[h("div",{class:"w-2 h-2 bg-white rounded-full mx-auto mt-1"},null,-1)]),2),h("div",{class:le(["absolute bottom-2 left-2 w-4 h-4 rounded-full transition-all duration-500 animate-pulse",[l.isSuccess?"bg-accent-green shadow-lg shadow-accent-green/50":"bg-primary/70 shadow-lg shadow-primary/30"]]),style:{"animation-delay":"1s"}},d[3]||(d[3]=[h("div",{class:"w-2 h-2 bg-white rounded-full mx-auto mt-1"},null,-1)]),2),h("div",{class:le(["absolute top-1/2 right-1 w-4 h-4 rounded-full transition-all duration-500 animate-pulse",[l.isSuccess?"bg-accent-green shadow-lg shadow-accent-green/50":"bg-primary/70 shadow-lg shadow-primary/30"]]),style:{"animation-delay":"1.5s",transform:"translateY(-50%)"}},d[4]||(d[4]=[h("div",{class:"w-2 h-2 bg-white rounded-full mx-auto mt-1"},null,-1)]),2),h("div",{class:le(["absolute top-3 left-3 w-4 h-4 rounded-full transition-all duration-500 animate-pulse",[l.isSuccess?"bg-accent-green shadow-lg shadow-accent-green/50":"bg-primary/70 shadow-lg shadow-primary/30"]]),style:{"animation-delay":"2s"}},d[5]||(d[5]=[h("div",{class:"w-2 h-2 bg-white rounded-full mx-auto mt-1"},null,-1)]),2)])):me("",!0)])]),h("div",j0,[l.isLoading?(M(),F("p",U0," Broadcasting advertisement... ")):l.isSuccess?(M(),F("p",q0," Advertisement sent successfully! ")):l.error&&u(l.error)?(M(),F("p",K0," Advertisement likely sent ")):l.error?(M(),F("p",W0," Failed to send advertisement ")):(M(),F("p",G0," This will broadcast your node's presence to nearby nodes. ")),l.error?(M(),F("div",Z0,[u(l.error)?(M(),F("p",z0," Network timeout occurred, but the advertisement may have been successfully transmitted to nearby nodes. ")):(M(),F("p",J0,X(l.error),1))])):me("",!0)]),!l.isLoading&&!l.isSuccess?(M(),F("div",Y0,[h("button",{onClick:a,class:"flex-1 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 hover:border-primary rounded-[10px] px-6 py-3 text-content-primary dark:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 transition-all duration-200"}," Cancel "),h("button",{onClick:c,class:le(["flex-1 rounded-[10px] px-6 py-3 font-medium transition-all duration-200 shadow-lg",[l.error&&u(l.error)?"bg-secondary hover:bg-secondary/90 text-background hover:shadow-secondary/20":"bg-primary hover:bg-primary/90 text-background hover:shadow-primary/20"]])},X(l.error&&u(l.error)?"Try Again":"Send Advertisement"),3)])):me("",!0),l.isSuccess?(M(),F("div",Q0," Closing automatically... ")):me("",!0)])],2)])):me("",!0)]))}}),Rc=je(X0,[["__scopeId","data-v-2eb89c71"]]),e3={},t3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function n3(e,t){return M(),F("svg",t3,t[0]||(t[0]=[At('',2)]))}const Wr=je(e3,[["render",n3]]),r3={},s3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o3(e,t){return M(),F("svg",s3,t[0]||(t[0]=[At('',9)]))}const Tc=je(r3,[["render",o3]]),i3={},a3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l3(e,t){return M(),F("svg",a3,t[0]||(t[0]=[At('',2)]))}const Oc=je(i3,[["render",l3]]),c3={},u3={width:"11",height:"14",viewBox:"0 0 11 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function d3(e,t){return M(),F("svg",u3,t[0]||(t[0]=[h("path",{d:"M9.81633 1.99133L8.5085 0.683492C8.29229 0.466088 8.03511 0.293723 7.75185 0.176372C7.46859 0.059021 7.16486 -0.000985579 6.85825 -0.000175002H1.75C1.28587 -0.000175002 0.840752 0.184199 0.512563 0.512388C0.184375 0.840577 0 1.2857 0 1.74983V13.9998H10.5V3.64099C10.4985 3.02248 10.2528 2.4296 9.81633 1.99133ZM8.9915 2.81616C9.02083 2.84799 9.04829 2.88149 9.07375 2.91649H7.58333V1.42608C7.61834 1.45153 7.65184 1.479 7.68367 1.50833L8.9915 2.81616ZM1.16667 12.8332V1.74983C1.16667 1.59512 1.22812 1.44674 1.33752 1.33735C1.44692 1.22795 1.59529 1.16649 1.75 1.16649H6.41667V4.08316H9.33333V12.8332H1.16667ZM2.33333 9.33316H8.16667V5.83316H2.33333V9.33316ZM3.5 6.99983H7V8.16649H3.5V6.99983ZM2.33333 10.4998H8.16667V11.6665H2.33333V10.4998Z",fill:"currentColor"},null,-1)]))}const Mc=je(c3,[["render",d3]]),f3={},p3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function h3(e,t){return M(),F("svg",p3,t[0]||(t[0]=[h("path",{d:"M12.25 0H1.75C1.28587 0 0.840752 0.184375 0.512563 0.512563C0.184375 0.840752 0 1.28587 0 1.75V12.25C0 12.7141 0.184375 13.1592 0.512563 13.4874C0.840752 13.8156 1.28587 14 1.75 14H12.25C12.7141 14 13.1592 13.8156 13.4874 13.4874C13.8156 13.1592 14 12.7141 14 12.25V1.75C14 1.28587 13.8156 0.840752 13.4874 0.512563C13.1592 0.184375 12.7141 0 12.25 0ZM12.8333 12.25C12.8333 12.4047 12.7719 12.5531 12.6625 12.6625C12.5531 12.7719 12.4047 12.8333 12.25 12.8333H1.75C1.59529 12.8333 1.44692 12.7719 1.33752 12.6625C1.22812 12.5531 1.16667 12.4047 1.16667 12.25V1.75C1.16667 1.59529 1.22812 1.44692 1.33752 1.33752C1.44692 1.22812 1.59529 1.16667 1.75 1.16667H12.25C12.4047 1.16667 12.5531 1.22812 12.6625 1.33752C12.7719 1.44692 12.8333 1.59529 12.8333 1.75V12.25ZM3.23583 7.41317L5.23583 9.41317C5.29134 9.46685 5.35738 9.50892 5.43004 9.53689C5.5027 9.56485 5.58055 9.57812 5.65892 9.57579C5.73729 9.57347 5.81418 9.5556 5.88513 9.52325C5.95608 9.4909 6.01963 9.44476 6.07175 9.38792C6.12387 9.33108 6.16351 9.26467 6.18833 9.19237C6.21315 9.12007 6.22263 9.04335 6.21618 8.96725C6.20973 8.89115 6.18746 8.81722 6.15078 8.74965C6.11411 8.68207 6.06376 8.62223 6.00292 8.57383L4.66708 7.23617L6.00292 5.90033C6.10827 5.78972 6.16669 5.64161 6.16522 5.48792C6.16375 5.33423 6.10251 5.1873 5.99491 5.07882C5.88731 4.97034 5.74082 4.90791 5.58716 4.90522C5.4335 4.90254 5.28489 4.95982 5.17367 5.06417L3.17367 7.06417C3.06317 7.17386 3.00063 7.32313 3.00063 7.47867C3.00063 7.63421 3.06317 7.78348 3.17367 7.89317L3.23583 7.41317ZM8.75 10.5H7.58333C7.4286 10.5 7.28025 10.5615 7.17085 10.6709C7.06146 10.7803 7 10.9286 7 11.0833C7 11.2381 7.06146 11.3864 7.17085 11.4958C7.28025 11.6052 7.4286 11.6667 7.58333 11.6667H8.75C8.90473 11.6667 9.05308 11.6052 9.16248 11.4958C9.27188 11.3864 9.33333 11.2381 9.33333 11.0833C9.33333 10.9286 9.27188 10.7803 9.16248 10.6709C9.05308 10.5615 8.90473 10.5 8.75 10.5Z",fill:"currentColor"},null,-1)]))}const Pc=je(f3,[["render",h3]]),m3={},g3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y3(e,t){return M(),F("svg",g3,t[0]||(t[0]=[At('',2)]))}const Lc=je(m3,[["render",y3]]),v3={name:"SystemIcon"},b3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C3(e,t,n,r,s,o){return M(),F("svg",b3,t[0]||(t[0]=[At('',5)]))}const Gr=je(v3,[["render",C3]]),_3={},w3={width:"11",height:"14",viewBox:"0 0 11 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x3(e,t){return M(),F("svg",w3,t[0]||(t[0]=[h("path",{d:"M10.5 14.0004H9.33333V11.0586C9.33287 10.6013 9.15099 10.1628 8.82761 9.83942C8.50422 9.51603 8.06575 9.33415 7.60842 9.33369H2.89158C2.43425 9.33415 1.99578 9.51603 1.67239 9.83942C1.34901 10.1628 1.16713 10.6013 1.16667 11.0586V14.0004H0V11.0586C0.000926233 10.292 0.305872 9.55705 0.847948 9.01497C1.39002 8.47289 2.12497 8.16795 2.89158 8.16702H7.60842C8.37503 8.16795 9.10998 8.47289 9.65205 9.01497C10.1941 9.55705 10.4991 10.292 10.5 11.0586V14.0004Z",fill:"currentColor"},null,-1),h("path",{d:"M5.25 6.99997C4.55777 6.99997 3.88108 6.7947 3.30551 6.41011C2.72993 6.02553 2.28133 5.4789 2.01642 4.83936C1.75152 4.19982 1.6822 3.49609 1.81725 2.81716C1.9523 2.13822 2.28564 1.51458 2.77513 1.0251C3.26461 0.535614 3.88825 0.202271 4.56719 0.0672226C5.24612 -0.0678257 5.94985 0.00148598 6.58939 0.266393C7.22894 0.531299 7.77556 0.979903 8.16015 1.55548C8.54473 2.13105 8.75 2.80774 8.75 3.49997C8.74908 4.42794 8.38003 5.31765 7.72385 5.97382C7.06768 6.63 6.17798 6.99904 5.25 6.99997ZM5.25 1.16664C4.78851 1.16664 4.33739 1.30349 3.95367 1.55988C3.56996 1.81627 3.27089 2.18068 3.09428 2.60704C2.91768 3.0334 2.87147 3.50256 2.9615 3.95518C3.05153 4.4078 3.27376 4.82357 3.60009 5.14989C3.92641 5.47621 4.34217 5.69844 4.79479 5.78847C5.24741 5.8785 5.71657 5.83229 6.14293 5.65569C6.56929 5.47909 6.93371 5.18002 7.1901 4.7963C7.44649 4.41259 7.58334 3.96146 7.58334 3.49997C7.58334 2.88113 7.3375 2.28764 6.89992 1.85006C6.46233 1.41247 5.86884 1.16664 5.25 1.16664Z",fill:"currentColor"},null,-1)]))}const Nc=je(_3,[["render",x3]]),k3={},E3={width:"11",height:"13",viewBox:"0 0 11 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function S3(e,t){return M(),F("svg",E3,t[0]||(t[0]=[h("path",{d:"M6.77889 9.16667H10.1122V12.5M4.11222 3.83333H0.77889V0.5M10.3906 4.50227C10.0168 3.57711 9.39097 2.77536 8.58423 2.18815C7.77749 1.60094 6.82233 1.25168 5.82707 1.18034C4.8318 1.109 3.83627 1.31827 2.95402 1.78441C2.07177 2.25055 1.3381 2.95503 0.836182 3.81742M0.500244 8.49805C0.874034 9.42321 1.49986 10.225 2.30661 10.8122C3.11335 11.3994 4.06948 11.7482 5.06474 11.8195C6.06001 11.8909 7.05473 11.6816 7.93697 11.2155C8.81922 10.7494 9.55239 10.045 10.0543 9.18262",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Ic=je(k3,[["render",S3]]),A3={},R3={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T3(e,t){return M(),F("svg",R3,t[0]||(t[0]=[At('',2)]))}const Dc=je(A3,[["render",T3]]),O3={class:"w-[285px] flex-shrink-0 p-[15px] hidden lg:block"},M3={class:"glass-card h-full p-6"},P3={class:"mb-12"},L3={class:"text-content-secondary dark:text-content-muted text-sm"},N3=["title"],I3={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},D3={class:"mb-8"},$3={class:"mb-8"},F3={class:"space-y-2"},V3=["onClick"],B3={class:"mb-8"},H3={class:"space-y-2"},j3=["onClick"],U3={class:"mb-8"},q3={class:"space-y-2"},K3=["onClick"],W3={class:"mb-8"},G3={class:"space-y-2"},Z3=["onClick"],z3=["disabled"],J3={class:"flex items-center gap-3"},Y3=["disabled"],Q3={class:"flex items-center gap-3"},X3={class:"mb-4"},ep={key:0,class:"mb-2 glass-card px-3 py-2 rounded-lg border border-blue-500/30 dark:border-blue-400/50 bg-blue-500/10 dark:bg-blue-400/20"},tp={class:"flex items-center gap-2"},np={key:0,class:"mt-2 glass-card px-3 py-2 rounded-lg border border-stroke-subtle dark:border-stroke/30 space-y-2 text-xs animate-fade-in"},rp={class:"space-y-1"},sp={class:"flex items-center justify-between"},op={class:"text-content-primary dark:text-content-primary font-mono"},ip={key:0,class:"pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted"},ap={key:0,class:"flex items-center gap-1"},lp={class:"bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded"},cp={class:"space-y-1"},up={class:"flex items-center justify-between"},dp={class:"text-content-primary dark:text-content-primary font-mono"},fp={key:0,class:"pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted"},pp={key:0,class:"flex items-center gap-1"},hp={class:"bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded"},mp={key:0,class:"mb-4"},gp={class:"text-content-secondary dark:text-content-muted text-xs mb-2"},yp={class:"text-content-primary dark:text-content-primary"},vp={class:"w-full h-1 bg-white/10 rounded-full overflow-hidden"},bp={class:"flex items-center gap-2 text-content-secondary dark:text-content-muted text-xs mb-3"},Cp={class:"flex items-center justify-center gap-3"},_p={href:"https://github.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-primary/20 dark:hover:bg-primary/30 hover:border-primary/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"GitHub"},wp={href:"https://buymeacoffee.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-yellow-50 dark:hover:bg-yellow-500/20 hover:border-yellow-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"Buy Me a Coffee"},xp=ht({name:"SidebarNav",__name:"Sidebar",setup(e){const t=Mo(),n=Po(),r=gr(),s=p0(),o=ne(!1),i=ne(!1),a=ne(!1),c=ne(!1),u=ne(!1),l=ne(null);let d=null;Mn(async()=>{d=await r.startAutoRefresh(5e3,s.isConnected)}),rs(()=>{d&&d()});const f={dashboard:Tc,neighbors:Nc,statistics:Lc,"system-stats":Gr,sessions:Gr,configuration:Wr,"room-servers":Wr,logs:Mc,terminal:Pc,help:Oc},y=[{name:"Dashboard",icon:"dashboard",route:"/"},{name:"Neighbors",icon:"neighbors",route:"/neighbors"},{name:"Statistics",icon:"statistics",route:"/statistics"},{name:"System Stats",icon:"system-stats",route:"/system-stats"},{name:"Sessions",icon:"sessions",route:"/sessions"},{name:"Configuration",icon:"configuration",route:"/configuration"},{name:"Terminal",icon:"terminal",route:"/terminal"},{name:"Room Servers",icon:"room-servers",route:"/room-servers"},{name:"Logs",icon:"logs",route:"/logs"},{name:"Help",icon:"help",route:"/help"}],g=ie(()=>$=>n.path===$),b=$=>{t.push($)},x=async()=>{o.value=!0,l.value=null;try{await r.sendAdvert(),u.value=!0,setTimeout(()=>{k()},2e3)}catch($){l.value=$ instanceof Error?$.message:"Unknown error occurred",console.error("Failed to send advert:",$)}finally{o.value=!1}},k=()=>{c.value=!1,u.value=!1,l.value=null,o.value=!1},L=async()=>{if(!i.value){i.value=!0;try{await r.toggleMode()}catch($){console.error("Failed to toggle mode:",$)}finally{i.value=!1}}},E=async()=>{if(!a.value){a.value=!0;try{await r.toggleDutyCycle()}catch($){console.error("Failed to toggle duty cycle:",$)}finally{a.value=!1}}},R=ne(new Date().toLocaleTimeString());setInterval(()=>{R.value=new Date().toLocaleTimeString()},1e3);const H=ie(()=>{const $=r.dutyCyclePercentage;let v="#A5E5B6";return $>90?v="#FB787B":$>70&&(v="#FFC246"),{width:$===0?"2px":`${Math.max($,2)}%`,backgroundColor:v}}),ee=ne(!1),G=ie(()=>r.version.includes("dev")||r.coreVersion.includes("dev")),J=$=>{const v=$.match(/^([\d.]+)(\.dev(\d+))?((\+g)([a-f0-9]+))?$/);return v?{base:v[1],isDev:!!v[2],devNumber:v[3]||null,commit:v[6]||null}:{base:$,isDev:!1,devNumber:null,commit:null}},T=ie(()=>J(r.version)),q=ie(()=>J(r.coreVersion));return($,v)=>(M(),F(Se,null,[h("aside",O3,[h("div",M3,[h("div",P3,[v[2]||(v[2]=h("div",{class:"mb-2 flex justify-center"},[h("img",{src:Mf,alt:"MeshCore",class:"h-4 opacity-80 dark:invert-0 invert"})],-1)),v[3]||(v[3]=h("h1",{class:"text-content-primary dark:text-content-primary text-[22px] font-extrabold tracking-tight mb-3 text-center",style:{"font-family":"system-ui, -apple-system, sans-serif"}},"pyMC Repeater",-1)),h("p",L3,[Pe(X(ue(r).nodeName)+" ",1),h("span",{class:le(["inline-block w-2 h-2 rounded-full ml-2",ue(r).statusBadge.text==="Active"?"bg-accent-green":ue(r).statusBadge.text==="Monitor Mode"?"bg-secondary":"bg-accent-red"]),title:ue(r).statusBadge.title},null,10,N3)]),h("p",I3,"<"+X(ue(r).pubKey)+">",1)]),v[21]||(v[21]=h("div",{class:"border-t border-stroke-subtle dark:border-stroke mb-6"},null,-1)),h("div",D3,[v[5]||(v[5]=h("p",{class:"text-content-muted dark:text-content-muted text-xs uppercase mb-4"},"Actions",-1)),h("button",{onClick:v[0]||(v[0]=O=>c.value=!0),class:"w-full bg-white dark:bg-white rounded-[10px] py-3 px-4 flex items-center gap-2 text-sm font-medium text-[#212122] border border-stroke-subtle dark:border-transparent hover:bg-background-mute dark:hover:bg-background-mute transition-colors"},v[4]||(v[4]=[h("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[h("path",{d:"M7 0C5.61553 0 4.26216 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.003033 5.6003 -0.13559 7.00777 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C13.998 5.1441 13.2599 3.36479 11.9475 2.05247C10.6352 0.74015 8.8559 0.0020073 7 0V0ZM7 12.8333C5.84628 12.8333 4.71846 12.4912 3.75918 11.8502C2.79989 11.2093 2.05222 10.2982 1.61071 9.23232C1.16919 8.16642 1.05368 6.99353 1.27876 5.86197C1.50384 4.73042 2.05941 3.69102 2.87521 2.87521C3.69102 2.0594 4.73042 1.50383 5.86198 1.27875C6.99353 1.05367 8.16642 1.16919 9.23232 1.6107C10.2982 2.05221 11.2093 2.79989 11.8502 3.75917C12.4912 4.71846 12.8333 5.84628 12.8333 7C12.8316 8.54658 12.2165 10.0293 11.1229 11.1229C10.0293 12.2165 8.54658 12.8316 7 12.8333ZM8.16667 7C8.1676 7.20501 8.11448 7.40665 8.01268 7.58461C7.91087 7.76256 7.76397 7.91054 7.58677 8.01365C7.40957 8.11676 7.20833 8.17136 7.00332 8.17194C6.7983 8.17252 6.59675 8.11906 6.41897 8.01696C6.24119 7.91485 6.09346 7.7677 5.99065 7.59033C5.88784 7.41295 5.83358 7.21162 5.83335 7.0066C5.83312 6.80159 5.88691 6.60013 5.98932 6.42252C6.09172 6.24491 6.23912 6.09743 6.41667 5.99492V3.5H7.58334V5.99492C7.76016 6.09659 7.90713 6.24298 8.00952 6.41939C8.1119 6.5958 8.1661 6.79603 8.16667 7Z",fill:"#212122"})],-1),Pe(" Send Advert ",-1)]))]),h("div",$3,[v[6]||(v[6]=h("p",{class:"text-content-muted dark:text-content-muted text-xs uppercase mb-4"},"Monitoring",-1)),h("div",F3,[(M(!0),F(Se,null,at(y.slice(0,3),O=>(M(),F("button",{key:O.name,onClick:N=>b(O.route),class:le([g.value(O.route)?"bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold":"text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent","w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200"])},[(M(),nt(Zt(f[O.icon]),{class:le(g.value(O.route)?"w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current":"w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current")},null,8,["class"])),Pe(" "+X(O.name),1)],10,V3))),128))])]),h("div",B3,[v[7]||(v[7]=h("p",{class:"text-content-muted dark:text-content-muted text-xs uppercase mb-4"},"System",-1)),h("div",H3,[(M(!0),F(Se,null,at(y.slice(3,7),O=>(M(),F("button",{key:O.name,onClick:N=>b(O.route),class:le([g.value(O.route)?"bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold":"text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent","w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200"])},[(M(),nt(Zt(f[O.icon]),{class:le(g.value(O.route)?"w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current":"w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current")},null,8,["class"])),Pe(" "+X(O.name),1)],10,j3))),128))])]),h("div",U3,[v[8]||(v[8]=h("p",{class:"text-content-muted dark:text-content-muted text-xs uppercase mb-4"},"Room Servers",-1)),h("div",q3,[(M(!0),F(Se,null,at(y.slice(7,8),O=>(M(),F("button",{key:O.name,onClick:N=>b(O.route),class:le([g.value(O.route)?"bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold":"text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,212,0.15)] border border-stroke-subtle dark:border-transparent","w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200"])},[(M(),nt(Zt(f[O.icon]),{class:le(g.value(O.route)?"w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current":"w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current")},null,8,["class"])),Pe(" "+X(O.name),1)],10,K3))),128))])]),h("div",W3,[v[9]||(v[9]=h("p",{class:"text-content-muted dark:text-content-muted text-xs uppercase mb-4"},"Other",-1)),h("div",G3,[(M(!0),F(Se,null,at(y.slice(8),O=>(M(),F("button",{key:O.name,onClick:N=>b(O.route),class:le([g.value(O.route)?"bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold":"text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent","w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200"])},[(M(),nt(Zt(f[O.icon]),{class:le(g.value(O.route)?"w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current":"w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current")},null,8,["class"])),Pe(" "+X(O.name),1)],10,Z3))),128))])]),ve(Ac,{"current-value":ue(r).noiseFloorDbm||-116,"update-interval":3e3,class:"mb-6"},null,8,["current-value"]),h("button",{onClick:L,disabled:i.value,class:le(["p-4 flex items-center justify-between mb-4 w-full transition-all duration-200 cursor-pointer group",ue(r).modeButtonState.warning?"glass-card-orange hover:bg-accent-red/10":"glass-card-green hover:bg-accent-green/10"])},[h("div",J3,[ve(Ic,{class:"w-4 h-4 text-content-primary dark:text-content-primary group-hover:text-primary transition-colors"}),v[10]||(v[10]=h("span",{class:"text-content-primary dark:text-content-primary text-sm group-hover:text-primary transition-colors"},"Mode",-1))]),h("span",{class:le(["text-xs font-medium group-hover:text-white transition-colors",ue(r).modeButtonState.warning?"text-accent-red":"text-accent-green"])},X(i.value?"Changing...":ue(r).currentMode.charAt(0).toUpperCase()+ue(r).currentMode.slice(1)),3)],10,z3),h("button",{onClick:E,disabled:a.value,class:le(["p-4 flex items-center justify-between mb-4 w-full transition-all duration-200 cursor-pointer group",ue(r).dutyCycleButtonState.warning?"glass-card-orange hover:bg-accent-red/10":"glass-card-green hover:bg-accent-green/10"])},[h("div",Q3,[ve(Dc,{class:"w-3.5 h-3.5 text-content-primary dark:text-content-primary group-hover:text-primary transition-colors"}),v[11]||(v[11]=h("span",{class:"text-content-primary dark:text-content-primary text-sm group-hover:text-primary transition-colors"},"Duty Cycle",-1))]),h("span",{class:le(["text-xs font-medium group-hover:text-white transition-colors",ue(r).dutyCycleButtonState.warning?"text-accent-red":"text-primary"])},X(a.value?"Changing...":ue(r).dutyCycleEnabled?"Enabled":"Disabled"),3)],10,Y3),h("div",X3,[G.value?(M(),F("div",ep,v[12]||(v[12]=[h("div",{class:"flex items-center justify-center gap-2"},[h("svg",{class:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[h("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})]),h("span",{class:"text-blue-500 dark:text-blue-400 text-xs font-semibold"},"Development Build")],-1)]))):me("",!0),h("div",{onClick:v[1]||(v[1]=O=>ee.value=!ee.value),class:"cursor-pointer transition-all duration-200 hover:scale-[1.02]"},[h("div",tp,[h("span",{class:le(["glass-card px-2 py-1 text-xs font-medium rounded border transition-colors",T.value.isDev?"text-yellow-600 dark:text-yellow-400 border-yellow-500/30 dark:border-yellow-500/30":"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke"])}," R:v"+X(T.value.base)+X(T.value.isDev?"-dev"+T.value.devNumber:""),3),h("span",{class:le(["glass-card px-2 py-1 text-xs font-medium rounded border transition-colors",q.value.isDev?"text-yellow-600 dark:text-yellow-400 border-yellow-500/30 dark:border-yellow-500/30":"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke"])}," Core:v"+X(q.value.base)+X(q.value.isDev?"-dev"+q.value.devNumber:""),3),(M(),F("svg",{class:le(["w-3 h-3 text-content-muted transition-transform duration-200",ee.value?"rotate-180":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},v[13]||(v[13]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)]),2))]),ee.value?(M(),F("div",np,[h("div",rp,[h("div",sp,[v[14]||(v[14]=h("span",{class:"text-content-muted font-medium"},"Repeater:",-1)),h("span",op,"v"+X(T.value.base),1)]),T.value.isDev?(M(),F("div",ip,[h("div",null,"Dev Build: "+X(T.value.devNumber),1),T.value.commit?(M(),F("div",ap,[v[15]||(v[15]=h("span",null,"Commit:",-1)),h("code",lp,X(T.value.commit),1)])):me("",!0)])):me("",!0)]),v[18]||(v[18]=h("div",{class:"border-t border-stroke-subtle dark:border-stroke/20"},null,-1)),h("div",cp,[h("div",up,[v[16]||(v[16]=h("span",{class:"text-content-muted font-medium"},"Core:",-1)),h("span",dp,"v"+X(q.value.base),1)]),q.value.isDev?(M(),F("div",fp,[h("div",null,"Dev Build: "+X(q.value.devNumber),1),q.value.commit?(M(),F("div",pp,[v[17]||(v[17]=h("span",null,"Commit:",-1)),h("code",hp,X(q.value.commit),1)])):me("",!0)])):me("",!0)])])):me("",!0)])]),v[22]||(v[22]=h("div",{class:"border-t border-accent-green mb-4"},null,-1)),ue(r).dutyCycleEnabled?(M(),F("div",mp,[h("p",gp,[v[19]||(v[19]=Pe(" Duty Cycle: ",-1)),h("span",yp,X(ue(r).dutyCycleUtilization.toFixed(1))+"% / "+X(ue(r).dutyCycleMax.toFixed(1))+"%",1)]),h("div",vp,[h("div",{class:"h-full rounded-full transition-all duration-300",style:On(H.value)},null,4)])])):me("",!0),h("div",bp,[v[20]||(v[20]=h("svg",{class:"w-3 h-3",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[h("path",{d:"M6.5 13C5.59722 13 4.75174 12.8286 3.96355 12.4858C3.17537 12.143 2.48926 11.6795 1.90522 11.0955C1.32119 10.5115 0.85776 9.82535 0.514945 9.03717C0.172131 8.24898 0.000482491 7.40326 1.0101e-06 6.5C-0.000480471 5.59674 0.171168 4.75126 0.514945 3.96356C0.858723 3.17585 1.32191 2.48974 1.9045 1.90522C2.48709 1.3207 3.1732 0.857278 3.96283 0.514944C4.75246 0.172611 5.59818 0.000962963 6.5 0C7.48703 0 8.42303 0.210648 9.30799 0.631944C10.193 1.05324 10.9421 1.64907 11.5555 2.41944V1.44444C11.5555 1.23981 11.6249 1.06841 11.7635 0.930222C11.9022 0.792037 12.0736 0.722704 12.2778 0.722222C12.4819 0.721741 12.6536 0.791074 12.7927 0.930222C12.9319 1.06937 13.001 1.24078 13 1.44444V4.33333C13 4.53796 12.9307 4.70961 12.792 4.84828C12.6533 4.98694 12.4819 5.05604 12.2778 5.05556H9.38888C9.18425 5.05556 9.01285 4.98622 8.87466 4.84756C8.73647 4.70889 8.66714 4.53748 8.66666 4.33333C8.66618 4.12919 8.73551 3.95778 8.87466 3.81911C9.01381 3.68044 9.18521 3.61111 9.38888 3.61111H10.6528C10.1593 2.93704 9.55138 2.40741 8.82916 2.02222C8.10694 1.63704 7.33055 1.44444 6.5 1.44444C5.09166 1.44444 3.89711 1.93507 2.91633 2.91633C1.93555 3.89759 1.44493 5.09215 1.44444 6.5C1.44396 7.90785 1.93459 9.10265 2.91633 10.0844C3.89807 11.0661 5.09263 11.5565 6.5 11.5556C7.64351 11.5556 8.66666 11.2125 9.56944 10.5264C10.4722 9.84028 11.068 8.95555 11.3569 7.87222C11.4171 7.67963 11.5255 7.53519 11.6819 7.43889C11.8384 7.34259 12.013 7.30648 12.2055 7.33055C12.4102 7.35463 12.5727 7.44178 12.693 7.592C12.8134 7.74222 12.8495 7.90785 12.8014 8.08889C12.4523 9.5213 11.694 10.698 10.5264 11.6191C9.35879 12.5402 8.01666 13.0005 6.5 13ZM7.22222 6.21111L9.02777 8.01667C9.16018 8.14907 9.22638 8.31759 9.22638 8.52222C9.22638 8.72685 9.16018 8.89537 9.02777 9.02778C8.89536 9.16018 8.72685 9.22639 8.52222 9.22639C8.31759 9.22639 8.14907 9.16018 8.01666 9.02778L5.99444 7.00556C5.92222 6.93333 5.86805 6.8522 5.83194 6.76217C5.79583 6.67213 5.77777 6.57872 5.77777 6.48194V3.61111C5.77777 3.40648 5.84711 3.23507 5.98577 3.09689C6.12444 2.9587 6.29585 2.88937 6.5 2.88889C6.70414 2.88841 6.87579 2.95774 7.01494 3.09689C7.15409 3.23604 7.22318 3.40744 7.22222 3.61111V6.21111Z",fill:"currentColor"})],-1)),Pe(" Last Updated: "+X(R.value),1)]),h("div",Cp,[h("a",_p,[ve(y0,{class:"w-5 h-5 text-white group-hover:text-primary transition-colors"})]),h("a",wp,[ve(_0,{class:"w-5 h-5 text-white group-hover:text-yellow-500 transition-colors"})])])])]),ve(Rc,{isOpen:c.value,isLoading:o.value,isSuccess:u.value,error:l.value,onClose:k,onSend:x},null,8,["isOpen","isLoading","isSuccess","error"])],64))}}),kp={class:"bg-white/95 dark:bg-black/20 backdrop-blur-xl border border-stroke dark:border-white/10 rounded-2xl h-full p-6 overflow-auto shadow-2xl"},Ep={class:"mb-6 flex items-center justify-between"},Sp={class:"text-content-secondary dark:text-[#C3C3C3] text-sm"},Ap=["title"],Rp={class:"text-content-secondary dark:text-[#C3C3C3] text-sm mt-1"},Tp={class:"mb-4"},Op={class:"mb-4"},Mp={class:"space-y-2 mb-3"},Pp=["onClick"],Lp={class:"mb-4"},Np={class:"space-y-2 mb-3"},Ip=["onClick"],Dp={class:"mb-4"},$p={class:"space-y-2 mb-3"},Fp=["onClick"],Vp={class:"mb-4"},Bp={class:"space-y-2 mb-3"},Hp=["onClick"],jp=["disabled"],Up={class:"flex items-center gap-3"},qp=["disabled"],Kp={class:"flex items-center gap-3"},Wp={class:"mb-4"},Gp={key:0,class:"mt-2 glass-card px-3 py-2 rounded-lg border border-stroke-subtle dark:border-stroke/30 space-y-2 text-xs animate-fade-in"},Zp={class:"space-y-1"},zp={class:"flex items-center justify-between"},Jp={class:"text-content-primary dark:text-content-primary font-mono"},Yp={key:0,class:"pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted"},Qp={key:0,class:"flex items-center gap-1"},Xp={class:"bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded"},e5={class:"space-y-1"},t5={class:"flex items-center justify-between"},n5={class:"text-content-primary dark:text-content-primary font-mono"},r5={key:0,class:"pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted"},s5={key:0,class:"flex items-center gap-1"},o5={class:"bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded"},i5={key:1,class:"mb-4"},a5={class:"text-content-muted text-xs mb-2"},l5={class:"text-content-primary dark:text-white"},c5={class:"w-full h-1 bg-stroke-subtle dark:bg-white/10 rounded-full overflow-hidden"},u5={class:"text-content-muted text-xs"},d5=ht({name:"MobileSidebar",__name:"MobileSidebar",props:{showMobileSidebar:{type:Boolean}},emits:["update:showMobileSidebar","close"],setup(e,{emit:t}){const n=Fu(()=>Je(()=>Promise.resolve().then(()=>O0),void 0)),r=ne(!1),s=e,o=t,i=Mo(),a=Po(),c=gr();Lt(()=>s.showMobileSidebar,j=>{j&&!r.value?setTimeout(()=>{r.value=!0},100):j||(r.value=!1)});const u=ne(!1),l=ne(!1),d=ne(!1),f=ne(!1),y=ne(!1),g=ne(null);let b=null;Mn(()=>{b=window.setInterval(()=>{q.value=new Date().toLocaleTimeString()},1e3)}),rs(()=>{b&&clearInterval(b)});const x={dashboard:Tc,neighbors:Nc,statistics:Lc,"system-stats":Gr,sessions:Gr,configuration:Wr,"room-servers":Wr,logs:Mc,terminal:Pc,help:Oc},k=[{name:"Dashboard",icon:"dashboard",route:"/"},{name:"Neighbors",icon:"neighbors",route:"/neighbors"},{name:"Statistics",icon:"statistics",route:"/statistics"},{name:"System Stats",icon:"system-stats",route:"/system-stats"},{name:"Sessions",icon:"sessions",route:"/sessions"},{name:"Configuration",icon:"configuration",route:"/configuration"},{name:"Terminal",icon:"terminal",route:"/terminal"},{name:"Room Servers",icon:"room-servers",route:"/room-servers"},{name:"Logs",icon:"logs",route:"/logs"},{name:"Help",icon:"help",route:"/help"}],L=ie(()=>j=>a.path===j),E=j=>{i.push(j),R()},R=()=>{o("update:showMobileSidebar",!1)},H=()=>{mn(),i.push("/login"),R()},ee=async()=>{u.value=!0,g.value=null;try{await c.sendAdvert(),y.value=!0,setTimeout(()=>{G()},2e3)}catch(j){g.value=j instanceof Error?j.message:"Unknown error occurred",console.error("Failed to send advert:",j)}finally{u.value=!1}},G=()=>{f.value=!1,y.value=!1,g.value=null,u.value=!1},J=async()=>{if(!l.value){l.value=!0;try{await c.toggleMode()}catch(j){console.error("Failed to toggle mode:",j)}finally{l.value=!1}}},T=async()=>{if(!d.value){d.value=!0;try{await c.toggleDutyCycle()}catch(j){console.error("Failed to toggle duty cycle:",j)}finally{d.value=!1}}},q=ne(new Date().toLocaleTimeString()),$=ne(!1),v=ie(()=>c.version.includes("dev")||c.coreVersion.includes("dev")),O=j=>{const I=j.match(/^([\d.]+)(\.dev(\d+))?((\+g)([a-f0-9]+))?$/);return I?{base:I[1],isDev:!!I[2],devNumber:I[3]||null,commit:I[6]||null}:{base:j,isDev:!1,devNumber:null,commit:null}},N=ie(()=>O(c.version)),Q=ie(()=>O(c.coreVersion)),se=ie(()=>{const j=c.dutyCyclePercentage;let I="#A5E5B6";return j>90?I="#FB787B":j>70&&(I="#FFC246"),{width:j===0?".125rem":`${Math.max(j,2)}%`,backgroundColor:I}});return(j,I)=>(M(),F(Se,null,[h("div",{class:le(["fixed inset-0 z-[1010] lg:hidden transition-opacity duration-300",j.showMobileSidebar?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"])},[h("div",{class:"absolute inset-0 bg-black/30 backdrop-blur-sm dark:bg-black/30",onClick:R}),h("div",{class:le(["absolute left-0 top-0 bottom-0 w-72 p-4 transition-transform duration-300",j.showMobileSidebar?"translate-x-0":"-translate-x-full"])},[h("div",kp,[h("div",Ep,[h("div",null,[I[2]||(I[2]=h("h1",{class:"text-content-heading dark:text-white text-[1.25rem] font-bold"},"pyMC Repeater",-1)),h("p",Sp,[Pe(X(ue(c).nodeName)+" ",1),h("span",{class:le(["inline-block w-2 h-2 rounded-full ml-2",ue(c).statusBadge.text==="Active"?"bg-accent-green":ue(c).statusBadge.text==="Monitor Mode"?"bg-secondary":"bg-accent-red"]),title:ue(c).statusBadge.title},null,10,Ap)]),h("p",Rp,"<"+X(ue(c).pubKey)+">",1)]),h("button",{onClick:R,class:"text-content-primary dark:text-content-muted hover:text-content-heading dark:hover:text-white"},"✕")]),I[19]||(I[19]=h("div",{class:"border-t border-stroke dark:border-dark-border mb-4"},null,-1)),h("div",Tp,[I[4]||(I[4]=h("p",{class:"text-content-muted text-xs uppercase mb-2"},"Actions",-1)),h("button",{onClick:I[0]||(I[0]=pe=>{f.value=!0,R()}),class:"w-full bg-content-heading dark:bg-white rounded-[.625rem] py-3 px-4 flex items-center gap-2 text-sm font-medium text-white dark:text-[#212122] hover:bg-content-primary dark:hover:bg-gray-100 transition-colors mb-2"},I[3]||(I[3]=[h("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[h("path",{d:"M7 0C5.61553 0 4.26216 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.003033 5.6003 -0.13559 7.00777 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C13.998 5.1441 13.2599 3.36479 11.9475 2.05247C10.6352 0.74015 8.8559 0.0020073 7 0V0ZM7 12.8333C5.84628 12.8333 4.71846 12.4912 3.75918 11.8502C2.79989 11.2093 2.05222 10.2982 1.61071 9.23232C1.16919 8.16642 1.05368 6.99353 1.27876 5.86197C1.50384 4.73042 2.05941 3.69102 2.87521 2.87521C3.69102 2.0594 4.73042 1.50383 5.86198 1.27875C6.99353 1.05367 8.16642 1.16919 9.23232 1.6107C10.2982 2.05221 11.2093 2.79989 11.8502 3.75917C12.4912 4.71846 12.8333 5.84628 12.8333 7C12.8316 8.54658 12.2165 10.0293 11.1229 11.1229C10.0293 12.2165 8.54658 12.8316 7 12.8333ZM8.16667 7C8.1676 7.20501 8.11448 7.40665 8.01268 7.58461C7.91087 7.76256 7.76397 7.91054 7.58677 8.01365C7.40957 8.11676 7.20833 8.17136 7.00332 8.17194C6.7983 8.17252 6.59675 8.11906 6.41897 8.01696C6.24119 7.91485 6.09346 7.7677 5.99065 7.59033C5.88784 7.41295 5.83358 7.21162 5.83335 7.0066C5.83312 6.80159 5.88691 6.60013 5.98932 6.42252C6.09172 6.24491 6.23912 6.09743 6.41667 5.99492V3.5H7.58334V5.99492C7.76016 6.09659 7.90713 6.24298 8.00952 6.41939C8.1119 6.5958 8.1661 6.79603 8.16667 7Z",fill:"currentColor"})],-1),Pe(" Send Advert ",-1)]))]),h("div",Op,[I[5]||(I[5]=h("p",{class:"text-content-muted text-xs uppercase mb-2"},"Monitoring",-1)),h("div",Mp,[(M(!0),F(Se,null,at(k.slice(0,3),pe=>(M(),F("button",{key:pe.name,onClick:Fe=>E(pe.route),class:le([L.value(pe.route)?"bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary":"text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5","w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all"])},[(M(),nt(Zt(x[pe.icon]),{class:"w-3.5 h-3.5"})),Pe(" "+X(pe.name),1)],10,Pp))),128))])]),h("div",Lp,[I[6]||(I[6]=h("p",{class:"text-content-muted text-xs uppercase mb-2"},"System",-1)),h("div",Np,[(M(!0),F(Se,null,at(k.slice(3,7),pe=>(M(),F("button",{key:pe.name,onClick:Fe=>E(pe.route),class:le([L.value(pe.route)?"bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary":"text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5","w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all"])},[(M(),nt(Zt(x[pe.icon]),{class:"w-3.5 h-3.5"})),Pe(" "+X(pe.name),1)],10,Ip))),128))])]),h("div",Dp,[I[7]||(I[7]=h("p",{class:"text-content-muted text-xs uppercase mb-2"},"Room Servers",-1)),h("div",$p,[(M(!0),F(Se,null,at(k.slice(7,8),pe=>(M(),F("button",{key:pe.name,onClick:Fe=>E(pe.route),class:le([L.value(pe.route)?"bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary":"text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5","w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all"])},[(M(),nt(Zt(x[pe.icon]),{class:"w-3.5 h-3.5"})),Pe(" "+X(pe.name),1)],10,Fp))),128))])]),h("div",Vp,[I[8]||(I[8]=h("p",{class:"text-content-muted text-xs uppercase mb-2"},"Other",-1)),h("div",Bp,[(M(!0),F(Se,null,at(k.slice(8),pe=>(M(),F("button",{key:pe.name,onClick:Fe=>E(pe.route),class:le([L.value(pe.route)?"bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary":"text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5","w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all"])},[(M(),nt(Zt(x[pe.icon]),{class:"w-3.5 h-3.5"})),Pe(" "+X(pe.name),1)],10,Hp))),128))])]),r.value?(M(),nt(ue(n),{key:0,"current-value":ue(c).noiseFloorDbm||-116,"update-interval":3e3,limit:50,class:"mb-4"},null,8,["current-value"])):me("",!0),h("button",{onClick:J,disabled:l.value,class:le(["p-4 flex items-center justify-between mb-3 w-full transition-all duration-200 cursor-pointer group",ue(c).modeButtonState.warning?"glass-card-orange hover:bg-accent-red/10":"glass-card-green hover:bg-accent-green/10"])},[h("div",Up,[ve(Ic,{class:"w-4 h-4 text-content-primary dark:text-white group-hover:text-primary transition-colors"}),I[9]||(I[9]=h("span",{class:"text-content-primary dark:text-white text-sm group-hover:text-primary transition-colors"},"Mode",-1))]),h("span",{class:le(["text-xs font-medium group-hover:text-primary dark:group-hover:text-white transition-colors",ue(c).modeButtonState.warning?"text-accent-red":"text-accent-green"])},X(l.value?"Changing...":ue(c).currentMode.charAt(0).toUpperCase()+ue(c).currentMode.slice(1)),3)],10,jp),h("button",{onClick:T,disabled:d.value,class:le(["p-4 flex items-center justify-between mb-3 w-full transition-all duration-200 cursor-pointer group",ue(c).dutyCycleButtonState.warning?"glass-card-orange hover:bg-accent-red/10":"glass-card-green hover:bg-accent-green/10"])},[h("div",Kp,[ve(Dc,{class:"w-3.5 h-3.5 text-content-primary dark:text-white group-hover:text-primary transition-colors"}),I[10]||(I[10]=h("span",{class:"text-content-primary dark:text-white text-sm group-hover:text-primary transition-colors"},"Duty Cycle",-1))]),h("span",{class:le(["text-xs font-medium group-hover:text-primary dark:group-hover:text-white transition-colors",ue(c).dutyCycleButtonState.warning?"text-accent-red":"text-primary"])},X(d.value?"Changing...":ue(c).dutyCycleEnabled?"Enabled":"Disabled"),3)],10,qp),h("button",{onClick:H,class:"w-full glass-card-orange hover:bg-accent-red/10 rounded-[.625rem] py-3 px-4 flex items-center justify-center gap-2 text-sm font-medium text-content-primary dark:text-white transition-all mb-4"},I[11]||(I[11]=[h("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","stroke-width":"1.5",xmlns:"http://www.w3.org/2000/svg"},[h("path",{d:"M13 3H15C16.1046 3 17 3.89543 17 5V15C17 16.1046 16.1046 17 15 17H13M8 7L4 10.5M4 10.5L8 14M4 10.5H13","stroke-linecap":"round","stroke-linejoin":"round"})],-1),Pe(" Logout ",-1)])),h("div",Wp,[h("div",{onClick:I[1]||(I[1]=pe=>$.value=!$.value),class:"flex items-center gap-2 cursor-pointer group"},[h("span",{class:le(["glass-card px-2 py-1 text-xs font-medium rounded border transition-all duration-200","border-stroke dark:border-dark-border",N.value.isDev?"text-secondary bg-secondary-bg/20 dark:bg-secondary-bg/10 border-secondary/40":"text-content-muted"])}," R:v"+X(N.value.base)+X(N.value.isDev?`.dev${N.value.devNumber}`:""),3),h("span",{class:le(["glass-card px-2 py-1 text-xs font-medium rounded border transition-all duration-200","border-stroke dark:border-dark-border",Q.value.isDev?"text-secondary bg-secondary-bg/20 dark:bg-secondary-bg/10 border-secondary/40":"text-content-muted"])}," C:v"+X(Q.value.base)+X(Q.value.isDev?`.dev${Q.value.devNumber}`:""),3),v.value?(M(),F("svg",{key:0,class:le(["w-3 h-3 text-content-muted transition-transform duration-200",$.value?"rotate-180":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},I[12]||(I[12]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)]),2)):me("",!0)]),$.value?(M(),F("div",Gp,[h("div",Zp,[h("div",zp,[I[13]||(I[13]=h("span",{class:"text-content-muted font-medium"},"Repeater:",-1)),h("span",Jp,"v"+X(N.value.base),1)]),N.value.isDev?(M(),F("div",Yp,[h("div",null,"Dev Build: "+X(N.value.devNumber),1),N.value.commit?(M(),F("div",Qp,[I[14]||(I[14]=h("span",null,"Commit:",-1)),h("code",Xp,X(N.value.commit),1)])):me("",!0)])):me("",!0)]),I[17]||(I[17]=h("div",{class:"border-t border-stroke-subtle dark:border-stroke/20"},null,-1)),h("div",e5,[h("div",t5,[I[15]||(I[15]=h("span",{class:"text-content-muted font-medium"},"Core:",-1)),h("span",n5,"v"+X(Q.value.base),1)]),Q.value.isDev?(M(),F("div",r5,[h("div",null,"Dev Build: "+X(Q.value.devNumber),1),Q.value.commit?(M(),F("div",s5,[I[16]||(I[16]=h("span",null,"Commit:",-1)),h("code",o5,X(Q.value.commit),1)])):me("",!0)])):me("",!0)])])):me("",!0)]),I[20]||(I[20]=h("div",{class:"border-t border-accent-green mb-4"},null,-1)),ue(c).dutyCycleEnabled?(M(),F("div",i5,[h("p",a5,[I[18]||(I[18]=Pe(" Duty Cycle: ",-1)),h("span",l5,X(ue(c).dutyCycleUtilization.toFixed(1))+"% / "+X(ue(c).dutyCycleMax.toFixed(1))+"%",1)]),h("div",c5,[h("div",{class:"h-full rounded-full transition-all duration-300",style:On(se.value)},null,4)])])):me("",!0),h("p",u5,"Last Updated: "+X(q.value),1)])],2)],2),ve(Rc,{isOpen:f.value,isLoading:u.value,isSuccess:y.value,error:g.value,onClose:G,onSend:ee},null,8,["isOpen","isLoading","isSuccess","error"])],64))}}),$c="theme-preference",kt=ne("dark"),pa=ne(!1);function Fc(e){const t=document.documentElement;e==="dark"?t.classList.add("dark"):t.classList.remove("dark")}function f5(){if(pa.value)return;const e=localStorage.getItem($c);e&&(e==="light"||e==="dark")?kt.value=e:window.matchMedia("(prefers-color-scheme: light)").matches?kt.value="light":kt.value="dark",Fc(kt.value),pa.value=!0}typeof window<"u"&&f5();Lt(kt,e=>{localStorage.setItem($c,e),Fc(e)});function p5(){return{theme:kt,toggleTheme:()=>{kt.value=kt.value==="dark"?"light":"dark"},setTheme:r=>{kt.value=r},isDark:()=>kt.value==="dark"}}const h5=["aria-label","title"],m5={key:0,xmlns:"http://www.w3.org/2000/svg",class:"w-5 h-5 text-yellow-600 dark:text-yellow-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},g5={key:1,xmlns:"http://www.w3.org/2000/svg",class:"w-5 h-5 text-content-secondary dark:text-content",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},y5=ht({__name:"ThemeToggle",setup(e){const{theme:t,toggleTheme:n}=p5();return(r,s)=>(M(),F("button",{onClick:s[0]||(s[0]=(...o)=>ue(n)&&ue(n)(...o)),class:"w-[35px] h-[35px] rounded bg-background-mute dark:bg-surface-elevated flex items-center justify-center hover:bg-stroke-subtle dark:hover:bg-stroke/30 transition-colors","aria-label":ue(t)==="dark"?"Switch to light mode":"Switch to dark mode",title:ue(t)==="dark"?"Switch to light mode":"Switch to dark mode"},[ue(t)==="dark"?(M(),F("svg",m5,s[1]||(s[1]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):(M(),F("svg",g5,s[2]||(s[2]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"},null,-1)])))],8,h5))}}),v5={class:"glass-card p-3 sm:p-6 mb-5 rounded-[20px] relative z-10"},b5={class:"flex justify-between items-center"},C5={class:"flex items-center gap-3"},_5={class:"hidden sm:block"},w5={class:"text-content-primary dark:text-content-primary text-2xl lg:text-[35px] font-bold mb-1 sm:mb-2"},x5={class:"flex items-center gap-3 sm:gap-4"},k5={class:"text-right",style:{"min-width":"180px"}},E5={key:0,class:"flex items-center gap-2 justify-end"},S5={key:1,class:"space-y-1"},A5={class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},R5={class:"text-primary font-medium"},T5={key:0,class:"text-xs text-content-muted dark:text-content-muted/80",style:{"min-height":"16px"}},O5={key:0},M5={key:2},P5={key:0,class:"text-xs text-content-muted dark:text-content-muted/60 hidden sm:block",style:{"min-height":"16px"}},L5={class:"flex items-center justify-between mb-3"},N5={class:"flex items-center gap-2"},I5=["disabled"],D5=["disabled"],$5={class:"space-y-3 text-sm"},F5={key:0,class:"bg-red-50 dark:bg-background-mute p-3 rounded-lg border border-accent-red/30 border-l-2 border-l-accent-red"},V5={class:"flex items-center justify-between"},B5={class:"text-accent-red font-bold"},H5={class:"text-xs text-content-muted dark:text-content-muted mt-1"},j5={key:1,class:"bg-green-50 dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 border-l-2 border-l-accent-green"},U5={class:"flex items-center justify-between"},q5={class:"text-accent-green font-bold"},K5={key:0,class:"text-xs text-content-muted dark:text-content-muted mt-1"},W5={key:2,class:"bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10"},G5={key:3,class:"bg-red-50 dark:bg-background-mute p-3 rounded-lg border border-accent-red/30 border-l-2 border-l-accent-red"},Z5={class:"text-xs text-content-secondary dark:text-content-muted"},z5={class:"bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 border-l-2 border-l-primary"},J5={class:"flex items-center justify-between"},Y5={class:"text-primary font-bold"},Q5={key:0,class:"text-xs text-content-muted dark:text-content-muted mt-1"},X5={class:"flex items-center justify-between"},eh={class:"text-content-primary dark:text-content-primary font-medium"},th={key:0,class:"mt-2"},nh={class:"text-xs text-content-muted dark:text-content-muted"},rh={class:"text-content-secondary dark:text-content-secondary"},sh={key:4,class:"bg-background-mute dark:bg-background-mute p-4 rounded-lg border border-stroke-subtle dark:border-stroke/10 text-center"},oh={key:5,class:"bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 text-center"},ih=ht({name:"TopBar",__name:"TopBar",emits:["toggleMobileSidebar"],setup(e,{emit:t}){const n=t,r=Mo(),s=gr(),o=ne(!1),i=ne(null),a=ne({hasUpdate:!1,currentVersion:"",latestVersion:"",isChecking:!1,lastChecked:null,error:null}),c=ne({}),u=ne(!0),l=ne(null),d=ne(c0()||"User"),f=["Chat Node","Repeater","Room Server"];function y($){const v=$.target;i.value&&!i.value.contains(v)&&(o.value=!1)}const g=async()=>{try{u.value=!0;const $={};for(const v of f)try{const O=await tt.get(`/adverts_by_contact_type?contact_type=${encodeURIComponent(v)}&hours=168`);O.success&&Array.isArray(O.data)?$[v]=O.data:$[v]=[]}catch(O){console.error(`Error fetching ${v} nodes:`,O),$[v]=[]}c.value=$,l.value=new Date}catch($){console.error("Error updating tracked nodes:",$)}finally{u.value=!1}},b=async()=>{if(!a.value.isChecking)try{a.value.isChecking=!0,a.value.error=null,await s.fetchStats();const $=s.version;if(!$||$==="Unknown"){a.value.error="Unable to determine current version";return}const O=await fetch("https://raw.githubusercontent.com/rightup/pyMC_Repeater/main/repeater/__init__.py");if(!O.ok)throw new Error(`GitHub request failed: ${O.status}`);const Q=(await O.text()).match(/__version__\s*=\s*["']([^"']+)["']/);if(!Q)throw new Error("Could not parse version from GitHub file");const se=Q[1];a.value.currentVersion=$,a.value.latestVersion=se,a.value.lastChecked=new Date,a.value.hasUpdate=$!==se}catch($){console.error("Error checking for updates:",$),a.value.error=$ instanceof Error?$.message:"Failed to check for updates"}finally{a.value.isChecking=!1}},x=()=>{mn(),r.push("/login")},k=ie(()=>Object.values(c.value).reduce((v,O)=>v+O.length,0)),L=ie(()=>f.map(v=>({type:v,count:c.value[v]?.length||0})).filter(v=>v.count>0)),E=ie(()=>a.value.hasUpdate||k.value>0),R=$=>({"Chat Node":"text-blue-600 dark:text-blue-400",Repeater:"text-accent-green","Room Server":"text-accent-purple"})[$]||"text-gray-400",H=$=>{const v=c.value[$]||[];return v.length===0?"None":v.reduce((N,Q)=>Q.last_seen>N.last_seen?Q:N,v[0]).node_name||"Unknown Node"};let ee=null,G=null;const J=()=>{ee&&clearInterval(ee),ee=setInterval(()=>{g()},3e4),G&&clearInterval(G),G=setInterval(()=>{b()},6e5)},T=()=>{ee&&(clearInterval(ee),ee=null),G&&(clearInterval(G),G=null)};Mn(()=>{document.addEventListener("click",y),g(),b(),J()}),ns(()=>{document.removeEventListener("click",y),T()});const q=()=>{n("toggleMobileSidebar")};return($,v)=>(M(),F("div",v5,[h("div",b5,[h("div",C5,[h("button",{onClick:q,class:"lg:hidden w-10 h-10 rounded bg-background-mute dark:bg-surface-elevated flex items-center justify-center hover:bg-stroke-subtle dark:hover:bg-stroke/30 transition-colors"},v[2]||(v[2]=[h("svg",{class:"w-5 h-5 text-content-secondary dark:text-content-primary",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[h("path",{d:"M3 6h14M3 10h14M3 14h14",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])),h("div",_5,[h("h1",w5,"Hi "+X(d.value)+"👋",1)])]),h("div",x5,[h("div",k5,[u.value?(M(),F("div",E5,v[3]||(v[3]=[h("div",{class:"animate-spin rounded-full h-3 w-3 border-b-2 border-primary"},null,-1),h("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Loading...",-1)]))):k.value>0?(M(),F("div",S5,[h("p",A5,[v[4]||(v[4]=Pe(" Tracking: ",-1)),h("span",R5,X(k.value)+" node"+X(k.value===1?"":"s"),1)]),L.value.length>0?(M(),F("div",T5,[(M(!0),F(Se,null,at(L.value,(O,N)=>(M(),F("span",{key:O.type,class:"inline"},[Pe(X(O.count)+" "+X(O.type)+X(O.count===1?"":"s"),1),N