ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add Dockerfile, contributing guide, and docs updates
Juan Denis83d7997b1a68
diff --git a/.env.example b/.env.exampleindex d5a8ede9..c1344d0b 100644--- a/.env.example+++ b/.env.example@@ -1,22 +1,56 @@+# ============================================# ServerKit Configuration-# Copy this file to .env and customize+# ============================================+# Copy this file to .env and customize for your environment+# Generate secure keys with: python -c "import secrets; print(secrets.token_hex(32))"+# ============================================-# Security Keys (REQUIRED - generate with: serverkit generate-keys)+# ----------------------------------------+# REQUIRED: Security Keys+# ----------------------------------------+# Generate unique keys for production!SECRET_KEY=your-secret-key-hereJWT_SECRET_KEY=your-jwt-secret-key-here-# Database-# SQLite (default):+# ----------------------------------------+# Database Configuration+# ----------------------------------------+# SQLite (default - good for small deployments):DATABASE_URL=sqlite:///serverkit.db-# PostgreSQL:++# PostgreSQL (recommended for production):# DATABASE_URL=postgresql://user:password@localhost:5432/serverkit-# CORS - your domain (comma-separated for multiple)-CORS_ORIGINS=http://localhost+# MySQL:+# DATABASE_URL=mysql://user:password@localhost:3306/serverkit++# ----------------------------------------+# Network Configuration+# ----------------------------------------+# CORS Origins - your domain(s), comma-separated+CORS_ORIGINS=http://localhost,https://your-domain.com-# Ports+# Ports (for Docker)PORT=80SSL_PORT=443+# ----------------------------------------# Environment+# ----------------------------------------+# Options: development, productionFLASK_ENV=production++# ----------------------------------------+# Optional: Notification Webhooks+# ----------------------------------------+# These can also be configured via the web UI at Settings > Notifications++# Discord Webhook URL+# DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...++# Slack Webhook URL+# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...++# Telegram Bot+# TELEGRAM_BOT_TOKEN=your-bot-token+# TELEGRAM_CHAT_ID=your-chat-iddiff --git a/.gitignore b/.gitignoreindex b9f921eb..3ed53d25 100644--- a/.gitignore+++ b/.gitignore@@ -2,3 +2,5 @@nul/.claude/.claude_+.env+/frontend/distdiff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.mdnew file mode 100644index 00000000..772e2810--- /dev/null+++ b/.planning/ROADMAP.md@@ -0,0 +1,293 @@+# ServerKit Roadmap++A modern, self-hosted server management panel - alternative to ServerPilot/CyberPanel.++---++## Phase 1: Foundation & Core Infrastructure++### 1.1 Project Setup+- [x] Initialize React frontend with Vite+- [x] Create admin dashboard mockup/design system+- [ ] Set up Flask backend structure+- [ ] Configure SQLAlchemy with SQLite/PostgreSQL+- [ ] Set up Docker development environment+- [ ] Configure CORS and API routing+- [ ] Implement JWT authentication system++### 1.2 User Management+- [ ] User registration and login+- [ ] Role-based access control (Admin, User)+- [ ] Session management+- [ ] Password reset functionality+- [ ] API token generation for CLI access++### 1.3 Core API Structure+```+/api/v1/+├── auth/ # Authentication endpoints+├── servers/ # Server management+├── apps/ # Application management+├── domains/ # Domain configuration+├── databases/ # Database management+├── ssl/ # SSL certificate management+└── system/ # System metrics and logs+```++---++## Phase 2: Server Agent & System Integration++### 2.1 Server Agent (Python)+- [ ] System metrics collection (CPU, RAM, Disk, Load)+- [ ] Process monitoring and management+- [ ] Service control (start, stop, restart)+- [ ] Log aggregation and streaming+- [ ] WebSocket connection for real-time updates++### 2.2 Nginx Management+- [ ] Nginx configuration generator+- [ ] Virtual host management+- [ ] Reverse proxy configuration+- [ ] Load balancing setup+- [ ] Configuration validation and reload++### 2.3 SSL/TLS Management+- [ ] Let's Encrypt integration (Certbot)+- [ ] Auto-renewal setup+- [ ] Custom certificate upload+- [ ] SSL status monitoring+- [ ] Force HTTPS redirects++---++## Phase 3: PHP & WordPress Support++### 3.1 PHP-FPM Management+- [ ] PHP 8.2 FPM pool configuration+- [ ] Multiple PHP version support (8.0, 8.1, 8.2, 8.3)+- [ ] Per-site PHP configuration+- [ ] PHP extensions management+- [ ] OPcache configuration++### 3.2 WordPress Toolkit+- [ ] One-click WordPress installation+- [ ] WP-CLI integration+- [ ] Automatic updates management+- [ ] Backup and restore+- [ ] Staging environment creation+- [ ] Database optimization tools++### 3.3 WordPress-Specific Features+- [ ] Plugin/theme management+- [ ] wp-config.php editor+- [ ] Security hardening+- [ ] Performance optimization+- [ ] Search & replace tool++---++## Phase 4: Python Application Support++### 4.1 Python Runtime Management+- [ ] Multiple Python version support (3.9, 3.10, 3.11, 3.12)+- [ ] Virtual environment management+- [ ] pip package management+- [ ] Requirements.txt handling++### 4.2 Flask Application Deployment+- [ ] Gunicorn/uWSGI configuration+- [ ] Environment variables management+- [ ] Application process management+- [ ] Log routing and monitoring+- [ ] Static file serving++### 4.3 Django Application Deployment+- [ ] Django-specific configuration+- [ ] Static/media file handling+- [ ] Database migrations support+- [ ] Celery worker management+- [ ] Django admin access++---++## Phase 5: Docker Container Management++### 5.1 Docker Integration+- [ ] Docker daemon connection+- [ ] Container listing and management+- [ ] Image management (pull, remove)+- [ ] Container logs streaming+- [ ] Resource usage monitoring++### 5.2 Docker Compose Support+- [ ] Compose file editor+- [ ] Stack deployment+- [ ] Service scaling+- [ ] Network management+- [ ] Volume management++### 5.3 Container Features+- [ ] Container shell access (WebSocket terminal)+- [ ] Environment variable management+- [ ] Port mapping configuration+- [ ] Container health checks+- [ ] Auto-restart policies++---++## Phase 6: Database Management++### 6.1 MySQL/MariaDB+- [ ] Database creation and management+- [ ] User and privilege management+- [ ] phpMyAdmin integration+- [ ] Backup and restore+- [ ] Query execution interface++### 6.2 PostgreSQL+- [ ] Database creation and management+- [ ] User and privilege management+- [ ] pgAdmin integration (optional)+- [ ] Backup and restore++### 6.3 Redis (Optional)+- [ ] Redis server management+- [ ] Key browser+- [ ] Memory usage monitoring++---++## Phase 7: Frontend Dashboard (React)++### 7.1 Dashboard Components+- [ ] Server overview with real-time metrics+- [ ] Application cards with status indicators+- [ ] Quick actions panel+- [ ] Activity feed+- [ ] Resource usage charts (Recharts)++### 7.2 Application Management UI+- [ ] Application list view+- [ ] Application detail page+- [ ] Deployment wizard+- [ ] Configuration editor+- [ ] Log viewer++### 7.3 Domain Management UI+- [ ] Domain list and management+- [ ] DNS records editor (if applicable)+- [ ] SSL certificate status+- [ ] Domain routing configuration++### 7.4 System Pages+- [ ] Web-based terminal (xterm.js)+- [ ] File manager+- [ ] Cron job manager+- [ ] Firewall configuration+- [ ] Settings and preferences++---++## Phase 8: Advanced Features++### 8.1 Monitoring & Alerts+- [ ] Uptime monitoring+- [ ] Resource threshold alerts+- [ ] Email/webhook notifications+- [ ] Custom alert rules+- [ ] Incident history++### 8.2 Backup System+- [ ] Scheduled backups+- [ ] Multiple backup destinations (local, S3, etc.)+- [ ] One-click restore+- [ ] Backup encryption+- [ ] Retention policies++### 8.3 Git Deployment+- [ ] GitHub/GitLab webhook integration+- [ ] Auto-deploy on push+- [ ] Deploy hooks (pre/post)+- [ ] Rollback functionality+- [ ] Deployment history++---++## Phase 9: Security & Hardening++### 9.1 Security Features+- [ ] Fail2ban integration+- [ ] UFW firewall management+- [ ] SSH key management+- [ ] Two-factor authentication+- [ ] Audit logging++### 9.2 Malware Protection+- [ ] File integrity monitoring+- [ ] Malware scanning (ClamAV)+- [ ] Suspicious activity detection++---++## Phase 10: Polish & Production++### 10.1 Documentation+- [ ] User documentation+- [ ] API documentation+- [ ] Installation guide+- [ ] Troubleshooting guide++### 10.2 Testing+- [ ] Unit tests (pytest)+- [ ] Integration tests+- [ ] E2E tests (Playwright/Cypress)+- [ ] Load testing++### 10.3 Production Readiness+- [ ] Production Docker image+- [ ] One-liner installation script+- [ ] Update mechanism+- [ ] Migration tools+- [ ] CLI tool for management++---++## Tech Stack Summary++| Component | Technology |+|-----------|------------|+| **Backend** | Python 3.11+, Flask, SQLAlchemy |+| **Frontend** | React 18, Vite, TailwindCSS |+| **Database** | SQLite (dev), PostgreSQL (prod) |+| **Web Server** | Nginx |+| **Process Manager** | Supervisor/systemd |+| **Container Runtime** | Docker |+| **Task Queue** | Celery + Redis (optional) |+| **Real-time** | WebSocket (Flask-SocketIO) |++---++## Milestones++| Milestone | Target | Status |+|-----------|--------|--------|+| **v0.1 - Alpha** | Core API + Auth + Basic Dashboard | Not Started |+| **v0.2 - PHP Support** | PHP-FPM + WordPress | Not Started |+| **v0.3 - Python Apps** | Flask/Django deployment | Not Started |+| **v0.4 - Docker** | Container management | Not Started |+| **v0.5 - Databases** | MySQL/PostgreSQL management | Not Started |+| **v1.0 - Stable** | Production ready | Not Started |++---++## Contributing++1. Pick an unchecked item from the roadmap+2. Create a feature branch+3. Implement with tests+4. Submit a PR++---++*Last updated: January 2026*diff --git a/docs/STRATEGIC_ROADMAP.md b/.planning/STRATEGIC_ROADMAP.mdsimilarity index 100%rename from docs/STRATEGIC_ROADMAP.mdrename to .planning/STRATEGIC_ROADMAP.mddiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 00000000..1ac64309--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,366 @@+# Contributing to ServerKit++Thank you for your interest in contributing to ServerKit! This guide will help you get started.++---++## Table of Contents++- [Code of Conduct](#code-of-conduct)+- [Getting Started](#getting-started)+- [Development Setup](#development-setup)+- [Project Structure](#project-structure)+- [Making Changes](#making-changes)+- [Coding Standards](#coding-standards)+- [Testing](#testing)+- [Submitting Changes](#submitting-changes)+- [Priority Areas](#priority-areas)++---++## Code of Conduct++- Be respectful and inclusive+- Provide constructive feedback+- Focus on the issue, not the person+- Help others learn and grow++---++## Getting Started++### Prerequisites++- Python 3.11++- Node.js 20++- Docker (optional, for testing)+- Git++### Fork and Clone++```bash+# Fork the repository on GitHub, then:+git clone https://github.com/YOUR_USERNAME/ServerKit.git+cd ServerKit+git remote add upstream https://github.com/jhd3197/ServerKit.git+```++---++## Development Setup++### Backend Setup++```bash+# Create virtual environment+cd backend+python -m venv venv++# Activate virtual environment+# Windows:+venv\Scripts\activate+# Linux/Mac:+source venv/bin/activate++# Install dependencies+pip install -r requirements.txt+pip install -r requirements-dev.txt # Development dependencies++# Copy environment file+cp ../.env.example .env+# Edit .env with your settings++# Run development server+python run.py+```++The backend will be available at `http://localhost:5000`.++### Frontend Setup++```bash+# In a new terminal+cd frontend++# Install dependencies+npm install++# Run development server+npm run dev+```++The frontend will be available at `http://localhost:5173` with hot-reload.++### Running Both Together++For development, run both the backend and frontend servers:++```bash+# Terminal 1 - Backend+cd backend && python run.py++# Terminal 2 - Frontend+cd frontend && npm run dev+```++Or use Docker:++```bash+docker compose -f docker-compose.dev.yml up+```++---++## Project Structure++```+ServerKit/+├── backend/ # Flask API+│ ├── app/+│ │ ├── api/ # API route blueprints+│ │ ├── models/ # SQLAlchemy models+│ │ └── services/ # Business logic+│ ├── config.py # Configuration+│ ├── run.py # Application entry point+│ └── requirements.txt+│+├── frontend/ # React application+│ ├── src/+│ │ ├── components/ # Reusable components+│ │ ├── pages/ # Page components+│ │ ├── services/ # API client+│ │ └── styles/ # LESS stylesheets+│ ├── package.json+│ └── vite.config.js+│+├── docs/ # Documentation+├── nginx/ # Nginx configuration+└── docker-compose.yml+```++### Key Files++**Backend:**+- `backend/app/__init__.py` - Flask app factory+- `backend/app/api/` - API endpoints (one file per feature)+- `backend/app/services/` - Business logic services+- `backend/app/models/` - Database models++**Frontend:**+- `frontend/src/App.jsx` - Main app with routing+- `frontend/src/pages/` - Page components+- `frontend/src/components/` - Shared components+- `frontend/src/services/api.js` - API client+- `frontend/src/styles/` - LESS stylesheets++---++## Making Changes++### Branch Naming++Use descriptive branch names:++```+feature/multi-server-support+fix/login-redirect-loop+docs/api-examples+refactor/notification-service+```++### Commit Messages++Write clear, concise commit messages:++```+Add Discord webhook notification support++- Create NotificationService for webhooks+- Add notification API endpoints+- Implement Discord embed formatting+- Add frontend notification settings+```++Format:+- First line: Brief summary (50 chars max)+- Blank line+- Body: Detailed description (wrap at 72 chars)++---++## Coding Standards++### Python (Backend)++- Follow PEP 8 style guide+- Use type hints where helpful+- Document public functions with docstrings+- Use meaningful variable names++```python+def get_system_stats() -> dict:+ """+ Retrieve current system statistics.++ Returns:+ dict: CPU, memory, disk, and network stats+ """+ cpu_percent = psutil.cpu_percent(interval=1)+ memory = psutil.virtual_memory()+ # ...+```++### JavaScript/React (Frontend)++- Use functional components with hooks+- Use meaningful component and variable names+- Keep components focused and small+- Use LESS for styling (not inline styles)++```jsx+const ServerStats = ({ serverId }) => {+ const [stats, setStats] = useState(null);+ const [loading, setLoading] = useState(true);++ useEffect(() => {+ fetchServerStats(serverId).then(setStats);+ }, [serverId]);++ if (loading) return <LoadingSpinner />;+ return <StatsDisplay stats={stats} />;+};+```++### LESS/CSS (Styles)++- Use the existing design system variables+- Follow BEM-like naming conventions+- Keep specificity low+- Use the component/page file structure++```less+.notification-card {+ background: @card-bg;+ border-radius: @border-radius-md;++ &__header {+ padding: @spacing-md;+ }++ &--expanded {+ border-color: @primary-color;+ }+}+```++---++## Testing++### Backend Tests++```bash+cd backend+pytest+pytest --cov=app # With coverage+```++### Frontend Tests++```bash+cd frontend+npm test+npm run test:coverage # With coverage+```++### Manual Testing++Before submitting, test your changes:++1. Run the full application+2. Test the feature in multiple browsers+3. Test error cases and edge cases+4. Verify responsive design (mobile/tablet)++---++## Submitting Changes++### Pull Request Process++1. **Update your fork:**+ ```bash+ git fetch upstream+ git rebase upstream/main+ ```++2. **Push your branch:**+ ```bash+ git push origin feature/your-feature+ ```++3. **Create Pull Request:**+ - Go to GitHub and create a PR+ - Fill out the PR template+ - Link any related issues++4. **PR Description:**+ - Describe what changed and why+ - Include screenshots for UI changes+ - List testing steps+ - Note any breaking changes++### PR Checklist++- [ ] Code follows project style guidelines+- [ ] Self-reviewed the code+- [ ] Added/updated tests if needed+- [ ] Updated documentation if needed+- [ ] No console errors or warnings+- [ ] Tested on multiple browsers (for frontend)++### Review Process++1. Maintainers will review your PR+2. Address any requested changes+3. Once approved, your PR will be merged++---++## Priority Areas++We especially welcome contributions in these areas:++### High Priority++- **Multi-Server Support** - Agent development, remote monitoring+- **Git Deployment** - GitHub/GitLab webhooks, auto-deploy+- **Backup System** - S3/B2 integration, scheduled backups+- **Security Enhancements** - Fail2ban, SSH key management++### Medium Priority++- **Email Server** - Postfix/Dovecot integration+- **API Improvements** - Rate limiting, API keys+- **Team Features** - Multi-user, RBAC++### Always Welcome++- Bug fixes+- Documentation improvements+- Test coverage+- UI/UX improvements+- Performance optimizations+- Accessibility improvements++---++## Questions?++- Open a [GitHub Discussion](https://github.com/jhd3197/ServerKit/discussions)+- Check existing [Issues](https://github.com/jhd3197/ServerKit/issues)+- Review the [Documentation](docs/README.md)++---++Thank you for contributing to ServerKit!diff --git a/Dockerfile b/Dockerfilenew file mode 100644index 00000000..42e60131--- /dev/null+++ b/Dockerfile@@ -0,0 +1,108 @@+# ============================================+# ServerKit Dockerfile - Single Container+# ============================================+# This Dockerfile creates a single container with both+# frontend and backend. Good for simple deployments.+#+# For production with separate containers and nginx,+# use docker-compose.yml instead.+#+# Build: docker build -t serverkit .+# Run: docker run -d -p 5000:5000 --env-file .env serverkit+# ============================================++# Stage 1: Build Frontend+FROM node:20-alpine AS frontend-builder++WORKDIR /app/frontend++# Copy package files+COPY frontend/package*.json ./++# Install dependencies+RUN npm ci++# Copy frontend source+COPY frontend/ ./++# Build production bundle+RUN npm run build++# ============================================+# Stage 2: Production Image+FROM python:3.11-slim-bookworm++# Set environment variables+ENV PYTHONDONTWRITEBYTECODE=1 \+ PYTHONUNBUFFERED=1 \+ FLASK_ENV=production \+ PORT=5000++# Install system dependencies+RUN apt-get update && apt-get install -y --no-install-recommends \+ # Required for psutil and some Python packages+ gcc \+ python3-dev \+ # Required for gevent+ libevent-dev \+ # Required for cryptography+ libffi-dev \+ libssl-dev \+ # ClamAV for malware scanning (optional, can be installed separately)+ clamav \+ clamav-daemon \+ clamav-freshclam \+ # Useful utilities+ curl \+ procps \+ && rm -rf /var/lib/apt/lists/* \+ && apt-get clean++# Create non-root user for security+RUN groupadd -r serverkit && useradd -r -g serverkit serverkit++# Create necessary directories+RUN mkdir -p /etc/serverkit /var/log/serverkit /var/quarantine \+ && chown -R serverkit:serverkit /etc/serverkit /var/log/serverkit /var/quarantine++# Set working directory+WORKDIR /app++# Copy backend requirements and install Python dependencies+COPY backend/requirements.txt ./backend/+RUN pip install --no-cache-dir -r backend/requirements.txt++# Copy backend source+COPY backend/ ./backend/++# Copy built frontend from Stage 1+COPY --from=frontend-builder /app/frontend/dist ./frontend/dist++# Create data directory for SQLite database+RUN mkdir -p /app/data && chown -R serverkit:serverkit /app/data++# Set ownership+RUN chown -R serverkit:serverkit /app++# Switch to non-root user+USER serverkit++# Expose port+EXPOSE 5000++# Health check+HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \+ CMD curl -f http://localhost:5000/api/v1/system/health || exit 1++# Working directory for the backend+WORKDIR /app/backend++# Default command - use gunicorn for production+CMD ["gunicorn", \+ "--worker-class", "geventwebsocket.gunicorn.workers.GeventWebSocketWorker", \+ "--workers", "1", \+ "--bind", "0.0.0.0:5000", \+ "--timeout", "120", \+ "--access-logfile", "-", \+ "--error-logfile", "-", \+ "run:app"]diff --git a/README.md b/README.mdindex 1c64c759..c8b05fe8 100644--- a/README.md+++ b/README.md@@ -1,94 +1,146 @@# ServerKit-**Modern, self-hosted server management panel** - An open-source alternative to ServerPilot and CyberPanel.----+<p align="center">+ <strong>Modern, self-hosted server management panel</strong><br>+ An open-source alternative to ServerPilot, RunCloud, and Coolify+</p>++<p align="center">+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">+ <img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python">+ <img src="https://img.shields.io/badge/react-18-blue.svg" alt="React">+ <img src="https://img.shields.io/badge/docker-ready-blue.svg" alt="Docker">+</p>----## Overview+## What is ServerKit?-ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.+ServerKit is a lightweight, modern server control panel for managing web applications, databases, Docker containers, and security on your VPS or dedicated server. Built with Python/Flask backend and React frontend.-### Key Features--- **PHP / WordPress** - PHP-FPM 8.2 with one-click WordPress installation-- **Python Apps** - Deploy Flask and Django applications with Gunicorn-- **Docker Support** - Manage containers directly from the dashboard-- **SSL Certificates** - Automatic Let's Encrypt with auto-renewal-- **Database Management** - MySQL/MariaDB and PostgreSQL support-- **Real-time Monitoring** - CPU, RAM, disk, and network metrics-- **Modern UI** - Dark-themed dashboard built with React+**Perfect for:** Developers, freelancers, and small teams who want full control over their infrastructure without the complexity of Kubernetes or the cost of managed platforms.----## Tech Stack+## Features-| Layer | Technology |-|-------|------------|-| Backend | Python 3.11+, Flask, SQLAlchemy |-| Frontend | React 18, Vite, TailwindCSS |-| Database | PostgreSQL / SQLite |-| Web Server | Nginx |-| Containers | Docker |-| Real-time | WebSocket (Flask-SocketIO) |+### Application Management+- **PHP / WordPress** - PHP-FPM 8.x with one-click WordPress installation+- **Python Apps** - Deploy Flask and Django with Gunicorn+- **Node.js** - PM2-managed Node applications+- **Docker** - Full container and Docker Compose management+- **Environment Variables** - Secure, encrypted variable management per app++### Infrastructure+- **Domain Management** - Nginx virtual hosts with easy configuration+- **SSL Certificates** - Automatic Let's Encrypt with auto-renewal+- **Database Management** - MySQL/MariaDB and PostgreSQL support+- **Firewall (UFW)** - Visual firewall rule management+- **Cron Jobs** - Schedule tasks with a visual editor+- **File Manager** - Browse and edit files via web interface+- **FTP Server** - Manage vsftpd users and access++### Security+- **Two-Factor Authentication (2FA)** - TOTP-based with backup codes+- **ClamAV Integration** - Malware scanning with quarantine+- **File Integrity Monitoring** - Detect unauthorized file changes+- **Failed Login Detection** - Monitor suspicious login attempts+- **Security Alerts** - Real-time notifications for threats++### Monitoring & Alerts+- **Real-time Metrics** - CPU, RAM, disk, network monitoring+- **Server Uptime Tracking** - Historical uptime data+- **Alert Thresholds** - Customizable warning/critical levels+- **Notification Webhooks:**+ - Discord+ - Slack+ - Telegram+ - Generic webhooks++### Modern UI+- Dark-themed responsive dashboard+- Real-time WebSocket updates+- Mobile-friendly interface----## Requirements+## Screenshots++<p align="center">+ <img src="https://github.com/user-attachments/assets/6407ecf0-7a1a-4c4b-b7e3-8af6619da2f9" alt="Dashboard" width="100%">+</p>-- Ubuntu 22.04+ / Debian 12+ (recommended)-- Python 3.11+-- Node.js 18+-- Docker (optional, for container management)-- Root or sudo access+<p align="center">+ <img src="https://github.com/user-attachments/assets/73807009-9538-48e9-bbdf-152aed57bdd8" alt="Applications" width="100%">+</p>---## Quick Start-### Development Setup+### Option 1: Docker (Recommended)```bash# Clone the repositorygit clone https://github.com/jhd3197/ServerKit.gitcd ServerKit-# Backend setup-cd backend-python -m venv venv-source venv/bin/activate # Windows: venv\Scripts\activate-pip install -r requirements.txt-flask run--# Frontend setup (new terminal)-cd frontend-npm install-npm run dev-```--### Production Installation+# Configure environment+cp .env.example .env+nano .env # Set SECRET_KEY and JWT_SECRET_KEY-Install command:+# Start ServerKit+docker compose up -d-```bash-curl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh | bash+# Access at http://localhost```-Update command:+### Option 2: One-Line Install (Ubuntu)```bashcurl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh | bash```+### Option 3: Manual Installation++See [Installation Guide](docs/INSTALLATION.md) for detailed instructions.+----## Screenshots--<img width="1703" height="887" alt="image" src="https://github.com/user-attachments/assets/73807009-9538-48e9-bbdf-152aed57bdd8" />+## Requirements++| Requirement | Minimum | Recommended |+|-------------|---------|-------------|+| OS | Ubuntu 22.04 LTS | Ubuntu 24.04 LTS |+| CPU | 1 vCPU | 2+ vCPU |+| RAM | 1 GB | 2+ GB |+| Disk | 10 GB | 20+ GB |+| Docker | 24.0+ | Latest |++---+## Tech Stack++| Layer | Technology |+|-------|------------|+| Backend | Python 3.11, Flask, SQLAlchemy, Flask-SocketIO |+| Frontend | React 18, Vite, LESS |+| Database | SQLite / PostgreSQL |+| Web Server | Nginx, Gunicorn |+| Containers | Docker, Docker Compose |+| Security | ClamAV, TOTP (pyotp), Cryptography |++---++## Documentation++| Document | Description |+|----------|-------------|+| [Installation Guide](docs/INSTALLATION.md) | Complete setup instructions |+| [Deployment Guide](docs/DEPLOYMENT.md) | CLI commands and production deployment |+| [API Reference](docs/API.md) | REST API documentation |+| [Roadmap](ROADMAP.md) | Development roadmap and planned features |+| [Contributing](CONTRIBUTING.md) | How to contribute |---@@ -98,135 +150,153 @@ curl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh |ServerKit/├── backend/ # Flask API│ ├── app/-│ │ ├── api/ # API routes+│ │ ├── api/ # API endpoints│ │ ├── models/ # Database models-│ │ ├── services/ # Business logic-│ │ └── utils/ # Helpers+│ │ └── services/ # Business logic│ ├── config.py│ └── requirements.txt│├── frontend/ # React application│ ├── src/│ │ ├── components/ # Reusable components-│ │ ├── layouts/ # Layout components│ │ ├── pages/ # Page components-│ │ └── services/ # API clients+│ │ ├── services/ # API client+│ │ └── styles/ # LESS stylesheets│ └── package.json│-├── agent/ # Server monitoring agent-│ └── serverkit-agent.py-│-├── docker/ # Docker configurations-│ ├── Dockerfile-│ └── docker-compose.yml-│├── docs/ # Documentation-├── ROADMAP.md # Development roadmap+├── docker-compose.yml # Docker configuration└── README.md```----## Supported Applications+## CLI Commands-### PHP / WordPress-- PHP-FPM 8.0, 8.1, 8.2, 8.3-- One-click WordPress installation-- WP-CLI integration-- Automatic updates and backups+ServerKit includes a management CLI:-### Python-- Flask applications with Gunicorn-- Django applications with static file handling-- Virtual environment management-- Multiple Python versions+```bash+# Service Management+serverkit start|stop|restart|status++# User Management+serverkit create-admin+serverkit reset-password-### Docker-- Container management-- Docker Compose support-- Image management-- Log streaming+# Database+serverkit backup-db+serverkit restore-db <backup-file>-### Databases-- MySQL / MariaDB-- PostgreSQL-- Redis (optional)+# Utilities+serverkit generate-keys+serverkit logs [service]+serverkit update+```----## API Documentation+## Configuration-API runs on port `5000` by default.+Create a `.env` file from the example:+```bash+cp .env.example .env```-Base URL: http://localhost:5000/api/v1-Authentication:- POST /auth/login # Get JWT token- POST /auth/register # Register new user- POST /auth/refresh # Refresh token+Key configuration options:-Applications:- GET /apps # List all apps- POST /apps # Create new app- GET /apps/:id # Get app details- PUT /apps/:id # Update app- DELETE /apps/:id # Delete app--Domains:- GET /domains # List domains- POST /domains # Add domain- DELETE /domains/:id # Remove domain--System:- GET /system/metrics # Server metrics- GET /system/logs # System logs- POST /system/services # Control services+```env+# Required - Generate unique values!+SECRET_KEY=your-secret-key+JWT_SECRET_KEY=your-jwt-secret++# Database (SQLite default, PostgreSQL for production)+DATABASE_URL=sqlite:///serverkit.db++# Your domain+CORS_ORIGINS=https://panel.yourdomain.com+```++Generate secure keys:+```bash+python -c "import secrets; print(secrets.token_hex(32))"```----## Configuration+## Notification Setup-Create a `.env` file in the backend directory:+ServerKit can send alerts to multiple channels:-```env-# Flask-FLASK_ENV=development-SECRET_KEY=your-secret-key+### Discord+1. Create webhook: Server Settings → Integrations → Webhooks+2. Copy URL to Settings → Notifications → Discord-# Database-DATABASE_URL=sqlite:///serverkit.db+### Slack+1. Create app: api.slack.com → Incoming Webhooks+2. Copy URL to Settings → Notifications → Slack-# JWT-JWT_SECRET_KEY=your-jwt-secret+### Telegram+1. Create bot via @BotFather+2. Get chat ID from @userinfobot+3. Configure in Settings → Notifications → Telegram-# Server Agent-AGENT_TOKEN=your-agent-token-```+---++## Security Features++### Two-Factor Authentication+- TOTP-based (Google Authenticator, Authy, etc.)+- Backup codes for recovery+- Enable in Settings → Security++### Malware Scanning+- ClamAV integration+- Quick scan / Full scan options+- Automatic quarantine+- Configure in Security → Settings++### File Integrity Monitoring+- Baseline creation+- Change detection+- Alert on modifications----## Roadmap+## API Overview-See [ROADMAP.md](ROADMAP.md) for the detailed development plan.+Base URL: `http://localhost:5000/api/v1`-**Current Status: Phase 1 - Foundation**+```+Authentication:+ POST /auth/login # Login+ POST /auth/register # Register+ POST /auth/2fa/verify # 2FA verification-| Phase | Description | Status |-|-------|-------------|--------|-| 1 | Foundation & Core | In Progress |-| 2 | Server Agent | Planned |-| 3 | PHP & WordPress | Planned |-| 4 | Python Apps | Planned |-| 5 | Docker Support | Planned |-| 6 | Database Management | Planned |+Applications:+ GET /apps # List apps+ POST /apps # Create app+ GET /apps/:id # Get app+ DELETE /apps/:id # Delete app++Security:+ GET /security/status # Security summary+ POST /security/scan/quick # Quick malware scan+ GET /security/events # Security events++Notifications:+ GET /notifications/config # Get config+ PUT /notifications/config/:channel # Update channel+ POST /notifications/test/:channel # Test channel+```++Full API documentation: [docs/API.md](docs/API.md)---## Contributing-Contributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md) before submitting a PR.+Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.1. Fork the repository2. Create your feature branch (`git checkout -b feature/amazing-feature`)@@ -236,17 +306,42 @@ Contributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md)---+## Roadmap++See [ROADMAP.md](ROADMAP.md) for the full development plan.++**Recent additions:**+- Two-Factor Authentication (2FA)+- Discord/Slack/Telegram notifications+- ClamAV malware scanning+- File integrity monitoring+- Environment variable management+- Cron job management++**Coming soon:**+- Multi-server management+- Git deployment with webhooks+- Let's Encrypt wildcard SSL+- Email server management+- Backup to S3/B2++---+## License-This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.+This project is licensed under the MIT License - see [LICENSE](LICENSE) for details.---## Acknowledgments-- Inspired by [ServerPilot](https://serverpilot.io) and [CyberPanel](https://cyberpanel.net)-- UI design inspired by modern admin dashboards+- Inspired by [Coolify](https://coolify.io), [ServerPilot](https://serverpilot.io), and [RunCloud](https://runcloud.io)+- UI inspired by modern admin dashboards----**ServerKit** - Simple. Modern. Self-hosted.+<p align="center">+ <strong>ServerKit</strong> - Simple. Modern. Self-hosted.<br>+ <a href="https://github.com/jhd3197/ServerKit/issues">Report Bug</a> ·+ <a href="https://github.com/jhd3197/ServerKit/issues">Request Feature</a>+</p>diff --git a/ROADMAP.md b/ROADMAP.mdindex 772e2810..e9feb778 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,293 +1,298 @@# ServerKit Roadmap-A modern, self-hosted server management panel - alternative to ServerPilot/CyberPanel.+This document outlines the development roadmap for ServerKit. Features are organized by phases and priority.----## Phase 1: Foundation & Core Infrastructure--### 1.1 Project Setup-- [x] Initialize React frontend with Vite-- [x] Create admin dashboard mockup/design system-- [ ] Set up Flask backend structure-- [ ] Configure SQLAlchemy with SQLite/PostgreSQL-- [ ] Set up Docker development environment-- [ ] Configure CORS and API routing-- [ ] Implement JWT authentication system--### 1.2 User Management-- [ ] User registration and login-- [ ] Role-based access control (Admin, User)-- [ ] Session management-- [ ] Password reset functionality-- [ ] API token generation for CLI access--### 1.3 Core API Structure-```-/api/v1/-├── auth/ # Authentication endpoints-├── servers/ # Server management-├── apps/ # Application management-├── domains/ # Domain configuration-├── databases/ # Database management-├── ssl/ # SSL certificate management-└── system/ # System metrics and logs-```+## Current Version: v0.9.0++### Recently Completed++- **Two-Factor Authentication (2FA)** - TOTP-based with backup codes+- **Notification Webhooks** - Discord, Slack, Telegram, generic webhooks+- **ClamAV Integration** - Malware scanning with quarantine+- **File Integrity Monitoring** - Baseline creation and change detection+- **Environment Variable Management** - Secure, encrypted per-app variables+- **Cron Job Management** - Visual cron editor+- **Server Uptime Tracking** - Historical uptime data and visualization----## Phase 2: Server Agent & System Integration--### 2.1 Server Agent (Python)-- [ ] System metrics collection (CPU, RAM, Disk, Load)-- [ ] Process monitoring and management-- [ ] Service control (start, stop, restart)-- [ ] Log aggregation and streaming-- [ ] WebSocket connection for real-time updates--### 2.2 Nginx Management-- [ ] Nginx configuration generator-- [ ] Virtual host management-- [ ] Reverse proxy configuration-- [ ] Load balancing setup-- [ ] Configuration validation and reload--### 2.3 SSL/TLS Management-- [ ] Let's Encrypt integration (Certbot)-- [ ] Auto-renewal setup-- [ ] Custom certificate upload-- [ ] SSL status monitoring-- [ ] Force HTTPS redirects+## Phase 1: Core Infrastructure (Completed)++- [x] Flask backend with SQLAlchemy ORM+- [x] React frontend with Vite+- [x] JWT-based authentication+- [x] Real-time WebSocket updates+- [x] System metrics (CPU, RAM, disk, network)+- [x] Docker and Docker Compose support+- [x] SQLite/PostgreSQL database support----## Phase 3: PHP & WordPress Support--### 3.1 PHP-FPM Management-- [ ] PHP 8.2 FPM pool configuration-- [ ] Multiple PHP version support (8.0, 8.1, 8.2, 8.3)-- [ ] Per-site PHP configuration-- [ ] PHP extensions management-- [ ] OPcache configuration--### 3.2 WordPress Toolkit-- [ ] One-click WordPress installation-- [ ] WP-CLI integration-- [ ] Automatic updates management-- [ ] Backup and restore-- [ ] Staging environment creation-- [ ] Database optimization tools--### 3.3 WordPress-Specific Features-- [ ] Plugin/theme management-- [ ] wp-config.php editor-- [ ] Security hardening-- [ ] Performance optimization-- [ ] Search & replace tool+## Phase 2: Application Management (Completed)++- [x] PHP/WordPress application deployment+- [x] Python (Flask/Django) application support+- [x] Node.js application management with PM2+- [x] Docker container management+- [x] Environment variable management+- [x] Application start/stop/restart controls+- [x] Log viewing per application----## Phase 4: Python Application Support+## Phase 3: Domain & SSL Management (Completed)++- [x] Nginx virtual host management+- [x] Domain configuration interface+- [x] Let's Encrypt SSL integration+- [x] SSL certificate auto-renewal+- [x] Redirect management (HTTP → HTTPS)-### 4.1 Python Runtime Management-- [ ] Multiple Python version support (3.9, 3.10, 3.11, 3.12)-- [ ] Virtual environment management-- [ ] pip package management-- [ ] Requirements.txt handling+----### 4.2 Flask Application Deployment-- [ ] Gunicorn/uWSGI configuration-- [ ] Environment variables management-- [ ] Application process management-- [ ] Log routing and monitoring-- [ ] Static file serving+## Phase 4: Database Management (Completed)-### 4.3 Django Application Deployment-- [ ] Django-specific configuration-- [ ] Static/media file handling-- [ ] Database migrations support-- [ ] Celery worker management-- [ ] Django admin access+- [x] MySQL/MariaDB database support+- [x] PostgreSQL database support+- [x] Database creation/deletion+- [x] User management per database+- [x] Basic query interface----## Phase 5: Docker Container Management--### 5.1 Docker Integration-- [ ] Docker daemon connection-- [ ] Container listing and management-- [ ] Image management (pull, remove)-- [ ] Container logs streaming-- [ ] Resource usage monitoring--### 5.2 Docker Compose Support-- [ ] Compose file editor-- [ ] Stack deployment-- [ ] Service scaling-- [ ] Network management-- [ ] Volume management--### 5.3 Container Features-- [ ] Container shell access (WebSocket terminal)-- [ ] Environment variable management-- [ ] Port mapping configuration-- [ ] Container health checks-- [ ] Auto-restart policies+## Phase 5: File & FTP Management (Completed)++- [x] Web-based file manager+- [x] File upload/download+- [x] File editing with syntax highlighting+- [x] vsftpd FTP server integration+- [x] FTP user management----## Phase 6: Database Management+## Phase 6: Monitoring & Alerts (Completed)-### 6.1 MySQL/MariaDB-- [ ] Database creation and management-- [ ] User and privilege management-- [ ] phpMyAdmin integration-- [ ] Backup and restore-- [ ] Query execution interface+- [x] Real-time system metrics+- [x] Server uptime tracking+- [x] Customizable alert thresholds+- [x] Discord webhook notifications+- [x] Slack webhook notifications+- [x] Telegram bot notifications+- [x] Generic webhook support+- [x] Alert history and logging-### 6.2 PostgreSQL-- [ ] Database creation and management-- [ ] User and privilege management-- [ ] pgAdmin integration (optional)-- [ ] Backup and restore+---++## Phase 7: Security Features (Completed)-### 6.3 Redis (Optional)-- [ ] Redis server management-- [ ] Key browser-- [ ] Memory usage monitoring+- [x] Two-factor authentication (TOTP)+- [x] Backup codes for 2FA recovery+- [x] ClamAV malware scanning+- [x] Quick scan / Full scan options+- [x] File quarantine management+- [x] File integrity monitoring+- [x] Failed login detection+- [x] Security event logging----## Phase 7: Frontend Dashboard (React)--### 7.1 Dashboard Components-- [ ] Server overview with real-time metrics-- [ ] Application cards with status indicators-- [ ] Quick actions panel-- [ ] Activity feed-- [ ] Resource usage charts (Recharts)--### 7.2 Application Management UI-- [ ] Application list view-- [ ] Application detail page-- [ ] Deployment wizard-- [ ] Configuration editor-- [ ] Log viewer--### 7.3 Domain Management UI-- [ ] Domain list and management-- [ ] DNS records editor (if applicable)-- [ ] SSL certificate status-- [ ] Domain routing configuration--### 7.4 System Pages-- [ ] Web-based terminal (xterm.js)-- [ ] File manager-- [ ] Cron job manager-- [ ] Firewall configuration-- [ ] Settings and preferences+## Phase 8: Scheduled Tasks (Completed)++- [x] Cron job management+- [x] Visual cron expression builder+- [x] Job execution history+- [x] Enable/disable jobs----## Phase 8: Advanced Features+## Phase 9: Firewall Management (Completed)-### 8.1 Monitoring & Alerts-- [ ] Uptime monitoring-- [ ] Resource threshold alerts-- [ ] Email/webhook notifications-- [ ] Custom alert rules-- [ ] Incident history+- [x] UFW firewall integration+- [x] Visual rule management+- [x] Common port presets+- [x] Rule enable/disable-### 8.2 Backup System-- [ ] Scheduled backups-- [ ] Multiple backup destinations (local, S3, etc.)-- [ ] One-click restore-- [ ] Backup encryption-- [ ] Retention policies+---++## Phase 10: Multi-Server Management (Planned)++**Priority: High** | **Target: v1.1.0**++- [ ] Agent-based remote server monitoring+- [ ] Centralized dashboard for multiple servers+- [ ] Server grouping and tagging+- [ ] Cross-server metrics comparison+- [ ] Remote command execution+- [ ] Server health overview++---++## Phase 11: Git Deployment (Planned)++**Priority: High** | **Target: v1.1.0**-### 8.3 Git Deployment- [ ] GitHub/GitLab webhook integration-- [ ] Auto-deploy on push-- [ ] Deploy hooks (pre/post)-- [ ] Rollback functionality-- [ ] Deployment history+- [ ] Automatic deployment on push+- [ ] Branch selection for deployment+- [ ] Rollback to previous deployments+- [ ] Deployment history and logs+- [ ] Pre/post deployment scripts+- [ ] Zero-downtime deployments----## Phase 9: Security & Hardening+## Phase 12: Backup & Restore (Planned)++**Priority: High** | **Target: v1.2.0**++- [ ] Automated database backups+- [ ] File/directory backups+- [ ] S3-compatible storage support+- [ ] Backblaze B2 integration+- [ ] Backup scheduling+- [ ] One-click restore+- [ ] Backup retention policies+- [ ] Offsite backup verification++---++## Phase 13: Email Server Management (Planned)++**Priority: Medium** | **Target: v1.3.0**++- [ ] Postfix mail server setup+- [ ] Dovecot IMAP/POP3 configuration+- [ ] Email account management+- [ ] Spam filtering (SpamAssassin)+- [ ] DKIM/SPF/DMARC configuration+- [ ] Webmail interface integration+- [ ] Email forwarding rules++---++## Phase 14: Advanced SSL Features (Planned)++**Priority: Medium** | **Target: v1.2.0**++- [ ] Wildcard SSL certificates+- [ ] Multi-domain certificates (SAN)+- [ ] Custom certificate upload+- [ ] Certificate expiry monitoring+- [ ] Automatic renewal notifications++---++## Phase 15: Team & Permissions (Planned)++**Priority: Medium** | **Target: v1.4.0**++- [ ] Multi-user support+- [ ] Role-based access control (RBAC)+- [ ] Custom permission sets+- [ ] Audit logging per user+- [ ] Team invitations+- [ ] Activity dashboard++---++## Phase 16: API Enhancements (Planned)++**Priority: Medium** | **Target: v1.3.0**++- [ ] API key management+- [ ] Rate limiting+- [ ] Webhook event subscriptions+- [ ] OpenAPI/Swagger documentation+- [ ] API usage analytics++---++## Phase 17: Advanced Security (Planned)++**Priority: High** | **Target: v1.2.0**-### 9.1 Security Features- [ ] Fail2ban integration-- [ ] UFW firewall management- [ ] SSH key management-- [ ] Two-factor authentication-- [ ] Audit logging--### 9.2 Malware Protection-- [ ] File integrity monitoring-- [ ] Malware scanning (ClamAV)-- [ ] Suspicious activity detection+- [ ] IP allowlist/blocklist+- [ ] Brute force protection+- [ ] Security audit reports+- [ ] Vulnerability scanning+- [ ] Automatic security updates----## Phase 10: Polish & Production+## Phase 18: Performance Optimization (Planned)++**Priority: Low** | **Target: v1.5.0**++- [ ] Redis caching integration+- [ ] Database query optimization+- [ ] Static asset CDN support+- [ ] Lazy loading for large datasets+- [ ] Background job queue (Celery)++----### 10.1 Documentation-- [ ] User documentation-- [ ] API documentation-- [ ] Installation guide-- [ ] Troubleshooting guide+## Phase 19: Mobile App (Planned)-### 10.2 Testing-- [ ] Unit tests (pytest)-- [ ] Integration tests-- [ ] E2E tests (Playwright/Cypress)-- [ ] Load testing+**Priority: Low** | **Target: v2.0.0**-### 10.3 Production Readiness-- [ ] Production Docker image-- [ ] One-liner installation script-- [ ] Update mechanism-- [ ] Migration tools-- [ ] CLI tool for management+- [ ] React Native mobile application+- [ ] Push notifications+- [ ] Quick actions (restart, view stats)+- [ ] Biometric authentication----## Tech Stack Summary+## Phase 20: Marketplace & Extensions (Planned)++**Priority: Low** | **Target: v2.0.0**-| Component | Technology |-|-----------|------------|-| **Backend** | Python 3.11+, Flask, SQLAlchemy |-| **Frontend** | React 18, Vite, TailwindCSS |-| **Database** | SQLite (dev), PostgreSQL (prod) |-| **Web Server** | Nginx |-| **Process Manager** | Supervisor/systemd |-| **Container Runtime** | Docker |-| **Task Queue** | Celery + Redis (optional) |-| **Real-time** | WebSocket (Flask-SocketIO) |+- [ ] Plugin/extension system+- [ ] Community marketplace+- [ ] Custom dashboard widgets+- [ ] Theme customization----## Milestones+## Version Milestones-| Milestone | Target | Status |-|-----------|--------|--------|-| **v0.1 - Alpha** | Core API + Auth + Basic Dashboard | Not Started |-| **v0.2 - PHP Support** | PHP-FPM + WordPress | Not Started |-| **v0.3 - Python Apps** | Flask/Django deployment | Not Started |-| **v0.4 - Docker** | Container management | Not Started |-| **v0.5 - Databases** | MySQL/PostgreSQL management | Not Started |-| **v1.0 - Stable** | Production ready | Not Started |+| Version | Target Features | Status |+|---------|-----------------|--------|+| v0.9.0 | Core features, 2FA, Notifications, Security | Current |+| v1.0.0 | Production-ready stable release | Planned |+| v1.1.0 | Multi-server, Git deployment | Planned |+| v1.2.0 | Backups, Advanced SSL, Advanced Security | Planned |+| v1.3.0 | Email server, API enhancements | Planned |+| v1.4.0 | Team & permissions | Planned |+| v1.5.0 | Performance optimizations | Planned |+| v2.0.0 | Mobile app, Marketplace | Future |---## Contributing-1. Pick an unchecked item from the roadmap-2. Create a feature branch-3. Implement with tests-4. Submit a PR+Want to help? See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.++**Priority areas for contributions:**+- Multi-server agent development+- Git webhook integration+- S3/B2 backup implementations+- Additional notification channels+- UI/UX improvements+- Documentation++---++## Feature Requests++Have a feature idea? Open an issue on GitHub with the `enhancement` label.----*Last updated: January 2026*+<p align="center">+ <strong>ServerKit Roadmap</strong><br>+ Last updated: January 2026+</p>diff --git a/ServerPilot_google_admin_2.html b/ServerPilot_google_admin_2.htmldeleted file mode 100644index 30ea2c70..00000000--- a/ServerPilot_google_admin_2.html+++ /dev/null@@ -1,482 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>JuanPilot | Infrastructure</title>- <style>- /* --- DESIGN SYSTEM --- */- :root {- --bg-body: #09090b; /* Zinc 950 */- --bg-sidebar: #0f0f11; /* Slightly lighter than body */- --bg-card: #18181b; /* Zinc 900 */- --bg-hover: #27272a; /* Zinc 800 */-- --border-subtle: #27272a;- --border-active: #3f3f46;-- --text-primary: #f4f4f5;- --text-secondary: #a1a1aa;- --text-tertiary: #71717a;-- --accent-primary: #6366f1; /* Indigo 500 */- --accent-glow: rgba(99, 102, 241, 0.15);-- --success: #10b981;- --warning: #f59e0b;- --danger: #ef4444;-- --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;- --sidebar-width: 280px;- }-- * { margin: 0; padding: 0; box-sizing: border-box; outline: none; }-- body {- background-color: var(--bg-body);- color: var(--text-primary);- font-family: var(--font-main);- display: flex;- min-height: 100vh;- font-size: 14px;- line-height: 1.5;- }-- /* --- ICONS (SVG Styling) --- */- svg {- width: 20px;- height: 20px;- stroke: currentColor;- stroke-width: 2;- stroke-linecap: round;- stroke-linejoin: round;- fill: none;- }-- /* --- SIDEBAR --- */- .sidebar {- width: var(--sidebar-width);- background-color: var(--bg-sidebar);- border-right: 1px solid var(--border-subtle);- display: flex;- flex-direction: column;- position: fixed;- height: 100vh;- z-index: 10;- }-- .brand {- padding: 24px 32px;- font-size: 16px;- font-weight: 700;- letter-spacing: -0.5px;- color: var(--text-primary);- display: flex;- align-items: center;- gap: 12px;- border-bottom: 1px solid var(--border-subtle);- }-- .brand-logo {- width: 32px; height: 32px;- background: linear-gradient(135deg, var(--accent-primary), #818cf8);- border-radius: 8px;- display: flex;- align-items: center;- justify-content: center;- color: white;- }-- .menu-label {- padding: 24px 32px 8px;- font-size: 11px;- font-weight: 600;- text-transform: uppercase;- letter-spacing: 0.05em;- color: var(--text-tertiary);- }-- .nav { display: flex; flex-direction: column; padding: 0 16px; gap: 4px; }-- .nav-item {- display: flex;- align-items: center;- gap: 12px;- padding: 10px 16px;- color: var(--text-secondary);- text-decoration: none;- border-radius: 6px;- transition: all 0.2s ease;- font-weight: 500;- }-- .nav-item:hover {- background-color: var(--bg-hover);- color: var(--text-primary);- }-- .nav-item.active {- background-color: var(--accent-glow);- color: var(--accent-primary);- }-- .user-profile {- margin-top: auto;- padding: 20px;- border-top: 1px solid var(--border-subtle);- display: flex;- align-items: center;- gap: 12px;- }-- .avatar {- width: 36px; height: 36px;- background-color: var(--bg-hover);- border-radius: 50%;- display: flex;- align-items: center;- justify-content: center;- color: var(--text-secondary);- font-weight: 600;- }-- /* --- MAIN AREA --- */- .main {- margin-left: var(--sidebar-width);- flex: 1;- padding: 40px;- }-- .top-bar {- display: flex;- justify-content: space-between;- align-items: center;- margin-bottom: 40px;- }-- h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }- .subtitle { color: var(--text-tertiary); margin-top: 4px; }-- .btn {- display: inline-flex;- align-items: center;- gap: 8px;- padding: 10px 20px;- border-radius: 8px;- border: 1px solid transparent;- font-size: 13px;- font-weight: 500;- cursor: pointer;- transition: 0.2s;- }-- .btn-primary {- background-color: var(--accent-primary);- color: white;- box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);- }- .btn-primary:hover { background-color: #4f46e5; }-- .btn-secondary {- background-color: transparent;- border-color: var(--border-active);- color: var(--text-primary);- }- .btn-secondary:hover { background-color: var(--bg-hover); }-- /* --- GRID LAYOUT --- */- .dashboard-grid {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));- gap: 24px;- }-- .card {- background-color: var(--bg-card);- border: 1px solid var(--border-subtle);- border-radius: 12px;- padding: 24px;- transition: transform 0.2s, border-color 0.2s;- position: relative;- overflow: hidden;- }-- .card:hover {- border-color: var(--border-active);- transform: translateY(-2px);- }-- .card-header {- display: flex;- justify-content: space-between;- align-items: flex-start;- margin-bottom: 20px;- }-- .app-icon {- width: 40px; height: 40px;- border-radius: 8px;- background-color: var(--bg-hover);- display: flex;- align-items: center;- justify-content: center;- color: var(--text-primary);- margin-bottom: 12px;- }-- .status-badge {- display: flex;- align-items: center;- gap: 6px;- padding: 4px 10px;- border-radius: 20px;- font-size: 11px;- font-weight: 600;- border: 1px solid transparent;- }-- .status-active { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }- .status-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }-- .card h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }- .card-link { color: var(--text-secondary); text-decoration: none; font-size: 13px; }- .card-link:hover { color: var(--accent-primary); }-- .metric-row {- margin-top: 24px;- padding-top: 20px;- border-top: 1px solid var(--border-subtle);- display: flex;- justify-content: space-between;- font-size: 12px;- color: var(--text-secondary);- }-- .metric-item { display: flex; flex-direction: column; gap: 4px; }- .metric-value { font-weight: 600; color: var(--text-primary); font-family: monospace; }-- /* --- STATS BAR (CPU/RAM) --- */- .stats-strip {- display: grid;- grid-template-columns: repeat(4, 1fr);- gap: 24px;- margin-bottom: 32px;- }-- .stat-card {- background: var(--bg-card);- padding: 20px;- border-radius: 12px;- border: 1px solid var(--border-subtle);- display: flex;- flex-direction: column;- gap: 8px;- }-- .stat-label { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; font-weight: 600; }- .stat-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }-- .progress-bar {- height: 4px;- background: var(--bg-hover);- border-radius: 2px;- overflow: hidden;- margin-top: 4px;- }- .progress-fill { height: 100%; border-radius: 2px; }-- </style>-</head>-<body>-- <aside class="sidebar">- <div class="brand">- <div class="brand-logo">- <svg viewBox="0 0 24 24"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>- </div>- JuanPilot- </div>-- <div class="menu-label">Overview</div>- <nav class="nav">- <a href="#" class="nav-item active">- <svg viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>- Dashboard- </a>- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>- Activity- </a>- </nav>-- <div class="menu-label">Infrastructure</div>- <nav class="nav">- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>- Domains & Sites- </a>- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>- Applications- </a>- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path></svg>- Databases- </a>- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>- SSL Certificates- </a>- </nav>-- <div class="menu-label">System</div>- <nav class="nav">- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><path d="M4 17l6-6-6-6M12 19h8"/></svg>- Terminal / Logs- </a>- <a href="#" class="nav-item">- <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>- Settings- </a>- </nav>-- <div class="user-profile">- <div class="avatar">JD</div>- <div style="font-size: 13px;">- <div style="font-weight: 600;">Juan Denis</div>- <div style="color: var(--text-tertiary);">Admin</div>- </div>- </div>- </aside>-- <main class="main">- <header class="top-bar">- <div>- <h1>Dashboard</h1>- <div class="subtitle">Overview of your droplet status and applications.</div>- </div>- <div style="display: flex; gap: 12px;">- <button class="btn btn-secondary">- <svg viewBox="0 0 24 24"><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg>- Logs- </button>- <button class="btn btn-primary">- <svg viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>- New Application- </button>- </div>- </header>-- <section class="stats-strip">- <div class="stat-card">- <div class="stat-label">CPU Usage</div>- <div class="stat-value">12%</div>- <div class="progress-bar"><div class="progress-fill" style="width: 12%; background: var(--success);"></div></div>- </div>- <div class="stat-card">- <div class="stat-label">Memory</div>- <div class="stat-value">1.8GB <span style="font-size: 14px; color: var(--text-tertiary);">/ 4GB</span></div>- <div class="progress-bar"><div class="progress-fill" style="width: 45%; background: var(--accent-primary);"></div></div>- </div>- <div class="stat-card">- <div class="stat-label">Disk Space</div>- <div class="stat-value">22GB <span style="font-size: 14px; color: var(--text-tertiary);">/ 80GB</span></div>- <div class="progress-bar"><div class="progress-fill" style="width: 27%; background: var(--accent-primary);"></div></div>- </div>- <div class="stat-card">- <div class="stat-label">Load Average</div>- <div class="stat-value">0.45</div>- <div class="progress-bar"><div class="progress-fill" style="width: 10%; background: var(--success);"></div></div>- </div>- </section>-- <h2 style="font-size: 18px; margin-bottom: 20px; font-weight: 600;">Active Projects</h2>- <div class="dashboard-grid">-- <div class="card">- <div class="card-header">- <div class="app-icon">- <svg viewBox="0 0 24 24" width="24" height="24"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>- </div>- <div class="status-badge status-active">- <div style="width: 6px; height: 6px; background: currentColor; border-radius: 50%;"></div>- Running- </div>- </div>- <h3>juandenis.com</h3>- <a href="#" class="card-link">https://juandenis.com</a>- <div class="metric-row">- <div class="metric-item">- <span>Stack</span>- <span class="metric-value" style="color: #a78bfa;">WP / PHP 8.2</span>- </div>- <div class="metric-item">- <span>Uptime</span>- <span class="metric-value">14d 2h</span>- </div>- <div class="metric-item">- <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px;">Manage</button>- </div>- </div>- </div>-- <div class="card">- <div class="card-header">- <div class="app-icon">- <svg viewBox="0 0 24 24" width="24" height="24"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg>- </div>- <div class="status-badge status-active">- <div style="width: 6px; height: 6px; background: currentColor; border-radius: 50%;"></div>- Running- </div>- </div>- <h3>api.samanlabs.com</h3>- <a href="#" class="card-link">https://api.samanlabs.com</a>- <div class="metric-row">- <div class="metric-item">- <span>Stack</span>- <span class="metric-value" style="color: #fcd34d;">Python / Flask</span>- </div>- <div class="metric-item">- <span>Port</span>- <span class="metric-value">8000</span>- </div>- <div class="metric-item">- <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px;">Manage</button>- </div>- </div>- </div>-- <div class="card">- <div class="card-header">- <div class="app-icon">- <svg viewBox="0 0 24 24" width="24" height="24"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>- </div>- <div class="status-badge status-warning">- <div style="width: 6px; height: 6px; background: currentColor; border-radius: 50%;"></div>- Syncing- </div>- </div>- <h3>cecileblin.com</h3>- <a href="#" class="card-link">https://cecileblin.com</a>- <div class="metric-row">- <div class="metric-item">- <span>Stack</span>- <span class="metric-value" style="color: #60a5fa;">Static / HTML</span>- </div>- <div class="metric-item">- <span>Last Deploy</span>- <span class="metric-value">2m ago</span>- </div>- <div class="metric-item">- <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px;">Manage</button>- </div>- </div>- </div>-- </div>- </main>--</body>-</html>\ No newline at end of filediff --git a/backend/Dockerfile b/backend/Dockerfileindex 60d27066..bce58760 100644--- a/backend/Dockerfile+++ b/backend/Dockerfile@@ -1,19 +1,36 @@# Backend Dockerfile for ServerKit-FROM python:3.11-slim+FROM python:3.11-slim-bookworm# Set environment variablesENV PYTHONDONTWRITEBYTECODE=1 \PYTHONUNBUFFERED=1 \- FLASK_ENV=production+ FLASK_ENV=production \+ PORT=5000# Set working directoryWORKDIR /app-# Install system dependencies+# Install system dependencies including ClamAV for security scanningRUN apt-get update && apt-get install -y --no-install-recommends \+ # Build dependenciesgcc \+ python3-dev \libpq-dev \- && rm -rf /var/lib/apt/lists/*+ libffi-dev \+ libssl-dev \+ libevent-dev \+ # ClamAV antivirus+ clamav \+ clamav-daemon \+ clamav-freshclam \+ # Utilities+ curl \+ procps \+ && rm -rf /var/lib/apt/lists/* \+ && apt-get clean++# Create directories for ServerKit+RUN mkdir -p /etc/serverkit /app/logs /var/quarantine# Copy requirements first for cachingCOPY requirements.txt .@@ -25,8 +42,12 @@ RUN pip install --no-cache-dir -r requirements.txt \# Copy application codeCOPY . .-# Create non-root user-RUN useradd --create-home appuser && chown -R appuser:appuser /app+# Create non-root user and set permissions+RUN useradd --create-home appuser \+ && chown -R appuser:appuser /app \+ && chown -R appuser:appuser /etc/serverkit \+ && chown -R appuser:appuser /var/quarantine+USER appuser# Expose port@@ -34,9 +55,10 @@ EXPOSE 5000# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \- CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5000/api/v1/health')" || exit 1+ CMD curl -f http://localhost:5000/api/v1/system/health || exit 1# Run with gunicorn + gevent for WebSocket supportCMD ["gunicorn", "-k", "geventwebsocket.gunicorn.workers.GeventWebSocketWorker", \- "-w", "1", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-", \+ "-w", "1", "-b", "0.0.0.0:5000", "--timeout", "120", \+ "--access-logfile", "-", "--error-logfile", "-", \"run:app"]diff --git a/docker-compose.yml b/docker-compose.ymlindex 009aa252..a5933ad1 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -1,6 +1,13 @@+# ============================================# ServerKit Docker Compose-# Usage: docker compose up -d-version: '3.8'+# ============================================+# Usage:+# 1. Copy .env.example to .env and configure+# 2. Run: docker compose up -d+#+# For production with SSL:+# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d+# ============================================services:backend:@@ -9,26 +16,48 @@ services:dockerfile: Dockerfilecontainer_name: serverkit-backendenvironment:+ # Flask Configuration- FLASK_ENV=${FLASK_ENV:-production}- - DATABASE_URL=${DATABASE_URL:-sqlite:///serverkit.db}+ - PORT=5000++ # Security Keys (REQUIRED - generate with: python -c "import secrets; print(secrets.token_hex(32))")- SECRET_KEY=${SECRET_KEY:?SECRET_KEY is required}- JWT_SECRET_KEY=${JWT_SECRET_KEY:?JWT_SECRET_KEY is required}- - CORS_ORIGINS=${CORS_ORIGINS:-http://localhost}++ # Database+ - DATABASE_URL=${DATABASE_URL:-sqlite:///serverkit.db}++ # CORS Origins (comma-separated list)+ - CORS_ORIGINS=${CORS_ORIGINS:-http://localhost,http://localhost:80}volumes:+ # Application data (database)- serverkit-data:/app/instance- - /var/log:/var/log:ro- - /home:/home:ro- - /opt:/opt:ro++ # ServerKit configuration (notifications, security settings, etc.)+ - serverkit-config:/etc/serverkit++ # ServerKit logs (using /app/logs to avoid conflict with host /var/log mount)+ - serverkit-logs:/app/logs++ # Quarantine directory for malware+ - serverkit-quarantine:/var/quarantine++ # Docker socket (for container management)- /var/run/docker.sock:/var/run/docker.sock:ronetworks:- serverkit-networkrestart: unless-stoppedhealthcheck:- test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/api/v1/health')"]+ test: ["CMD", "curl", "-f", "http://localhost:5000/api/v1/system/health"]interval: 30stimeout: 10sretries: 3- start_period: 10s+ start_period: 15s+ logging:+ driver: "json-file"+ options:+ max-size: "10m"+ max-file: "3"frontend:build:@@ -51,11 +80,23 @@ services:interval: 30stimeout: 10sretries: 3+ logging:+ driver: "json-file"+ options:+ max-size: "10m"+ max-file: "3"networks:serverkit-network:driver: bridge+ name: serverkit-networkvolumes:serverkit-data:name: serverkit-data+ serverkit-config:+ name: serverkit-config+ serverkit-logs:+ name: serverkit-logs+ serverkit-quarantine:+ name: serverkit-quarantinediff --git a/docs/API.md b/docs/API.mdnew file mode 100644index 00000000..aba38571--- /dev/null+++ b/docs/API.md@@ -0,0 +1,1229 @@+# ServerKit API Reference++This document provides complete REST API documentation for ServerKit.++---++## Overview++**Base URL:** `http://localhost:5000/api/v1`++**Content Type:** All requests and responses use `application/json`++**Authentication:** JWT Bearer tokens (except where noted)++---++## Authentication++### Login++Authenticate and receive access tokens.++```http+POST /auth/login+```++**Rate Limit:** 5 requests per minute++**Request Body:**+```json+{+ "email": "[email protected]",+ "password": "your-password"+}+```++**Response (200):**+```json+{+ "user": {+ "id": 1,+ "email": "[email protected]",+ "username": "admin",+ "role": "admin"+ },+ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",+ "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."+}+```++**Response (2FA Required):**+```json+{+ "requires_2fa": true,+ "temp_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",+ "message": "Two-factor authentication required"+}+```++---++### Register++Create a new user account. The first registered user becomes admin.++```http+POST /auth/register+```++**Rate Limit:** 3 requests per minute++**Request Body:**+```json+{+ "email": "[email protected]",+ "username": "newuser",+ "password": "secure-password"+}+```++**Response (201):**+```json+{+ "message": "User registered successfully",+ "user": {+ "id": 1,+ "email": "[email protected]",+ "username": "newuser",+ "role": "admin"+ },+ "access_token": "...",+ "refresh_token": "..."+}+```++---++### Refresh Token++Get a new access token using a refresh token.++```http+POST /auth/refresh+Authorization: Bearer <refresh_token>+```++**Response (200):**+```json+{+ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."+}+```++---++### Get Current User++```http+GET /auth/me+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "user": {+ "id": 1,+ "email": "[email protected]",+ "username": "admin",+ "role": "admin",+ "totp_enabled": true+ }+}+```++---++### Update Current User++```http+PUT /auth/me+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "username": "newusername",+ "email": "[email protected]",+ "password": "new-password"+}+```++---++## Two-Factor Authentication++### Setup 2FA++Generate a TOTP secret and QR code for setup.++```http+POST /2fa/setup+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "secret": "BASE32SECRET",+ "qr_code": "data:image/png;base64,...",+ "backup_codes": ["12345678", "87654321", ...]+}+```++---++### Enable 2FA++Verify and enable 2FA after setup.++```http+POST /2fa/enable+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "code": "123456"+}+```++---++### Verify 2FA++Complete login with 2FA code.++```http+POST /2fa/verify+Authorization: Bearer <temp_token>+```++**Request Body:**+```json+{+ "code": "123456"+}+```++**Response (200):**+```json+{+ "user": {...},+ "access_token": "...",+ "refresh_token": "..."+}+```++---++### Disable 2FA++```http+POST /2fa/disable+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "code": "123456"+}+```++---++## System Metrics++All system endpoints require admin role.++### Get All Metrics++```http+GET /system/metrics+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "cpu": {+ "percent": 15.2,+ "count": 4,+ "freq_current": 2400.0+ },+ "memory": {+ "total": 8589934592,+ "available": 4294967296,+ "percent": 50.0,+ "used": 4294967296+ },+ "disk": {+ "total": 107374182400,+ "used": 53687091200,+ "free": 53687091200,+ "percent": 50.0+ },+ "network": {+ "bytes_sent": 1234567890,+ "bytes_recv": 9876543210+ }+}+```++---++### Get CPU Metrics++```http+GET /system/cpu+```++### Get Memory Metrics++```http+GET /system/memory+```++### Get Disk Metrics++```http+GET /system/disk+```++### Get Network Metrics++```http+GET /system/network+```++### Get Running Processes++```http+GET /system/processes+```++**Response (200):**+```json+{+ "processes": [+ {+ "pid": 1234,+ "name": "python",+ "cpu_percent": 5.2,+ "memory_percent": 2.1,+ "status": "running"+ }+ ]+}+```++---++### Get Services Status++```http+GET /system/services+```++**Response (200):**+```json+{+ "services": [+ {"name": "nginx", "status": "running"},+ {"name": "mysql", "status": "running"},+ {"name": "docker", "status": "stopped"}+ ]+}+```++---++### Health Check++No authentication required.++```http+GET /system/health+```++**Response (200):**+```json+{+ "status": "healthy",+ "service": "serverkit-api"+}+```++---++## Applications++### List Applications++```http+GET /apps+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "apps": [+ {+ "id": 1,+ "name": "my-app",+ "app_type": "php",+ "status": "running",+ "php_version": "8.2",+ "port": 8080,+ "root_path": "/var/www/my-app",+ "created_at": "2024-01-01T00:00:00Z"+ }+ ]+}+```++---++### Get Application++```http+GET /apps/:id+Authorization: Bearer <access_token>+```++---++### Create Application++```http+POST /apps+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "name": "my-app",+ "app_type": "php",+ "php_version": "8.2",+ "port": 8080,+ "root_path": "/var/www/my-app"+}+```++**Valid app_type values:** `php`, `wordpress`, `flask`, `django`, `docker`, `static`++---++### Update Application++```http+PUT /apps/:id+Authorization: Bearer <access_token>+```++---++### Delete Application++```http+DELETE /apps/:id+Authorization: Bearer <access_token>+```++---++### Start Application++```http+POST /apps/:id/start+Authorization: Bearer <access_token>+```++### Stop Application++```http+POST /apps/:id/stop+Authorization: Bearer <access_token>+```++### Restart Application++```http+POST /apps/:id/restart+Authorization: Bearer <access_token>+```++---++## Environment Variables++### List Environment Variables++```http+GET /apps/:app_id/env+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "env_vars": [+ {+ "id": 1,+ "key": "DATABASE_URL",+ "is_secret": true,+ "created_at": "2024-01-01T00:00:00Z"+ }+ ]+}+```++---++### Set Environment Variable++```http+POST /apps/:app_id/env+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "key": "DATABASE_URL",+ "value": "postgresql://user:pass@localhost/db",+ "is_secret": true+}+```++---++### Delete Environment Variable++```http+DELETE /apps/:app_id/env/:key+Authorization: Bearer <access_token>+```++---++## Domains++### List Domains++```http+GET /domains+Authorization: Bearer <access_token>+```++### Create Domain++```http+POST /domains+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "domain": "example.com",+ "app_id": 1+}+```++### Delete Domain++```http+DELETE /domains/:id+Authorization: Bearer <access_token>+```++---++## SSL Certificates++### List Certificates++```http+GET /ssl/certificates+Authorization: Bearer <access_token>+```++### Issue Certificate++Request a Let's Encrypt certificate.++```http+POST /ssl/issue+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "domain": "example.com",+ "email": "[email protected]"+}+```++### Renew Certificate++```http+POST /ssl/renew/:domain+Authorization: Bearer <access_token>+```++---++## Databases++### List Databases++```http+GET /databases+Authorization: Bearer <access_token>+```++### Create Database++```http+POST /databases+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "name": "my_database",+ "type": "mysql",+ "charset": "utf8mb4"+}+```++### Delete Database++```http+DELETE /databases/:id+Authorization: Bearer <access_token>+```++### Create Database User++```http+POST /databases/:id/users+Authorization: Bearer <access_token>+```++---++## Docker++### List Containers++```http+GET /docker/containers+Authorization: Bearer <access_token>+```++### Get Container++```http+GET /docker/containers/:id+Authorization: Bearer <access_token>+```++### Start Container++```http+POST /docker/containers/:id/start+Authorization: Bearer <access_token>+```++### Stop Container++```http+POST /docker/containers/:id/stop+Authorization: Bearer <access_token>+```++### Container Logs++```http+GET /docker/containers/:id/logs+Authorization: Bearer <access_token>+```++### List Images++```http+GET /docker/images+Authorization: Bearer <access_token>+```++---++## Files++### List Directory++```http+GET /files?path=/var/www+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "files": [+ {+ "name": "index.html",+ "path": "/var/www/index.html",+ "type": "file",+ "size": 1234,+ "modified": "2024-01-01T00:00:00Z"+ }+ ]+}+```++### Read File++```http+GET /files/read?path=/var/www/index.html+Authorization: Bearer <access_token>+```++### Write File++```http+POST /files/write+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "path": "/var/www/index.html",+ "content": "<html>...</html>"+}+```++### Delete File++```http+DELETE /files?path=/var/www/old-file.txt+Authorization: Bearer <access_token>+```++---++## Cron Jobs++### List Cron Jobs++```http+GET /cron+Authorization: Bearer <access_token>+```++### Create Cron Job++```http+POST /cron+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "name": "Daily Backup",+ "command": "/usr/local/bin/backup.sh",+ "schedule": "0 2 * * *",+ "enabled": true+}+```++### Update Cron Job++```http+PUT /cron/:id+Authorization: Bearer <access_token>+```++### Delete Cron Job++```http+DELETE /cron/:id+Authorization: Bearer <access_token>+```++---++## Firewall (UFW)++### Get Firewall Status++```http+GET /firewall/status+Authorization: Bearer <access_token>+```++### List Rules++```http+GET /firewall/rules+Authorization: Bearer <access_token>+```++### Add Rule++```http+POST /firewall/rules+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "port": 443,+ "protocol": "tcp",+ "action": "allow",+ "direction": "in"+}+```++### Delete Rule++```http+DELETE /firewall/rules/:id+Authorization: Bearer <access_token>+```++### Enable/Disable Firewall++```http+POST /firewall/enable+POST /firewall/disable+Authorization: Bearer <access_token>+```++---++## Security++### Get Security Status++```http+GET /security/status+Authorization: Bearer <access_token>+```++**Response (200):**+```json+{+ "clamav_installed": true,+ "clamav_running": true,+ "last_scan": "2024-01-01T00:00:00Z",+ "threats_found": 0,+ "quarantined_files": 3,+ "integrity_initialized": true+}+```++---++### Get ClamAV Status++```http+GET /security/clamav/status+Authorization: Bearer <access_token>+```++### Install ClamAV++```http+POST /security/clamav/install+Authorization: Bearer <access_token>+```++### Update Virus Definitions++```http+POST /security/clamav/update+Authorization: Bearer <access_token>+```++---++### Scan File++```http+POST /security/scan/file+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "path": "/var/www/suspicious-file.php"+}+```++### Scan Directory++```http+POST /security/scan/directory+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "path": "/var/www/html",+ "recursive": true+}+```++### Quick Scan++Scan common web directories.++```http+POST /security/scan/quick+Authorization: Bearer <access_token>+```++### Full Scan++Scan entire system.++```http+POST /security/scan/full+Authorization: Bearer <access_token>+```++---++### Get Quarantine++```http+GET /security/quarantine+Authorization: Bearer <access_token>+```++### Quarantine File++```http+POST /security/quarantine+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "path": "/var/www/malware.php"+}+```++### Delete Quarantined File++```http+DELETE /security/quarantine/:id+Authorization: Bearer <access_token>+```++---++### Initialize Integrity Database++```http+POST /security/integrity/initialize+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "paths": ["/var/www", "/etc/nginx"]+}+```++### Check File Integrity++```http+GET /security/integrity/check+Authorization: Bearer <access_token>+```++---++### Get Failed Logins++```http+GET /security/failed-logins+Authorization: Bearer <access_token>+```++### Get Security Events++```http+GET /security/events+Authorization: Bearer <access_token>+```++---++## Notifications++### Get Notification Status++```http+GET /notifications/status+Authorization: Bearer <access_token>+```++### Get Notification Config++```http+GET /notifications/config+Authorization: Bearer <access_token>+```++### Update Channel Config++```http+PUT /notifications/config/:channel+Authorization: Bearer <access_token>+```++**Channels:** `discord`, `slack`, `telegram`, `webhook`++**Request Body (Discord):**+```json+{+ "enabled": true,+ "webhook_url": "https://discord.com/api/webhooks/...",+ "severity_levels": ["warning", "critical"]+}+```++### Test Notification++```http+POST /notifications/test/:channel+Authorization: Bearer <access_token>+```++### Test All Channels++```http+POST /notifications/test+Authorization: Bearer <access_token>+```++---++## Monitoring++### Get Monitoring Status++```http+GET /monitoring/status+Authorization: Bearer <access_token>+```++### Get Alert Thresholds++```http+GET /monitoring/thresholds+Authorization: Bearer <access_token>+```++### Update Alert Thresholds++```http+PUT /monitoring/thresholds+Authorization: Bearer <access_token>+```++**Request Body:**+```json+{+ "cpu_warning": 70,+ "cpu_critical": 90,+ "memory_warning": 80,+ "memory_critical": 95,+ "disk_warning": 80,+ "disk_critical": 95+}+```++### Get Alert History++```http+GET /monitoring/alerts+Authorization: Bearer <access_token>+```++---++## Uptime++### Get Uptime History++```http+GET /uptime/history+Authorization: Bearer <access_token>+```++### Get Uptime Stats++```http+GET /uptime/stats+Authorization: Bearer <access_token>+```++---++## Error Responses++All endpoints return consistent error responses:++```json+{+ "error": "Error message describing what went wrong"+}+```++### Common Status Codes++| Code | Description |+|------|-------------|+| 200 | Success |+| 201 | Created |+| 400 | Bad Request - Invalid input |+| 401 | Unauthorized - Invalid or missing token |+| 403 | Forbidden - Insufficient permissions |+| 404 | Not Found - Resource doesn't exist |+| 409 | Conflict - Resource already exists |+| 429 | Too Many Requests - Rate limit exceeded |+| 500 | Internal Server Error |++---++## Rate Limiting++Some endpoints have rate limits:++| Endpoint | Limit |+|----------|-------|+| POST /auth/login | 5/minute |+| POST /auth/register | 3/minute |++When rate limited, you'll receive a 429 response with retry information.++---++## WebSocket Events++ServerKit uses Socket.IO for real-time updates.++**Connection:**+```javascript+const socket = io('http://localhost:5000', {+ auth: { token: 'your-access-token' }+});+```++**Events:**++| Event | Description |+|-------|-------------|+| `metrics` | Real-time system metrics |+| `alert` | New alert triggered |+| `scan_progress` | Malware scan progress |+| `scan_complete` | Scan finished |++---++## Examples++### cURL++```bash+# Login+TOKEN=$(curl -s -X POST http://localhost:5000/api/v1/auth/login \+ -H "Content-Type: application/json" \+ -d '{"email":"[email protected]","password":"password"}' \+ | jq -r '.access_token')++# Get system metrics+curl -s http://localhost:5000/api/v1/system/metrics \+ -H "Authorization: Bearer $TOKEN" | jq++# Create application+curl -s -X POST http://localhost:5000/api/v1/apps \+ -H "Authorization: Bearer $TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"name":"my-app","app_type":"php","php_version":"8.2"}'+```++### Python++```python+import requests++BASE_URL = "http://localhost:5000/api/v1"++# Login+response = requests.post(f"{BASE_URL}/auth/login", json={+ "email": "[email protected]",+ "password": "password"+})+token = response.json()["access_token"]++headers = {"Authorization": f"Bearer {token}"}++# Get metrics+metrics = requests.get(f"{BASE_URL}/system/metrics", headers=headers).json()+print(f"CPU: {metrics['cpu']['percent']}%")+```++### JavaScript++```javascript+const BASE_URL = 'http://localhost:5000/api/v1';++// Login+const loginRes = await fetch(`${BASE_URL}/auth/login`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ email: '[email protected]',+ password: 'password'+ })+});++const { access_token } = await loginRes.json();++// Get metrics+const metricsRes = await fetch(`${BASE_URL}/system/metrics`, {+ headers: { 'Authorization': `Bearer ${access_token}` }+});++const metrics = await metricsRes.json();+console.log(`CPU: ${metrics.cpu.percent}%`);+```++---++<p align="center">+ <strong>ServerKit API Reference</strong><br>+ Version 0.9.0+</p>diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.mdnew file mode 100644index 00000000..50a3c1e6--- /dev/null+++ b/docs/INSTALLATION.md@@ -0,0 +1,548 @@+# ServerKit Installation Guide++This guide covers installing ServerKit on Ubuntu 22.04/24.04 LTS. ServerKit is a modern server management panel for managing web applications, databases, Docker containers, and more.++## Table of Contents++- [Requirements](#requirements)+- [Quick Install (Docker)](#quick-install-docker)+- [Manual Installation](#manual-installation)+- [Post-Installation Setup](#post-installation-setup)+- [Security Configuration](#security-configuration)+- [Notification Setup](#notification-setup)+- [Troubleshooting](#troubleshooting)++---++## Requirements++### Minimum System Requirements++- **OS**: Ubuntu 22.04 LTS or 24.04 LTS (64-bit)+- **CPU**: 1 vCPU (2+ recommended)+- **RAM**: 1 GB minimum (2+ GB recommended)+- **Disk**: 10 GB free space+- **Network**: Public IP with ports 80, 443, and 5000 accessible++### Software Requirements++For Docker installation:+- Docker Engine 24.0++- Docker Compose v2.0+++For manual installation:+- Python 3.11++- Node.js 20++- Nginx (optional, for reverse proxy)++---++## Quick Install (Docker)++This is the recommended installation method.++### Step 1: Install Docker++```bash+# Update system packages+sudo apt update && sudo apt upgrade -y++# Install prerequisites+sudo apt install -y ca-certificates curl gnupg++# Add Docker's official GPG key+sudo install -m 0755 -d /etc/apt/keyrings+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg+sudo chmod a+r /etc/apt/keyrings/docker.gpg++# Add Docker repository+echo \+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null++# Install Docker+sudo apt update+sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin++# Add your user to docker group (logout/login required)+sudo usermod -aG docker $USER++# Verify installation+docker --version+docker compose version+```++### Step 2: Clone ServerKit++```bash+# Clone the repository+git clone https://github.com/yourusername/ServerKit.git+cd ServerKit+```++### Step 3: Configure Environment++```bash+# Copy example environment file+cp .env.example .env++# Generate secure keys+echo "SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))')" >> .env+echo "JWT_SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))')" >> .env++# Edit configuration+nano .env+```++**Important**: Update these values in `.env`:+- `SECRET_KEY` - Unique random string for Flask sessions+- `JWT_SECRET_KEY` - Unique random string for JWT tokens+- `CORS_ORIGINS` - Your domain (e.g., `https://panel.yourdomain.com`)++### Step 4: Start ServerKit++```bash+# Build and start containers+docker compose up -d++# View logs+docker compose logs -f++# Check status+docker compose ps+```++### Step 5: Access ServerKit++Open your browser and navigate to:+- **HTTP**: `http://your-server-ip`+- **HTTPS**: `https://your-server-ip` (if SSL configured)++Create your admin account on first visit.++---++## Manual Installation++For installations without Docker.++### Step 1: Install System Dependencies++```bash+# Update system+sudo apt update && sudo apt upgrade -y++# Install Python 3.11+sudo apt install -y python3.11 python3.11-venv python3.11-dev python3-pip++# Install Node.js 20+curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -+sudo apt install -y nodejs++# Install build tools and libraries+sudo apt install -y build-essential libffi-dev libssl-dev libpq-dev++# Install Nginx (for reverse proxy)+sudo apt install -y nginx++# Install ClamAV (for malware scanning)+sudo apt install -y clamav clamav-daemon clamav-freshclam++# Install other useful tools+sudo apt install -y git curl wget+```++### Step 2: Clone and Setup Backend++```bash+# Clone repository+cd /opt+sudo git clone https://github.com/yourusername/ServerKit.git+sudo chown -R $USER:$USER ServerKit+cd ServerKit++# Create Python virtual environment+python3.11 -m venv venv+source venv/bin/activate++# Install Python dependencies+cd backend+pip install -r requirements.txt+pip install gunicorn gevent gevent-websocket+```++### Step 3: Build Frontend++```bash+# Navigate to frontend directory+cd /opt/ServerKit/frontend++# Install Node dependencies+npm ci++# Build production bundle+npm run build+```++### Step 4: Configure Environment++```bash+# Create environment file+cd /opt/ServerKit/backend+cp ../.env.example .env++# Generate and set secure keys+SECRET=$(python3 -c 'import secrets; print(secrets.token_hex(32))')+JWT_SECRET=$(python3 -c 'import secrets; print(secrets.token_hex(32))')++sed -i "s/SECRET_KEY=.*/SECRET_KEY=$SECRET/" .env+sed -i "s/JWT_SECRET_KEY=.*/JWT_SECRET_KEY=$JWT_SECRET/" .env++# Edit other settings+nano .env+```++### Step 5: Create ServerKit Directories++```bash+# Create required directories+sudo mkdir -p /etc/serverkit+sudo mkdir -p /var/log/serverkit+sudo mkdir -p /var/quarantine++# Set permissions+sudo chown -R $USER:$USER /etc/serverkit+sudo chown -R $USER:$USER /var/log/serverkit+sudo chown -R $USER:$USER /var/quarantine+```++### Step 6: Create Systemd Service++```bash+sudo nano /etc/systemd/system/serverkit.service+```++Add the following content:++```ini+[Unit]+Description=ServerKit Server Management Panel+After=network.target++[Service]+Type=simple+User=root+WorkingDirectory=/opt/ServerKit/backend+Environment="PATH=/opt/ServerKit/venv/bin"+Environment="FLASK_ENV=production"+ExecStart=/opt/ServerKit/venv/bin/gunicorn \+ --worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker \+ --workers 1 \+ --bind 127.0.0.1:5000 \+ --timeout 120 \+ --access-logfile /var/log/serverkit/access.log \+ --error-logfile /var/log/serverkit/error.log \+ run:app+Restart=always+RestartSec=5++[Install]+WantedBy=multi-user.target+```++Enable and start the service:++```bash+sudo systemctl daemon-reload+sudo systemctl enable serverkit+sudo systemctl start serverkit+sudo systemctl status serverkit+```++### Step 7: Configure Nginx Reverse Proxy++```bash+sudo nano /etc/nginx/sites-available/serverkit+```++Add the following configuration:++```nginx+server {+ listen 80;+ server_name your-domain.com; # Change to your domain or IP++ # Frontend (static files)+ location / {+ root /opt/ServerKit/frontend/dist;+ try_files $uri $uri/ /index.html;+ }++ # Backend API+ location /api/ {+ proxy_pass http://127.0.0.1:5000;+ proxy_http_version 1.1;+ proxy_set_header Upgrade $http_upgrade;+ proxy_set_header Connection "upgrade";+ proxy_set_header Host $host;+ proxy_set_header X-Real-IP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ proxy_set_header X-Forwarded-Proto $scheme;+ proxy_read_timeout 86400;+ }++ # WebSocket support+ location /socket.io/ {+ proxy_pass http://127.0.0.1:5000;+ proxy_http_version 1.1;+ proxy_set_header Upgrade $http_upgrade;+ proxy_set_header Connection "upgrade";+ proxy_set_header Host $host;+ proxy_set_header X-Real-IP $remote_addr;+ }+}+```++Enable the site:++```bash+sudo ln -s /etc/nginx/sites-available/serverkit /etc/nginx/sites-enabled/+sudo nginx -t+sudo systemctl reload nginx+```++### Step 8: Setup SSL with Let's Encrypt (Recommended)++```bash+# Install Certbot+sudo apt install -y certbot python3-certbot-nginx++# Obtain SSL certificate+sudo certbot --nginx -d your-domain.com++# Auto-renewal is configured automatically+sudo systemctl status certbot.timer+```++---++## Post-Installation Setup++### 1. Create Admin Account++1. Open ServerKit in your browser+2. Click "Register" to create your admin account+3. The first registered user automatically becomes admin++### 2. Update ClamAV Definitions++```bash+# Update virus definitions+sudo freshclam++# Restart ClamAV daemon+sudo systemctl restart clamav-daemon+```++### 3. Configure Firewall (UFW)++```bash+# Enable UFW+sudo ufw enable++# Allow SSH (important!)+sudo ufw allow ssh++# Allow HTTP and HTTPS+sudo ufw allow 80/tcp+sudo ufw allow 443/tcp++# Check status+sudo ufw status+```++---++## Security Configuration++### Enable Two-Factor Authentication++1. Go to **Settings > Security**+2. Click "Enable Two-Factor Authentication"+3. Scan the QR code with your authenticator app+4. Enter the verification code+5. **Save your backup codes securely!**++### Configure Notification Webhooks++Get alerts for security events, server issues, and more:++1. Go to **Settings > Notifications**+2. Configure your preferred channels:+ - **Discord**: Create a webhook in your server settings+ - **Slack**: Create an incoming webhook app+ - **Telegram**: Create a bot via @BotFather++### Enable File Integrity Monitoring++1. Go to **Security > File Integrity**+2. Click "Initialize Baseline" to create a snapshot+3. Periodically run "Check Integrity" to detect changes++---++## Notification Setup++### Discord Webhook++1. Open Discord and go to your server+2. Right-click a channel → Edit Channel → Integrations → Webhooks+3. Create a new webhook and copy the URL+4. In ServerKit: Settings → Notifications → Discord+5. Paste the webhook URL and enable++### Slack Webhook++1. Go to [Slack API](https://api.slack.com/apps)+2. Create a new app → Incoming Webhooks+3. Add a new webhook to your workspace+4. Copy the webhook URL+5. In ServerKit: Settings → Notifications → Slack++### Telegram Bot++1. Message @BotFather on Telegram+2. Send `/newbot` and follow instructions+3. Copy the bot token+4. Get your chat ID from @userinfobot+5. In ServerKit: Settings → Notifications → Telegram++---++## Troubleshooting++### Docker Issues++**Container won't start:**+```bash+# Check logs+docker compose logs backend++# Check if port is in use+sudo lsof -i :5000+sudo lsof -i :80+```++**Permission denied errors:**+```bash+# Fix Docker socket permissions+sudo chmod 666 /var/run/docker.sock+```++### Manual Installation Issues++**Python module not found:**+```bash+# Ensure virtual environment is activated+source /opt/ServerKit/venv/bin/activate+pip install -r requirements.txt+```++**Nginx 502 Bad Gateway:**+```bash+# Check if backend is running+sudo systemctl status serverkit++# Check backend logs+sudo tail -f /var/log/serverkit/error.log+```++**Database errors:**+```bash+# Reset database (WARNING: deletes all data)+cd /opt/ServerKit/backend+rm -f instance/serverkit.db+python -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()"+```++### ClamAV Issues++**ClamAV not starting:**+```bash+# Check status+sudo systemctl status clamav-daemon++# Update definitions first+sudo systemctl stop clamav-freshclam+sudo freshclam+sudo systemctl start clamav-freshclam+sudo systemctl start clamav-daemon+```++### Getting Help++- Check logs in `/var/log/serverkit/`+- Docker logs: `docker compose logs -f`+- Open an issue on GitHub++---++## Updating ServerKit++### Docker Update++```bash+cd /path/to/ServerKit+git pull+docker compose down+docker compose build --no-cache+docker compose up -d+```++### Manual Update++```bash+cd /opt/ServerKit+git pull++# Update backend+source venv/bin/activate+pip install -r backend/requirements.txt++# Update frontend+cd frontend+npm ci+npm run build++# Restart service+sudo systemctl restart serverkit+```++---++## Uninstalling++### Docker++```bash+cd /path/to/ServerKit+docker compose down -v # -v removes volumes (data)+cd ..+rm -rf ServerKit+```++### Manual++```bash+sudo systemctl stop serverkit+sudo systemctl disable serverkit+sudo rm /etc/systemd/system/serverkit.service+sudo rm /etc/nginx/sites-enabled/serverkit+sudo rm /etc/nginx/sites-available/serverkit+sudo rm -rf /opt/ServerKit+sudo rm -rf /etc/serverkit+sudo rm -rf /var/log/serverkit+sudo systemctl daemon-reload+sudo systemctl reload nginx+```diff --git a/docs/README.md b/docs/README.mdnew file mode 100644index 00000000..ff5fee09--- /dev/null+++ b/docs/README.md@@ -0,0 +1,241 @@+# ServerKit Documentation++Welcome to the ServerKit documentation. This guide will help you install, configure, and use ServerKit effectively.++---++## Quick Links++| Document | Description |+|----------|-------------|+| [Installation Guide](INSTALLATION.md) | Complete setup instructions for Docker and manual installation |+| [Deployment Guide](DEPLOYMENT.md) | Production deployment, CLI commands, and configuration |+| [API Reference](API.md) | REST API documentation with examples |++---++## Getting Started++### 1. Installation++Choose your preferred installation method:++- **[Docker Installation](INSTALLATION.md#quick-install-docker)** (Recommended) - Get started in minutes+- **[Manual Installation](INSTALLATION.md#manual-installation)** - Full control over the setup+- **[One-Line Install](../README.md#option-2-one-line-install-ubuntu)** - Quick Ubuntu script++### 2. Initial Setup++After installation:++1. Access ServerKit at `http://your-server-ip`+2. Create your admin account (first user becomes admin)+3. [Enable Two-Factor Authentication](INSTALLATION.md#enable-two-factor-authentication)+4. [Configure Notifications](INSTALLATION.md#configure-notification-webhooks)++### 3. Start Managing++- Add your first application from the Applications page+- Configure domains and SSL certificates+- Set up monitoring alerts+- Enable security scanning++---++## Feature Guides++### Application Management++ServerKit supports multiple application types:++| Type | Runtime | Process Manager |+|------|---------|-----------------|+| PHP / WordPress | PHP-FPM 8.x | Nginx |+| Python (Flask/Django) | Python 3.x | Gunicorn |+| Node.js | Node 18+ | PM2 |+| Docker | Containers | Docker Engine |++Each application includes:+- Environment variable management (encrypted)+- Log viewing and streaming+- Start/stop/restart controls+- Domain and SSL configuration++### Domain & SSL++- **Nginx Virtual Hosts** - Automatic configuration generation+- **Let's Encrypt SSL** - Free certificates with auto-renewal+- **Custom Certificates** - Upload your own SSL certificates++### Database Management++Supported databases:+- MySQL / MariaDB+- PostgreSQL++Features:+- Create/delete databases+- User management+- Basic query interface++### Monitoring & Alerts++Real-time monitoring includes:+- CPU, RAM, disk usage+- Network traffic+- Server uptime history+- Process monitoring++Alert channels:+- Discord webhooks+- Slack webhooks+- Telegram bot+- Generic HTTP webhooks++### Security++- **Two-Factor Authentication** - TOTP-based (Google Authenticator, Authy)+- **Malware Scanning** - ClamAV integration+- **File Integrity Monitoring** - Detect unauthorized changes+- **Firewall Management** - UFW rule configuration++### Scheduled Tasks++- Visual cron job editor+- Execution history+- Enable/disable jobs+- Common schedule presets++---++## Configuration++### Environment Variables++ServerKit is configured via environment variables. See [.env.example](../.env.example) for all options.++**Required variables:**+```env+SECRET_KEY=your-secret-key+JWT_SECRET_KEY=your-jwt-secret+```++**Database options:**+```env+# SQLite (default)+DATABASE_URL=sqlite:///serverkit.db++# PostgreSQL (production)+DATABASE_URL=postgresql://user:pass@localhost/serverkit+```++### Notification Setup++Configure webhooks in Settings > Notifications or via environment:++```env+DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...+SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...+TELEGRAM_BOT_TOKEN=your-bot-token+TELEGRAM_CHAT_ID=your-chat-id+```++---++## CLI Reference++ServerKit includes a management CLI:++```bash+# Service Management+serverkit start|stop|restart|status++# User Management+serverkit create-admin+serverkit reset-password++# Database+serverkit backup-db+serverkit restore-db <backup-file>++# Utilities+serverkit generate-keys+serverkit logs [service]+serverkit update+```++See [Deployment Guide](DEPLOYMENT.md) for complete CLI documentation.++---++## API Reference++ServerKit provides a REST API for automation and integration.++**Base URL:** `http://localhost:5000/api/v1`++**Authentication:** JWT Bearer tokens++Quick example:+```bash+# Login+curl -X POST http://localhost:5000/api/v1/auth/login \+ -H "Content-Type: application/json" \+ -d '{"username": "admin", "password": "password"}'++# Use token+curl http://localhost:5000/api/v1/system/stats \+ -H "Authorization: Bearer <token>"+```++See [API Reference](API.md) for complete documentation.++---++## Troubleshooting++### Common Issues++**Container won't start:**+```bash+docker compose logs backend+sudo lsof -i :5000+```++**502 Bad Gateway:**+```bash+sudo systemctl status serverkit+sudo tail -f /var/log/serverkit/error.log+```++**ClamAV not working:**+```bash+sudo freshclam+sudo systemctl restart clamav-daemon+```++See [Installation Guide - Troubleshooting](INSTALLATION.md#troubleshooting) for more solutions.++---++## Additional Resources++- [Main README](../README.md) - Project overview and quick start+- [Roadmap](../ROADMAP.md) - Development plans and upcoming features+- [Contributing Guide](../CONTRIBUTING.md) - How to contribute+- [GitHub Issues](https://github.com/jhd3197/ServerKit/issues) - Report bugs or request features++---++## Support++- **Bug Reports:** [GitHub Issues](https://github.com/jhd3197/ServerKit/issues)+- **Feature Requests:** [GitHub Issues](https://github.com/jhd3197/ServerKit/issues) with `enhancement` label+- **Security Issues:** Please report privately via GitHub Security Advisories++---++<p align="center">+ <strong>ServerKit Documentation</strong><br>+ Version 0.9.0+</p>diff --git a/frontend/dist/assets/index-BT_A2C8f.js b/frontend/dist/assets/index-BT_A2C8f.jsdeleted file mode 100644index 3fd9bd61..00000000--- a/frontend/dist/assets/index-BT_A2C8f.js+++ /dev/null@@ -1,225 +0,0 @@-function Vh(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Hh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ed={exports:{}},xa={},td={exports:{}},Z={};/**- * @license React- * react.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var Qn=Symbol.for("react.element"),Wh=Symbol.for("react.portal"),Qh=Symbol.for("react.fragment"),Kh=Symbol.for("react.strict_mode"),Gh=Symbol.for("react.profiler"),Yh=Symbol.for("react.provider"),Xh=Symbol.for("react.context"),Jh=Symbol.for("react.forward_ref"),Zh=Symbol.for("react.suspense"),em=Symbol.for("react.memo"),tm=Symbol.for("react.lazy"),To=Symbol.iterator;function sm(e){return e===null||typeof e!="object"?null:(e=To&&e[To]||e["@@iterator"],typeof e=="function"?e:null)}var sd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nd=Object.assign,rd={};function Ys(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||sd}Ys.prototype.isReactComponent={};Ys.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ys.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ad(){}ad.prototype=Ys.prototype;function wl(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||sd}var kl=wl.prototype=new ad;kl.constructor=wl;nd(kl,Ys.prototype);kl.isPureReactComponent=!0;var Lo=Array.isArray,id=Object.prototype.hasOwnProperty,Sl={current:null},ld={key:!0,ref:!0,__self:!0,__source:!0};function od(e,t,n){var r,a={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)id.call(t,r)&&!ld.hasOwnProperty(r)&&(a[r]=t[r]);var c=arguments.length-2;if(c===1)a.children=n;else if(1<c){for(var o=Array(c),u=0;u<c;u++)o[u]=arguments[u+2];a.children=o}if(e&&e.defaultProps)for(r in c=e.defaultProps,c)a[r]===void 0&&(a[r]=c[r]);return{$$typeof:Qn,type:e,key:i,ref:l,props:a,_owner:Sl.current}}function nm(e,t){return{$$typeof:Qn,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Cl(e){return typeof e=="object"&&e!==null&&e.$$typeof===Qn}function rm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Do=/\/+/g;function qa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?rm(""+e.key):t.toString(36)}function Sr(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(i){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case Qn:case Wh:l=!0}}if(l)return l=e,a=a(l),e=r===""?"."+qa(l,0):r,Lo(a)?(n="",e!=null&&(n=e.replace(Do,"$&/")+"/"),Sr(a,t,n,"",function(u){return u})):a!=null&&(Cl(a)&&(a=nm(a,n+(!a.key||l&&l.key===a.key?"":(""+a.key).replace(Do,"$&/")+"/")+e)),t.push(a)),1;if(l=0,r=r===""?".":r+":",Lo(e))for(var c=0;c<e.length;c++){i=e[c];var o=r+qa(i,c);l+=Sr(i,t,n,o,a)}else if(o=sm(e),typeof o=="function")for(e=o.call(e),c=0;!(i=e.next()).done;)i=i.value,o=r+qa(i,c++),l+=Sr(i,t,n,o,a);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function ar(e,t,n){if(e==null)return e;var r=[],a=0;return Sr(e,r,"","",function(i){return t.call(n,i,a++)}),r}function am(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Be={current:null},Cr={transition:null},im={ReactCurrentDispatcher:Be,ReactCurrentBatchConfig:Cr,ReactCurrentOwner:Sl};function cd(){throw Error("act(...) is not supported in production builds of React.")}Z.Children={map:ar,forEach:function(e,t,n){ar(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ar(e,function(){t++}),t},toArray:function(e){return ar(e,function(t){return t})||[]},only:function(e){if(!Cl(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Z.Component=Ys;Z.Fragment=Qh;Z.Profiler=Gh;Z.PureComponent=wl;Z.StrictMode=Kh;Z.Suspense=Zh;Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=im;Z.act=cd;Z.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=nd({},e.props),a=e.key,i=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,l=Sl.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(o in t)id.call(t,o)&&!ld.hasOwnProperty(o)&&(r[o]=t[o]===void 0&&c!==void 0?c[o]:t[o])}var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){c=Array(o);for(var u=0;u<o;u++)c[u]=arguments[u+2];r.children=c}return{$$typeof:Qn,type:e.type,key:a,ref:i,props:r,_owner:l}};Z.createContext=function(e){return e={$$typeof:Xh,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Yh,_context:e},e.Consumer=e};Z.createElement=od;Z.createFactory=function(e){var t=od.bind(null,e);return t.type=e,t};Z.createRef=function(){return{current:null}};Z.forwardRef=function(e){return{$$typeof:Jh,render:e}};Z.isValidElement=Cl;Z.lazy=function(e){return{$$typeof:tm,_payload:{_status:-1,_result:e},_init:am}};Z.memo=function(e,t){return{$$typeof:em,type:e,compare:t===void 0?null:t}};Z.startTransition=function(e){var t=Cr.transition;Cr.transition={};try{e()}finally{Cr.transition=t}};Z.unstable_act=cd;Z.useCallback=function(e,t){return Be.current.useCallback(e,t)};Z.useContext=function(e){return Be.current.useContext(e)};Z.useDebugValue=function(){};Z.useDeferredValue=function(e){return Be.current.useDeferredValue(e)};Z.useEffect=function(e,t){return Be.current.useEffect(e,t)};Z.useId=function(){return Be.current.useId()};Z.useImperativeHandle=function(e,t,n){return Be.current.useImperativeHandle(e,t,n)};Z.useInsertionEffect=function(e,t){return Be.current.useInsertionEffect(e,t)};Z.useLayoutEffect=function(e,t){return Be.current.useLayoutEffect(e,t)};Z.useMemo=function(e,t){return Be.current.useMemo(e,t)};Z.useReducer=function(e,t,n){return Be.current.useReducer(e,t,n)};Z.useRef=function(e){return Be.current.useRef(e)};Z.useState=function(e){return Be.current.useState(e)};Z.useSyncExternalStore=function(e,t,n){return Be.current.useSyncExternalStore(e,t,n)};Z.useTransition=function(){return Be.current.useTransition()};Z.version="18.3.1";td.exports=Z;var d=td.exports;const qr=Hh(d),lm=Vh({__proto__:null,default:qr},[d]);/**- * @license React- * react-jsx-runtime.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var om=d,cm=Symbol.for("react.element"),dm=Symbol.for("react.fragment"),um=Object.prototype.hasOwnProperty,hm=om.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mm={key:!0,ref:!0,__self:!0,__source:!0};function dd(e,t,n){var r,a={},i=null,l=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(l=t.ref);for(r in t)um.call(t,r)&&!mm.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:cm,type:e,key:i,ref:l,props:a,_owner:hm.current}}xa.Fragment=dm;xa.jsx=dd;xa.jsxs=dd;ed.exports=xa;var s=ed.exports,yi={},ud={exports:{}},Xe={},hd={exports:{}},md={};/**- * @license React- * scheduler.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */(function(e){function t(R,_){var I=R.length;R.push(_);e:for(;0<I;){var Q=I-1>>>1,Y=R[Q];if(0<a(Y,_))R[Q]=_,R[I]=Y,I=Q;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var _=R[0],I=R.pop();if(I!==_){R[0]=I;e:for(var Q=0,Y=R.length,ve=Y>>>1;Q<ve;){var ne=2*(Q+1)-1,C=R[ne],G=ne+1,F=R[G];if(0>a(C,I))G<Y&&0>a(F,C)?(R[Q]=F,R[G]=I,Q=G):(R[Q]=C,R[ne]=I,Q=ne);else if(G<Y&&0>a(F,I))R[Q]=F,R[G]=I,Q=G;else break e}}return _}function a(R,_){var I=R.sortIndex-_.sortIndex;return I!==0?I:R.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var o=[],u=[],f=1,h=null,p=3,v=!1,N=!1,j=!1,k=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(R){for(var _=n(u);_!==null;){if(_.callback===null)r(u);else if(_.startTime<=R)r(u),_.sortIndex=_.expirationTime,t(o,_);else break;_=n(u)}}function y(R){if(j=!1,g(R),!N)if(n(o)!==null)N=!0,z(S);else{var _=n(u);_!==null&&J(y,_.startTime-R)}}function S(R,_){N=!1,j&&(j=!1,m(P),P=-1),v=!0;var I=p;try{for(g(_),h=n(o);h!==null&&(!(h.expirationTime>_)||R&&!L());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,p=h.priorityLevel;var Y=Q(h.expirationTime<=_);_=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(o)&&r(o),g(_)}else r(o);h=n(o)}if(h!==null)var ve=!0;else{var ne=n(u);ne!==null&&J(y,ne.startTime-_),ve=!1}return ve}finally{h=null,p=I,v=!1}}var E=!1,T=null,P=-1,O=5,w=-1;function L(){return!(e.unstable_now()-w<O)}function U(){if(T!==null){var R=e.unstable_now();w=R;var _=!0;try{_=T(!0,R)}finally{_?V():(E=!1,T=null)}}else E=!1}var V;if(typeof x=="function")V=function(){x(U)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,B=H.port2;H.port1.onmessage=U,V=function(){B.postMessage(null)}}else V=function(){k(U,0)};function z(R){T=R,E||(E=!0,V())}function J(R,_){P=k(function(){R(e.unstable_now())},_)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){N||v||(N=!0,z(S))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(o)},e.unstable_next=function(R){switch(p){case 1:case 2:case 3:var _=3;break;default:_=p}var I=p;p=_;try{return R()}finally{p=I}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,_){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var I=p;p=R;try{return _()}finally{p=I}},e.unstable_scheduleCallback=function(R,_,I){var Q=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?Q+I:Q):I=Q,R){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=I+Y,R={id:f++,callback:_,priorityLevel:R,startTime:I,expirationTime:Y,sortIndex:-1},I>Q?(R.sortIndex=I,t(u,R),n(o)===null&&R===n(u)&&(j?(m(P),P=-1):j=!0,J(y,I-Q))):(R.sortIndex=Y,t(o,R),N||v||(N=!0,z(S))),R},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(R){var _=p;return function(){var I=p;p=_;try{return R.apply(this,arguments)}finally{p=I}}}})(md);hd.exports=md;var pm=hd.exports;/**- * @license React- * react-dom.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var fm=d,Ye=pm;function M(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var pd=new Set,_n={};function ys(e,t){Us(e,t),Us(e+"Capture",t)}function Us(e,t){for(_n[e]=t,e=0;e<t.length;e++)pd.add(t[e])}var _t=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ji=Object.prototype.hasOwnProperty,xm=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Fo={},Mo={};function vm(e){return ji.call(Mo,e)?!0:ji.call(Fo,e)?!1:xm.test(e)?Mo[e]=!0:(Fo[e]=!0,!1)}function gm(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ym(e,t,n,r){if(t===null||typeof t>"u"||gm(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ie(e,t,n,r,a,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var Le={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Le[e]=new Ie(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Le[t]=new Ie(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Le[e]=new Ie(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Le[e]=new Ie(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Le[e]=new Ie(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Le[e]=new Ie(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Le[e]=new Ie(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Le[e]=new Ie(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Le[e]=new Ie(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pl=/[\-:]([a-z])/g;function _l(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Pl,_l);Le[t]=new Ie(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Pl,_l);Le[t]=new Ie(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Pl,_l);Le[t]=new Ie(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Le[e]=new Ie(e,1,!1,e.toLowerCase(),null,!1,!1)});Le.xlinkHref=new Ie("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Le[e]=new Ie(e,1,!1,e.toLowerCase(),null,!0,!0)});function El(e,t,n,r){var a=Le.hasOwnProperty(t)?Le[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(ym(t,n,a,r)&&(n=null),r||a===null?vm(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Dt=fm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ir=Symbol.for("react.element"),ks=Symbol.for("react.portal"),Ss=Symbol.for("react.fragment"),Tl=Symbol.for("react.strict_mode"),Ni=Symbol.for("react.profiler"),fd=Symbol.for("react.provider"),xd=Symbol.for("react.context"),Ll=Symbol.for("react.forward_ref"),bi=Symbol.for("react.suspense"),wi=Symbol.for("react.suspense_list"),Dl=Symbol.for("react.memo"),At=Symbol.for("react.lazy"),vd=Symbol.for("react.offscreen"),Ao=Symbol.iterator;function nn(e){return e===null||typeof e!="object"?null:(e=Ao&&e[Ao]||e["@@iterator"],typeof e=="function"?e:null)}var he=Object.assign,Ua;function mn(e){if(Ua===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ua=t&&t[1]||""}return`-`+Ua+e}var za=!1;function Va(e,t){if(!e||za)return"";za=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`-`),i=r.stack.split(`-`),l=a.length-1,c=i.length-1;1<=l&&0<=c&&a[l]!==i[c];)c--;for(;1<=l&&0<=c;l--,c--)if(a[l]!==i[c]){if(l!==1||c!==1)do if(l--,c--,0>c||a[l]!==i[c]){var o=`-`+a[l].replace(" at new "," at ");return e.displayName&&o.includes("<anonymous>")&&(o=o.replace("<anonymous>",e.displayName)),o}while(1<=l&&0<=c);break}}}finally{za=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mn(e):""}function jm(e){switch(e.tag){case 5:return mn(e.type);case 16:return mn("Lazy");case 13:return mn("Suspense");case 19:return mn("SuspenseList");case 0:case 2:case 15:return e=Va(e.type,!1),e;case 11:return e=Va(e.type.render,!1),e;case 1:return e=Va(e.type,!0),e;default:return""}}function ki(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ss:return"Fragment";case ks:return"Portal";case Ni:return"Profiler";case Tl:return"StrictMode";case bi:return"Suspense";case wi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xd:return(e.displayName||"Context")+".Consumer";case fd:return(e._context.displayName||"Context")+".Provider";case Ll:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dl:return t=e.displayName||null,t!==null?t:ki(e.type)||"Memo";case At:t=e._payload,e=e._init;try{return ki(e(t))}catch{}}return null}function Nm(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ki(t);case 8:return t===Tl?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Jt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function bm(e){var t=gd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function lr(e){e._valueTracker||(e._valueTracker=bm(e))}function yd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=gd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ur(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Si(e,t){var n=t.checked;return he({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function $o(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Jt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function jd(e,t){t=t.checked,t!=null&&El(e,"checked",t,!1)}function Ci(e,t){jd(e,t);var n=Jt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Pi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Pi(e,t.type,Jt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ro(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Pi(e,t,n){(t!=="number"||Ur(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var pn=Array.isArray;function $s(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Jt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function _i(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return he({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Oo(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(M(92));if(pn(n)){if(1<n.length)throw Error(M(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Jt(n)}}function Nd(e,t){var n=Jt(t.value),r=Jt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Bo(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function bd(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ei(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?bd(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var or,wd=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(or=or||document.createElement("div"),or.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=or.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function En(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wm=["Webkit","ms","Moz","O"];Object.keys(gn).forEach(function(e){wm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),gn[t]=gn[e]})});function kd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||gn.hasOwnProperty(e)&&gn[e]?(""+t).trim():t+"px"}function Sd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=kd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var km=he({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ti(e,t){if(t){if(km[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function Li(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Di=null;function Fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fi=null,Rs=null,Os=null;function Io(e){if(e=Yn(e)){if(typeof Fi!="function")throw Error(M(280));var t=e.stateNode;t&&(t=Na(t),Fi(e.stateNode,e.type,t))}}function Cd(e){Rs?Os?Os.push(e):Os=[e]:Rs=e}function Pd(){if(Rs){var e=Rs,t=Os;if(Os=Rs=null,Io(e),t)for(e=0;e<t.length;e++)Io(t[e])}}function _d(e,t){return e(t)}function Ed(){}var Ha=!1;function Td(e,t,n){if(Ha)return e(t,n);Ha=!0;try{return _d(e,t,n)}finally{Ha=!1,(Rs!==null||Os!==null)&&(Ed(),Pd())}}function Tn(e,t){var n=e.stateNode;if(n===null)return null;var r=Na(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(M(231,t,typeof n));return n}var Mi=!1;if(_t)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){Mi=!0}}),window.addEventListener("test",rn,rn),window.removeEventListener("test",rn,rn)}catch{Mi=!1}function Sm(e,t,n,r,a,i,l,c,o){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var yn=!1,zr=null,Vr=!1,Ai=null,Cm={onError:function(e){yn=!0,zr=e}};function Pm(e,t,n,r,a,i,l,c,o){yn=!1,zr=null,Sm.apply(Cm,arguments)}function _m(e,t,n,r,a,i,l,c,o){if(Pm.apply(this,arguments),yn){if(yn){var u=zr;yn=!1,zr=null}else throw Error(M(198));Vr||(Vr=!0,Ai=u)}}function js(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Ld(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function qo(e){if(js(e)!==e)throw Error(M(188))}function Em(e){var t=e.alternate;if(!t){if(t=js(e),t===null)throw Error(M(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return qo(a),e;if(i===r)return qo(a),t;i=i.sibling}throw Error(M(188))}if(n.return!==r.return)n=a,r=i;else{for(var l=!1,c=a.child;c;){if(c===n){l=!0,n=a,r=i;break}if(c===r){l=!0,r=a,n=i;break}c=c.sibling}if(!l){for(c=i.child;c;){if(c===n){l=!0,n=i,r=a;break}if(c===r){l=!0,r=i,n=a;break}c=c.sibling}if(!l)throw Error(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?e:t}function Dd(e){return e=Em(e),e!==null?Fd(e):null}function Fd(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Fd(e);if(t!==null)return t;e=e.sibling}return null}var Md=Ye.unstable_scheduleCallback,Uo=Ye.unstable_cancelCallback,Tm=Ye.unstable_shouldYield,Lm=Ye.unstable_requestPaint,xe=Ye.unstable_now,Dm=Ye.unstable_getCurrentPriorityLevel,Ml=Ye.unstable_ImmediatePriority,Ad=Ye.unstable_UserBlockingPriority,Hr=Ye.unstable_NormalPriority,Fm=Ye.unstable_LowPriority,$d=Ye.unstable_IdlePriority,va=null,vt=null;function Mm(e){if(vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(va,e,void 0,(e.current.flags&128)===128)}catch{}}var ut=Math.clz32?Math.clz32:Rm,Am=Math.log,$m=Math.LN2;function Rm(e){return e>>>=0,e===0?32:31-(Am(e)/$m|0)|0}var cr=64,dr=4194304;function fn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var c=l&~a;c!==0?r=fn(c):(i&=l,i!==0&&(r=fn(i)))}else l=n&~a,l!==0?r=fn(l):i!==0&&(r=fn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ut(t),a=1<<n,r|=e[n],t&=~a;return r}function Om(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bm(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var l=31-ut(i),c=1<<l,o=a[l];o===-1?(!(c&n)||c&r)&&(a[l]=Om(c,t)):o<=t&&(e.expiredLanes|=c),i&=~c}}function $i(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Rd(){var e=cr;return cr<<=1,!(cr&4194240)&&(cr=64),e}function Wa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Kn(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ut(t),e[t]=n}function Im(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-ut(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function Al(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ut(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var se=0;function Od(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bd,$l,Id,qd,Ud,Ri=!1,ur=[],Ut=null,zt=null,Vt=null,Ln=new Map,Dn=new Map,Rt=[],qm="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function zo(e,t){switch(e){case"focusin":case"focusout":Ut=null;break;case"dragenter":case"dragleave":zt=null;break;case"mouseover":case"mouseout":Vt=null;break;case"pointerover":case"pointerout":Ln.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dn.delete(t.pointerId)}}function an(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=Yn(t),t!==null&&$l(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Um(e,t,n,r,a){switch(t){case"focusin":return Ut=an(Ut,e,t,n,r,a),!0;case"dragenter":return zt=an(zt,e,t,n,r,a),!0;case"mouseover":return Vt=an(Vt,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Ln.set(i,an(Ln.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Dn.set(i,an(Dn.get(i)||null,e,t,n,r,a)),!0}return!1}function zd(e){var t=cs(e.target);if(t!==null){var n=js(t);if(n!==null){if(t=n.tag,t===13){if(t=Ld(n),t!==null){e.blockedOn=t,Ud(e.priority,function(){Id(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Pr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Oi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Di=r,n.target.dispatchEvent(r),Di=null}else return t=Yn(n),t!==null&&$l(t),e.blockedOn=n,!1;t.shift()}return!0}function Vo(e,t,n){Pr(e)&&n.delete(t)}function zm(){Ri=!1,Ut!==null&&Pr(Ut)&&(Ut=null),zt!==null&&Pr(zt)&&(zt=null),Vt!==null&&Pr(Vt)&&(Vt=null),Ln.forEach(Vo),Dn.forEach(Vo)}function ln(e,t){e.blockedOn===t&&(e.blockedOn=null,Ri||(Ri=!0,Ye.unstable_scheduleCallback(Ye.unstable_NormalPriority,zm)))}function Fn(e){function t(a){return ln(a,e)}if(0<ur.length){ln(ur[0],e);for(var n=1;n<ur.length;n++){var r=ur[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ut!==null&&ln(Ut,e),zt!==null&&ln(zt,e),Vt!==null&&ln(Vt,e),Ln.forEach(t),Dn.forEach(t),n=0;n<Rt.length;n++)r=Rt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rt.length&&(n=Rt[0],n.blockedOn===null);)zd(n),n.blockedOn===null&&Rt.shift()}var Bs=Dt.ReactCurrentBatchConfig,Qr=!0;function Vm(e,t,n,r){var a=se,i=Bs.transition;Bs.transition=null;try{se=1,Rl(e,t,n,r)}finally{se=a,Bs.transition=i}}function Hm(e,t,n,r){var a=se,i=Bs.transition;Bs.transition=null;try{se=4,Rl(e,t,n,r)}finally{se=a,Bs.transition=i}}function Rl(e,t,n,r){if(Qr){var a=Oi(e,t,n,r);if(a===null)si(e,t,r,Kr,n),zo(e,r);else if(Um(a,e,t,n,r))r.stopPropagation();else if(zo(e,r),t&4&&-1<qm.indexOf(e)){for(;a!==null;){var i=Yn(a);if(i!==null&&Bd(i),i=Oi(e,t,n,r),i===null&&si(e,t,r,Kr,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else si(e,t,r,null,n)}}var Kr=null;function Oi(e,t,n,r){if(Kr=null,e=Fl(r),e=cs(e),e!==null)if(t=js(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ld(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Kr=e,null}function Vd(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Dm()){case Ml:return 1;case Ad:return 4;case Hr:case Fm:return 16;case $d:return 536870912;default:return 16}default:return 16}}var Bt=null,Ol=null,_r=null;function Hd(){if(_r)return _r;var e,t=Ol,n=t.length,r,a="value"in Bt?Bt.value:Bt.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var l=n-e;for(r=1;r<=l&&t[n-r]===a[i-r];r++);return _r=a.slice(e,1<r?1-r:void 0)}function Er(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function hr(){return!0}function Ho(){return!1}function Je(e){function t(n,r,a,i,l){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=l,this.currentTarget=null;for(var c in e)e.hasOwnProperty(c)&&(n=e[c],this[c]=n?n(i):i[c]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?hr:Ho,this.isPropagationStopped=Ho,this}return he(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=hr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),t}var Xs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bl=Je(Xs),Gn=he({},Xs,{view:0,detail:0}),Wm=Je(Gn),Qa,Ka,on,ga=he({},Gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Il,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==on&&(on&&e.type==="mousemove"?(Qa=e.screenX-on.screenX,Ka=e.screenY-on.screenY):Ka=Qa=0,on=e),Qa)},movementY:function(e){return"movementY"in e?e.movementY:Ka}}),Wo=Je(ga),Qm=he({},ga,{dataTransfer:0}),Km=Je(Qm),Gm=he({},Gn,{relatedTarget:0}),Ga=Je(Gm),Ym=he({},Xs,{animationName:0,elapsedTime:0,pseudoElement:0}),Xm=Je(Ym),Jm=he({},Xs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zm=Je(Jm),ep=he({},Xs,{data:0}),Qo=Je(ep),tp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sp={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},np={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=np[e])?!!t[e]:!1}function Il(){return rp}var ap=he({},Gn,{key:function(e){if(e.key){var t=tp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Er(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Il,charCode:function(e){return e.type==="keypress"?Er(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Er(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ip=Je(ap),lp=he({},ga,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ko=Je(lp),op=he({},Gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Il}),cp=Je(op),dp=he({},Xs,{propertyName:0,elapsedTime:0,pseudoElement:0}),up=Je(dp),hp=he({},ga,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),mp=Je(hp),pp=[9,13,27,32],ql=_t&&"CompositionEvent"in window,jn=null;_t&&"documentMode"in document&&(jn=document.documentMode);var fp=_t&&"TextEvent"in window&&!jn,Wd=_t&&(!ql||jn&&8<jn&&11>=jn),Go=" ",Yo=!1;function Qd(e,t){switch(e){case"keyup":return pp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cs=!1;function xp(e,t){switch(e){case"compositionend":return Kd(t);case"keypress":return t.which!==32?null:(Yo=!0,Go);case"textInput":return e=t.data,e===Go&&Yo?null:e;default:return null}}function vp(e,t){if(Cs)return e==="compositionend"||!ql&&Qd(e,t)?(e=Hd(),_r=Ol=Bt=null,Cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Wd&&t.locale!=="ko"?null:t.data;default:return null}}var gp={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Xo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!gp[e.type]:t==="textarea"}function Gd(e,t,n,r){Cd(r),t=Gr(t,"onChange"),0<t.length&&(n=new Bl("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Nn=null,Mn=null;function yp(e){iu(e,0)}function ya(e){var t=Es(e);if(yd(t))return e}function jp(e,t){if(e==="change")return t}var Yd=!1;if(_t){var Ya;if(_t){var Xa="oninput"in document;if(!Xa){var Jo=document.createElement("div");Jo.setAttribute("oninput","return;"),Xa=typeof Jo.oninput=="function"}Ya=Xa}else Ya=!1;Yd=Ya&&(!document.documentMode||9<document.documentMode)}function Zo(){Nn&&(Nn.detachEvent("onpropertychange",Xd),Mn=Nn=null)}function Xd(e){if(e.propertyName==="value"&&ya(Mn)){var t=[];Gd(t,Mn,e,Fl(e)),Td(yp,t)}}function Np(e,t,n){e==="focusin"?(Zo(),Nn=t,Mn=n,Nn.attachEvent("onpropertychange",Xd)):e==="focusout"&&Zo()}function bp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ya(Mn)}function wp(e,t){if(e==="click")return ya(t)}function kp(e,t){if(e==="input"||e==="change")return ya(t)}function Sp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mt=typeof Object.is=="function"?Object.is:Sp;function An(e,t){if(mt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ji.call(t,a)||!mt(e[a],t[a]))return!1}return!0}function ec(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function tc(e,t){var n=ec(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ec(n)}}function Jd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zd(){for(var e=window,t=Ur();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ur(e.document)}return t}function Ul(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Cp(e){var t=Zd(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Jd(n.ownerDocument.documentElement,n)){if(r!==null&&Ul(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=tc(n,i);var l=tc(n,r);a&&l&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Pp=_t&&"documentMode"in document&&11>=document.documentMode,Ps=null,Bi=null,bn=null,Ii=!1;function sc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ii||Ps==null||Ps!==Ur(r)||(r=Ps,"selectionStart"in r&&Ul(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bn&&An(bn,r)||(bn=r,r=Gr(Bi,"onSelect"),0<r.length&&(t=new Bl("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ps)))}function mr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _s={animationend:mr("Animation","AnimationEnd"),animationiteration:mr("Animation","AnimationIteration"),animationstart:mr("Animation","AnimationStart"),transitionend:mr("Transition","TransitionEnd")},Ja={},eu={};_t&&(eu=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function ja(e){if(Ja[e])return Ja[e];if(!_s[e])return e;var t=_s[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in eu)return Ja[e]=t[n];return e}var tu=ja("animationend"),su=ja("animationiteration"),nu=ja("animationstart"),ru=ja("transitionend"),au=new Map,nc="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function es(e,t){au.set(e,t),ys(t,[e])}for(var Za=0;Za<nc.length;Za++){var ei=nc[Za],_p=ei.toLowerCase(),Ep=ei[0].toUpperCase()+ei.slice(1);es(_p,"on"+Ep)}es(tu,"onAnimationEnd");es(su,"onAnimationIteration");es(nu,"onAnimationStart");es("dblclick","onDoubleClick");es("focusin","onFocus");es("focusout","onBlur");es(ru,"onTransitionEnd");Us("onMouseEnter",["mouseout","mouseover"]);Us("onMouseLeave",["mouseout","mouseover"]);Us("onPointerEnter",["pointerout","pointerover"]);Us("onPointerLeave",["pointerout","pointerover"]);ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ys("onBeforeInput",["compositionend","keypress","textInput","paste"]);ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tp=new Set("cancel close invalid load scroll toggle".split(" ").concat(xn));function rc(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,_m(r,t,void 0,e),e.currentTarget=null}function iu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var l=r.length-1;0<=l;l--){var c=r[l],o=c.instance,u=c.currentTarget;if(c=c.listener,o!==i&&a.isPropagationStopped())break e;rc(a,c,u),i=o}else for(l=0;l<r.length;l++){if(c=r[l],o=c.instance,u=c.currentTarget,c=c.listener,o!==i&&a.isPropagationStopped())break e;rc(a,c,u),i=o}}}if(Vr)throw e=Ai,Vr=!1,Ai=null,e}function ie(e,t){var n=t[Hi];n===void 0&&(n=t[Hi]=new Set);var r=e+"__bubble";n.has(r)||(lu(t,e,2,!1),n.add(r))}function ti(e,t,n){var r=0;t&&(r|=4),lu(n,e,r,t)}var pr="_reactListening"+Math.random().toString(36).slice(2);function $n(e){if(!e[pr]){e[pr]=!0,pd.forEach(function(n){n!=="selectionchange"&&(Tp.has(n)||ti(n,!1,e),ti(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pr]||(t[pr]=!0,ti("selectionchange",!1,t))}}function lu(e,t,n,r){switch(Vd(t)){case 1:var a=Vm;break;case 4:a=Hm;break;default:a=Rl}n=a.bind(null,t,n,e),a=void 0,!Mi||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function si(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var l=r.tag;if(l===3||l===4){var c=r.stateNode.containerInfo;if(c===a||c.nodeType===8&&c.parentNode===a)break;if(l===4)for(l=r.return;l!==null;){var o=l.tag;if((o===3||o===4)&&(o=l.stateNode.containerInfo,o===a||o.nodeType===8&&o.parentNode===a))return;l=l.return}for(;c!==null;){if(l=cs(c),l===null)return;if(o=l.tag,o===5||o===6){r=i=l;continue e}c=c.parentNode}}r=r.return}Td(function(){var u=i,f=Fl(n),h=[];e:{var p=au.get(e);if(p!==void 0){var v=Bl,N=e;switch(e){case"keypress":if(Er(n)===0)break e;case"keydown":case"keyup":v=ip;break;case"focusin":N="focus",v=Ga;break;case"focusout":N="blur",v=Ga;break;case"beforeblur":case"afterblur":v=Ga;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=Wo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=Km;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=cp;break;case tu:case su:case nu:v=Xm;break;case ru:v=up;break;case"scroll":v=Wm;break;case"wheel":v=mp;break;case"copy":case"cut":case"paste":v=Zm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=Ko}var j=(t&4)!==0,k=!j&&e==="scroll",m=j?p!==null?p+"Capture":null:p;j=[];for(var x=u,g;x!==null;){g=x;var y=g.stateNode;if(g.tag===5&&y!==null&&(g=y,m!==null&&(y=Tn(x,m),y!=null&&j.push(Rn(x,y,g)))),k)break;x=x.return}0<j.length&&(p=new v(p,N,null,n,f),h.push({event:p,listeners:j}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",p&&n!==Di&&(N=n.relatedTarget||n.fromElement)&&(cs(N)||N[Et]))break e;if((v||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,v?(N=n.relatedTarget||n.toElement,v=u,N=N?cs(N):null,N!==null&&(k=js(N),N!==k||N.tag!==5&&N.tag!==6)&&(N=null)):(v=null,N=u),v!==N)){if(j=Wo,y="onMouseLeave",m="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(j=Ko,y="onPointerLeave",m="onPointerEnter",x="pointer"),k=v==null?p:Es(v),g=N==null?p:Es(N),p=new j(y,x+"leave",v,n,f),p.target=k,p.relatedTarget=g,y=null,cs(f)===u&&(j=new j(m,x+"enter",N,n,f),j.target=g,j.relatedTarget=k,y=j),k=y,v&&N)t:{for(j=v,m=N,x=0,g=j;g;g=bs(g))x++;for(g=0,y=m;y;y=bs(y))g++;for(;0<x-g;)j=bs(j),x--;for(;0<g-x;)m=bs(m),g--;for(;x--;){if(j===m||m!==null&&j===m.alternate)break t;j=bs(j),m=bs(m)}j=null}else j=null;v!==null&&ac(h,p,v,j,!1),N!==null&&k!==null&&ac(h,k,N,j,!0)}}e:{if(p=u?Es(u):window,v=p.nodeName&&p.nodeName.toLowerCase(),v==="select"||v==="input"&&p.type==="file")var S=jp;else if(Xo(p))if(Yd)S=kp;else{S=bp;var E=Np}else(v=p.nodeName)&&v.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(S=wp);if(S&&(S=S(e,u))){Gd(h,S,n,f);break e}E&&E(e,p,u),e==="focusout"&&(E=p._wrapperState)&&E.controlled&&p.type==="number"&&Pi(p,"number",p.value)}switch(E=u?Es(u):window,e){case"focusin":(Xo(E)||E.contentEditable==="true")&&(Ps=E,Bi=u,bn=null);break;case"focusout":bn=Bi=Ps=null;break;case"mousedown":Ii=!0;break;case"contextmenu":case"mouseup":case"dragend":Ii=!1,sc(h,n,f);break;case"selectionchange":if(Pp)break;case"keydown":case"keyup":sc(h,n,f)}var T;if(ql)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Cs?Qd(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Wd&&n.locale!=="ko"&&(Cs||P!=="onCompositionStart"?P==="onCompositionEnd"&&Cs&&(T=Hd()):(Bt=f,Ol="value"in Bt?Bt.value:Bt.textContent,Cs=!0)),E=Gr(u,P),0<E.length&&(P=new Qo(P,e,null,n,f),h.push({event:P,listeners:E}),T?P.data=T:(T=Kd(n),T!==null&&(P.data=T)))),(T=fp?xp(e,n):vp(e,n))&&(u=Gr(u,"onBeforeInput"),0<u.length&&(f=new Qo("onBeforeInput","beforeinput",null,n,f),h.push({event:f,listeners:u}),f.data=T))}iu(h,t)})}function Rn(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gr(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Tn(e,n),i!=null&&r.unshift(Rn(e,i,a)),i=Tn(e,t),i!=null&&r.push(Rn(e,i,a))),e=e.return}return r}function bs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ac(e,t,n,r,a){for(var i=t._reactName,l=[];n!==null&&n!==r;){var c=n,o=c.alternate,u=c.stateNode;if(o!==null&&o===r)break;c.tag===5&&u!==null&&(c=u,a?(o=Tn(n,i),o!=null&&l.unshift(Rn(n,o,c))):a||(o=Tn(n,i),o!=null&&l.push(Rn(n,o,c)))),n=n.return}l.length!==0&&e.push({event:t,listeners:l})}var Lp=/\r\n?/g,Dp=/\u0000|\uFFFD/g;function ic(e){return(typeof e=="string"?e:""+e).replace(Lp,`-`).replace(Dp,"")}function fr(e,t,n){if(t=ic(t),ic(e)!==t&&n)throw Error(M(425))}function Yr(){}var qi=null,Ui=null;function zi(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vi=typeof setTimeout=="function"?setTimeout:void 0,Fp=typeof clearTimeout=="function"?clearTimeout:void 0,lc=typeof Promise=="function"?Promise:void 0,Mp=typeof queueMicrotask=="function"?queueMicrotask:typeof lc<"u"?function(e){return lc.resolve(null).then(e).catch(Ap)}:Vi;function Ap(e){setTimeout(function(){throw e})}function ni(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Fn(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Fn(t)}function Ht(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function oc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Js=Math.random().toString(36).slice(2),xt="__reactFiber$"+Js,On="__reactProps$"+Js,Et="__reactContainer$"+Js,Hi="__reactEvents$"+Js,$p="__reactListeners$"+Js,Rp="__reactHandles$"+Js;function cs(e){var t=e[xt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Et]||n[xt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=oc(e);e!==null;){if(n=e[xt])return n;e=oc(e)}return t}e=n,n=e.parentNode}return null}function Yn(e){return e=e[xt]||e[Et],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Es(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function Na(e){return e[On]||null}var Wi=[],Ts=-1;function ts(e){return{current:e}}function le(e){0>Ts||(e.current=Wi[Ts],Wi[Ts]=null,Ts--)}function ae(e,t){Ts++,Wi[Ts]=e.current,e.current=t}var Zt={},$e=ts(Zt),Ve=ts(!1),ps=Zt;function zs(e,t){var n=e.type.contextTypes;if(!n)return Zt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function He(e){return e=e.childContextTypes,e!=null}function Xr(){le(Ve),le($e)}function cc(e,t,n){if($e.current!==Zt)throw Error(M(168));ae($e,t),ae(Ve,n)}function ou(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(M(108,Nm(e)||"Unknown",a));return he({},n,r)}function Jr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zt,ps=$e.current,ae($e,e),ae(Ve,Ve.current),!0}function dc(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=ou(e,t,ps),r.__reactInternalMemoizedMergedChildContext=e,le(Ve),le($e),ae($e,e)):le(Ve),ae(Ve,n)}var kt=null,ba=!1,ri=!1;function cu(e){kt===null?kt=[e]:kt.push(e)}function Op(e){ba=!0,cu(e)}function ss(){if(!ri&&kt!==null){ri=!0;var e=0,t=se;try{var n=kt;for(se=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}kt=null,ba=!1}catch(a){throw kt!==null&&(kt=kt.slice(e+1)),Md(Ml,ss),a}finally{se=t,ri=!1}}return null}var Ls=[],Ds=0,Zr=null,ea=0,Ze=[],et=0,fs=null,St=1,Ct="";function ls(e,t){Ls[Ds++]=ea,Ls[Ds++]=Zr,Zr=e,ea=t}function du(e,t,n){Ze[et++]=St,Ze[et++]=Ct,Ze[et++]=fs,fs=e;var r=St;e=Ct;var a=32-ut(r)-1;r&=~(1<<a),n+=1;var i=32-ut(t)+a;if(30<i){var l=a-a%5;i=(r&(1<<l)-1).toString(32),r>>=l,a-=l,St=1<<32-ut(t)+a|n<<a|r,Ct=i+e}else St=1<<i|n<<a|r,Ct=e}function zl(e){e.return!==null&&(ls(e,1),du(e,1,0))}function Vl(e){for(;e===Zr;)Zr=Ls[--Ds],Ls[Ds]=null,ea=Ls[--Ds],Ls[Ds]=null;for(;e===fs;)fs=Ze[--et],Ze[et]=null,Ct=Ze[--et],Ze[et]=null,St=Ze[--et],Ze[et]=null}var Ge=null,Ke=null,oe=!1,dt=null;function uu(e,t){var n=st(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function uc(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ge=e,Ke=Ht(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ge=e,Ke=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=fs!==null?{id:St,overflow:Ct}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=st(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ge=e,Ke=null,!0):!1;default:return!1}}function Qi(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ki(e){if(oe){var t=Ke;if(t){var n=t;if(!uc(e,t)){if(Qi(e))throw Error(M(418));t=Ht(n.nextSibling);var r=Ge;t&&uc(e,t)?uu(r,n):(e.flags=e.flags&-4097|2,oe=!1,Ge=e)}}else{if(Qi(e))throw Error(M(418));e.flags=e.flags&-4097|2,oe=!1,Ge=e}}}function hc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ge=e}function xr(e){if(e!==Ge)return!1;if(!oe)return hc(e),oe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!zi(e.type,e.memoizedProps)),t&&(t=Ke)){if(Qi(e))throw hu(),Error(M(418));for(;t;)uu(e,t),t=Ht(t.nextSibling)}if(hc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ke=Ht(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ke=null}}else Ke=Ge?Ht(e.stateNode.nextSibling):null;return!0}function hu(){for(var e=Ke;e;)e=Ht(e.nextSibling)}function Vs(){Ke=Ge=null,oe=!1}function Hl(e){dt===null?dt=[e]:dt.push(e)}var Bp=Dt.ReactCurrentBatchConfig;function cn(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(M(309));var r=n.stateNode}if(!r)throw Error(M(147,e));var a=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(l){var c=a.refs;l===null?delete c[i]:c[i]=l},t._stringRef=i,t)}if(typeof e!="string")throw Error(M(284));if(!n._owner)throw Error(M(290,e))}return e}function vr(e,t){throw e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function mc(e){var t=e._init;return t(e._payload)}function mu(e){function t(m,x){if(e){var g=m.deletions;g===null?(m.deletions=[x],m.flags|=16):g.push(x)}}function n(m,x){if(!e)return null;for(;x!==null;)t(m,x),x=x.sibling;return null}function r(m,x){for(m=new Map;x!==null;)x.key!==null?m.set(x.key,x):m.set(x.index,x),x=x.sibling;return m}function a(m,x){return m=Gt(m,x),m.index=0,m.sibling=null,m}function i(m,x,g){return m.index=g,e?(g=m.alternate,g!==null?(g=g.index,g<x?(m.flags|=2,x):g):(m.flags|=2,x)):(m.flags|=1048576,x)}function l(m){return e&&m.alternate===null&&(m.flags|=2),m}function c(m,x,g,y){return x===null||x.tag!==6?(x=ui(g,m.mode,y),x.return=m,x):(x=a(x,g),x.return=m,x)}function o(m,x,g,y){var S=g.type;return S===Ss?f(m,x,g.props.children,y,g.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===At&&mc(S)===x.type)?(y=a(x,g.props),y.ref=cn(m,x,g),y.return=m,y):(y=$r(g.type,g.key,g.props,null,m.mode,y),y.ref=cn(m,x,g),y.return=m,y)}function u(m,x,g,y){return x===null||x.tag!==4||x.stateNode.containerInfo!==g.containerInfo||x.stateNode.implementation!==g.implementation?(x=hi(g,m.mode,y),x.return=m,x):(x=a(x,g.children||[]),x.return=m,x)}function f(m,x,g,y,S){return x===null||x.tag!==7?(x=ms(g,m.mode,y,S),x.return=m,x):(x=a(x,g),x.return=m,x)}function h(m,x,g){if(typeof x=="string"&&x!==""||typeof x=="number")return x=ui(""+x,m.mode,g),x.return=m,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case ir:return g=$r(x.type,x.key,x.props,null,m.mode,g),g.ref=cn(m,null,x),g.return=m,g;case ks:return x=hi(x,m.mode,g),x.return=m,x;case At:var y=x._init;return h(m,y(x._payload),g)}if(pn(x)||nn(x))return x=ms(x,m.mode,g,null),x.return=m,x;vr(m,x)}return null}function p(m,x,g,y){var S=x!==null?x.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return S!==null?null:c(m,x,""+g,y);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case ir:return g.key===S?o(m,x,g,y):null;case ks:return g.key===S?u(m,x,g,y):null;case At:return S=g._init,p(m,x,S(g._payload),y)}if(pn(g)||nn(g))return S!==null?null:f(m,x,g,y,null);vr(m,g)}return null}function v(m,x,g,y,S){if(typeof y=="string"&&y!==""||typeof y=="number")return m=m.get(g)||null,c(x,m,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ir:return m=m.get(y.key===null?g:y.key)||null,o(x,m,y,S);case ks:return m=m.get(y.key===null?g:y.key)||null,u(x,m,y,S);case At:var E=y._init;return v(m,x,g,E(y._payload),S)}if(pn(y)||nn(y))return m=m.get(g)||null,f(x,m,y,S,null);vr(x,y)}return null}function N(m,x,g,y){for(var S=null,E=null,T=x,P=x=0,O=null;T!==null&&P<g.length;P++){T.index>P?(O=T,T=null):O=T.sibling;var w=p(m,T,g[P],y);if(w===null){T===null&&(T=O);break}e&&T&&w.alternate===null&&t(m,T),x=i(w,x,P),E===null?S=w:E.sibling=w,E=w,T=O}if(P===g.length)return n(m,T),oe&&ls(m,P),S;if(T===null){for(;P<g.length;P++)T=h(m,g[P],y),T!==null&&(x=i(T,x,P),E===null?S=T:E.sibling=T,E=T);return oe&&ls(m,P),S}for(T=r(m,T);P<g.length;P++)O=v(T,m,P,g[P],y),O!==null&&(e&&O.alternate!==null&&T.delete(O.key===null?P:O.key),x=i(O,x,P),E===null?S=O:E.sibling=O,E=O);return e&&T.forEach(function(L){return t(m,L)}),oe&&ls(m,P),S}function j(m,x,g,y){var S=nn(g);if(typeof S!="function")throw Error(M(150));if(g=S.call(g),g==null)throw Error(M(151));for(var E=S=null,T=x,P=x=0,O=null,w=g.next();T!==null&&!w.done;P++,w=g.next()){T.index>P?(O=T,T=null):O=T.sibling;var L=p(m,T,w.value,y);if(L===null){T===null&&(T=O);break}e&&T&&L.alternate===null&&t(m,T),x=i(L,x,P),E===null?S=L:E.sibling=L,E=L,T=O}if(w.done)return n(m,T),oe&&ls(m,P),S;if(T===null){for(;!w.done;P++,w=g.next())w=h(m,w.value,y),w!==null&&(x=i(w,x,P),E===null?S=w:E.sibling=w,E=w);return oe&&ls(m,P),S}for(T=r(m,T);!w.done;P++,w=g.next())w=v(T,m,P,w.value,y),w!==null&&(e&&w.alternate!==null&&T.delete(w.key===null?P:w.key),x=i(w,x,P),E===null?S=w:E.sibling=w,E=w);return e&&T.forEach(function(U){return t(m,U)}),oe&&ls(m,P),S}function k(m,x,g,y){if(typeof g=="object"&&g!==null&&g.type===Ss&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ir:e:{for(var S=g.key,E=x;E!==null;){if(E.key===S){if(S=g.type,S===Ss){if(E.tag===7){n(m,E.sibling),x=a(E,g.props.children),x.return=m,m=x;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===At&&mc(S)===E.type){n(m,E.sibling),x=a(E,g.props),x.ref=cn(m,E,g),x.return=m,m=x;break e}n(m,E);break}else t(m,E);E=E.sibling}g.type===Ss?(x=ms(g.props.children,m.mode,y,g.key),x.return=m,m=x):(y=$r(g.type,g.key,g.props,null,m.mode,y),y.ref=cn(m,x,g),y.return=m,m=y)}return l(m);case ks:e:{for(E=g.key;x!==null;){if(x.key===E)if(x.tag===4&&x.stateNode.containerInfo===g.containerInfo&&x.stateNode.implementation===g.implementation){n(m,x.sibling),x=a(x,g.children||[]),x.return=m,m=x;break e}else{n(m,x);break}else t(m,x);x=x.sibling}x=hi(g,m.mode,y),x.return=m,m=x}return l(m);case At:return E=g._init,k(m,x,E(g._payload),y)}if(pn(g))return N(m,x,g,y);if(nn(g))return j(m,x,g,y);vr(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,x!==null&&x.tag===6?(n(m,x.sibling),x=a(x,g),x.return=m,m=x):(n(m,x),x=ui(g,m.mode,y),x.return=m,m=x),l(m)):n(m,x)}return k}var Hs=mu(!0),pu=mu(!1),ta=ts(null),sa=null,Fs=null,Wl=null;function Ql(){Wl=Fs=sa=null}function Kl(e){var t=ta.current;le(ta),e._currentValue=t}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Is(e,t){sa=e,Wl=Fs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ze=!0),e.firstContext=null)}function rt(e){var t=e._currentValue;if(Wl!==e)if(e={context:e,memoizedValue:t,next:null},Fs===null){if(sa===null)throw Error(M(308));Fs=e,sa.dependencies={lanes:0,firstContext:e}}else Fs=Fs.next=e;return t}var ds=null;function Gl(e){ds===null?ds=[e]:ds.push(e)}function fu(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Gl(t)):(n.next=a.next,a.next=n),t.interleaved=n,Tt(e,r)}function Tt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $t=!1;function Yl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Pt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Tt(e,n)}return a=r.interleaved,a===null?(t.next=t,Gl(r)):(t.next=a.next,a.next=t),r.interleaved=t,Tt(e,n)}function Tr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Al(e,n)}}function pc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function na(e,t,n,r){var a=e.updateQueue;$t=!1;var i=a.firstBaseUpdate,l=a.lastBaseUpdate,c=a.shared.pending;if(c!==null){a.shared.pending=null;var o=c,u=o.next;o.next=null,l===null?i=u:l.next=u,l=o;var f=e.alternate;f!==null&&(f=f.updateQueue,c=f.lastBaseUpdate,c!==l&&(c===null?f.firstBaseUpdate=u:c.next=u,f.lastBaseUpdate=o))}if(i!==null){var h=a.baseState;l=0,f=u=o=null,c=i;do{var p=c.lane,v=c.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:v,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var N=e,j=c;switch(p=t,v=n,j.tag){case 1:if(N=j.payload,typeof N=="function"){h=N.call(v,h,p);break e}h=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=j.payload,p=typeof N=="function"?N.call(v,h,p):N,p==null)break e;h=he({},h,p);break e;case 2:$t=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,p=a.effects,p===null?a.effects=[c]:p.push(c))}else v={eventTime:v,lane:p,tag:c.tag,payload:c.payload,callback:c.callback,next:null},f===null?(u=f=v,o=h):f=f.next=v,l|=p;if(c=c.next,c===null){if(c=a.shared.pending,c===null)break;p=c,c=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(!0);if(f===null&&(o=h),a.baseState=o,a.firstBaseUpdate=u,a.lastBaseUpdate=f,t=a.shared.interleaved,t!==null){a=t;do l|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);vs|=l,e.lanes=l,e.memoizedState=h}}function fc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(M(191,a));a.call(r)}}}var Xn={},gt=ts(Xn),Bn=ts(Xn),In=ts(Xn);function us(e){if(e===Xn)throw Error(M(174));return e}function Xl(e,t){switch(ae(In,t),ae(Bn,e),ae(gt,Xn),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ei(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ei(t,e)}le(gt),ae(gt,t)}function Ws(){le(gt),le(Bn),le(In)}function vu(e){us(In.current);var t=us(gt.current),n=Ei(t,e.type);t!==n&&(ae(Bn,e),ae(gt,n))}function Jl(e){Bn.current===e&&(le(gt),le(Bn))}var ce=ts(0);function ra(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ai=[];function Zl(){for(var e=0;e<ai.length;e++)ai[e]._workInProgressVersionPrimary=null;ai.length=0}var Lr=Dt.ReactCurrentDispatcher,ii=Dt.ReactCurrentBatchConfig,xs=0,de=null,we=null,Pe=null,aa=!1,wn=!1,qn=0,Ip=0;function Fe(){throw Error(M(321))}function eo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!mt(e[n],t[n]))return!1;return!0}function to(e,t,n,r,a,i){if(xs=i,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Lr.current=e===null||e.memoizedState===null?Vp:Hp,e=n(r,a),wn){i=0;do{if(wn=!1,qn=0,25<=i)throw Error(M(301));i+=1,Pe=we=null,t.updateQueue=null,Lr.current=Wp,e=n(r,a)}while(wn)}if(Lr.current=ia,t=we!==null&&we.next!==null,xs=0,Pe=we=de=null,aa=!1,t)throw Error(M(300));return e}function so(){var e=qn!==0;return qn=0,e}function ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pe===null?de.memoizedState=Pe=e:Pe=Pe.next=e,Pe}function at(){if(we===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=we.next;var t=Pe===null?de.memoizedState:Pe.next;if(t!==null)Pe=t,we=e;else{if(e===null)throw Error(M(310));we=e,e={memoizedState:we.memoizedState,baseState:we.baseState,baseQueue:we.baseQueue,queue:we.queue,next:null},Pe===null?de.memoizedState=Pe=e:Pe=Pe.next=e}return Pe}function Un(e,t){return typeof t=="function"?t(e):t}function li(e){var t=at(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=we,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var l=a.next;a.next=i.next,i.next=l}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var c=l=null,o=null,u=i;do{var f=u.lane;if((xs&f)===f)o!==null&&(o=o.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var h={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};o===null?(c=o=h,l=r):o=o.next=h,de.lanes|=f,vs|=f}u=u.next}while(u!==null&&u!==i);o===null?l=r:o.next=c,mt(r,t.memoizedState)||(ze=!0),t.memoizedState=r,t.baseState=l,t.baseQueue=o,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do i=a.lane,de.lanes|=i,vs|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function oi(e){var t=at(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var l=a=a.next;do i=e(i,l.action),l=l.next;while(l!==a);mt(i,t.memoizedState)||(ze=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function gu(){}function yu(e,t){var n=de,r=at(),a=t(),i=!mt(r.memoizedState,a);if(i&&(r.memoizedState=a,ze=!0),r=r.queue,no(bu.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Pe!==null&&Pe.memoizedState.tag&1){if(n.flags|=2048,zn(9,Nu.bind(null,n,r,a,t),void 0,null),_e===null)throw Error(M(349));xs&30||ju(n,t,a)}return a}function ju(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Nu(e,t,n,r){t.value=n,t.getSnapshot=r,wu(t)&&ku(e)}function bu(e,t,n){return n(function(){wu(t)&&ku(e)})}function wu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!mt(e,n)}catch{return!0}}function ku(e){var t=Tt(e,1);t!==null&&ht(t,e,1,-1)}function xc(e){var t=ft();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:e},t.queue=e,e=e.dispatch=zp.bind(null,de,e),[t.memoizedState,e]}function zn(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Su(){return at().memoizedState}function Dr(e,t,n,r){var a=ft();de.flags|=e,a.memoizedState=zn(1|t,n,void 0,r===void 0?null:r)}function wa(e,t,n,r){var a=at();r=r===void 0?null:r;var i=void 0;if(we!==null){var l=we.memoizedState;if(i=l.destroy,r!==null&&eo(r,l.deps)){a.memoizedState=zn(t,n,i,r);return}}de.flags|=e,a.memoizedState=zn(1|t,n,i,r)}function vc(e,t){return Dr(8390656,8,e,t)}function no(e,t){return wa(2048,8,e,t)}function Cu(e,t){return wa(4,2,e,t)}function Pu(e,t){return wa(4,4,e,t)}function _u(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Eu(e,t,n){return n=n!=null?n.concat([e]):null,wa(4,4,_u.bind(null,t,e),n)}function ro(){}function Tu(e,t){var n=at();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&eo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Lu(e,t){var n=at();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&eo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Du(e,t,n){return xs&21?(mt(n,t)||(n=Rd(),de.lanes|=n,vs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ze=!0),e.memoizedState=n)}function qp(e,t){var n=se;se=n!==0&&4>n?n:4,e(!0);var r=ii.transition;ii.transition={};try{e(!1),t()}finally{se=n,ii.transition=r}}function Fu(){return at().memoizedState}function Up(e,t,n){var r=Kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Mu(e))Au(t,n);else if(n=fu(e,t,n,r),n!==null){var a=Oe();ht(n,e,r,a),$u(n,t,r)}}function zp(e,t,n){var r=Kt(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Mu(e))Au(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,c=i(l,n);if(a.hasEagerState=!0,a.eagerState=c,mt(c,l)){var o=t.interleaved;o===null?(a.next=a,Gl(t)):(a.next=o.next,o.next=a),t.interleaved=a;return}}catch{}finally{}n=fu(e,t,a,r),n!==null&&(a=Oe(),ht(n,e,r,a),$u(n,t,r))}}function Mu(e){var t=e.alternate;return e===de||t!==null&&t===de}function Au(e,t){wn=aa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $u(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Al(e,n)}}var ia={readContext:rt,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},Vp={readContext:rt,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:vc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Dr(4194308,4,_u.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Dr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Dr(4,2,e,t)},useMemo:function(e,t){var n=ft();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ft();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Up.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:xc,useDebugValue:ro,useDeferredValue:function(e){return ft().memoizedState=e},useTransition:function(){var e=xc(!1),t=e[0];return e=qp.bind(null,e[1]),ft().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=de,a=ft();if(oe){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),_e===null)throw Error(M(349));xs&30||ju(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,vc(bu.bind(null,r,i,e),[e]),r.flags|=2048,zn(9,Nu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ft(),t=_e.identifierPrefix;if(oe){var n=Ct,r=St;n=(r&~(1<<32-ut(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qn++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Ip++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hp={readContext:rt,useCallback:Tu,useContext:rt,useEffect:no,useImperativeHandle:Eu,useInsertionEffect:Cu,useLayoutEffect:Pu,useMemo:Lu,useReducer:li,useRef:Su,useState:function(){return li(Un)},useDebugValue:ro,useDeferredValue:function(e){var t=at();return Du(t,we.memoizedState,e)},useTransition:function(){var e=li(Un)[0],t=at().memoizedState;return[e,t]},useMutableSource:gu,useSyncExternalStore:yu,useId:Fu,unstable_isNewReconciler:!1},Wp={readContext:rt,useCallback:Tu,useContext:rt,useEffect:no,useImperativeHandle:Eu,useInsertionEffect:Cu,useLayoutEffect:Pu,useMemo:Lu,useReducer:oi,useRef:Su,useState:function(){return oi(Un)},useDebugValue:ro,useDeferredValue:function(e){var t=at();return we===null?t.memoizedState=e:Du(t,we.memoizedState,e)},useTransition:function(){var e=oi(Un)[0],t=at().memoizedState;return[e,t]},useMutableSource:gu,useSyncExternalStore:yu,useId:Fu,unstable_isNewReconciler:!1};function lt(e,t){if(e&&e.defaultProps){t=he({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Yi(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:he({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ka={isMounted:function(e){return(e=e._reactInternals)?js(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Oe(),a=Kt(e),i=Pt(r,a);i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,a),t!==null&&(ht(t,e,a,r),Tr(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Oe(),a=Kt(e),i=Pt(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,a),t!==null&&(ht(t,e,a,r),Tr(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Oe(),r=Kt(e),a=Pt(n,r);a.tag=2,t!=null&&(a.callback=t),t=Wt(e,a,r),t!==null&&(ht(t,e,r,n),Tr(t,e,r))}};function gc(e,t,n,r,a,i,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,l):t.prototype&&t.prototype.isPureReactComponent?!An(n,r)||!An(a,i):!0}function Ru(e,t,n){var r=!1,a=Zt,i=t.contextType;return typeof i=="object"&&i!==null?i=rt(i):(a=He(t)?ps:$e.current,r=t.contextTypes,i=(r=r!=null)?zs(e,a):Zt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ka,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function yc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ka.enqueueReplaceState(t,t.state,null)}function Xi(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Yl(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=rt(i):(i=He(t)?ps:$e.current,a.context=zs(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Yi(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&ka.enqueueReplaceState(a,a.state,null),na(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Qs(e,t){try{var n="",r=t;do n+=jm(r),r=r.return;while(r);var a=n}catch(i){a=`-Error generating stack: `+i.message+`-`+i.stack}return{value:e,source:t,stack:a,digest:null}}function ci(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ji(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Qp=typeof WeakMap=="function"?WeakMap:Map;function Ou(e,t,n){n=Pt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){oa||(oa=!0,ol=r),Ji(e,t)},n}function Bu(e,t,n){n=Pt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Ji(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ji(e,t),typeof r!="function"&&(Qt===null?Qt=new Set([this]):Qt.add(this));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),n}function jc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Qp;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=of.bind(null,e,t,n),t.then(e,e))}function Nc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function bc(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Pt(-1,1),t.tag=2,Wt(n,t,1))),n.lanes|=1),e)}var Kp=Dt.ReactCurrentOwner,ze=!1;function Re(e,t,n,r){t.child=e===null?pu(t,null,n,r):Hs(t,e.child,n,r)}function wc(e,t,n,r,a){n=n.render;var i=t.ref;return Is(t,a),r=to(e,t,n,r,i,a),n=so(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Lt(e,t,a)):(oe&&n&&zl(t),t.flags|=1,Re(e,t,r,a),t.child)}function kc(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!mo(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Iu(e,t,i,r,a)):(e=$r(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var l=i.memoizedProps;if(n=n.compare,n=n!==null?n:An,n(l,r)&&e.ref===t.ref)return Lt(e,t,a)}return t.flags|=1,e=Gt(i,r),e.ref=t.ref,e.return=t,t.child=e}function Iu(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(An(i,r)&&e.ref===t.ref)if(ze=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(ze=!0);else return t.lanes=e.lanes,Lt(e,t,a)}return Zi(e,t,n,r,a)}function qu(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ae(As,Qe),Qe|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ae(As,Qe),Qe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ae(As,Qe),Qe|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ae(As,Qe),Qe|=r;return Re(e,t,a,n),t.child}function Uu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Zi(e,t,n,r,a){var i=He(n)?ps:$e.current;return i=zs(t,i),Is(t,a),n=to(e,t,n,r,i,a),r=so(),e!==null&&!ze?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Lt(e,t,a)):(oe&&r&&zl(t),t.flags|=1,Re(e,t,n,a),t.child)}function Sc(e,t,n,r,a){if(He(n)){var i=!0;Jr(t)}else i=!1;if(Is(t,a),t.stateNode===null)Fr(e,t),Ru(t,n,r),Xi(t,n,r,a),r=!0;else if(e===null){var l=t.stateNode,c=t.memoizedProps;l.props=c;var o=l.context,u=n.contextType;typeof u=="object"&&u!==null?u=rt(u):(u=He(n)?ps:$e.current,u=zs(t,u));var f=n.getDerivedStateFromProps,h=typeof f=="function"||typeof l.getSnapshotBeforeUpdate=="function";h||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(c!==r||o!==u)&&yc(t,l,r,u),$t=!1;var p=t.memoizedState;l.state=p,na(t,r,l,a),o=t.memoizedState,c!==r||p!==o||Ve.current||$t?(typeof f=="function"&&(Yi(t,n,f,r),o=t.memoizedState),(c=$t||gc(t,n,c,r,p,o,u))?(h||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=o),l.props=r,l.state=o,l.context=u,r=c):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{l=t.stateNode,xu(e,t),c=t.memoizedProps,u=t.type===t.elementType?c:lt(t.type,c),l.props=u,h=t.pendingProps,p=l.context,o=n.contextType,typeof o=="object"&&o!==null?o=rt(o):(o=He(n)?ps:$e.current,o=zs(t,o));var v=n.getDerivedStateFromProps;(f=typeof v=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(c!==h||p!==o)&&yc(t,l,r,o),$t=!1,p=t.memoizedState,l.state=p,na(t,r,l,a);var N=t.memoizedState;c!==h||p!==N||Ve.current||$t?(typeof v=="function"&&(Yi(t,n,v,r),N=t.memoizedState),(u=$t||gc(t,n,u,r,p,N,o)||!1)?(f||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(r,N,o),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(r,N,o)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=N),l.props=r,l.state=N,l.context=o,r=u):(typeof l.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return el(e,t,n,r,i,a)}function el(e,t,n,r,a,i){Uu(e,t);var l=(t.flags&128)!==0;if(!r&&!l)return a&&dc(t,n,!1),Lt(e,t,i);r=t.stateNode,Kp.current=t;var c=l&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&l?(t.child=Hs(t,e.child,null,i),t.child=Hs(t,null,c,i)):Re(e,t,c,i),t.memoizedState=r.state,a&&dc(t,n,!0),t.child}function zu(e){var t=e.stateNode;t.pendingContext?cc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&cc(e,t.context,!1),Xl(e,t.containerInfo)}function Cc(e,t,n,r,a){return Vs(),Hl(a),t.flags|=256,Re(e,t,n,r),t.child}var tl={dehydrated:null,treeContext:null,retryLane:0};function sl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Vu(e,t,n){var r=t.pendingProps,a=ce.current,i=!1,l=(t.flags&128)!==0,c;if((c=l)||(c=e!==null&&e.memoizedState===null?!1:(a&2)!==0),c?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),ae(ce,a&1),e===null)return Ki(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=r.children,e=r.fallback,i?(r=t.mode,i=t.child,l={mode:"hidden",children:l},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=l):i=Pa(l,r,0,null),e=ms(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=sl(n),t.memoizedState=tl,e):ao(t,l));if(a=e.memoizedState,a!==null&&(c=a.dehydrated,c!==null))return Gp(e,t,l,r,c,a,n);if(i){i=r.fallback,l=t.mode,a=e.child,c=a.sibling;var o={mode:"hidden",children:r.children};return!(l&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=o,t.deletions=null):(r=Gt(a,o),r.subtreeFlags=a.subtreeFlags&14680064),c!==null?i=Gt(c,i):(i=ms(i,l,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,l=e.child.memoizedState,l=l===null?sl(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=tl,r}return i=e.child,e=i.sibling,r=Gt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ao(e,t){return t=Pa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function gr(e,t,n,r){return r!==null&&Hl(r),Hs(t,e.child,null,n),e=ao(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gp(e,t,n,r,a,i,l){if(n)return t.flags&256?(t.flags&=-257,r=ci(Error(M(422))),gr(e,t,l,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Pa({mode:"visible",children:r.children},a,0,null),i=ms(i,a,l,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Hs(t,e.child,null,l),t.child.memoizedState=sl(l),t.memoizedState=tl,i);if(!(t.mode&1))return gr(e,t,l,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var c=r.dgst;return r=c,i=Error(M(419)),r=ci(i,r,void 0),gr(e,t,l,r)}if(c=(l&e.childLanes)!==0,ze||c){if(r=_e,r!==null){switch(l&-l){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|l)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,Tt(e,a),ht(r,e,a,-1))}return ho(),r=ci(Error(M(421))),gr(e,t,l,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=cf.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Ke=Ht(a.nextSibling),Ge=t,oe=!0,dt=null,e!==null&&(Ze[et++]=St,Ze[et++]=Ct,Ze[et++]=fs,St=e.id,Ct=e.overflow,fs=t),t=ao(t,r.children),t.flags|=4096,t)}function Pc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function di(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function Hu(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(Re(e,t,r.children,n),r=ce.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Pc(e,n,t);else if(e.tag===19)Pc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ae(ce,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&ra(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),di(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&ra(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}di(t,!0,n,null,i);break;case"together":di(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Lt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),vs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,n=Gt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Yp(e,t,n){switch(t.tag){case 3:zu(t),Vs();break;case 5:vu(t);break;case 1:He(t.type)&&Jr(t);break;case 4:Xl(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;ae(ta,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ae(ce,ce.current&1),t.flags|=128,null):n&t.child.childLanes?Vu(e,t,n):(ae(ce,ce.current&1),e=Lt(e,t,n),e!==null?e.sibling:null);ae(ce,ce.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Hu(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),ae(ce,ce.current),r)break;return null;case 22:case 23:return t.lanes=0,qu(e,t,n)}return Lt(e,t,n)}var Wu,nl,Qu,Ku;Wu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};nl=function(){};Qu=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,us(gt.current);var i=null;switch(n){case"input":a=Si(e,a),r=Si(e,r),i=[];break;case"select":a=he({},a,{value:void 0}),r=he({},r,{value:void 0}),i=[];break;case"textarea":a=_i(e,a),r=_i(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yr)}Ti(n,r);var l;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var c=a[u];for(l in c)c.hasOwnProperty(l)&&(n||(n={}),n[l]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(_n.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var o=r[u];if(c=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&o!==c&&(o!=null||c!=null))if(u==="style")if(c){for(l in c)!c.hasOwnProperty(l)||o&&o.hasOwnProperty(l)||(n||(n={}),n[l]="");for(l in o)o.hasOwnProperty(l)&&c[l]!==o[l]&&(n||(n={}),n[l]=o[l])}else n||(i||(i=[]),i.push(u,n)),n=o;else u==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,c=c?c.__html:void 0,o!=null&&c!==o&&(i=i||[]).push(u,o)):u==="children"?typeof o!="string"&&typeof o!="number"||(i=i||[]).push(u,""+o):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(_n.hasOwnProperty(u)?(o!=null&&u==="onScroll"&&ie("scroll",e),i||c===o||(i=[])):(i=i||[]).push(u,o))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Ku=function(e,t,n,r){n!==r&&(t.flags|=4)};function dn(e,t){if(!oe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Me(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Xp(e,t,n){var r=t.pendingProps;switch(Vl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Me(t),null;case 1:return He(t.type)&&Xr(),Me(t),null;case 3:return r=t.stateNode,Ws(),le(Ve),le($e),Zl(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(xr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dt!==null&&(ul(dt),dt=null))),nl(e,t),Me(t),null;case 5:Jl(t);var a=us(In.current);if(n=t.type,e!==null&&t.stateNode!=null)Qu(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(M(166));return Me(t),null}if(e=us(gt.current),xr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[xt]=t,r[On]=i,e=(t.mode&1)!==0,n){case"dialog":ie("cancel",r),ie("close",r);break;case"iframe":case"object":case"embed":ie("load",r);break;case"video":case"audio":for(a=0;a<xn.length;a++)ie(xn[a],r);break;case"source":ie("error",r);break;case"img":case"image":case"link":ie("error",r),ie("load",r);break;case"details":ie("toggle",r);break;case"input":$o(r,i),ie("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ie("invalid",r);break;case"textarea":Oo(r,i),ie("invalid",r)}Ti(n,i),a=null;for(var l in i)if(i.hasOwnProperty(l)){var c=i[l];l==="children"?typeof c=="string"?r.textContent!==c&&(i.suppressHydrationWarning!==!0&&fr(r.textContent,c,e),a=["children",c]):typeof c=="number"&&r.textContent!==""+c&&(i.suppressHydrationWarning!==!0&&fr(r.textContent,c,e),a=["children",""+c]):_n.hasOwnProperty(l)&&c!=null&&l==="onScroll"&&ie("scroll",r)}switch(n){case"input":lr(r),Ro(r,i,!0);break;case"textarea":lr(r),Bo(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Yr)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{l=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=bd(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[xt]=t,e[On]=r,Wu(e,t,!1,!1),t.stateNode=e;e:{switch(l=Li(n,r),n){case"dialog":ie("cancel",e),ie("close",e),a=r;break;case"iframe":case"object":case"embed":ie("load",e),a=r;break;case"video":case"audio":for(a=0;a<xn.length;a++)ie(xn[a],e);a=r;break;case"source":ie("error",e),a=r;break;case"img":case"image":case"link":ie("error",e),ie("load",e),a=r;break;case"details":ie("toggle",e),a=r;break;case"input":$o(e,r),a=Si(e,r),ie("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=he({},r,{value:void 0}),ie("invalid",e);break;case"textarea":Oo(e,r),a=_i(e,r),ie("invalid",e);break;default:a=r}Ti(n,a),c=a;for(i in c)if(c.hasOwnProperty(i)){var o=c[i];i==="style"?Sd(e,o):i==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,o!=null&&wd(e,o)):i==="children"?typeof o=="string"?(n!=="textarea"||o!=="")&&En(e,o):typeof o=="number"&&En(e,""+o):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(_n.hasOwnProperty(i)?o!=null&&i==="onScroll"&&ie("scroll",e):o!=null&&El(e,i,o,l))}switch(n){case"input":lr(e),Ro(e,r,!1);break;case"textarea":lr(e),Bo(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Jt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?$s(e,!!r.multiple,i,!1):r.defaultValue!=null&&$s(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Yr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Me(t),null;case 6:if(e&&t.stateNode!=null)Ku(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(M(166));if(n=us(In.current),us(gt.current),xr(t)){if(r=t.stateNode,n=t.memoizedProps,r[xt]=t,(i=r.nodeValue!==n)&&(e=Ge,e!==null))switch(e.tag){case 3:fr(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&fr(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[xt]=t,t.stateNode=r}return Me(t),null;case 13:if(le(ce),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(oe&&Ke!==null&&t.mode&1&&!(t.flags&128))hu(),Vs(),t.flags|=98560,i=!1;else if(i=xr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(M(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(M(317));i[xt]=t}else Vs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Me(t),i=!1}else dt!==null&&(ul(dt),dt=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||ce.current&1?ke===0&&(ke=3):ho())),t.updateQueue!==null&&(t.flags|=4),Me(t),null);case 4:return Ws(),nl(e,t),e===null&&$n(t.stateNode.containerInfo),Me(t),null;case 10:return Kl(t.type._context),Me(t),null;case 17:return He(t.type)&&Xr(),Me(t),null;case 19:if(le(ce),i=t.memoizedState,i===null)return Me(t),null;if(r=(t.flags&128)!==0,l=i.rendering,l===null)if(r)dn(i,!1);else{if(ke!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=ra(e),l!==null){for(t.flags|=128,dn(i,!1),r=l.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,l=i.alternate,l===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,e=l.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ae(ce,ce.current&1|2),t.child}e=e.sibling}i.tail!==null&&xe()>Ks&&(t.flags|=128,r=!0,dn(i,!1),t.lanes=4194304)}else{if(!r)if(e=ra(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!oe)return Me(t),null}else 2*xe()-i.renderingStartTime>Ks&&n!==1073741824&&(t.flags|=128,r=!0,dn(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=xe(),t.sibling=null,n=ce.current,ae(ce,r?n&1|2:n&1),t):(Me(t),null);case 22:case 23:return uo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qe&1073741824&&(Me(t),t.subtreeFlags&6&&(t.flags|=8192)):Me(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function Jp(e,t){switch(Vl(t),t.tag){case 1:return He(t.type)&&Xr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ws(),le(Ve),le($e),Zl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Jl(t),null;case 13:if(le(ce),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));Vs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(ce),null;case 4:return Ws(),null;case 10:return Kl(t.type._context),null;case 22:case 23:return uo(),null;case 24:return null;default:return null}}var yr=!1,Ae=!1,Zp=typeof WeakSet=="function"?WeakSet:Set,q=null;function Ms(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pe(e,t,r)}else n.current=null}function rl(e,t,n){try{n()}catch(r){pe(e,t,r)}}var _c=!1;function ef(e,t){if(qi=Qr,e=Zd(),Ul(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,c=-1,o=-1,u=0,f=0,h=e,p=null;t:for(;;){for(var v;h!==n||a!==0&&h.nodeType!==3||(c=l+a),h!==i||r!==0&&h.nodeType!==3||(o=l+r),h.nodeType===3&&(l+=h.nodeValue.length),(v=h.firstChild)!==null;)p=h,h=v;for(;;){if(h===e)break t;if(p===n&&++u===a&&(c=l),p===i&&++f===r&&(o=l),(v=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=v}n=c===-1||o===-1?null:{start:c,end:o}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ui={focusedElem:e,selectionRange:n},Qr=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var N=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var j=N.memoizedProps,k=N.memoizedState,m=t.stateNode,x=m.getSnapshotBeforeUpdate(t.elementType===t.type?j:lt(t.type,j),k);m.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(y){pe(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return N=_c,_c=!1,N}function kn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&rl(t,n,i)}a=a.next}while(a!==r)}}function Sa(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function al(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Gu(e){var t=e.alternate;t!==null&&(e.alternate=null,Gu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xt],delete t[On],delete t[Hi],delete t[$p],delete t[Rp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yu(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yr));else if(r!==4&&(e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function ll(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ll(e,t,n),e=e.sibling;e!==null;)ll(e,t,n),e=e.sibling}var Ee=null,ot=!1;function Mt(e,t,n){for(n=n.child;n!==null;)Xu(e,t,n),n=n.sibling}function Xu(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(va,n)}catch{}switch(n.tag){case 5:Ae||Ms(n,t);case 6:var r=Ee,a=ot;Ee=null,Mt(e,t,n),Ee=r,ot=a,Ee!==null&&(ot?(e=Ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ee.removeChild(n.stateNode));break;case 18:Ee!==null&&(ot?(e=Ee,n=n.stateNode,e.nodeType===8?ni(e.parentNode,n):e.nodeType===1&&ni(e,n),Fn(e)):ni(Ee,n.stateNode));break;case 4:r=Ee,a=ot,Ee=n.stateNode.containerInfo,ot=!0,Mt(e,t,n),Ee=r,ot=a;break;case 0:case 11:case 14:case 15:if(!Ae&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&rl(n,t,l),a=a.next}while(a!==r)}Mt(e,t,n);break;case 1:if(!Ae&&(Ms(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){pe(n,t,c)}Mt(e,t,n);break;case 21:Mt(e,t,n);break;case 22:n.mode&1?(Ae=(r=Ae)||n.memoizedState!==null,Mt(e,t,n),Ae=r):Mt(e,t,n);break;default:Mt(e,t,n)}}function Tc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Zp),t.forEach(function(r){var a=df.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,l=t,c=l;e:for(;c!==null;){switch(c.tag){case 5:Ee=c.stateNode,ot=!1;break e;case 3:Ee=c.stateNode.containerInfo,ot=!0;break e;case 4:Ee=c.stateNode.containerInfo,ot=!0;break e}c=c.return}if(Ee===null)throw Error(M(160));Xu(i,l,a),Ee=null,ot=!1;var o=a.alternate;o!==null&&(o.return=null),a.return=null}catch(u){pe(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ju(t,e),t=t.sibling}function Ju(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(it(t,e),pt(e),r&4){try{kn(3,e,e.return),Sa(3,e)}catch(j){pe(e,e.return,j)}try{kn(5,e,e.return)}catch(j){pe(e,e.return,j)}}break;case 1:it(t,e),pt(e),r&512&&n!==null&&Ms(n,n.return);break;case 5:if(it(t,e),pt(e),r&512&&n!==null&&Ms(n,n.return),e.flags&32){var a=e.stateNode;try{En(a,"")}catch(j){pe(e,e.return,j)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,l=n!==null?n.memoizedProps:i,c=e.type,o=e.updateQueue;if(e.updateQueue=null,o!==null)try{c==="input"&&i.type==="radio"&&i.name!=null&&jd(a,i),Li(c,l);var u=Li(c,i);for(l=0;l<o.length;l+=2){var f=o[l],h=o[l+1];f==="style"?Sd(a,h):f==="dangerouslySetInnerHTML"?wd(a,h):f==="children"?En(a,h):El(a,f,h,u)}switch(c){case"input":Ci(a,i);break;case"textarea":Nd(a,i);break;case"select":var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var v=i.value;v!=null?$s(a,!!i.multiple,v,!1):p!==!!i.multiple&&(i.defaultValue!=null?$s(a,!!i.multiple,i.defaultValue,!0):$s(a,!!i.multiple,i.multiple?[]:"",!1))}a[On]=i}catch(j){pe(e,e.return,j)}}break;case 6:if(it(t,e),pt(e),r&4){if(e.stateNode===null)throw Error(M(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(j){pe(e,e.return,j)}}break;case 3:if(it(t,e),pt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fn(t.containerInfo)}catch(j){pe(e,e.return,j)}break;case 4:it(t,e),pt(e);break;case 13:it(t,e),pt(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(oo=xe())),r&4&&Tc(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Ae=(u=Ae)||f,it(t,e),Ae=u):it(t,e),pt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(q=e,f=e.child;f!==null;){for(h=q=f;q!==null;){switch(p=q,v=p.child,p.tag){case 0:case 11:case 14:case 15:kn(4,p,p.return);break;case 1:Ms(p,p.return);var N=p.stateNode;if(typeof N.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,N.props=t.memoizedProps,N.state=t.memoizedState,N.componentWillUnmount()}catch(j){pe(r,n,j)}}break;case 5:Ms(p,p.return);break;case 22:if(p.memoizedState!==null){Dc(h);continue}}v!==null?(v.return=p,q=v):Dc(h)}f=f.sibling}e:for(f=null,h=e;;){if(h.tag===5){if(f===null){f=h;try{a=h.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(c=h.stateNode,o=h.memoizedProps.style,l=o!=null&&o.hasOwnProperty("display")?o.display:null,c.style.display=kd("display",l))}catch(j){pe(e,e.return,j)}}}else if(h.tag===6){if(f===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(j){pe(e,e.return,j)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;f===h&&(f=null),h=h.return}f===h&&(f=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:it(t,e),pt(e),r&4&&Tc(e);break;case 21:break;default:it(t,e),pt(e)}}function pt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Yu(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(En(a,""),r.flags&=-33);var i=Ec(e);ll(e,i,a);break;case 3:case 4:var l=r.stateNode.containerInfo,c=Ec(e);il(e,c,l);break;default:throw Error(M(161))}}catch(o){pe(e,e.return,o)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tf(e,t,n){q=e,Zu(e)}function Zu(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var a=q,i=a.child;if(a.tag===22&&r){var l=a.memoizedState!==null||yr;if(!l){var c=a.alternate,o=c!==null&&c.memoizedState!==null||Ae;c=yr;var u=Ae;if(yr=l,(Ae=o)&&!u)for(q=a;q!==null;)l=q,o=l.child,l.tag===22&&l.memoizedState!==null?Fc(a):o!==null?(o.return=l,q=o):Fc(a);for(;i!==null;)q=i,Zu(i),i=i.sibling;q=a,yr=c,Ae=u}Lc(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,q=i):Lc(e)}}function Lc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ae||Sa(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ae)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:lt(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&fc(t,i,r);break;case 3:var l=t.updateQueue;if(l!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}fc(t,l,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var o=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":o.autoFocus&&n.focus();break;case"img":o.src&&(n.src=o.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var h=f.dehydrated;h!==null&&Fn(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}Ae||t.flags&512&&al(t)}catch(p){pe(t,t.return,p)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Dc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Fc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sa(4,t)}catch(o){pe(t,n,o)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(o){pe(t,a,o)}}var i=t.return;try{al(t)}catch(o){pe(t,i,o)}break;case 5:var l=t.return;try{al(t)}catch(o){pe(t,l,o)}}}catch(o){pe(t,t.return,o)}if(t===e){q=null;break}var c=t.sibling;if(c!==null){c.return=t.return,q=c;break}q=t.return}}var sf=Math.ceil,la=Dt.ReactCurrentDispatcher,io=Dt.ReactCurrentOwner,nt=Dt.ReactCurrentBatchConfig,te=0,_e=null,ye=null,Te=0,Qe=0,As=ts(0),ke=0,Vn=null,vs=0,Ca=0,lo=0,Sn=null,Ue=null,oo=0,Ks=1/0,wt=null,oa=!1,ol=null,Qt=null,jr=!1,It=null,ca=0,Cn=0,cl=null,Mr=-1,Ar=0;function Oe(){return te&6?xe():Mr!==-1?Mr:Mr=xe()}function Kt(e){return e.mode&1?te&2&&Te!==0?Te&-Te:Bp.transition!==null?(Ar===0&&(Ar=Rd()),Ar):(e=se,e!==0||(e=window.event,e=e===void 0?16:Vd(e.type)),e):1}function ht(e,t,n,r){if(50<Cn)throw Cn=0,cl=null,Error(M(185));Kn(e,n,r),(!(te&2)||e!==_e)&&(e===_e&&(!(te&2)&&(Ca|=n),ke===4&&Ot(e,Te)),We(e,r),n===1&&te===0&&!(t.mode&1)&&(Ks=xe()+500,ba&&ss()))}function We(e,t){var n=e.callbackNode;Bm(e,t);var r=Wr(e,e===_e?Te:0);if(r===0)n!==null&&Uo(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Uo(n),t===1)e.tag===0?Op(Mc.bind(null,e)):cu(Mc.bind(null,e)),Mp(function(){!(te&6)&&ss()}),n=null;else{switch(Od(r)){case 1:n=Ml;break;case 4:n=Ad;break;case 16:n=Hr;break;case 536870912:n=$d;break;default:n=Hr}n=lh(n,eh.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function eh(e,t){if(Mr=-1,Ar=0,te&6)throw Error(M(327));var n=e.callbackNode;if(qs()&&e.callbackNode!==n)return null;var r=Wr(e,e===_e?Te:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=da(e,r);else{t=r;var a=te;te|=2;var i=sh();(_e!==e||Te!==t)&&(wt=null,Ks=xe()+500,hs(e,t));do try{af();break}catch(c){th(e,c)}while(!0);Ql(),la.current=i,te=a,ye!==null?t=0:(_e=null,Te=0,t=ke)}if(t!==0){if(t===2&&(a=$i(e),a!==0&&(r=a,t=dl(e,a))),t===1)throw n=Vn,hs(e,0),Ot(e,r),We(e,xe()),n;if(t===6)Ot(e,r);else{if(a=e.current.alternate,!(r&30)&&!nf(a)&&(t=da(e,r),t===2&&(i=$i(e),i!==0&&(r=i,t=dl(e,i))),t===1))throw n=Vn,hs(e,0),Ot(e,r),We(e,xe()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(M(345));case 2:os(e,Ue,wt);break;case 3:if(Ot(e,r),(r&130023424)===r&&(t=oo+500-xe(),10<t)){if(Wr(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Oe(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Vi(os.bind(null,e,Ue,wt),t);break}os(e,Ue,wt);break;case 4:if(Ot(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var l=31-ut(r);i=1<<l,l=t[l],l>a&&(a=l),r&=~i}if(r=a,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sf(r/1960))-r,10<r){e.timeoutHandle=Vi(os.bind(null,e,Ue,wt),r);break}os(e,Ue,wt);break;case 5:os(e,Ue,wt);break;default:throw Error(M(329))}}}return We(e,xe()),e.callbackNode===n?eh.bind(null,e):null}function dl(e,t){var n=Sn;return e.current.memoizedState.isDehydrated&&(hs(e,t).flags|=256),e=da(e,t),e!==2&&(t=Ue,Ue=n,t!==null&&ul(t)),e}function ul(e){Ue===null?Ue=e:Ue.push.apply(Ue,e)}function nf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!mt(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ot(e,t){for(t&=~lo,t&=~Ca,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ut(t),r=1<<n;e[n]=-1,t&=~r}}function Mc(e){if(te&6)throw Error(M(327));qs();var t=Wr(e,0);if(!(t&1))return We(e,xe()),null;var n=da(e,t);if(e.tag!==0&&n===2){var r=$i(e);r!==0&&(t=r,n=dl(e,r))}if(n===1)throw n=Vn,hs(e,0),Ot(e,t),We(e,xe()),n;if(n===6)throw Error(M(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,os(e,Ue,wt),We(e,xe()),null}function co(e,t){var n=te;te|=1;try{return e(t)}finally{te=n,te===0&&(Ks=xe()+500,ba&&ss())}}function gs(e){It!==null&&It.tag===0&&!(te&6)&&qs();var t=te;te|=1;var n=nt.transition,r=se;try{if(nt.transition=null,se=1,e)return e()}finally{se=r,nt.transition=n,te=t,!(te&6)&&ss()}}function uo(){Qe=As.current,le(As)}function hs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Fp(n)),ye!==null)for(n=ye.return;n!==null;){var r=n;switch(Vl(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xr();break;case 3:Ws(),le(Ve),le($e),Zl();break;case 5:Jl(r);break;case 4:Ws();break;case 13:le(ce);break;case 19:le(ce);break;case 10:Kl(r.type._context);break;case 22:case 23:uo()}n=n.return}if(_e=e,ye=e=Gt(e.current,null),Te=Qe=t,ke=0,Vn=null,lo=Ca=vs=0,Ue=Sn=null,ds!==null){for(t=0;t<ds.length;t++)if(n=ds[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var l=i.next;i.next=a,r.next=l}n.pending=r}ds=null}return e}function th(e,t){do{var n=ye;try{if(Ql(),Lr.current=ia,aa){for(var r=de.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}aa=!1}if(xs=0,Pe=we=de=null,wn=!1,qn=0,io.current=null,n===null||n.return===null){ke=1,Vn=t,ye=null;break}e:{var i=e,l=n.return,c=n,o=t;if(t=Te,c.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){var u=o,f=c,h=f.tag;if(!(f.mode&1)&&(h===0||h===11||h===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var v=Nc(l);if(v!==null){v.flags&=-257,bc(v,l,c,i,t),v.mode&1&&jc(i,u,t),t=v,o=u;var N=t.updateQueue;if(N===null){var j=new Set;j.add(o),t.updateQueue=j}else N.add(o);break e}else{if(!(t&1)){jc(i,u,t),ho();break e}o=Error(M(426))}}else if(oe&&c.mode&1){var k=Nc(l);if(k!==null){!(k.flags&65536)&&(k.flags|=256),bc(k,l,c,i,t),Hl(Qs(o,c));break e}}i=o=Qs(o,c),ke!==4&&(ke=2),Sn===null?Sn=[i]:Sn.push(i),i=l;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var m=Ou(i,o,t);pc(i,m);break e;case 1:c=o;var x=i.type,g=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Qt===null||!Qt.has(g)))){i.flags|=65536,t&=-t,i.lanes|=t;var y=Bu(i,c,t);pc(i,y);break e}}i=i.return}while(i!==null)}rh(n)}catch(S){t=S,ye===n&&n!==null&&(ye=n=n.return);continue}break}while(!0)}function sh(){var e=la.current;return la.current=ia,e===null?ia:e}function ho(){(ke===0||ke===3||ke===2)&&(ke=4),_e===null||!(vs&268435455)&&!(Ca&268435455)||Ot(_e,Te)}function da(e,t){var n=te;te|=2;var r=sh();(_e!==e||Te!==t)&&(wt=null,hs(e,t));do try{rf();break}catch(a){th(e,a)}while(!0);if(Ql(),te=n,la.current=r,ye!==null)throw Error(M(261));return _e=null,Te=0,ke}function rf(){for(;ye!==null;)nh(ye)}function af(){for(;ye!==null&&!Tm();)nh(ye)}function nh(e){var t=ih(e.alternate,e,Qe);e.memoizedProps=e.pendingProps,t===null?rh(e):ye=t,io.current=null}function rh(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Jp(n,t),n!==null){n.flags&=32767,ye=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ke=6,ye=null;return}}else if(n=Xp(n,t,Qe),n!==null){ye=n;return}if(t=t.sibling,t!==null){ye=t;return}ye=t=e}while(t!==null);ke===0&&(ke=5)}function os(e,t,n){var r=se,a=nt.transition;try{nt.transition=null,se=1,lf(e,t,n,r)}finally{nt.transition=a,se=r}return null}function lf(e,t,n,r){do qs();while(It!==null);if(te&6)throw Error(M(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(M(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Im(e,i),e===_e&&(ye=_e=null,Te=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||jr||(jr=!0,lh(Hr,function(){return qs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=nt.transition,nt.transition=null;var l=se;se=1;var c=te;te|=4,io.current=null,ef(e,n),Ju(n,e),Cp(Ui),Qr=!!qi,Ui=qi=null,e.current=n,tf(n),Lm(),te=c,se=l,nt.transition=i}else e.current=n;if(jr&&(jr=!1,It=e,ca=a),i=e.pendingLanes,i===0&&(Qt=null),Mm(n.stateNode),We(e,xe()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(oa)throw oa=!1,e=ol,ol=null,e;return ca&1&&e.tag!==0&&qs(),i=e.pendingLanes,i&1?e===cl?Cn++:(Cn=0,cl=e):Cn=0,ss(),null}function qs(){if(It!==null){var e=Od(ca),t=nt.transition,n=se;try{if(nt.transition=null,se=16>e?16:e,It===null)var r=!1;else{if(e=It,It=null,ca=0,te&6)throw Error(M(331));var a=te;for(te|=4,q=e.current;q!==null;){var i=q,l=i.child;if(q.flags&16){var c=i.deletions;if(c!==null){for(var o=0;o<c.length;o++){var u=c[o];for(q=u;q!==null;){var f=q;switch(f.tag){case 0:case 11:case 15:kn(8,f,i)}var h=f.child;if(h!==null)h.return=f,q=h;else for(;q!==null;){f=q;var p=f.sibling,v=f.return;if(Gu(f),f===u){q=null;break}if(p!==null){p.return=v,q=p;break}q=v}}}var N=i.alternate;if(N!==null){var j=N.child;if(j!==null){N.child=null;do{var k=j.sibling;j.sibling=null,j=k}while(j!==null)}}q=i}}if(i.subtreeFlags&2064&&l!==null)l.return=i,q=l;else e:for(;q!==null;){if(i=q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:kn(9,i,i.return)}var m=i.sibling;if(m!==null){m.return=i.return,q=m;break e}q=i.return}}var x=e.current;for(q=x;q!==null;){l=q;var g=l.child;if(l.subtreeFlags&2064&&g!==null)g.return=l,q=g;else e:for(l=x;q!==null;){if(c=q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sa(9,c)}}catch(S){pe(c,c.return,S)}if(c===l){q=null;break e}var y=c.sibling;if(y!==null){y.return=c.return,q=y;break e}q=c.return}}if(te=a,ss(),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(va,e)}catch{}r=!0}return r}finally{se=n,nt.transition=t}}return!1}function Ac(e,t,n){t=Qs(n,t),t=Ou(e,t,1),e=Wt(e,t,1),t=Oe(),e!==null&&(Kn(e,1,t),We(e,t))}function pe(e,t,n){if(e.tag===3)Ac(e,e,n);else for(;t!==null;){if(t.tag===3){Ac(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qt===null||!Qt.has(r))){e=Qs(n,e),e=Bu(t,e,1),t=Wt(t,e,1),e=Oe(),t!==null&&(Kn(t,1,e),We(t,e));break}}t=t.return}}function of(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Oe(),e.pingedLanes|=e.suspendedLanes&n,_e===e&&(Te&n)===n&&(ke===4||ke===3&&(Te&130023424)===Te&&500>xe()-oo?hs(e,0):lo|=n),We(e,t)}function ah(e,t){t===0&&(e.mode&1?(t=dr,dr<<=1,!(dr&130023424)&&(dr=4194304)):t=1);var n=Oe();e=Tt(e,t),e!==null&&(Kn(e,t,n),We(e,n))}function cf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ah(e,n)}function df(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),ah(e,n)}var ih;ih=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ve.current)ze=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ze=!1,Yp(e,t,n);ze=!!(e.flags&131072)}else ze=!1,oe&&t.flags&1048576&&du(t,ea,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fr(e,t),e=t.pendingProps;var a=zs(t,$e.current);Is(t,n),a=to(null,t,r,e,a,n);var i=so();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,He(r)?(i=!0,Jr(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Yl(t),a.updater=ka,t.stateNode=a,a._reactInternals=t,Xi(t,r,e,n),t=el(null,t,r,!0,i,n)):(t.tag=0,oe&&i&&zl(t),Re(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fr(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=hf(r),e=lt(r,e),a){case 0:t=Zi(null,t,r,e,n);break e;case 1:t=Sc(null,t,r,e,n);break e;case 11:t=wc(null,t,r,e,n);break e;case 14:t=kc(null,t,r,lt(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:lt(r,a),Zi(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:lt(r,a),Sc(e,t,r,a,n);case 3:e:{if(zu(t),e===null)throw Error(M(387));r=t.pendingProps,i=t.memoizedState,a=i.element,xu(e,t),na(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Qs(Error(M(423)),t),t=Cc(e,t,r,n,a);break e}else if(r!==a){a=Qs(Error(M(424)),t),t=Cc(e,t,r,n,a);break e}else for(Ke=Ht(t.stateNode.containerInfo.firstChild),Ge=t,oe=!0,dt=null,n=pu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vs(),r===a){t=Lt(e,t,n);break e}Re(e,t,r,n)}t=t.child}return t;case 5:return vu(t),e===null&&Ki(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,l=a.children,zi(r,a)?l=null:i!==null&&zi(r,i)&&(t.flags|=32),Uu(e,t),Re(e,t,l,n),t.child;case 6:return e===null&&Ki(t),null;case 13:return Vu(e,t,n);case 4:return Xl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hs(t,null,r,n):Re(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:lt(r,a),wc(e,t,r,a,n);case 7:return Re(e,t,t.pendingProps,n),t.child;case 8:return Re(e,t,t.pendingProps.children,n),t.child;case 12:return Re(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,l=a.value,ae(ta,r._currentValue),r._currentValue=l,i!==null)if(mt(i.value,l)){if(i.children===a.children&&!Ve.current){t=Lt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var c=i.dependencies;if(c!==null){l=i.child;for(var o=c.firstContext;o!==null;){if(o.context===r){if(i.tag===1){o=Pt(-1,n&-n),o.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?o.next=o:(o.next=f.next,f.next=o),u.pending=o}}i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),Gi(i.return,n,t),c.lanes|=n;break}o=o.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(M(341));l.lanes|=n,c=l.alternate,c!==null&&(c.lanes|=n),Gi(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}Re(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Is(t,n),a=rt(a),r=r(a),t.flags|=1,Re(e,t,r,n),t.child;case 14:return r=t.type,a=lt(r,t.pendingProps),a=lt(r.type,a),kc(e,t,r,a,n);case 15:return Iu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:lt(r,a),Fr(e,t),t.tag=1,He(r)?(e=!0,Jr(t)):e=!1,Is(t,n),Ru(t,r,a),Xi(t,r,a,n),el(null,t,r,!0,e,n);case 19:return Hu(e,t,n);case 22:return qu(e,t,n)}throw Error(M(156,t.tag))};function lh(e,t){return Md(e,t)}function uf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function st(e,t,n,r){return new uf(e,t,n,r)}function mo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hf(e){if(typeof e=="function")return mo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ll)return 11;if(e===Dl)return 14}return 2}function Gt(e,t){var n=e.alternate;return n===null?(n=st(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $r(e,t,n,r,a,i){var l=2;if(r=e,typeof e=="function")mo(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Ss:return ms(n.children,a,i,t);case Tl:l=8,a|=8;break;case Ni:return e=st(12,n,t,a|2),e.elementType=Ni,e.lanes=i,e;case bi:return e=st(13,n,t,a),e.elementType=bi,e.lanes=i,e;case wi:return e=st(19,n,t,a),e.elementType=wi,e.lanes=i,e;case vd:return Pa(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fd:l=10;break e;case xd:l=9;break e;case Ll:l=11;break e;case Dl:l=14;break e;case At:l=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=st(l,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function ms(e,t,n,r){return e=st(7,e,r,t),e.lanes=n,e}function Pa(e,t,n,r){return e=st(22,e,r,t),e.elementType=vd,e.lanes=n,e.stateNode={isHidden:!1},e}function ui(e,t,n){return e=st(6,e,null,t),e.lanes=n,e}function hi(e,t,n){return t=st(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function mf(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wa(0),this.expirationTimes=Wa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wa(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function po(e,t,n,r,a,i,l,c,o){return e=new mf(e,t,n,c,o),t===1?(t=1,i===!0&&(t|=8)):t=0,i=st(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yl(i),e}function pf(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ks,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function oh(e){if(!e)return Zt;e=e._reactInternals;e:{if(js(e)!==e||e.tag!==1)throw Error(M(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(He(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(M(171))}if(e.tag===1){var n=e.type;if(He(n))return ou(e,n,t)}return t}function ch(e,t,n,r,a,i,l,c,o){return e=po(n,r,!0,e,a,i,l,c,o),e.context=oh(null),n=e.current,r=Oe(),a=Kt(n),i=Pt(r,a),i.callback=t??null,Wt(n,i,a),e.current.lanes=a,Kn(e,a,r),We(e,r),e}function _a(e,t,n,r){var a=t.current,i=Oe(),l=Kt(a);return n=oh(n),t.context===null?t.context=n:t.pendingContext=n,t=Pt(i,l),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Wt(a,t,l),e!==null&&(ht(e,a,l,i),Tr(e,a,l)),l}function ua(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function $c(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fo(e,t){$c(e,t),(e=e.alternate)&&$c(e,t)}function ff(){return null}var dh=typeof reportError=="function"?reportError:function(e){console.error(e)};function xo(e){this._internalRoot=e}Ea.prototype.render=xo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));_a(e,t,null,null)};Ea.prototype.unmount=xo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gs(function(){_a(null,e,null,null)}),t[Et]=null}};function Ea(e){this._internalRoot=e}Ea.prototype.unstable_scheduleHydration=function(e){if(e){var t=qd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rt.length&&t!==0&&t<Rt[n].priority;n++);Rt.splice(n,0,e),n===0&&zd(e)}};function vo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ta(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Rc(){}function xf(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=ua(l);i.call(u)}}var l=ch(t,r,e,0,null,!1,!1,"",Rc);return e._reactRootContainer=l,e[Et]=l.current,$n(e.nodeType===8?e.parentNode:e),gs(),l}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var c=r;r=function(){var u=ua(o);c.call(u)}}var o=po(e,0,!1,null,null,!1,!1,"",Rc);return e._reactRootContainer=o,e[Et]=o.current,$n(e.nodeType===8?e.parentNode:e),gs(function(){_a(t,o,n,r)}),o}function La(e,t,n,r,a){var i=n._reactRootContainer;if(i){var l=i;if(typeof a=="function"){var c=a;a=function(){var o=ua(l);c.call(o)}}_a(t,l,e,a)}else l=xf(n,t,e,a,r);return ua(l)}Bd=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fn(t.pendingLanes);n!==0&&(Al(t,n|1),We(t,xe()),!(te&6)&&(Ks=xe()+500,ss()))}break;case 13:gs(function(){var r=Tt(e,1);if(r!==null){var a=Oe();ht(r,e,1,a)}}),fo(e,1)}};$l=function(e){if(e.tag===13){var t=Tt(e,134217728);if(t!==null){var n=Oe();ht(t,e,134217728,n)}fo(e,134217728)}};Id=function(e){if(e.tag===13){var t=Kt(e),n=Tt(e,t);if(n!==null){var r=Oe();ht(n,e,t,r)}fo(e,t)}};qd=function(){return se};Ud=function(e,t){var n=se;try{return se=e,t()}finally{se=n}};Fi=function(e,t,n){switch(t){case"input":if(Ci(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=Na(r);if(!a)throw Error(M(90));yd(r),Ci(r,a)}}}break;case"textarea":Nd(e,n);break;case"select":t=n.value,t!=null&&$s(e,!!n.multiple,t,!1)}};_d=co;Ed=gs;var vf={usingClientEntryPoint:!1,Events:[Yn,Es,Na,Cd,Pd,co]},un={findFiberByHostInstance:cs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gf={bundleType:un.bundleType,version:un.version,rendererPackageName:un.rendererPackageName,rendererConfig:un.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Dd(e),e===null?null:e.stateNode},findFiberByHostInstance:un.findFiberByHostInstance||ff,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nr.isDisabled&&Nr.supportsFiber)try{va=Nr.inject(gf),vt=Nr}catch{}}Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vf;Xe.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vo(t))throw Error(M(200));return pf(e,t,null,n)};Xe.createRoot=function(e,t){if(!vo(e))throw Error(M(299));var n=!1,r="",a=dh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=po(e,1,!1,null,null,n,!1,r,a),e[Et]=t.current,$n(e.nodeType===8?e.parentNode:e),new xo(t)};Xe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=Dd(t),e=e===null?null:e.stateNode,e};Xe.flushSync=function(e){return gs(e)};Xe.hydrate=function(e,t,n){if(!Ta(t))throw Error(M(200));return La(null,e,t,!0,n)};Xe.hydrateRoot=function(e,t,n){if(!vo(e))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",l=dh;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),t=ch(t,null,e,1,n??null,a,!1,i,l),e[Et]=t.current,$n(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Ea(t)};Xe.render=function(e,t,n){if(!Ta(t))throw Error(M(200));return La(null,e,t,!1,n)};Xe.unmountComponentAtNode=function(e){if(!Ta(e))throw Error(M(40));return e._reactRootContainer?(gs(function(){La(null,null,e,!1,function(){e._reactRootContainer=null,e[Et]=null})}),!0):!1};Xe.unstable_batchedUpdates=co;Xe.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ta(n))throw Error(M(200));if(e==null||e._reactInternals===void 0)throw Error(M(38));return La(e,t,n,!1,r)};Xe.version="18.3.1-next-f1338f8080-20240426";function uh(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uh)}catch(e){console.error(e)}}uh(),ud.exports=Xe;var yf=ud.exports,Oc=yf;yi.createRoot=Oc.createRoot,yi.hydrateRoot=Oc.hydrateRoot;/**- * @remix-run/router v1.23.2- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function Hn(){return Hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hn.apply(this,arguments)}var qt;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(qt||(qt={}));const Bc="popstate";function jf(e){e===void 0&&(e={});function t(r,a){let{pathname:i,search:l,hash:c}=r.location;return hl("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:ha(a)}return bf(t,n,null,e)}function ue(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function go(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Nf(){return Math.random().toString(36).substr(2,8)}function Ic(e,t){return{usr:e.state,key:e.key,idx:t}}function hl(e,t,n,r){return n===void 0&&(n=null),Hn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Zs(t):t,{state:n,key:t&&t.key||r||Nf()})}function ha(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Zs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function bf(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,c=qt.Pop,o=null,u=f();u==null&&(u=0,l.replaceState(Hn({},l.state,{idx:u}),""));function f(){return(l.state||{idx:null}).idx}function h(){c=qt.Pop;let k=f(),m=k==null?null:k-u;u=k,o&&o({action:c,location:j.location,delta:m})}function p(k,m){c=qt.Push;let x=hl(j.location,k,m);u=f()+1;let g=Ic(x,u),y=j.createHref(x);try{l.pushState(g,"",y)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;a.location.assign(y)}i&&o&&o({action:c,location:j.location,delta:1})}function v(k,m){c=qt.Replace;let x=hl(j.location,k,m);u=f();let g=Ic(x,u),y=j.createHref(x);l.replaceState(g,"",y),i&&o&&o({action:c,location:j.location,delta:0})}function N(k){let m=a.location.origin!=="null"?a.location.origin:a.location.href,x=typeof k=="string"?k:ha(k);return x=x.replace(/ $/,"%20"),ue(m,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,m)}let j={get action(){return c},get location(){return e(a,l)},listen(k){if(o)throw new Error("A history only accepts one active listener");return a.addEventListener(Bc,h),o=k,()=>{a.removeEventListener(Bc,h),o=null}},createHref(k){return t(a,k)},createURL:N,encodeLocation(k){let m=N(k);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:p,replace:v,go(k){return l.go(k)}};return j}var qc;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(qc||(qc={}));function wf(e,t,n){return n===void 0&&(n="/"),kf(e,t,n)}function kf(e,t,n,r){let a=typeof t=="string"?Zs(t):t,i=Gs(a.pathname||"/",n);if(i==null)return null;let l=hh(e);Sf(l);let c=null;for(let o=0;c==null&&o<l.length;++o){let u=$f(i);c=Mf(l[o],u)}return c}function hh(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let a=(i,l,c)=>{let o={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};o.relativePath.startsWith("/")&&(ue(o.relativePath.startsWith(r),'Absolute route path "'+o.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),o.relativePath=o.relativePath.slice(r.length));let u=Yt([r,o.relativePath]),f=n.concat(o);i.children&&i.children.length>0&&(ue(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),hh(i.children,t,f,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:Df(u,i.index),routesMeta:f})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,l);else for(let o of mh(i.path))a(i,l,o)}),t}function mh(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=mh(r.join("/")),c=[];return c.push(...l.map(o=>o===""?i:[i,o].join("/"))),a&&c.push(...l),c.map(o=>e.startsWith("/")&&o===""?"/":o)}function Sf(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ff(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Cf=/^:[\w-]+$/,Pf=3,_f=2,Ef=1,Tf=10,Lf=-2,Uc=e=>e==="*";function Df(e,t){let n=e.split("/"),r=n.length;return n.some(Uc)&&(r+=Lf),t&&(r+=_f),n.filter(a=>!Uc(a)).reduce((a,i)=>a+(Cf.test(i)?Pf:i===""?Ef:Tf),r)}function Ff(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function Mf(e,t,n){let{routesMeta:r}=e,a={},i="/",l=[];for(let c=0;c<r.length;++c){let o=r[c],u=c===r.length-1,f=i==="/"?t:t.slice(i.length)||"/",h=ml({path:o.relativePath,caseSensitive:o.caseSensitive,end:u},f),p=o.route;if(!h)return null;Object.assign(a,h.params),l.push({params:a,pathname:Yt([i,h.pathname]),pathnameBase:qf(Yt([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=Yt([i,h.pathnameBase]))}return l}function ml(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Af(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],l=i.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:r.reduce((u,f,h)=>{let{paramName:p,isOptional:v}=f;if(p==="*"){let j=c[h]||"";l=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[h];return v&&!N?u[p]=void 0:u[p]=(N||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:l,pattern:e}}function Af(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),go(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,o)=>(r.push({paramName:c,isOptional:o!=null}),o?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function $f(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return go(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Gs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const Rf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Of=e=>Rf.test(e);function Bf(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Zs(e):e,i;if(n)if(Of(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),go(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?i=zc(n.substring(1),"/"):i=zc(n,t)}else i=t;return{pathname:i,search:Uf(r),hash:zf(a)}}function zc(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function mi(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function If(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function yo(e,t){let n=If(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function jo(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=Zs(e):(a=Hn({},e),ue(!a.pathname||!a.pathname.includes("?"),mi("?","pathname","search",a)),ue(!a.pathname||!a.pathname.includes("#"),mi("#","pathname","hash",a)),ue(!a.search||!a.search.includes("#"),mi("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,c;if(l==null)c=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let p=l.split("/");for(;p[0]==="..";)p.shift(),h-=1;a.pathname=p.join("/")}c=h>=0?t[h]:"/"}let o=Bf(a,c),u=l&&l!=="/"&&l.endsWith("/"),f=(i||l===".")&&n.endsWith("/");return!o.pathname.endsWith("/")&&(u||f)&&(o.pathname+="/"),o}const Yt=e=>e.join("/").replace(/\/\/+/g,"/"),qf=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Uf=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,zf=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Vf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const ph=["post","put","patch","delete"];new Set(ph);const Hf=["get",...ph];new Set(Hf);/**- * React Router v6.30.3- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function Wn(){return Wn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wn.apply(this,arguments)}const Da=d.createContext(null),fh=d.createContext(null),Ft=d.createContext(null),Fa=d.createContext(null),Nt=d.createContext({outlet:null,matches:[],isDataRoute:!1}),xh=d.createContext(null);function Wf(e,t){let{relative:n}=t===void 0?{}:t;en()||ue(!1);let{basename:r,navigator:a}=d.useContext(Ft),{hash:i,pathname:l,search:c}=Ma(e,{relative:n}),o=l;return r!=="/"&&(o=l==="/"?r:Yt([r,l])),a.createHref({pathname:o,search:c,hash:i})}function en(){return d.useContext(Fa)!=null}function tn(){return en()||ue(!1),d.useContext(Fa).location}function vh(e){d.useContext(Ft).static||d.useLayoutEffect(e)}function ns(){let{isDataRoute:e}=d.useContext(Nt);return e?ox():Qf()}function Qf(){en()||ue(!1);let e=d.useContext(Da),{basename:t,future:n,navigator:r}=d.useContext(Ft),{matches:a}=d.useContext(Nt),{pathname:i}=tn(),l=JSON.stringify(yo(a,n.v7_relativeSplatPath)),c=d.useRef(!1);return vh(()=>{c.current=!0}),d.useCallback(function(u,f){if(f===void 0&&(f={}),!c.current)return;if(typeof u=="number"){r.go(u);return}let h=jo(u,JSON.parse(l),i,f.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Yt([t,h.pathname])),(f.replace?r.replace:r.push)(h,f.state,f)},[t,r,l,i,e])}const Kf=d.createContext(null);function Gf(e){let t=d.useContext(Nt).outlet;return t&&d.createElement(Kf.Provider,{value:e},t)}function Yf(){let{matches:e}=d.useContext(Nt),t=e[e.length-1];return t?t.params:{}}function Ma(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=d.useContext(Ft),{matches:a}=d.useContext(Nt),{pathname:i}=tn(),l=JSON.stringify(yo(a,r.v7_relativeSplatPath));return d.useMemo(()=>jo(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function Xf(e,t){return Jf(e,t)}function Jf(e,t,n,r){en()||ue(!1);let{navigator:a}=d.useContext(Ft),{matches:i}=d.useContext(Nt),l=i[i.length-1],c=l?l.params:{};l&&l.pathname;let o=l?l.pathnameBase:"/";l&&l.route;let u=tn(),f;if(t){var h;let k=typeof t=="string"?Zs(t):t;o==="/"||(h=k.pathname)!=null&&h.startsWith(o)||ue(!1),f=k}else f=u;let p=f.pathname||"/",v=p;if(o!=="/"){let k=o.replace(/^\//,"").split("/");v="/"+p.replace(/^\//,"").split("/").slice(k.length).join("/")}let N=wf(e,{pathname:v}),j=nx(N&&N.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Yt([o,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?o:Yt([o,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),i,n,r);return t&&j?d.createElement(Fa.Provider,{value:{location:Wn({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:qt.Pop}},j):j}function Zf(){let e=lx(),t=Vf(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:a},n):null,null)}const ex=d.createElement(Zf,null);class tx extends d.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?d.createElement(Nt.Provider,{value:this.props.routeContext},d.createElement(xh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sx(e){let{routeContext:t,match:n,children:r}=e,a=d.useContext(Da);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),d.createElement(Nt.Provider,{value:t},r)}function nx(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=l.findIndex(h=>h.route.id&&(c==null?void 0:c[h.route.id])!==void 0);f>=0||ue(!1),l=l.slice(0,Math.min(l.length,f+1))}let o=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f<l.length;f++){let h=l[f];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=f),h.route.id){let{loaderData:p,errors:v}=n,N=h.route.loader&&p[h.route.id]===void 0&&(!v||v[h.route.id]===void 0);if(h.route.lazy||N){o=!0,u>=0?l=l.slice(0,u+1):l=[l[0]];break}}}return l.reduceRight((f,h,p)=>{let v,N=!1,j=null,k=null;n&&(v=c&&h.route.id?c[h.route.id]:void 0,j=h.route.errorElement||ex,o&&(u<0&&p===0?(cx("route-fallback"),N=!0,k=null):u===p&&(N=!0,k=h.route.hydrateFallbackElement||null)));let m=t.concat(l.slice(0,p+1)),x=()=>{let g;return v?g=j:N?g=k:h.route.Component?g=d.createElement(h.route.Component,null):h.route.element?g=h.route.element:g=f,d.createElement(sx,{match:h,routeContext:{outlet:f,matches:m,isDataRoute:n!=null},children:g})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?d.createElement(tx,{location:n.location,revalidation:n.revalidation,component:j,error:v,children:x(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):x()},null)}var gh=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(gh||{}),yh=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(yh||{});function rx(e){let t=d.useContext(Da);return t||ue(!1),t}function ax(e){let t=d.useContext(fh);return t||ue(!1),t}function ix(e){let t=d.useContext(Nt);return t||ue(!1),t}function jh(e){let t=ix(),n=t.matches[t.matches.length-1];return n.route.id||ue(!1),n.route.id}function lx(){var e;let t=d.useContext(xh),n=ax(),r=jh();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function ox(){let{router:e}=rx(gh.UseNavigateStable),t=jh(yh.UseNavigateStable),n=d.useRef(!1);return vh(()=>{n.current=!0}),d.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Wn({fromRouteId:t},i)))},[e,t])}const Vc={};function cx(e,t,n){Vc[e]||(Vc[e]=!0)}function dx(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Nh(e){let{to:t,replace:n,state:r,relative:a}=e;en()||ue(!1);let{future:i,static:l}=d.useContext(Ft),{matches:c}=d.useContext(Nt),{pathname:o}=tn(),u=ns(),f=jo(t,yo(c,i.v7_relativeSplatPath),o,a==="path"),h=JSON.stringify(f);return d.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:a}),[u,h,a,n,r]),null}function ux(e){return Gf(e.context)}function be(e){ue(!1)}function hx(e){let{basename:t="/",children:n=null,location:r,navigationType:a=qt.Pop,navigator:i,static:l=!1,future:c}=e;en()&&ue(!1);let o=t.replace(/^\/*/,"/"),u=d.useMemo(()=>({basename:o,navigator:i,static:l,future:Wn({v7_relativeSplatPath:!1},c)}),[o,c,i,l]);typeof r=="string"&&(r=Zs(r));let{pathname:f="/",search:h="",hash:p="",state:v=null,key:N="default"}=r,j=d.useMemo(()=>{let k=Gs(f,o);return k==null?null:{location:{pathname:k,search:h,hash:p,state:v,key:N},navigationType:a}},[o,f,h,p,v,N,a]);return j==null?null:d.createElement(Ft.Provider,{value:u},d.createElement(Fa.Provider,{children:n,value:j}))}function mx(e){let{children:t,location:n}=e;return Xf(pl(t),n)}new Promise(()=>{});function pl(e,t){t===void 0&&(t=[]);let n=[];return d.Children.forEach(e,(r,a)=>{if(!d.isValidElement(r))return;let i=[...t,a];if(r.type===d.Fragment){n.push.apply(n,pl(r.props.children,i));return}r.type!==be&&ue(!1),!r.props.index||!r.props.children||ue(!1);let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=pl(r.props.children,i)),n.push(l)}),n}/**- * React Router DOM v6.30.3- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ma.apply(this,arguments)}function bh(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function px(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fx(e,t){return e.button===0&&(!t||t==="_self")&&!px(e)}const xx=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],vx=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],gx="6";try{window.__reactRouterVersion=gx}catch{}const yx=d.createContext({isTransitioning:!1}),jx="startTransition",Hc=lm[jx];function Nx(e){let{basename:t,children:n,future:r,window:a}=e,i=d.useRef();i.current==null&&(i.current=jf({window:a,v5Compat:!0}));let l=i.current,[c,o]=d.useState({action:l.action,location:l.location}),{v7_startTransition:u}=r||{},f=d.useCallback(h=>{u&&Hc?Hc(()=>o(h)):o(h)},[o,u]);return d.useLayoutEffect(()=>l.listen(f),[l,f]),d.useEffect(()=>dx(r),[r]),d.createElement(hx,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:l,future:r})}const bx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,No=d.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:i,replace:l,state:c,target:o,to:u,preventScrollReset:f,viewTransition:h}=t,p=bh(t,xx),{basename:v}=d.useContext(Ft),N,j=!1;if(typeof u=="string"&&wx.test(u)&&(N=u,bx))try{let g=new URL(window.location.href),y=u.startsWith("//")?new URL(g.protocol+u):new URL(u),S=Gs(y.pathname,v);y.origin===g.origin&&S!=null?u=S+y.search+y.hash:j=!0}catch{}let k=Wf(u,{relative:a}),m=Sx(u,{replace:l,state:c,target:o,preventScrollReset:f,relative:a,viewTransition:h});function x(g){r&&r(g),g.defaultPrevented||m(g)}return d.createElement("a",ma({},p,{href:N||k,onClick:j||i?r:x,ref:n,target:o}))}),qe=d.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:a=!1,className:i="",end:l=!1,style:c,to:o,viewTransition:u,children:f}=t,h=bh(t,vx),p=Ma(o,{relative:h.relative}),v=tn(),N=d.useContext(fh),{navigator:j,basename:k}=d.useContext(Ft),m=N!=null&&Cx(p)&&u===!0,x=j.encodeLocation?j.encodeLocation(p).pathname:p.pathname,g=v.pathname,y=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;a||(g=g.toLowerCase(),y=y?y.toLowerCase():null,x=x.toLowerCase()),y&&k&&(y=Gs(y,k)||y);const S=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let E=g===x||!l&&g.startsWith(x)&&g.charAt(S)==="/",T=y!=null&&(y===x||!l&&y.startsWith(x)&&y.charAt(x.length)==="/"),P={isActive:E,isPending:T,isTransitioning:m},O=E?r:void 0,w;typeof i=="function"?w=i(P):w=[i,E?"active":null,T?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(P):c;return d.createElement(No,ma({},h,{"aria-current":O,className:w,ref:n,style:L,to:o,viewTransition:u}),typeof f=="function"?f(P):f)});var fl;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(fl||(fl={}));var Wc;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Wc||(Wc={}));function kx(e){let t=d.useContext(Da);return t||ue(!1),t}function Sx(e,t){let{target:n,replace:r,state:a,preventScrollReset:i,relative:l,viewTransition:c}=t===void 0?{}:t,o=ns(),u=tn(),f=Ma(e,{relative:l});return d.useCallback(h=>{if(fx(h,n)){h.preventDefault();let p=r!==void 0?r:ha(u)===ha(f);o(e,{replace:p,state:a,preventScrollReset:i,relative:l,viewTransition:c})}},[u,o,f,r,a,n,e,i,l,c])}function Cx(e,t){t===void 0&&(t={});let n=d.useContext(yx);n==null&&ue(!1);let{basename:r}=kx(fl.useViewTransitionState),a=Ma(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Gs(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Gs(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ml(a.pathname,l)!=null||ml(a.pathname,i)!=null}const Px="/api/v1";class _x{constructor(){this.baseUrl=Px}getToken(){return localStorage.getItem("access_token")}setTokens(t,n){localStorage.setItem("access_token",t),localStorage.setItem("refresh_token",n)}clearTokens(){localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")}async request(t,n={}){const r=`${this.baseUrl}${t}`,a=this.getToken(),i={headers:{"Content-Type":"application/json",...a&&{Authorization:`Bearer ${a}`},...n.headers},...n};n.body&&typeof n.body=="object"&&(i.body=JSON.stringify(n.body));try{const l=await fetch(r,i);if(l.status===401){if(await this.refreshToken()){i.headers.Authorization=`Bearer ${this.getToken()}`;const o=await fetch(r,i);return this.handleResponse(o)}throw this.clearTokens(),window.location.href="/login",new Error("Session expired")}return this.handleResponse(l)}catch(l){throw console.error("API Error:",l),l}}async handleResponse(t){const n=await t.json();if(!t.ok)throw new Error(n.error||"Request failed");return n}async refreshToken(){const t=localStorage.getItem("refresh_token");if(!t)return!1;try{const n=await fetch(`${this.baseUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(n.ok){const r=await n.json();return localStorage.setItem("access_token",r.access_token),!0}return!1}catch{return!1}}async login(t,n){const r=await this.request("/auth/login",{method:"POST",body:{email:t,password:n}});return this.setTokens(r.access_token,r.refresh_token),r}async register(t,n,r){const a=await this.request("/auth/register",{method:"POST",body:{email:t,username:n,password:r}});return this.setTokens(a.access_token,a.refresh_token),a}async logout(){this.clearTokens()}async getCurrentUser(){return this.request("/auth/me")}async updateCurrentUser(t){return this.request("/auth/me",{method:"PUT",body:t})}async getApps(){return this.request("/apps")}async getApp(t){return this.request(`/apps/${t}`)}async createApp(t){return this.request("/apps",{method:"POST",body:t})}async updateApp(t,n){return this.request(`/apps/${t}`,{method:"PUT",body:n})}async deleteApp(t){return this.request(`/apps/${t}`,{method:"DELETE"})}async startApp(t){return this.request(`/apps/${t}/start`,{method:"POST"})}async stopApp(t){return this.request(`/apps/${t}/stop`,{method:"POST"})}async restartApp(t){return this.request(`/apps/${t}/restart`,{method:"POST"})}async getDomains(){return this.request("/domains")}async getDomain(t){return this.request(`/domains/${t}`)}async createDomain(t){return this.request("/domains",{method:"POST",body:t})}async updateDomain(t,n){return this.request(`/domains/${t}`,{method:"PUT",body:n})}async deleteDomain(t){return this.request(`/domains/${t}`,{method:"DELETE"})}async enableSsl(t,n){return this.request(`/domains/${t}/ssl/enable`,{method:"POST",body:{email:n}})}async disableSsl(t){return this.request(`/domains/${t}/ssl/disable`,{method:"POST"})}async renewDomainSsl(t){return this.request(`/domains/${t}/ssl/renew`,{method:"POST"})}async verifyDomain(t){return this.request(`/domains/${t}/verify`)}async getDomainsNginxSites(){return this.request("/domains/nginx/sites")}async getDomainsSslStatus(){return this.request("/domains/ssl/status")}async getSystemMetrics(){return this.request("/system/metrics")}async getProcesses(){return this.request("/system/processes")}async getServices(){return this.request("/system/services")}async healthCheck(){return this.request("/system/health")}async getProcesses(t=50,n="cpu"){return this.request(`/processes?limit=${t}&sort=${n}`)}async getProcess(t){return this.request(`/processes/${t}`)}async killProcess(t,n=!1){return this.request(`/processes/${t}?force=${n}`,{method:"DELETE"})}async getServicesStatus(){return this.request("/processes/services")}async controlService(t,n){return this.request(`/processes/services/${t}`,{method:"POST",body:{action:n}})}async getNginxStatus(){return this.request("/nginx/status")}async testNginxConfig(){return this.request("/nginx/test",{method:"POST"})}async reloadNginx(){return this.request("/nginx/reload",{method:"POST"})}async getNginxSites(){return this.request("/nginx/sites")}async createNginxSite(t){return this.request("/nginx/sites",{method:"POST",body:t})}async enableNginxSite(t){return this.request(`/nginx/sites/${t}/enable`,{method:"POST"})}async disableNginxSite(t){return this.request(`/nginx/sites/${t}/disable`,{method:"POST"})}async deleteNginxSite(t){return this.request(`/nginx/sites/${t}`,{method:"DELETE"})}async getSSLStatus(){return this.request("/ssl/status")}async getCertificates(){return this.request("/ssl/certificates")}async obtainCertificate(t){return this.request("/ssl/certificates",{method:"POST",body:t})}async renewCertificate(t){return this.request(`/ssl/certificates/${t}/renew`,{method:"POST"})}async renewAllCertificates(){return this.request("/ssl/certificates/renew-all",{method:"POST"})}async revokeCertificate(t){return this.request(`/ssl/certificates/${t}`,{method:"DELETE"})}async getLogFiles(){return this.request("/logs")}async readLog(t,n=100){return this.request(`/logs/read?path=${encodeURIComponent(t)}&lines=${n}`)}async searchLog(t,n,r=100){return this.request(`/logs/search?path=${encodeURIComponent(t)}&pattern=${encodeURIComponent(n)}&lines=${r}`)}async getAppLogs(t,n="access",r=100){return this.request(`/logs/app/${t}?type=${n}&lines=${r}`)}async getJournalLogs(t,n=100){const r=new URLSearchParams({lines:n});return t&&r.append("unit",t),this.request(`/logs/journal?${r}`)}async clearLog(t){return this.request("/logs/clear",{method:"POST",body:{path:t}})}async getPHPVersions(){return this.request("/php/versions")}async installPHPVersion(t){return this.request(`/php/versions/${t}/install`,{method:"POST"})}async setDefaultPHPVersion(t){return this.request("/php/versions/default",{method:"POST",body:{version:t}})}async getPHPExtensions(t){return this.request(`/php/versions/${t}/extensions`)}async installPHPExtension(t,n){return this.request(`/php/versions/${t}/extensions`,{method:"POST",body:{extension:n}})}async getPHPPools(t){return this.request(`/php/versions/${t}/pools`)}async createPHPPool(t,n){return this.request(`/php/versions/${t}/pools`,{method:"POST",body:n})}async deletePHPPool(t,n){return this.request(`/php/versions/${t}/pools/${n}`,{method:"DELETE"})}async restartPHPFPM(t){return this.request(`/php/versions/${t}/fpm/restart`,{method:"POST"})}async getPHPFPMStatus(t){return this.request(`/php/versions/${t}/fpm/status`)}async installWordPress(t){return this.request("/wordpress/install",{method:"POST",body:t})}async getWordPressInfo(t){return this.request(`/wordpress/sites/${t}/info`)}async updateWordPress(t){return this.request(`/wordpress/sites/${t}/update`,{method:"POST"})}async getWordPressPlugins(t){return this.request(`/wordpress/sites/${t}/plugins`)}async installWordPressPlugin(t,n,r=!0){return this.request(`/wordpress/sites/${t}/plugins`,{method:"POST",body:{plugin:n,activate:r}})}async uninstallWordPressPlugin(t,n){return this.request(`/wordpress/sites/${t}/plugins/${n}`,{method:"DELETE"})}async activateWordPressPlugin(t,n){return this.request(`/wordpress/sites/${t}/plugins/${n}/activate`,{method:"POST"})}async deactivateWordPressPlugin(t,n){return this.request(`/wordpress/sites/${t}/plugins/${n}/deactivate`,{method:"POST"})}async updateWordPressPlugins(t,n=null){return this.request(`/wordpress/sites/${t}/plugins/update`,{method:"POST",body:n?{plugins:n}:{}})}async getWordPressThemes(t){return this.request(`/wordpress/sites/${t}/themes`)}async installWordPressTheme(t,n,r=!1){return this.request(`/wordpress/sites/${t}/themes`,{method:"POST",body:{theme:n,activate:r}})}async activateWordPressTheme(t,n){return this.request(`/wordpress/sites/${t}/themes/${n}/activate`,{method:"POST"})}async createWordPressBackup(t,n=!0){return this.request(`/wordpress/sites/${t}/backup`,{method:"POST",body:{include_db:n}})}async getWordPressBackups(t){return this.request(`/wordpress/sites/${t}/backups`)}async restoreWordPressBackup(t,n){return this.request(`/wordpress/sites/${t}/restore`,{method:"POST",body:{backup_name:n}})}async deleteWordPressBackup(t){return this.request(`/wordpress/backups/${t}`,{method:"DELETE"})}async hardenWordPress(t){return this.request(`/wordpress/sites/${t}/harden`,{method:"POST"})}async optimizeWordPressDatabase(t){return this.request(`/wordpress/sites/${t}/optimize`,{method:"POST"})}async flushWordPressCache(t){return this.request(`/wordpress/sites/${t}/flush-cache`,{method:"POST"})}async searchReplaceWordPress(t,n,r,a=!0){return this.request(`/wordpress/sites/${t}/search-replace`,{method:"POST",body:{search:n,replace:r,dry_run:a}})}async createWordPressUser(t,n){return this.request(`/wordpress/sites/${t}/users`,{method:"POST",body:n})}async resetWordPressPassword(t,n,r=null){return this.request(`/wordpress/sites/${t}/users/${n}/reset-password`,{method:"POST",body:r?{password:r}:{}})}async getPythonVersions(){return this.request("/python/versions")}async createFlaskApp(t){return this.request("/python/apps/flask",{method:"POST",body:t})}async createDjangoApp(t){return this.request("/python/apps/django",{method:"POST",body:t})}async createPythonVenv(t){return this.request(`/python/apps/${t}/venv`,{method:"POST"})}async getPythonPackages(t){return this.request(`/python/apps/${t}/packages`)}async installPythonPackages(t,n){return this.request(`/python/apps/${t}/packages`,{method:"POST",body:{packages:n}})}async freezePythonRequirements(t){return this.request(`/python/apps/${t}/requirements`,{method:"POST"})}async getPythonEnvVars(t){return this.request(`/python/apps/${t}/env`)}async setPythonEnvVars(t,n){return this.request(`/python/apps/${t}/env`,{method:"PUT",body:{env_vars:n}})}async deletePythonEnvVar(t,n){return this.request(`/python/apps/${t}/env/${n}`,{method:"DELETE"})}async startPythonApp(t){return this.request(`/python/apps/${t}/start`,{method:"POST"})}async stopPythonApp(t){return this.request(`/python/apps/${t}/stop`,{method:"POST"})}async restartPythonApp(t){return this.request(`/python/apps/${t}/restart`,{method:"POST"})}async getPythonAppStatus(t){return this.request(`/python/apps/${t}/status`)}async getGunicornConfig(t){return this.request(`/python/apps/${t}/gunicorn`)}async updateGunicornConfig(t,n){return this.request(`/python/apps/${t}/gunicorn`,{method:"PUT",body:{content:n}})}async runPythonMigrations(t){return this.request(`/python/apps/${t}/migrate`,{method:"POST"})}async collectPythonStatic(t){return this.request(`/python/apps/${t}/collectstatic`,{method:"POST"})}async runPythonCommand(t,n){return this.request(`/python/apps/${t}/run`,{method:"POST",body:{command:n}})}async deletePythonApp(t,n=!1){return this.request(`/python/apps/${t}`,{method:"DELETE",body:{remove_files:n}})}async getDockerStatus(){return this.request("/docker/status")}async getDockerInfo(){return this.request("/docker/info")}async getDockerDiskUsage(){return this.request("/docker/disk-usage")}async getContainers(t=!0){return this.request(`/docker/containers?all=${t}`)}async getContainer(t){return this.request(`/docker/containers/${t}`)}async createContainer(t){return this.request("/docker/containers",{method:"POST",body:t})}async runContainer(t){return this.request("/docker/containers/run",{method:"POST",body:t})}async startContainer(t){return this.request(`/docker/containers/${t}/start`,{method:"POST"})}async stopContainer(t,n=10){return this.request(`/docker/containers/${t}/stop`,{method:"POST",body:{timeout:n}})}async restartContainer(t,n=10){return this.request(`/docker/containers/${t}/restart`,{method:"POST",body:{timeout:n}})}async removeContainer(t,n=!1,r=!1){return this.request(`/docker/containers/${t}`,{method:"DELETE",body:{force:n,volumes:r}})}async getContainerLogs(t,n=100,r=null){const a=new URLSearchParams({tail:n});return r&&a.append("since",r),this.request(`/docker/containers/${t}/logs?${a}`)}async getContainerStats(t){return this.request(`/docker/containers/${t}/stats`)}async execContainer(t,n){return this.request(`/docker/containers/${t}/exec`,{method:"POST",body:{command:n}})}async getImages(){return this.request("/docker/images")}async pullImage(t,n="latest"){return this.request("/docker/images/pull",{method:"POST",body:{image:t,tag:n}})}async removeImage(t,n=!1){return this.request(`/docker/images/${t}`,{method:"DELETE",body:{force:n}})}async buildImage(t,n,r="Dockerfile",a=!1){return this.request("/docker/images/build",{method:"POST",body:{path:t,tag:n,dockerfile:r,no_cache:a}})}async getNetworks(){return this.request("/docker/networks")}async createNetwork(t,n="bridge"){return this.request("/docker/networks",{method:"POST",body:{name:t,driver:n}})}async removeNetwork(t){return this.request(`/docker/networks/${t}`,{method:"DELETE"})}async getVolumes(){return this.request("/docker/volumes")}async createVolume(t,n="local"){return this.request("/docker/volumes",{method:"POST",body:{name:t,driver:n}})}async removeVolume(t,n=!1){return this.request(`/docker/volumes/${t}`,{method:"DELETE",body:{force:n}})}async composeUp(t,n=!0,r=!1){return this.request("/docker/compose/up",{method:"POST",body:{path:t,detach:n,build:r}})}async composeDown(t,n=!1,r=!0){return this.request("/docker/compose/down",{method:"POST",body:{path:t,volumes:n,remove_orphans:r}})}async composePs(t){return this.request("/docker/compose/ps",{method:"POST",body:{path:t}})}async composeLogs(t,n=null,r=100){return this.request("/docker/compose/logs",{method:"POST",body:{path:t,service:n,tail:r}})}async composeRestart(t,n=null){return this.request("/docker/compose/restart",{method:"POST",body:{path:t,service:n}})}async composePull(t,n=null){return this.request("/docker/compose/pull",{method:"POST",body:{path:t,service:n}})}async createDockerApp(t){return this.request("/docker/apps",{method:"POST",body:t})}async pruneDocker(t=!1,n=!1){return this.request("/docker/prune",{method:"POST",body:{all:t,volumes:n}})}async getDatabaseStatus(){return this.request("/databases/status")}async getMySQLDatabases(t=null){const n=t?`?root_password=${encodeURIComponent(t)}`:"";return this.request(`/databases/mysql${n}`)}async createMySQLDatabase(t){return this.request("/databases/mysql",{method:"POST",body:t})}async dropMySQLDatabase(t,n=null){return this.request(`/databases/mysql/${t}`,{method:"DELETE",body:{root_password:n}})}async getMySQLTables(t,n=null){const r=n?`?root_password=${encodeURIComponent(n)}`:"";return this.request(`/databases/mysql/${t}/tables${r}`)}async backupMySQLDatabase(t,n=null){return this.request(`/databases/mysql/${t}/backup`,{method:"POST",body:{root_password:n}})}async restoreMySQLDatabase(t,n,r=null){return this.request(`/databases/mysql/${t}/restore`,{method:"POST",body:{backup_path:n,root_password:r}})}async getMySQLUsers(t=null){const n=t?`?root_password=${encodeURIComponent(t)}`:"";return this.request(`/databases/mysql/users${n}`)}async createMySQLUser(t){return this.request("/databases/mysql/users",{method:"POST",body:t})}async dropMySQLUser(t,n="localhost",r=null){return this.request(`/databases/mysql/users/${t}`,{method:"DELETE",body:{host:n,root_password:r}})}async grantMySQLPrivileges(t,n,r="ALL",a="localhost",i=null){return this.request(`/databases/mysql/users/${t}/grant`,{method:"POST",body:{database:n,privileges:r,host:a,root_password:i}})}async getPostgreSQLDatabases(){return this.request("/databases/postgresql")}async createPostgreSQLDatabase(t){return this.request("/databases/postgresql",{method:"POST",body:t})}async dropPostgreSQLDatabase(t){return this.request(`/databases/postgresql/${t}`,{method:"DELETE"})}async getPostgreSQLTables(t){return this.request(`/databases/postgresql/${t}/tables`)}async backupPostgreSQLDatabase(t){return this.request(`/databases/postgresql/${t}/backup`,{method:"POST"})}async restorePostgreSQLDatabase(t,n){return this.request(`/databases/postgresql/${t}/restore`,{method:"POST",body:{backup_path:n}})}async getPostgreSQLUsers(){return this.request("/databases/postgresql/users")}async createPostgreSQLUser(t){return this.request("/databases/postgresql/users",{method:"POST",body:t})}async dropPostgreSQLUser(t){return this.request(`/databases/postgresql/users/${t}`,{method:"DELETE"})}async grantPostgreSQLPrivileges(t,n,r="ALL"){return this.request(`/databases/postgresql/users/${t}/grant`,{method:"POST",body:{database:n,privileges:r}})}async getDatabaseBackups(t=null){const n=t?`?type=${t}`:"";return this.request(`/databases/backups${n}`)}async deleteDatabaseBackup(t){return this.request(`/databases/backups/${t}`,{method:"DELETE"})}async generateDatabasePassword(t=16){return this.request(`/databases/generate-password?length=${t}`)}async getMonitoringStatus(){return this.request("/monitoring/status")}async getMonitoringMetrics(){return this.request("/monitoring/metrics")}async checkAlerts(){return this.request("/monitoring/alerts/check")}async getAlertHistory(t=100){return this.request(`/monitoring/alerts/history?limit=${t}`)}async getMonitoringConfig(){return this.request("/monitoring/config")}async updateMonitoringConfig(t){return this.request("/monitoring/config",{method:"PUT",body:t})}async getMonitoringThresholds(){return this.request("/monitoring/thresholds")}async updateMonitoringThresholds(t){return this.request("/monitoring/thresholds",{method:"PUT",body:t})}async startMonitoring(){return this.request("/monitoring/start",{method:"POST"})}async stopMonitoring(){return this.request("/monitoring/stop",{method:"POST"})}async testEmailAlert(t){return this.request("/monitoring/test/email",{method:"POST",body:{email:t}})}async testWebhookAlert(t){return this.request("/monitoring/test/webhook",{method:"POST",body:{webhook_url:t}})}async getBackups(t=null){const n=t?`?type=${t}`:"";return this.request(`/backups${n}`)}async getBackupStats(){return this.request("/backups/stats")}async getBackupConfig(){return this.request("/backups/config")}async updateBackupConfig(t){return this.request("/backups/config",{method:"PUT",body:t})}async backupApplication(t,n=!1,r=null){return this.request("/backups/application",{method:"POST",body:{application_id:t,include_db:n,db_config:r}})}async backupDatabase(t,n,r=null,a=null,i="localhost"){return this.request("/backups/database",{method:"POST",body:{db_type:t,db_name:n,user:r,password:a,host:i}})}async restoreApplication(t,n=null){return this.request("/backups/restore/application",{method:"POST",body:{backup_path:t,restore_path:n}})}async restoreDatabase(t,n,r,a=null,i=null,l="localhost"){return this.request("/backups/restore/database",{method:"POST",body:{backup_path:t,db_type:n,db_name:r,user:a,password:i,host:l}})}async deleteBackup(t){return this.request(`/backups/${encodeURIComponent(t)}`,{method:"DELETE"})}async cleanupBackups(t=null){return this.request("/backups/cleanup",{method:"POST",body:t?{retention_days:t}:{}})}async getBackupSchedules(){return this.request("/backups/schedules")}async addBackupSchedule(t,n,r,a,i=null){return this.request("/backups/schedules",{method:"POST",body:{name:t,backup_type:n,target:r,schedule_time:a,days:i}})}async removeBackupSchedule(t){return this.request(`/backups/schedules/${t}`,{method:"DELETE"})}async getDeployConfig(t){return this.request(`/deploy/apps/${t}/config`)}async configureDeployment(t,n,r="main",a=!0,i=null,l=null){return this.request(`/deploy/apps/${t}/config`,{method:"POST",body:{repo_url:n,branch:r,auto_deploy:a,pre_deploy_script:i,post_deploy_script:l}})}async removeDeployment(t){return this.request(`/deploy/apps/${t}/config`,{method:"DELETE"})}async triggerDeploy(t,n=!1){return this.request(`/deploy/apps/${t}/deploy`,{method:"POST",body:{force:n}})}async pullChanges(t,n=null){return this.request(`/deploy/apps/${t}/pull`,{method:"POST",body:n?{branch:n}:{}})}async getGitStatus(t){return this.request(`/deploy/apps/${t}/git-status`)}async getCommitInfo(t){return this.request(`/deploy/apps/${t}/commit`)}async getDeploymentHistory(t=null,n=50){const r=new URLSearchParams({limit:n});return t&&r.append("app_id",t),this.request(`/deploy/history?${r}`)}async cloneRepository(t,n,r="main"){return this.request("/deploy/clone",{method:"POST",body:{app_path:t,repo_url:n,branch:r}})}async browseFiles(t="/home",n=!1){const r=new URLSearchParams({path:t,show_hidden:n});return this.request(`/files/browse?${r}`)}async getFileInfo(t){return this.request(`/files/info?path=${encodeURIComponent(t)}`)}async readFile(t){return this.request(`/files/read?path=${encodeURIComponent(t)}`)}async writeFile(t,n,r=!0){return this.request("/files/write",{method:"POST",body:{path:t,content:n,create_backup:r}})}async createFile(t,n=""){return this.request("/files/create",{method:"POST",body:{path:t,content:n}})}async createDirectory(t){return this.request("/files/mkdir",{method:"POST",body:{path:t}})}async deleteFile(t){return this.request(`/files/delete?path=${encodeURIComponent(t)}`,{method:"DELETE"})}async renameFile(t,n){return this.request("/files/rename",{method:"POST",body:{path:t,new_name:n}})}async copyFile(t,n){return this.request("/files/copy",{method:"POST",body:{src:t,dest:n}})}async moveFile(t,n){return this.request("/files/move",{method:"POST",body:{src:t,dest:n}})}async changeFilePermissions(t,n){return this.request("/files/chmod",{method:"POST",body:{path:t,mode:n}})}async searchFiles(t,n,r=100){const a=new URLSearchParams({directory:t,pattern:n,max_results:r});return this.request(`/files/search?${a}`)}async getDiskUsage(t="/"){return this.request(`/files/disk-usage?path=${encodeURIComponent(t)}`)}async downloadFile(t){const n=this.getToken(),r=`${this.baseUrl}/files/download?path=${encodeURIComponent(t)}`;window.open(`${r}&token=${n}`,"_blank")}async uploadFile(t,n,r=null){const a=this.getToken(),i=new FormData;return i.append("file",n),i.append("destination",t),new Promise((l,c)=>{const o=new XMLHttpRequest;o.open("POST",`${this.baseUrl}/files/upload`),o.setRequestHeader("Authorization",`Bearer ${a}`),r&&(o.upload.onprogress=u=>{u.lengthComputable&&r(u.loaded/u.total*100)}),o.onload=()=>{o.status>=200&&o.status<300?l(JSON.parse(o.responseText)):c(new Error(JSON.parse(o.responseText).error||"Upload failed"))},o.onerror=()=>c(new Error("Upload failed")),o.send(i)})}async getFTPStatus(){return this.request("/ftp/status")}async controlFTPService(t,n=null){return this.request(`/ftp/service/${t}`,{method:"POST",body:n?{service:n}:{}})}async getFTPConfig(t=null){const n=t?`?service=${t}`:"";return this.request(`/ftp/config${n}`)}async updateFTPConfig(t,n=null){return this.request("/ftp/config",{method:"POST",body:{config:t,service:n}})}async getFTPUsers(){return this.request("/ftp/users")}async createFTPUser(t,n=null,r=null){return this.request("/ftp/users",{method:"POST",body:{username:t,password:n,home_dir:r}})}async deleteFTPUser(t,n=!1){const r=n?"?delete_home=true":"";return this.request(`/ftp/users/${t}${r}`,{method:"DELETE"})}async changeFTPPassword(t,n=null){return this.request(`/ftp/users/${t}/password`,{method:"POST",body:n?{password:n}:{}})}async toggleFTPUser(t,n){return this.request(`/ftp/users/${t}/toggle`,{method:"POST",body:{enabled:n}})}async getFTPConnections(){return this.request("/ftp/connections")}async disconnectFTPSession(t){return this.request(`/ftp/connections/${t}`,{method:"DELETE"})}async getFTPLogs(t=100){return this.request(`/ftp/logs?lines=${t}`)}async installFTPServer(t="vsftpd"){return this.request("/ftp/install",{method:"POST",body:{service:t}})}async testFTPConnection(t="localhost",n=21,r=null,a=null){return this.request("/ftp/test",{method:"POST",body:{host:t,port:n,username:r,password:a}})}async getFirewallStatus(){return this.request("/firewall/status")}async enableFirewall(t=null){return this.request("/firewall/enable",{method:"POST",body:t?{firewall:t}:{}})}async disableFirewall(t=null){return this.request("/firewall/disable",{method:"POST",body:t?{firewall:t}:{}})}async getFirewallRules(t=null){const n=t?`?firewall=${t}`:"";return this.request(`/firewall/rules${n}`)}async addFirewallRule(t){return this.request("/firewall/rules",{method:"POST",body:t})}async removeFirewallRule(t){return this.request("/firewall/rules",{method:"DELETE",body:t})}async blockIP(t,n=!0){return this.request("/firewall/block-ip",{method:"POST",body:{ip:t,permanent:n}})}async unblockIP(t,n=!0){return this.request("/firewall/unblock-ip",{method:"POST",body:{ip:t,permanent:n}})}async getBlockedIPs(){return this.request("/firewall/blocked-ips")}async allowPort(t,n="tcp",r=!0){return this.request("/firewall/allow-port",{method:"POST",body:{port:t,protocol:n,permanent:r}})}async denyPort(t,n="tcp",r=!0){return this.request("/firewall/deny-port",{method:"POST",body:{port:t,protocol:n,permanent:r}})}async getFirewallZones(){return this.request("/firewall/zones")}async setDefaultZone(t){return this.request("/firewall/zones/default",{method:"POST",body:{zone:t}})}async installFirewall(t="ufw"){return this.request("/firewall/install",{method:"POST",body:{firewall:t}})}}const b=new _x,wh=d.createContext(null);function Ex({children:e}){const[t,n]=d.useState(null),[r,a]=d.useState(!0);d.useEffect(()=>{i()},[]);async function i(){if(localStorage.getItem("access_token"))try{const v=await b.getCurrentUser();n(v.user)}catch(v){console.error("Auth check failed:",v),b.clearTokens()}a(!1)}async function l(p,v){const N=await b.login(p,v);return n(N.user),N}async function c(p,v,N){const j=await b.register(p,v,N);return n(j.user),j}function o(){b.logout(),n(null)}async function u(p){const v=await b.updateCurrentUser(p);return n(v.user),v}async function f(){const p=await b.getCurrentUser();return n(p.user),p.user}const h={user:t,loading:r,login:l,register:c,logout:o,updateUser:u,refreshUser:f,isAuthenticated:!!t,isAdmin:(t==null?void 0:t.role)==="admin"};return s.jsx(wh.Provider,{value:h,children:e})}function rs(){const e=d.useContext(wh);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const kh=d.createContext(null);function Se(){const e=d.useContext(kh);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}let Tx=0;function Lx({children:e}){const[t,n]=d.useState([]),r=d.useCallback(f=>{n(h=>h.filter(p=>p.id!==f))},[]),a=d.useCallback((f,h="info",p=5e3)=>{const v=++Tx,N={id:v,message:f,type:h};return n(j=>[...j,N]),p>0&&setTimeout(()=>r(v),p),v},[r]),i=d.useCallback((f,h)=>a(f,"success",h),[a]),l=d.useCallback((f,h)=>a(f,"error",h),[a]),c=d.useCallback((f,h)=>a(f,"warning",h),[a]),o=d.useCallback((f,h)=>a(f,"info",h),[a]),u={toasts:t,addToast:a,removeToast:r,success:i,error:l,warning:c,info:o};return s.jsx(kh.Provider,{value:u,children:e})}/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */var Dx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Fx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const re=(e,t)=>{const n=d.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:c="",children:o,...u},f)=>d.createElement("svg",{ref:f,...Dx,width:a,height:a,stroke:r,strokeWidth:l?Number(i)*24/Number(a):i,className:["lucide",`lucide-${Fx(e)}`,c].join(" "),...u},[...t.map(([h,p])=>d.createElement(h,p)),...Array.isArray(o)?o:[o]]));return n.displayName=`${e}`,n};/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Mx=re("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Ax=re("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const $x=re("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Sh=re("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Rx=re("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Ox=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Bx=re("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Qc=re("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Ix=re("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const qx=re("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Ux=re("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Pn=re("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const zx=re("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const bo=re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const pi=re("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Vx=re("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const fi=re("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Hx=re("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const pa=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const xl=re("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Wx=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Ch=re("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const br=re("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Qx=re("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Kx=re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Aa=re("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**- * @license lucide-react v0.363.0 - ISC- *- * This source code is licensed under the ISC license.- * See the LICENSE file in the root directory of this source tree.- */const Gx=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Yx={success:Sh,error:Rx,warning:Aa,info:bo};function Xx({toast:e,onDismiss:t}){const n=Yx[e.type]||bo;return s.jsxs("div",{className:`toast toast-${e.type}`,children:[s.jsx("div",{className:"toast-icon",children:s.jsx(n,{size:18})}),s.jsx("div",{className:"toast-message",children:e.message}),s.jsx("button",{className:"toast-dismiss",onClick:()=>t(e.id),children:s.jsx(Gx,{size:14})})]})}function Jx(){const{toasts:e,removeToast:t}=Se();return e.length===0?null:s.jsx("div",{className:"toast-container",children:e.map(n=>s.jsx(Xx,{toast:n,onDismiss:t},n.id))})}const Zx=()=>{var n;const{user:e,logout:t}=rs();return s.jsxs("aside",{className:"sidebar",children:[s.jsxs("div",{className:"brand",children:[s.jsx("div",{className:"brand-logo",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})}),"ServerKit"]}),s.jsx("div",{className:"menu-label",children:"Overview"}),s.jsx("nav",{className:"nav",children:s.jsxs(qe,{to:"/",className:({isActive:r})=>`nav-item ${r?"active":""}`,end:!0,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7"})]}),"Dashboard"]})}),s.jsx("div",{className:"menu-label",children:"Infrastructure"}),s.jsxs("nav",{className:"nav",children:[s.jsxs(qe,{to:"/domains",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),"Domains & Sites"]}),s.jsxs(qe,{to:"/apps",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),s.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),s.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]}),"Applications"]}),s.jsxs(qe,{to:"/databases",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),s.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]}),"Databases"]}),s.jsxs(qe,{to:"/ssl",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"SSL Certificates"]}),s.jsxs(qe,{to:"/docker",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("rect",{x:"2",y:"7",width:"6",height:"6",rx:"1"}),s.jsx("rect",{x:"9",y:"7",width:"6",height:"6",rx:"1"}),s.jsx("rect",{x:"16",y:"7",width:"6",height:"6",rx:"1"}),s.jsx("rect",{x:"2",y:"14",width:"6",height:"6",rx:"1"}),s.jsx("rect",{x:"9",y:"14",width:"6",height:"6",rx:"1"})]}),"Docker"]}),s.jsxs(qe,{to:"/php",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"6"}),s.jsx("text",{x:"12",y:"15",textAnchor:"middle",fontSize:"8",fill:"currentColor",stroke:"none",children:"php"})]}),"PHP"]}),s.jsxs(qe,{to:"/firewall",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),"Firewall"]})]}),s.jsx("div",{className:"menu-label",children:"Operations"}),s.jsxs("nav",{className:"nav",children:[s.jsxs(qe,{to:"/files",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),"File Manager"]}),s.jsxs(qe,{to:"/ftp",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"17 8 12 3 7 8"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"FTP Server"]}),s.jsxs(qe,{to:"/monitoring",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})}),"Monitoring"]}),s.jsxs(qe,{to:"/backups",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Backups"]})]}),s.jsx("div",{className:"menu-label",children:"System"}),s.jsxs("nav",{className:"nav",children:[s.jsxs(qe,{to:"/terminal",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsx("svg",{viewBox:"0 0 24 24",children:s.jsx("path",{d:"M4 17l6-6-6-6M12 19h8"})}),"Terminal / Logs"]}),s.jsxs(qe,{to:"/settings",className:({isActive:r})=>`nav-item ${r?"active":""}`,children:[s.jsxs("svg",{viewBox:"0 0 24 24",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]})]}),s.jsxs("div",{className:"user-profile",children:[s.jsx("div",{className:"avatar",children:((n=e==null?void 0:e.username)==null?void 0:n.charAt(0).toUpperCase())||"U"}),s.jsxs("div",{style:{flex:1,fontSize:"13px"},children:[s.jsx("div",{style:{fontWeight:600},children:(e==null?void 0:e.username)||"User"}),s.jsx("div",{style:{color:"var(--text-tertiary)"},children:(e==null?void 0:e.role)||"user"})]}),s.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"4px"},title:"Logout",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),s.jsx("polyline",{points:"16 17 21 12 16 7"}),s.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})]})]})},ev=()=>s.jsxs("div",{className:"dashboard-layout",children:[s.jsx(Zx,{}),s.jsxs("main",{className:"main-content",children:[s.jsx("div",{className:"header",children:s.jsx("h2",{children:"Dashboard"})}),s.jsx(ux,{})]})]}),jt=Object.create(null);jt.open="0";jt.close="1";jt.ping="2";jt.pong="3";jt.message="4";jt.upgrade="5";jt.noop="6";const Rr=Object.create(null);Object.keys(jt).forEach(e=>{Rr[jt[e]]=e});const vl={type:"error",data:"parser error"},Ph=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_h=typeof ArrayBuffer=="function",Eh=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,wo=({type:e,data:t},n,r)=>Ph&&t instanceof Blob?n?r(t):Kc(t,r):_h&&(t instanceof ArrayBuffer||Eh(t))?n?r(t):Kc(new Blob([t]),r):r(jt[e]+(t||"")),Kc=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function Gc(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let xi;function tv(e,t){if(Ph&&e.data instanceof Blob)return e.data.arrayBuffer().then(Gc).then(t);if(_h&&(e.data instanceof ArrayBuffer||Eh(e.data)))return t(Gc(e.data));wo(e,!1,n=>{xi||(xi=new TextEncoder),t(xi.encode(n))})}const Yc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Yc.length;e++)vn[Yc.charCodeAt(e)]=e;const sv=e=>{let t=e.length*.75,n=e.length,r,a=0,i,l,c,o;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),f=new Uint8Array(u);for(r=0;r<n;r+=4)i=vn[e.charCodeAt(r)],l=vn[e.charCodeAt(r+1)],c=vn[e.charCodeAt(r+2)],o=vn[e.charCodeAt(r+3)],f[a++]=i<<2|l>>4,f[a++]=(l&15)<<4|c>>2,f[a++]=(c&3)<<6|o&63;return u},nv=typeof ArrayBuffer=="function",ko=(e,t)=>{if(typeof e!="string")return{type:"message",data:Th(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:rv(e.substring(1),t)}:Rr[n]?e.length>1?{type:Rr[n],data:e.substring(1)}:{type:Rr[n]}:vl},rv=(e,t)=>{if(nv){const n=sv(e);return Th(n,t)}else return{base64:!0,data:e}},Th=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Lh="",av=(e,t)=>{const n=e.length,r=new Array(n);let a=0;e.forEach((i,l)=>{wo(i,!1,c=>{r[l]=c,++a===n&&t(r.join(Lh))})})},iv=(e,t)=>{const n=e.split(Lh),r=[];for(let a=0;a<n.length;a++){const i=ko(n[a],t);if(r.push(i),i.type==="error")break}return r};function lv(){return new TransformStream({transform(e,t){tv(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let vi;function wr(e){return e.reduce((t,n)=>t+n.length,0)}function kr(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function ov(e,t){vi||(vi=new TextDecoder);const n=[];let r=0,a=-1,i=!1;return new TransformStream({transform(l,c){for(n.push(l);;){if(r===0){if(wr(n)<1)break;const o=kr(n,1);i=(o[0]&128)===128,a=o[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(wr(n)<2)break;const o=kr(n,2);a=new DataView(o.buffer,o.byteOffset,o.length).getUint16(0),r=3}else if(r===2){if(wr(n)<8)break;const o=kr(n,8),u=new DataView(o.buffer,o.byteOffset,o.length),f=u.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(vl);break}a=f*Math.pow(2,32)+u.getUint32(4),r=3}else{if(wr(n)<a)break;const o=kr(n,a);c.enqueue(ko(i?o:vi.decode(o),t)),r=0}if(a===0||a>e){c.enqueue(vl);break}}}})}const Dh=4;function je(e){if(e)return cv(e)}function cv(e){for(var t in je.prototype)e[t]=je.prototype[t];return e}je.prototype.on=je.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};je.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};je.prototype.off=je.prototype.removeListener=je.prototype.removeAllListeners=je.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===t||r.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};je.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,t)}return this};je.prototype.emitReserved=je.prototype.emit;je.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};je.prototype.hasListeners=function(e){return!!this.listeners(e).length};const $a=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),tt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),dv="arraybuffer";function Fh(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const uv=tt.setTimeout,hv=tt.clearTimeout;function Ra(e,t){t.useNativeTimers?(e.setTimeoutFn=uv.bind(tt),e.clearTimeoutFn=hv.bind(tt)):(e.setTimeoutFn=tt.setTimeout.bind(tt),e.clearTimeoutFn=tt.clearTimeout.bind(tt))}const mv=1.33;function pv(e){return typeof e=="string"?fv(e):Math.ceil((e.byteLength||e.size)*mv)}function fv(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Mh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function xv(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function vv(e){let t={},n=e.split("&");for(let r=0,a=n.length;r<a;r++){let i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class gv extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class So extends je{constructor(t){super(),this.writable=!1,Ra(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new gv(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=ko(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=xv(t);return n.length?"?"+n:""}}class yv extends So{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};iv(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,av(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Mh()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Ah=!1;try{Ah=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const jv=Ah;function Nv(){}class bv extends yv{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class yt extends je{constructor(t,n,r){super(),this.createRequest=t,Ra(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=Fh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=yt.requestsCount++,yt.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Nv,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete yt.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}yt.requestsCount=0;yt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xc);else if(typeof addEventListener=="function"){const e="onpagehide"in tt?"pagehide":"unload";addEventListener(e,Xc,!1)}}function Xc(){for(let e in yt.requests)yt.requests.hasOwnProperty(e)&&yt.requests[e].abort()}const wv=function(){const e=$h({xdomain:!1});return e&&e.responseType!==null}();class kv extends bv{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=wv&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new yt($h,this.uri(),t)}}function $h(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||jv))return new XMLHttpRequest}catch{}if(!t)try{return new tt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Rh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Sv extends So{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=Rh?{}:Fh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;wo(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}a&&$a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Mh()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const gi=tt.WebSocket||tt.MozWebSocket;class Cv extends Sv{createSocket(t,n,r){return Rh?new gi(t,n,r):n?new gi(t,n):new gi(t)}doWrite(t,n){this.ws.send(n)}}class Pv extends So{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=ov(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),a=lv();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{r.read().then(({done:c,value:o})=>{c||(this.onPacket(o),i())}).catch(c=>{})};i();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this._writer.write(l).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;this._writer.write(r).then(()=>{a&&$a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const _v={websocket:Cv,webtransport:Pv,polling:kv},Ev=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function gl(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let a=Ev.exec(e||""),i={},l=14;for(;l--;)i[Tv[l]]=a[l]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Lv(i,i.path),i.queryKey=Dv(i,i.query),i}function Lv(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Dv(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,i){a&&(n[a]=i)}),n}const yl=typeof addEventListener=="function"&&typeof removeEventListener=="function",Or=[];yl&&addEventListener("offline",()=>{Or.forEach(e=>e())},!1);class Xt extends je{constructor(t,n){if(super(),this.binaryType=dv,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=gl(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=gl(n.host).host);Ra(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=vv(this.opts.query)),yl&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Or.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Dh,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Xt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Xt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=pv(a)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,$a(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Xt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),yl&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Or.indexOf(this._offlineEventListener);r!==-1&&Or.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xt.protocol=Dh;class Fv extends Xt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Xt.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xt.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(f(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function i(){r||(r=!0,f(),n.close(),n=null)}const l=h=>{const p=new Error("probe error: "+h);p.transport=n.name,i(),this.emitReserved("upgradeError",p)};function c(){l("transport closed")}function o(){l("socket closed")}function u(h){n&&h.name!==n.name&&i()}const f=()=>{n.removeListener("open",a),n.removeListener("error",l),n.removeListener("close",c),this.off("close",o),this.off("upgrading",u)};n.once("open",a),n.once("error",l),n.once("close",c),this.once("close",o),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Mv=class extends Fv{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(a=>_v[a]).filter(a=>!!a)),super(t,r)}};function Av(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=gl(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const $v=typeof ArrayBuffer=="function",Rv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Oh=Object.prototype.toString,Ov=typeof Blob=="function"||typeof Blob<"u"&&Oh.call(Blob)==="[object BlobConstructor]",Bv=typeof File=="function"||typeof File<"u"&&Oh.call(File)==="[object FileConstructor]";function Co(e){return $v&&(e instanceof ArrayBuffer||Rv(e))||Ov&&e instanceof Blob||Bv&&e instanceof File}function Br(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Br(e[n]))return!0;return!1}if(Co(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Br(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Br(e[n]))return!0;return!1}function Iv(e){const t=[],n=e.data,r=e;return r.data=jl(n,t),r.attachments=t.length,{packet:r,buffers:t}}function jl(e,t){if(!e)return e;if(Co(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=jl(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=jl(e[r],t));return n}return e}function qv(e,t){return e.data=Nl(e.data,t),delete e.attachments,e}function Nl(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Nl(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Nl(e[n],t));return e}const Bh=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Uv=5;var X;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(X||(X={}));class zv{constructor(t){this.replacer=t}encode(t){return(t.type===X.EVENT||t.type===X.ACK)&&Br(t)?this.encodeAsBinary({type:t.type===X.EVENT?X.BINARY_EVENT:X.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===X.BINARY_EVENT||t.type===X.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Iv(t),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}class Po extends je{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===X.BINARY_EVENT;r||n.type===X.BINARY_ACK?(n.type=r?X.EVENT:X.ACK,this.reconstructor=new Vv(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Co(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(X[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===X.BINARY_EVENT||r.type===X.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const l=t.substring(i,n);if(l!=Number(l)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(l)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(i,n)}else r.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const l=t.charAt(n);if(l==null||Number(l)!=l){--n;break}if(n===t.length)break}r.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(Po.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case X.CONNECT:return fa(n);case X.DISCONNECT:return n===void 0;case X.CONNECT_ERROR:return typeof n=="string"||fa(n);case X.EVENT:case X.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Bh.indexOf(n[0])===-1);case X.ACK:case X.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Vv{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=qv(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Hv(e){return typeof e=="string"}const Wv=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Qv(e){return e===void 0||Wv(e)}function fa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Kv(e,t){switch(e){case X.CONNECT:return t===void 0||fa(t);case X.DISCONNECT:return t===void 0;case X.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Bh.indexOf(t[0])===-1);case X.ACK:return Array.isArray(t);case X.CONNECT_ERROR:return typeof t=="string"||fa(t);default:return!1}}function Gv(e){return Hv(e.nsp)&&Qv(e.id)&&Kv(e.type,e.data)}const Yv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Po,Encoder:zv,get PacketType(){return X},isPacketValid:Gv,protocol:Uv},Symbol.toStringTag,{value:"Module"}));function ct(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Xv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ih extends je{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ct(t,"open",this.onopen.bind(this)),ct(t,"packet",this.onpacket.bind(this)),ct(t,"error",this.onerror.bind(this)),ct(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,a,i;if(Xv.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const l={type:X.EVENT,data:n};if(l.options={},l.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const f=this.ids++,h=n.pop();this._registerAckCallback(f,h),l.id=f}const c=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,o=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!c||(o?(this.notifyOutgoingListeners(l),this.packet(l)):this.sendBuffer.push(l)),this.flags={},this}_registerAckCallback(t,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===t&&this.sendBuffer.splice(c,1);n.call(this,new Error("operation has timed out"))},a),l=(...c)=>{this.io.clearTimeoutFn(i),n.apply(this,c)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,a)=>{const i=(l,c)=>l?a(l):r(c);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>(this._queue[0],a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:X.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case X.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case X.EVENT:case X.BINARY_EVENT:this.onevent(t);break;case X.ACK:case X.BINARY_ACK:this.onack(t);break;case X.DISCONNECT:this.ondisconnect();break;case X.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:X.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:X.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function sn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}sn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};sn.prototype.reset=function(){this.attempts=0};sn.prototype.setMin=function(e){this.ms=e};sn.prototype.setMax=function(e){this.max=e};sn.prototype.setJitter=function(e){this.jitter=e};class bl extends je{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Ra(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new sn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||Yv;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Mv(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=ct(n,"open",function(){r.onopen(),t&&t()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),t?t(c):this.maybeReconnectOnOpen()},l=ct(n,"error",i);if(this._timeout!==!1){const c=this._timeout,o=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},c);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}return this.subs.push(a),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ct(t,"ping",this.onping.bind(this)),ct(t,"data",this.ondata.bind(this)),ct(t,"error",this.onerror.bind(this)),ct(t,"close",this.onclose.bind(this)),ct(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){$a(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Ih(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const hn={};function Ir(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Av(e,t.path||"/socket.io"),r=n.source,a=n.id,i=n.path,l=hn[a]&&i in hn[a].nsps,c=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let o;return c?o=new bl(r,t):(hn[a]||(hn[a]=new bl(r,t)),o=hn[a]),n.query&&!t.query&&(t.query=n.queryKey),o.socket(n.path,t)}Object.assign(Ir,{Manager:bl,Socket:Ih,io:Ir,connect:Ir});const Jv="http://localhost:5000";class Zv{constructor(){this.socket=null,this.listeners=new Map}connect(){var n;const t=localStorage.getItem("access_token");if(!t){console.warn("No token available for WebSocket connection");return}(n=this.socket)!=null&&n.connected||(this.socket=Ir(Jv,{query:{token:t},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5,reconnectionDelay:1e3}),this.socket.on("connect",()=>{console.log("WebSocket connected"),this.emit("connected")}),this.socket.on("disconnect",r=>{console.log("WebSocket disconnected:",r),this.emit("disconnected",r)}),this.socket.on("error",r=>{console.error("WebSocket error:",r),this.emit("error",r)}),this.socket.on("metrics",r=>{this.emit("metrics",r)}),this.socket.on("log_line",r=>{this.emit("log_line",r)}),this.socket.on("log_error",r=>{this.emit("log_error",r)}))}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null)}subscribeMetrics(){var t;(t=this.socket)!=null&&t.connected&&this.socket.emit("subscribe_metrics")}unsubscribeMetrics(){var t;(t=this.socket)!=null&&t.connected&&this.socket.emit("unsubscribe_metrics")}subscribeLogs(t){var n;(n=this.socket)!=null&&n.connected&&this.socket.emit("subscribe_logs",{path:t})}unsubscribeLogs(){var t;(t=this.socket)!=null&&t.connected&&this.socket.emit("unsubscribe_logs")}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var r;(r=this.listeners.get(t))==null||r.delete(n)}}off(t,n){var r;(r=this.listeners.get(t))==null||r.delete(n)}emit(t,n){var r;(r=this.listeners.get(t))==null||r.forEach(a=>{try{a(n)}catch(i){console.error("Socket listener error:",i)}})}}const is=new Zv;function eg(e=!0){const[t,n]=d.useState(null),[r,a]=d.useState(!0),[i,l]=d.useState(null),[c,o]=d.useState(!1),u=d.useCallback(async()=>{try{const f=await b.getSystemMetrics();n(f),l(null)}catch(f){l(f.message)}finally{a(!1)}},[]);return d.useEffect(()=>{if(u(),e){is.connect();const f=is.on("connected",()=>{o(!0),is.subscribeMetrics()}),h=is.on("disconnected",()=>{o(!1)}),p=is.on("metrics",N=>{n(N),a(!1)}),v=is.on("error",N=>{l(N.message||"WebSocket error")});return()=>{f(),h(),p(),v(),is.unsubscribeMetrics()}}else{const f=setInterval(u,5e3);return()=>clearInterval(f)}},[e,u]),{metrics:t,loading:r,error:i,connected:c,refresh:u}}const tg=()=>{var g,y,S,E,T,P,O,w,L,U,V,H,B,z,J,R,_,I,Q,Y,ve,ne,C,G,F,ee,ge,D,W,fe,Ce,bt,as,A,Ne,Ns,Jn,Zn,er,tr,sr,nr;const e=ns(),{metrics:t,loading:n,connected:r}=eg(!0),[a,i]=d.useState([]),[l,c]=d.useState([]),[o,u]=d.useState(null),[f,h]=d.useState(!0);d.useEffect(()=>{p()},[]);async function p(){try{const[K,De,Ia]=await Promise.all([b.getApps(),b.getServicesStatus().catch(()=>({services:[]})),b.getDatabasesStatus().catch(()=>null)]);i(K.apps||[]),c(De.services||[]),u(Ia)}catch(K){console.error("Failed to load data:",K)}finally{h(!1)}}function v(K){switch(K){case"running":return"status-active";case"stopped":return"status-stopped";case"error":return"status-error";default:return"status-warning"}}function N(K){switch(K){case"docker":return s.jsx(Qc,{size:20});case"wordpress":case"php":return s.jsx(Bx,{size:20});case"flask":case"django":return s.jsx(pi,{size:20});default:return s.jsx(Pn,{size:20})}}function j(K){return{php:"#777bb4",wordpress:"#21759b",flask:"#000000",django:"#092e20",docker:"#2496ed",static:"#60a5fa"}[K]||"#6366f1"}function k(K){if(!K)return{days:0,hours:0,minutes:0};const De=K.match(/(\d+)d\s*(\d+)h\s*(\d+)m|(\d+)h\s*(\d+)m|(\d+)m/);return De?De[1]?{days:parseInt(De[1]),hours:parseInt(De[2]),minutes:parseInt(De[3])}:De[4]?{days:0,hours:parseInt(De[4]),minutes:parseInt(De[5])}:{days:0,hours:0,minutes:parseInt(De[6])}:{days:0,hours:0,minutes:0}}const m=k((g=t==null?void 0:t.system)==null?void 0:g.uptime_human),x=a.filter(K=>K.status==="running").length;return l.filter(K=>K.status==="running").length,f&&n?s.jsx("div",{className:"loading",children:"Loading dashboard..."}):s.jsxs("div",{children:[s.jsxs("header",{className:"top-bar",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Dashboard"}),s.jsxs("div",{className:"subtitle",children:["Overview of your server status and applications",r&&s.jsx("span",{className:"live-indicator",children:" Live"})]})]}),s.jsxs("div",{className:"top-bar-actions",children:[s.jsxs("button",{className:"btn btn-secondary",onClick:p,children:[s.jsx(xl,{size:16}),"Refresh"]}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>e("/apps"),children:[s.jsx(pa,{size:16}),"New Application"]})]})]}),(t==null?void 0:t.system)&&s.jsxs("div",{className:"uptime-display",children:[s.jsx(Ch,{size:24,style:{color:"var(--success)"}}),s.jsxs("div",{style:{flex:1},children:[s.jsx("div",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginBottom:"4px"},children:"Server Uptime"}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[s.jsxs("div",{className:"uptime-item",children:[s.jsx("span",{className:"uptime-value",children:m.days}),s.jsx("span",{className:"uptime-label",children:"Days"})]}),s.jsx("span",{className:"uptime-separator",children:":"}),s.jsxs("div",{className:"uptime-item",children:[s.jsx("span",{className:"uptime-value",children:String(m.hours).padStart(2,"0")}),s.jsx("span",{className:"uptime-label",children:"Hours"})]}),s.jsx("span",{className:"uptime-separator",children:":"}),s.jsxs("div",{className:"uptime-item",children:[s.jsx("span",{className:"uptime-value",children:String(m.minutes).padStart(2,"0")}),s.jsx("span",{className:"uptime-label",children:"Minutes"})]})]})]}),s.jsxs("div",{style:{textAlign:"right"},children:[s.jsx("div",{style:{fontSize:"12px",color:"var(--text-tertiary)"},children:(y=t.system)==null?void 0:y.hostname}),s.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)"},children:(S=t.system)==null?void 0:S.platform})]})]}),t&&s.jsxs("div",{className:"system-metrics",children:[s.jsxs("div",{className:"metric-card",children:[s.jsxs("div",{className:"metric-header",children:[s.jsx("h4",{children:"CPU Usage"}),s.jsx(Ix,{size:18,className:"metric-icon"})]}),s.jsxs("div",{className:"metric-main",children:[s.jsx("span",{className:"metric-value",children:((E=t.cpu)==null?void 0:E.percent)||0}),s.jsx("span",{className:"metric-unit",children:"%"})]}),s.jsx("div",{className:"progress-bar",children:s.jsx("div",{className:"progress-fill",style:{width:`${((T=t.cpu)==null?void 0:T.percent)||0}%`,background:(((P=t.cpu)==null?void 0:P.percent)||0)>80?"var(--danger)":(((O=t.cpu)==null?void 0:O.percent)||0)>60?"var(--warning)":"var(--success)"}})}),s.jsxs("div",{className:"metric-sub",children:[(w=t.cpu)==null?void 0:w.cores," cores @ ",(L=t.cpu)==null?void 0:L.frequency_mhz," MHz"]})]}),s.jsxs("div",{className:"metric-card",children:[s.jsxs("div",{className:"metric-header",children:[s.jsx("h4",{children:"Memory"}),s.jsx(Hx,{size:18,className:"metric-icon"})]}),s.jsxs("div",{className:"metric-main",children:[s.jsx("span",{className:"metric-value",children:((V=(U=t.memory)==null?void 0:U.ram)==null?void 0:V.percent)||0}),s.jsx("span",{className:"metric-unit",children:"%"})]}),s.jsx("div",{className:"progress-bar",children:s.jsx("div",{className:"progress-fill",style:{width:`${((B=(H=t.memory)==null?void 0:H.ram)==null?void 0:B.percent)||0}%`,background:"var(--accent-primary)"}})}),s.jsxs("div",{className:"metric-sub",children:[(J=(z=t.memory)==null?void 0:z.ram)==null?void 0:J.used_human," / ",(_=(R=t.memory)==null?void 0:R.ram)==null?void 0:_.total_human]})]}),s.jsxs("div",{className:"metric-card",children:[s.jsxs("div",{className:"metric-header",children:[s.jsx("h4",{children:"Disk Space"}),s.jsx(zx,{size:18,className:"metric-icon"})]}),s.jsxs("div",{className:"metric-main",children:[s.jsx("span",{className:"metric-value",children:((Y=(Q=(I=t.disk)==null?void 0:I.partitions)==null?void 0:Q[0])==null?void 0:Y.percent)||0}),s.jsx("span",{className:"metric-unit",children:"%"})]}),s.jsx("div",{className:"progress-bar",children:s.jsx("div",{className:"progress-fill",style:{width:`${((C=(ne=(ve=t.disk)==null?void 0:ve.partitions)==null?void 0:ne[0])==null?void 0:C.percent)||0}%`,background:(((ee=(F=(G=t.disk)==null?void 0:G.partitions)==null?void 0:F[0])==null?void 0:ee.percent)||0)>90?"var(--danger)":"var(--accent-primary)"}})}),s.jsxs("div",{className:"metric-sub",children:[(W=(D=(ge=t.disk)==null?void 0:ge.partitions)==null?void 0:D[0])==null?void 0:W.used_human," / ",(bt=(Ce=(fe=t.disk)==null?void 0:fe.partitions)==null?void 0:Ce[0])==null?void 0:bt.total_human]})]}),s.jsxs("div",{className:"metric-card",children:[s.jsxs("div",{className:"metric-header",children:[s.jsx("h4",{children:"Network I/O"}),s.jsx(Mx,{size:18,className:"metric-icon"})]}),s.jsxs("div",{className:"metric-main",children:[s.jsx("span",{className:"metric-value",style:{fontSize:"18px"},children:((A=(as=t.network)==null?void 0:as.io)==null?void 0:A.bytes_sent_human)||"0B"}),s.jsx("span",{className:"metric-unit",children:"sent"})]}),s.jsxs("div",{className:"metric-sub",children:["Received: ",((Ns=(Ne=t.network)==null?void 0:Ne.io)==null?void 0:Ns.bytes_recv_human)||"0B"]})]})]}),s.jsx("h2",{className:"section-title",children:"Quick Actions"}),s.jsxs("div",{className:"quick-actions",children:[s.jsxs("div",{className:"quick-action-card",onClick:()=>e("/apps"),children:[s.jsx("div",{className:"action-icon",children:s.jsx(pi,{size:24})}),s.jsx("h4",{children:"Applications"}),s.jsxs("p",{children:[x," of ",a.length," running"]})]}),s.jsxs("div",{className:"quick-action-card",onClick:()=>e("/docker"),children:[s.jsx("div",{className:"action-icon",children:s.jsx(Qc,{size:24})}),s.jsx("h4",{children:"Docker"}),s.jsx("p",{children:"Manage containers"})]}),s.jsxs("div",{className:"quick-action-card",onClick:()=>e("/databases"),children:[s.jsx("div",{className:"action-icon",children:s.jsx(qx,{size:24})}),s.jsx("h4",{children:"Databases"}),s.jsx("p",{children:"MySQL & PostgreSQL"})]}),s.jsxs("div",{className:"quick-action-card",onClick:()=>e("/domains"),children:[s.jsx("div",{className:"action-icon",children:s.jsx(Pn,{size:24})}),s.jsx("h4",{children:"Domains"}),s.jsx("p",{children:"Manage sites"})]})]}),l.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"section-title",children:"Services"}),s.jsx("div",{className:"services-grid",children:l.map(K=>s.jsxs("div",{className:"service-item",children:[s.jsx("span",{className:`service-dot ${K.status==="running"?"running":"stopped"}`}),s.jsx("span",{className:"service-name",children:K.name}),s.jsx("span",{className:"service-status",children:K.status})]},K.name))})]}),o&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"section-title",style:{marginTop:"32px"},children:"Database Servers"}),s.jsxs("div",{className:"db-status",children:[s.jsxs("div",{className:"db-status-item",children:[s.jsx("div",{className:"status-icon mysql",children:"M"}),s.jsxs("div",{className:"status-info",children:[s.jsx("h3",{children:"MySQL / MariaDB"}),s.jsxs("span",{className:(Jn=o.mysql)!=null&&Jn.running?"running":"stopped",children:[(Zn=o.mysql)!=null&&Zn.running?"Running":"Stopped",((er=o.mysql)==null?void 0:er.version)&&` - ${o.mysql.version}`]})]})]}),s.jsxs("div",{className:"db-status-item",children:[s.jsx("div",{className:"status-icon postgresql",children:"P"}),s.jsxs("div",{className:"status-info",children:[s.jsx("h3",{children:"PostgreSQL"}),s.jsxs("span",{className:(tr=o.postgresql)!=null&&tr.running?"running":"stopped",children:[(sr=o.postgresql)!=null&&sr.running?"Running":"Stopped",((nr=o.postgresql)==null?void 0:nr.version)&&` - ${o.postgresql.version}`]})]})]})]})]}),s.jsxs("div",{className:"section-header",style:{marginTop:"32px"},children:[s.jsx("h2",{className:"section-title",style:{marginBottom:0},children:"Active Projects"}),s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>e("/apps"),children:["View All ",s.jsx(Ax,{size:14})]})]}),a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx(pi,{size:48}),s.jsx("h3",{children:"No applications yet"}),s.jsx("p",{children:"Create your first application to get started."}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>e("/apps"),children:[s.jsx(pa,{size:16}),"Create Application"]})]}):s.jsx("div",{className:"dashboard-grid",children:a.slice(0,6).map(K=>s.jsxs("div",{className:"card",onClick:()=>e(`/apps/${K.id}`),children:[s.jsxs("div",{className:"card-header",children:[s.jsx("div",{className:"app-icon",style:{background:j(K.app_type)},children:N(K.app_type)}),s.jsxs("div",{className:`status-badge ${v(K.status)}`,children:[s.jsx("div",{className:"status-dot"}),K.status.charAt(0).toUpperCase()+K.status.slice(1)]})]}),s.jsx("h3",{children:K.name}),K.domains&&K.domains[0]&&s.jsx("a",{href:`https://${K.domains[0].name}`,className:"card-link",target:"_blank",rel:"noopener noreferrer",onClick:De=>De.stopPropagation(),children:K.domains[0].name}),s.jsxs("div",{className:"metric-row",children:[s.jsxs("div",{className:"metric-item",children:[s.jsx("span",{children:"Stack"}),s.jsxs("span",{className:"metric-value",style:{color:j(K.app_type)},children:[K.app_type.toUpperCase(),K.php_version&&` / PHP ${K.php_version}`,K.python_version&&` / Py ${K.python_version}`]})]}),K.port&&s.jsxs("div",{className:"metric-item",children:[s.jsx("span",{children:"Port"}),s.jsx("span",{className:"metric-value",children:K.port})]})]})]},K.id))})]})},sg=()=>{const[e,t]=d.useState(""),[n,r]=d.useState(""),[a,i]=d.useState(""),[l,c]=d.useState(!1),{login:o}=rs(),u=ns();async function f(h){h.preventDefault(),i(""),c(!0);try{await o(e,n),u("/")}catch(p){i(p.message||"Failed to login")}finally{c(!1)}}return s.jsx("div",{className:"auth-container",children:s.jsxs("div",{className:"auth-card",children:[s.jsxs("div",{className:"auth-header",children:[s.jsx("div",{className:"brand-logo",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})}),s.jsx("h1",{children:"ServerKit"}),s.jsx("p",{children:"Sign in to your account"})]}),a&&s.jsx("div",{className:"error-message",children:a}),s.jsxs("form",{onSubmit:f,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"email",children:"Email"}),s.jsx("input",{type:"email",id:"email",value:e,onChange:h=>t(h.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"password",children:"Password"}),s.jsx("input",{type:"password",id:"password",value:n,onChange:h=>r(h.target.value),placeholder:"Enter your password",required:!0})]}),s.jsx("button",{type:"submit",className:"btn btn-primary btn-full",disabled:l,children:l?"Signing in...":"Sign In"})]}),s.jsxs("p",{className:"auth-footer",children:["Don't have an account? ",s.jsx(No,{to:"/register",children:"Create one"})]})]})})},ng=()=>{const[e,t]=d.useState(""),[n,r]=d.useState(""),[a,i]=d.useState(""),[l,c]=d.useState(""),[o,u]=d.useState(""),[f,h]=d.useState(!1),{register:p}=rs(),v=ns();async function N(j){if(j.preventDefault(),u(""),a!==l){u("Passwords do not match");return}if(a.length<8){u("Password must be at least 8 characters");return}h(!0);try{await p(e,n,a),v("/")}catch(k){u(k.message||"Failed to register")}finally{h(!1)}}return s.jsx("div",{className:"auth-container",children:s.jsxs("div",{className:"auth-card",children:[s.jsxs("div",{className:"auth-header",children:[s.jsx("div",{className:"brand-logo",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"32",height:"32",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})}),s.jsx("h1",{children:"ServerKit"}),s.jsx("p",{children:"Create your account"})]}),o&&s.jsx("div",{className:"error-message",children:o}),s.jsxs("form",{onSubmit:N,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"email",children:"Email"}),s.jsx("input",{type:"email",id:"email",value:e,onChange:j=>t(j.target.value),placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"username",children:"Username"}),s.jsx("input",{type:"text",id:"username",value:n,onChange:j=>r(j.target.value),placeholder:"Choose a username",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"password",children:"Password"}),s.jsx("input",{type:"password",id:"password",value:a,onChange:j=>i(j.target.value),placeholder:"At least 8 characters",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsx("input",{type:"password",id:"confirmPassword",value:l,onChange:j=>c(j.target.value),placeholder:"Confirm your password",required:!0})]}),s.jsx("button",{type:"submit",className:"btn btn-primary btn-full",disabled:f,children:f?"Creating account...":"Create Account"})]}),s.jsxs("p",{className:"auth-footer",children:["Already have an account? ",s.jsx(No,{to:"/login",children:"Sign in"})]})]})})},rg=()=>{const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,i]=d.useState(!1),l=ns();d.useEffect(()=>{c()},[]);async function c(){try{const h=await b.getApps();t(h.apps||[])}catch(h){console.error("Failed to load apps:",h)}finally{r(!1)}}function o(h){return{php:"#a78bfa",wordpress:"#21759b",flask:"#fcd34d",django:"#34d399",docker:"#2496ed",static:"#60a5fa"}[h]||"#a1a1aa"}function u(h){switch(h){case"running":return"status-active";case"stopped":return"status-stopped";case"error":return"status-error";default:return"status-warning"}}async function f(h,p){try{p==="start"?await b.startApp(h):p==="stop"?await b.stopApp(h):p==="restart"&&await b.restartApp(h),c()}catch(v){console.error(`Failed to ${p} app:`,v)}}return n?s.jsx("div",{className:"loading",children:"Loading applications..."}):s.jsxs("div",{children:[s.jsxs("header",{className:"top-bar",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Applications"}),s.jsx("div",{className:"subtitle",children:"Manage your web applications"})]}),s.jsx("div",{className:"top-bar-actions",children:s.jsxs("button",{className:"btn btn-primary",onClick:()=>i(!0),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Application"]})})]}),e.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"48",height:"48",stroke:"currentColor",fill:"none",strokeWidth:"1.5",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),s.jsx("h3",{children:"No applications yet"}),s.jsx("p",{children:"Create your first application to get started."}),s.jsx("button",{className:"btn btn-primary",onClick:()=>i(!0),children:"Create Application"})]}):s.jsx("div",{className:"apps-list",children:e.map(h=>s.jsxs("div",{className:"app-row",children:[s.jsxs("div",{className:"app-info",children:[s.jsx("div",{className:"app-icon",style:{background:o(h.app_type)},children:h.app_type==="wordpress"?"W":h.app_type.charAt(0).toUpperCase()}),s.jsxs("div",{className:"app-details",children:[s.jsx("h3",{children:h.name}),s.jsxs("div",{className:"app-meta",children:[s.jsx("span",{className:"app-type",children:h.app_type.toUpperCase()}),h.php_version&&s.jsxs("span",{children:["PHP ",h.php_version]}),h.python_version&&s.jsxs("span",{children:["Python ",h.python_version]}),h.domains&&h.domains[0]&&s.jsx("a",{href:`https://${h.domains[0].name}`,target:"_blank",rel:"noopener noreferrer",children:h.domains[0].name})]})]})]}),s.jsx("div",{className:"app-status",children:s.jsxs("span",{className:`status-badge ${u(h.status)}`,children:[s.jsx("span",{className:"status-dot"}),h.status]})}),s.jsxs("div",{className:"app-actions",children:[h.status==="running"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>f(h.id,"restart"),children:"Restart"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>f(h.id,"stop"),children:"Stop"})]}):s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>f(h.id,"start"),children:"Start"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>l(`/apps/${h.id}`),children:"Manage"})]})]},h.id))}),a&&s.jsx(ag,{onClose:()=>i(!1),onCreated:c})]})},ag=({onClose:e,onCreated:t})=>{var k;const[n,r]=d.useState(1),[a,i]=d.useState(""),[l,c]=d.useState({name:"",app_type:"",php_version:"8.2",python_version:"3.11",port:8e3,root_path:"/var/www/",site_url:"",site_title:"",admin_user:"admin",admin_email:"",db_name:"",db_user:"",db_password:"",docker_image:"",docker_ports:"",docker_volumes:"",docker_env:""}),[o,u]=d.useState(!1),[f,h]=d.useState(""),p=[{id:"wordpress",name:"WordPress",icon:"W",color:"#21759b",description:"Full WordPress installation with WP-CLI"},{id:"php",name:"PHP",icon:"P",color:"#777bb4",description:"PHP application with FPM"},{id:"flask",name:"Flask",icon:"F",color:"#fcd34d",description:"Python Flask application"},{id:"django",name:"Django",icon:"D",color:"#34d399",description:"Python Django application"},{id:"docker",name:"Docker",icon:"D",color:"#2496ed",description:"Docker container application"},{id:"static",name:"Static",icon:"S",color:"#60a5fa",description:"Static HTML/CSS/JS site"}];function v(m){c({...l,[m.target.name]:m.target.value})}function N(m){i(m),c({...l,app_type:m,root_path:`/var/www/${l.name||"mysite"}`}),r(2)}async function j(m){m.preventDefault(),h(""),u(!0);try{if(a==="wordpress")await b.installWordPress({path:l.root_path,site_url:l.site_url,site_title:l.site_title||l.name,admin_user:l.admin_user,admin_email:l.admin_email,db_name:l.db_name,db_user:l.db_user,db_password:l.db_password,php_version:l.php_version});else if(a==="flask")await b.createFlaskApp({name:l.name,path:l.root_path,python_version:l.python_version,port:l.port,workers:l.workers||2});else if(a==="django")await b.createDjangoApp({name:l.name,path:l.root_path,python_version:l.python_version,port:l.port,workers:l.workers||2});else if(a==="docker"){const x=l.docker_ports?l.docker_ports.split(",").map(S=>S.trim()):[],g=l.docker_volumes?l.docker_volumes.split(",").map(S=>S.trim()):[],y=l.docker_env?Object.fromEntries(l.docker_env.split(`-`).filter(S=>S.includes("=")).map(S=>{const[E,...T]=S.split("=");return[E.trim(),T.join("=").trim()]})):{};await b.createDockerApp({name:l.name,path:l.root_path,image:l.docker_image,ports:x,volumes:g,env:y})}else await b.createApp({name:l.name,app_type:a,php_version:a==="php"?l.php_version:null,root_path:l.root_path});t(),e()}catch(x){h(x.message||"Failed to create application")}finally{u(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:n===1?"Select Application Type":`Create ${(k=p.find(m=>m.id===a))==null?void 0:k.name} App`}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),f&&s.jsx("div",{className:"error-message",children:f}),n===1?s.jsx("div",{className:"app-type-grid",children:p.map(m=>s.jsxs("button",{className:"app-type-card",onClick:()=>N(m.id),children:[s.jsx("div",{className:"app-type-icon",style:{background:m.color},children:m.icon}),s.jsx("h3",{children:m.name}),s.jsx("p",{children:m.description})]},m.id))}):s.jsxs("form",{onSubmit:j,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Site Name"}),s.jsx("input",{type:"text",name:"name",value:l.name,onChange:v,placeholder:"My Awesome Site",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Root Path"}),s.jsx("input",{type:"text",name:"root_path",value:l.root_path,onChange:v,placeholder:"/var/www/mysite",required:!0})]}),a==="wordpress"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Site URL"}),s.jsx("input",{type:"url",name:"site_url",value:l.site_url,onChange:v,placeholder:"https://example.com",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Admin Email"}),s.jsx("input",{type:"email",name:"admin_email",value:l.admin_email,onChange:v,placeholder:"[email protected]",required:!0})]}),s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Name"}),s.jsx("input",{type:"text",name:"db_name",value:l.db_name,onChange:v,required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database User"}),s.jsx("input",{type:"text",name:"db_user",value:l.db_user,onChange:v,required:!0})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Password"}),s.jsx("input",{type:"password",name:"db_password",value:l.db_password,onChange:v,required:!0})]})]}),(a==="php"||a==="wordpress")&&s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"PHP Version"}),s.jsxs("select",{name:"php_version",value:l.php_version,onChange:v,children:[s.jsx("option",{value:"8.0",children:"PHP 8.0"}),s.jsx("option",{value:"8.1",children:"PHP 8.1"}),s.jsx("option",{value:"8.2",children:"PHP 8.2"}),s.jsx("option",{value:"8.3",children:"PHP 8.3"})]})]}),["flask","django"].includes(a)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Python Version"}),s.jsxs("select",{name:"python_version",value:l.python_version,onChange:v,children:[s.jsx("option",{value:"3.9",children:"Python 3.9"}),s.jsx("option",{value:"3.10",children:"Python 3.10"}),s.jsx("option",{value:"3.11",children:"Python 3.11"}),s.jsx("option",{value:"3.12",children:"Python 3.12"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Port"}),s.jsx("input",{type:"number",name:"port",value:l.port,onChange:v,min:"1024",max:"65535"})]})]}),a==="docker"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Docker Image *"}),s.jsx("input",{type:"text",name:"docker_image",value:l.docker_image,onChange:v,placeholder:"nginx:latest, mysql:8, redis:alpine",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Ports (comma-separated)"}),s.jsx("input",{type:"text",name:"docker_ports",value:l.docker_ports,onChange:v,placeholder:"8080:80, 3306:3306"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Volumes (comma-separated)"}),s.jsx("input",{type:"text",name:"docker_volumes",value:l.docker_volumes,onChange:v,placeholder:"/host/data:/container/data"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Environment Variables (one per line, KEY=value)"}),s.jsx("textarea",{name:"docker_env",value:l.docker_env,onChange:v,placeholder:`MYSQL_ROOT_PASSWORD=secret-MYSQL_DATABASE=mydb`,rows:4})]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>r(1),children:"Back"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:o,children:o?"Creating...":"Create Application"})]})]})]})})},ig=()=>{const{id:e}=Yf(),t=ns(),[n,r]=d.useState(null),[a,i]=d.useState(!0),[l,c]=d.useState("overview");d.useEffect(()=>{o()},[e]);async function o(){try{const N=await b.getApp(e);r(N.app)}catch(N){console.error("Failed to load app:",N)}finally{i(!1)}}async function u(N){try{N==="start"?await b.startApp(e):N==="stop"?await b.stopApp(e):N==="restart"&&await b.restartApp(e),o()}catch(j){console.error(`Failed to ${N} app:`,j)}}function f(N){return{php:"#777bb4",wordpress:"#21759b",flask:"#fcd34d",django:"#34d399",docker:"#2496ed",static:"#60a5fa"}[N]||"#a1a1aa"}function h(N){switch(N){case"running":return"status-active";case"stopped":return"status-stopped";case"error":return"status-error";default:return"status-warning"}}if(a)return s.jsx("div",{className:"loading",children:"Loading application..."});if(!n)return s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"Application not found"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>t("/apps"),children:"Back to Applications"})]});const p=["flask","django"].includes(n.app_type),v=n.app_type==="wordpress";return n.app_type,s.jsxs("div",{children:[s.jsxs("header",{className:"top-bar",children:[s.jsxs("div",{className:"app-header-info",children:[s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t("/apps"),children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),"Back"]}),s.jsxs("div",{className:"app-header-title",children:[s.jsx("div",{className:"app-icon",style:{background:f(n.app_type)},children:n.app_type.charAt(0).toUpperCase()}),s.jsxs("div",{children:[s.jsx("h1",{children:n.name}),s.jsxs("div",{className:"subtitle",children:[n.app_type.toUpperCase(),n.python_version&&` • Python ${n.python_version}`,n.php_version&&` • PHP ${n.php_version}`,n.port&&` • Port ${n.port}`]})]})]})]}),s.jsxs("div",{className:"top-bar-actions",children:[s.jsxs("span",{className:`status-badge ${h(n.status)}`,children:[s.jsx("span",{className:"status-dot"}),n.status]}),n.status==="running"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>u("restart"),children:"Restart"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>u("stop"),children:"Stop"})]}):s.jsx("button",{className:"btn btn-primary",onClick:()=>u("start"),children:"Start"})]})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${l==="overview"?"active":""}`,onClick:()=>c("overview"),children:"Overview"}),p&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`tab ${l==="packages"?"active":""}`,onClick:()=>c("packages"),children:"Packages"}),s.jsx("button",{className:`tab ${l==="environment"?"active":""}`,onClick:()=>c("environment"),children:"Environment"}),s.jsx("button",{className:`tab ${l==="gunicorn"?"active":""}`,onClick:()=>c("gunicorn"),children:"Gunicorn"}),s.jsx("button",{className:`tab ${l==="commands"?"active":""}`,onClick:()=>c("commands"),children:"Commands"})]}),v&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`tab ${l==="plugins"?"active":""}`,onClick:()=>c("plugins"),children:"Plugins"}),s.jsx("button",{className:`tab ${l==="themes"?"active":""}`,onClick:()=>c("themes"),children:"Themes"}),s.jsx("button",{className:`tab ${l==="backups"?"active":""}`,onClick:()=>c("backups"),children:"Backups"})]}),s.jsx("button",{className:`tab ${l==="deploy"?"active":""}`,onClick:()=>c("deploy"),children:"Deploy"}),s.jsx("button",{className:`tab ${l==="logs"?"active":""}`,onClick:()=>c("logs"),children:"Logs"}),s.jsx("button",{className:`tab ${l==="settings"?"active":""}`,onClick:()=>c("settings"),children:"Settings"})]}),s.jsxs("div",{className:"tab-content",children:[l==="overview"&&s.jsx(lg,{app:n}),l==="packages"&&p&&s.jsx(og,{appId:n.id}),l==="environment"&&p&&s.jsx(cg,{appId:n.id}),l==="gunicorn"&&p&&s.jsx(dg,{appId:n.id}),l==="commands"&&p&&s.jsx(ug,{appId:n.id,appType:n.app_type}),l==="plugins"&&v&&s.jsx(hg,{appId:n.id}),l==="themes"&&v&&s.jsx(mg,{appId:n.id}),l==="backups"&&v&&s.jsx(pg,{appId:n.id}),l==="deploy"&&s.jsx(vg,{appId:n.id,appPath:n.path}),l==="logs"&&s.jsx(fg,{app:n}),l==="settings"&&s.jsx(xg,{app:n,onUpdate:o})]})]})},lg=({app:e})=>{const[t,n]=d.useState(null);d.useEffect(()=>{["flask","django"].includes(e.app_type)&&r()},[e]);async function r(){try{const a=await b.getPythonAppStatus(e.id);n(a)}catch(a){console.error("Failed to load status:",a)}}return s.jsxs("div",{className:"overview-grid",children:[s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Application Info"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Type"}),s.jsx("span",{className:"info-value",children:e.app_type.toUpperCase()})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Root Path"}),s.jsx("span",{className:"info-value mono",children:e.root_path})]}),e.python_version&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Python Version"}),s.jsx("span",{className:"info-value",children:e.python_version})]}),e.php_version&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"PHP Version"}),s.jsx("span",{className:"info-value",children:e.php_version})]}),e.port&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Port"}),s.jsx("span",{className:"info-value",children:e.port})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Created"}),s.jsx("span",{className:"info-value",children:new Date(e.created_at).toLocaleDateString()})]})]})]}),t&&s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Process Status"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Service"}),s.jsx("span",{className:"info-value mono",children:t.service_name})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"State"}),s.jsxs("span",{className:"info-value",children:[t.active_state," (",t.sub_state,")"]})]}),t.main_pid!=="0"&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"PID"}),s.jsx("span",{className:"info-value mono",children:t.main_pid})]}),t.memory&&t.memory!=="0"&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Memory"}),s.jsx("span",{className:"info-value",children:qh(parseInt(t.memory))})]})]})]}),e.domains&&e.domains.length>0&&s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Domains"}),s.jsx("div",{className:"domains-list",children:e.domains.map(a=>s.jsxs("div",{className:"domain-item",children:[s.jsx("a",{href:`https://${a.name}`,target:"_blank",rel:"noopener noreferrer",children:a.name}),a.ssl_enabled&&s.jsx("span",{className:"ssl-badge",children:"SSL"})]},a.id))})]})]})},og=({appId:e})=>{const t=Se(),[n,r]=d.useState([]),[a,i]=d.useState(!0),[l,c]=d.useState(!1),[o,u]=d.useState("");d.useEffect(()=>{f()},[e]);async function f(){try{const v=await b.getPythonPackages(e);r(v.packages||[])}catch(v){console.error("Failed to load packages:",v)}finally{i(!1)}}async function h(v){if(v.preventDefault(),!!o.trim()){c(!0);try{await b.installPythonPackages(e,[o.trim()]),u(""),f()}catch(N){console.error("Failed to install package:",N)}finally{c(!1)}}}async function p(){try{await b.freezePythonRequirements(e),t.success("requirements.txt updated")}catch(v){t.error("Failed to freeze requirements"),console.error("Failed to freeze requirements:",v)}}return a?s.jsx("div",{className:"loading",children:"Loading packages..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Installed Packages"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:p,children:"Freeze to requirements.txt"})]}),s.jsxs("form",{className:"install-form",onSubmit:h,children:[s.jsx("input",{type:"text",value:o,onChange:v=>u(v.target.value),placeholder:"Package name (e.g., requests, flask==2.0.0)"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:l,children:l?"Installing...":"Install"})]}),s.jsx("div",{className:"packages-list",children:n.map(v=>s.jsxs("div",{className:"package-item",children:[s.jsx("span",{className:"package-name",children:v.name}),s.jsx("span",{className:"package-version",children:v.version})]},v.name))})]})},cg=({appId:e})=>{const[t,n]=d.useState({}),[r,a]=d.useState(!0),[i,l]=d.useState(""),[c,o]=d.useState("");d.useEffect(()=>{u()},[e]);async function u(){try{const p=await b.getPythonEnvVars(e);n(p.env_vars||{})}catch(p){console.error("Failed to load env vars:",p)}finally{a(!1)}}async function f(p){if(p.preventDefault(),!!i.trim())try{await b.setPythonEnvVars(e,{[i]:c}),l(""),o(""),u()}catch(v){console.error("Failed to add env var:",v)}}async function h(p){if(confirm(`Delete ${p}?`))try{await b.deletePythonEnvVar(e,p),u()}catch(v){console.error("Failed to delete env var:",v)}}return r?s.jsx("div",{className:"loading",children:"Loading environment variables..."}):s.jsxs("div",{children:[s.jsx("h3",{children:"Environment Variables"}),s.jsx("p",{className:"hint",children:"Changes require app restart to take effect."}),s.jsxs("form",{className:"env-form",onSubmit:f,children:[s.jsx("input",{type:"text",value:i,onChange:p=>l(p.target.value),placeholder:"KEY"}),s.jsx("input",{type:"text",value:c,onChange:p=>o(p.target.value),placeholder:"value"}),s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Add"})]}),s.jsx("div",{className:"env-list",children:Object.entries(t).map(([p,v])=>s.jsxs("div",{className:"env-item",children:[s.jsx("span",{className:"env-key",children:p}),s.jsx("span",{className:"env-value",children:v}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>h(p),children:"Delete"})]},p))})]})},dg=({appId:e})=>{const t=Se(),[n,r]=d.useState(""),[a,i]=d.useState(!0),[l,c]=d.useState(!1);d.useEffect(()=>{o()},[e]);async function o(){try{const f=await b.getGunicornConfig(e);r(f.content||"")}catch(f){console.error("Failed to load config:",f)}finally{i(!1)}}async function u(){c(!0);try{await b.updateGunicornConfig(e,n),t.success("Configuration saved. Restart the app to apply changes.")}catch(f){t.error("Failed to save configuration"),console.error("Failed to save config:",f)}finally{c(!1)}}return a?s.jsx("div",{className:"loading",children:"Loading Gunicorn configuration..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Gunicorn Configuration"}),s.jsx("button",{className:"btn btn-primary",onClick:u,disabled:l,children:l?"Saving...":"Save"})]}),s.jsx("textarea",{className:"code-editor",value:n,onChange:f=>r(f.target.value),spellCheck:!1})]})},ug=({appId:e,appType:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState(null),[l,c]=d.useState(!1),o=t==="django"?[{label:"Run Migrations",cmd:"python manage.py migrate"},{label:"Collect Static",cmd:"python manage.py collectstatic --noinput"},{label:"Create Superuser",cmd:"python manage.py createsuperuser"},{label:"Shell",cmd:"python manage.py shell"},{label:"Check",cmd:"python manage.py check"}]:[{label:"Flask Routes",cmd:"flask routes"},{label:"Flask Shell",cmd:"flask shell"},{label:"DB Upgrade",cmd:"flask db upgrade"},{label:"DB Migrate",cmd:"flask db migrate"}];async function u(f){const h=f||n;if(h.trim()){c(!0),i(null);try{const p=await b.runPythonCommand(e,h);i(p)}catch(p){i({success:!1,stderr:p.message})}finally{c(!1)}}}return s.jsxs("div",{children:[s.jsx("h3",{children:"Run Commands"}),s.jsx("p",{className:"hint",children:"Commands run in the app's virtual environment context."}),s.jsx("div",{className:"quick-commands",children:o.map(({label:f,cmd:h})=>s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>u(h),disabled:l,children:f},h))}),s.jsxs("div",{className:"command-input",children:[s.jsx("input",{type:"text",value:n,onChange:f=>r(f.target.value),placeholder:"Enter command...",onKeyDown:f=>f.key==="Enter"&&u()}),s.jsx("button",{className:"btn btn-primary",onClick:()=>u(),disabled:l,children:l?"Running...":"Run"})]}),a&&s.jsxs("div",{className:`command-output ${a.success?"":"error"}`,children:[a.stdout&&s.jsx("pre",{children:a.stdout}),a.stderr&&s.jsx("pre",{className:"stderr",children:a.stderr}),!a.stdout&&!a.stderr&&s.jsx("pre",{children:a.success?"Command completed successfully":"Command failed"})]})]})},hg=({appId:e})=>{const[t,n]=d.useState([]),[r,a]=d.useState(!0);d.useEffect(()=>{i()},[e]);async function i(){try{const o=await b.getWordPressPlugins(e);n(o.plugins||[])}catch(o){console.error("Failed to load plugins:",o)}finally{a(!1)}}async function l(o){try{await b.activateWordPressPlugin(e,o),i()}catch(u){console.error("Failed to activate plugin:",u)}}async function c(o){try{await b.deactivateWordPressPlugin(e,o),i()}catch(u){console.error("Failed to deactivate plugin:",u)}}return r?s.jsx("div",{className:"loading",children:"Loading plugins..."}):s.jsxs("div",{children:[s.jsx("h3",{children:"WordPress Plugins"}),s.jsx("div",{className:"plugins-list",children:t.map(o=>s.jsxs("div",{className:"plugin-item",children:[s.jsxs("div",{className:"plugin-info",children:[s.jsx("span",{className:"plugin-name",children:o.title||o.name}),s.jsx("span",{className:"plugin-version",children:o.version})]}),s.jsx("div",{className:"plugin-actions",children:o.status==="active"?s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>c(o.name),children:"Deactivate"}):s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>l(o.name),children:"Activate"})})]},o.name))})]})},mg=({appId:e})=>{const[t,n]=d.useState([]),[r,a]=d.useState(!0);d.useEffect(()=>{i()},[e]);async function i(){try{const c=await b.getWordPressThemes(e);n(c.themes||[])}catch(c){console.error("Failed to load themes:",c)}finally{a(!1)}}async function l(c){try{await b.activateWordPressTheme(e,c),i()}catch(o){console.error("Failed to activate theme:",o)}}return r?s.jsx("div",{className:"loading",children:"Loading themes..."}):s.jsxs("div",{children:[s.jsx("h3",{children:"WordPress Themes"}),s.jsx("div",{className:"themes-list",children:t.map(c=>s.jsxs("div",{className:`theme-item ${c.status==="active"?"active":""}`,children:[s.jsxs("div",{className:"theme-info",children:[s.jsx("span",{className:"theme-name",children:c.title||c.name}),s.jsx("span",{className:"theme-version",children:c.version})]}),c.status!=="active"&&s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>l(c.name),children:"Activate"}),c.status==="active"&&s.jsx("span",{className:"active-badge",children:"Active"})]},c.name))})]})},pg=({appId:e})=>{const t=Se(),[n,r]=d.useState([]),[a,i]=d.useState(!0),[l,c]=d.useState(!1);d.useEffect(()=>{o()},[e]);async function o(){try{const h=await b.getWordPressBackups(e);r(h.backups||[])}catch(h){console.error("Failed to load backups:",h)}finally{i(!1)}}async function u(){c(!0);try{await b.createWordPressBackup(e),o()}catch(h){console.error("Failed to create backup:",h)}finally{c(!1)}}async function f(h){if(confirm(`Restore from ${h}? This will overwrite current data.`))try{await b.restoreWordPressBackup(e,h),t.success("Backup restored successfully")}catch(p){t.error("Failed to restore backup"),console.error("Failed to restore backup:",p)}}return a?s.jsx("div",{className:"loading",children:"Loading backups..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Backups"}),s.jsx("button",{className:"btn btn-primary",onClick:u,disabled:l,children:l?"Creating...":"Create Backup"})]}),n.length===0?s.jsx("p",{className:"hint",children:"No backups yet. Create your first backup."}):s.jsx("div",{className:"backups-list",children:n.map(h=>s.jsxs("div",{className:"backup-item",children:[s.jsxs("div",{className:"backup-info",children:[s.jsx("span",{className:"backup-name",children:h.name}),s.jsx("span",{className:"backup-size",children:qh(h.size)}),s.jsx("span",{className:"backup-date",children:new Date(h.created_at).toLocaleString()})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>f(h.name),children:"Restore"})]},h.name))})]})},fg=({app:e})=>{const[t,n]=d.useState(""),[r,a]=d.useState(!0),[i,l]=d.useState("access");d.useEffect(()=>{c()},[e,i]);async function c(){a(!0);try{const o=await b.getAppLogs(e.name,i,200);n(o.content||"No logs available")}catch{n("Failed to load logs")}finally{a(!1)}}return s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Application Logs"}),s.jsxs("div",{className:"log-controls",children:[s.jsxs("select",{value:i,onChange:o=>l(o.target.value),children:[s.jsx("option",{value:"access",children:"Access Log"}),s.jsx("option",{value:"error",children:"Error Log"})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:c,children:"Refresh"})]})]}),s.jsx("pre",{className:"log-viewer",children:r?"Loading...":t})]})},xg=({app:e,onUpdate:t})=>{const n=ns(),[r,a]=d.useState(!1);async function i(){if(confirm(`Delete ${e.name}? This action cannot be undone.`)&&confirm('Are you sure? Type "delete" to confirm.')){a(!0);try{await b.deleteApp(e.id),n("/apps")}catch(l){console.error("Failed to delete app:",l),a(!1)}}}return s.jsxs("div",{children:[s.jsx("h3",{children:"Application Settings"}),s.jsxs("div",{className:"card danger-zone",children:[s.jsx("h4",{children:"Danger Zone"}),s.jsx("p",{children:"Once you delete an application, there is no going back."}),s.jsx("button",{className:"btn btn-danger",onClick:i,disabled:r,children:r?"Deleting...":"Delete Application"})]})]})},vg=({appId:e,appPath:t})=>{const n=Se(),[r,a]=d.useState(null),[i,l]=d.useState(null),[c,o]=d.useState([]),[u,f]=d.useState(!0),[h,p]=d.useState(!1),[v,N]=d.useState(!1),[j,k]=d.useState(null),[m,x]=d.useState({repoUrl:"",branch:"main",autoDeploy:!0,preDeployScript:"",postDeployScript:""});d.useEffect(()=>{g()},[e]);async function g(){try{f(!0);const[w,L]=await Promise.all([b.getDeployConfig(e),b.getDeploymentHistory(e,20)]);if(w.configured){a(w.config),x({repoUrl:w.config.repo_url||"",branch:w.config.branch||"main",autoDeploy:w.config.auto_deploy!==!1,preDeployScript:w.config.pre_deploy_script||"",postDeployScript:w.config.post_deploy_script||""});try{const U=await b.getGitStatus(e);l(U)}catch{}}else a(null);o(L.deployments||[])}catch(w){k(w.message)}finally{f(!1)}}async function y(w){w.preventDefault();try{await b.configureDeployment(e,m.repoUrl,m.branch,m.autoDeploy,m.preDeployScript||null,m.postDeployScript||null),N(!1),g()}catch(L){k(L.message)}}async function S(){if(confirm("Remove deployment configuration? This will not delete the repository files."))try{await b.removeDeployment(e),a(null),l(null),g()}catch(w){k(w.message)}}async function E(w=!1){p(!0),k(null);try{const L=await b.triggerDeploy(e,w);L.success?n.success("Deployment completed successfully!"):k(L.error||"Deployment failed"),g()}catch(L){k(L.message)}finally{p(!1)}}async function T(){p(!0),k(null);try{const w=await b.pullChanges(e);w.success?n.success("Changes pulled successfully!"):k(w.error||"Pull failed"),g()}catch(w){k(w.message)}finally{p(!1)}}function P(w){return new Date(w).toLocaleString()}function O(w){switch(w){case"success":return"badge-success";case"failed":return"badge-danger";case"in_progress":return"badge-warning";default:return"badge-secondary"}}return u?s.jsx("div",{className:"loading",children:"Loading deployment configuration..."}):s.jsxs("div",{className:"deploy-tab",children:[j&&s.jsxs("div",{className:"alert alert-danger",children:[j,s.jsx("button",{onClick:()=>k(null),className:"alert-close",children:"×"})]}),r?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"deploy-header",children:s.jsxs("div",{className:"deploy-status-card",children:[s.jsxs("div",{className:"deploy-repo-info",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"})}),s.jsxs("div",{children:[s.jsx("span",{className:"repo-url",children:r.repo_url}),s.jsxs("span",{className:"repo-branch",children:["Branch: ",r.branch]})]})]}),s.jsxs("div",{className:"deploy-actions",children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:T,disabled:h,children:"Pull Only"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>E(!1),disabled:h,children:h?"Deploying...":"Deploy Now"})]})]})}),s.jsxs("div",{className:"deploy-grid",children:[s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Configuration"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Repository"}),s.jsx("span",{className:"info-value mono",children:r.repo_url})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Branch"}),s.jsx("span",{className:"info-value",children:r.branch})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Auto Deploy"}),s.jsx("span",{className:"info-value",children:r.auto_deploy?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Deploy Count"}),s.jsx("span",{className:"info-value",children:r.deploy_count||0})]}),r.last_deploy&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Last Deploy"}),s.jsx("span",{className:"info-value",children:P(r.last_deploy)})]})]}),s.jsxs("div",{className:"card-actions",children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>N(!0),children:"Edit Configuration"}),s.jsx("button",{className:"btn btn-danger btn-sm",onClick:S,children:"Remove"})]})]}),i&&!i.error&&s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Git Status"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Current Branch"}),s.jsx("span",{className:"info-value",children:i.branch})]}),i.commit&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Commit"}),s.jsx("span",{className:"info-value mono",children:i.commit.short_hash})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Message"}),s.jsx("span",{className:"info-value",children:i.commit.message})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Author"}),s.jsx("span",{className:"info-value",children:i.commit.author})]})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Uncommitted Changes"}),s.jsx("span",{className:"info-value",children:i.has_uncommitted?`${i.changes} file(s)`:"None"})]}),(i.ahead>0||i.behind>0)&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Remote Status"}),s.jsxs("span",{className:"info-value",children:[i.ahead>0&&`${i.ahead} ahead`,i.ahead>0&&i.behind>0&&", ",i.behind>0&&`${i.behind} behind`]})]})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Webhook"}),s.jsx("p",{className:"hint",children:"Use this URL in your Git provider to trigger automatic deployments on push."}),s.jsxs("div",{className:"webhook-url",children:[s.jsxs("code",{children:[window.location.origin,"/api/v1/deploy/webhook/",e,"/",r.webhook_token]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/api/v1/deploy/webhook/${e}/${r.webhook_token}`),n.success("Webhook URL copied to clipboard")},children:"Copy"})]})]})]}),(r.pre_deploy_script||r.post_deploy_script)&&s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Deploy Scripts"}),s.jsxs("div",{className:"scripts-grid",children:[r.pre_deploy_script&&s.jsxs("div",{className:"script-section",children:[s.jsx("h4",{children:"Pre-Deploy Script"}),s.jsx("pre",{className:"script-code",children:r.pre_deploy_script})]}),r.post_deploy_script&&s.jsxs("div",{className:"script-section",children:[s.jsx("h4",{children:"Post-Deploy Script"}),s.jsx("pre",{className:"script-code",children:r.post_deploy_script})]})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("h3",{children:"Deployment History"}),c.length===0?s.jsx("p",{className:"hint",children:"No deployments yet."}):s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Started"}),s.jsx("th",{children:"Completed"}),s.jsx("th",{children:"Details"})]})}),s.jsx("tbody",{children:c.map((w,L)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("span",{className:`badge ${O(w.status)}`,children:w.status})}),s.jsx("td",{children:P(w.started_at)}),s.jsx("td",{children:w.completed_at?P(w.completed_at):"-"}),s.jsxs("td",{children:[w.error&&s.jsx("span",{className:"text-danger",children:w.error}),w.steps&&s.jsxs("span",{className:"text-muted",children:[w.steps.length," step(s)"]})]})]},L))})]})]})]}):s.jsx("div",{className:"deploy-setup",children:s.jsxs("div",{className:"empty-state",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("line",{x1:"1.05",y1:"12",x2:"7",y2:"12"}),s.jsx("line",{x1:"17.01",y1:"12",x2:"22.96",y2:"12"})]}),s.jsx("h3",{children:"Git Deployment Not Configured"}),s.jsx("p",{children:"Connect a Git repository to enable automatic deployments via webhooks or manual triggers."}),s.jsx("button",{className:"btn btn-primary",onClick:()=>N(!0),children:"Configure Deployment"})]})}),v&&s.jsx("div",{className:"modal-overlay",onClick:()=>N(!1),children:s.jsxs("div",{className:"modal",onClick:w=>w.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:r?"Edit Deployment":"Configure Deployment"}),s.jsx("button",{className:"modal-close",onClick:()=>N(!1),children:"×"})]}),s.jsxs("form",{onSubmit:y,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Repository URL *"}),s.jsx("input",{type:"url",value:m.repoUrl,onChange:w=>x({...m,repoUrl:w.target.value}),placeholder:"https://github.com/user/repo.git",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Branch"}),s.jsx("input",{type:"text",value:m.branch,onChange:w=>x({...m,branch:w.target.value}),placeholder:"main"})]}),s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:m.autoDeploy,onChange:w=>x({...m,autoDeploy:w.target.checked})}),s.jsx("span",{children:"Enable Auto Deploy on Webhook"})]})}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Pre-Deploy Script (optional)"}),s.jsx("textarea",{value:m.preDeployScript,onChange:w=>x({...m,preDeployScript:w.target.value}),placeholder:`npm install-npm run build`,rows:3}),s.jsx("span",{className:"form-help",children:"Commands to run before pulling changes"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Post-Deploy Script (optional)"}),s.jsx("textarea",{value:m.postDeployScript,onChange:w=>x({...m,postDeployScript:w.target.value}),placeholder:`npm install-npm run build-systemctl restart myapp`,rows:3}),s.jsx("span",{className:"form-help",children:"Commands to run after pulling changes"})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>N(!1),children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",children:r?"Update Configuration":"Configure Deployment"})]})]})]})})]})};function qh(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const gg=()=>{const[e,t]=d.useState("containers"),[n,r]=d.useState(null),[a,i]=d.useState(!0);d.useEffect(()=>{l()},[]);async function l(){try{const c=await b.getDockerStatus();r(c)}catch(c){r({installed:!1,error:c.message})}finally{i(!1)}}return a?s.jsx("div",{className:"loading",children:"Checking Docker status..."}):n!=null&&n.installed?s.jsxs("div",{children:[s.jsx("header",{className:"top-bar",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Docker"}),s.jsx("div",{className:"subtitle",children:"Container management"})]})}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${e==="containers"?"active":""}`,onClick:()=>t("containers"),children:"Containers"}),s.jsx("button",{className:`tab ${e==="images"?"active":""}`,onClick:()=>t("images"),children:"Images"}),s.jsx("button",{className:`tab ${e==="networks"?"active":""}`,onClick:()=>t("networks"),children:"Networks"}),s.jsx("button",{className:`tab ${e==="volumes"?"active":""}`,onClick:()=>t("volumes"),children:"Volumes"})]}),s.jsxs("div",{className:"tab-content",children:[e==="containers"&&s.jsx(yg,{}),e==="images"&&s.jsx(wg,{}),e==="networks"&&s.jsx(Sg,{}),e==="volumes"&&s.jsx(Pg,{})]})]}):s.jsxs("div",{children:[s.jsx("header",{className:"top-bar",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Docker"}),s.jsx("div",{className:"subtitle",children:"Container management"})]})}),s.jsxs("div",{className:"empty-state",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"48",height:"48",stroke:"currentColor",fill:"none",strokeWidth:"1.5",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),s.jsx("h3",{children:"Docker not available"}),s.jsx("p",{children:(n==null?void 0:n.error)||"Docker is not installed or running on this server."})]})]})},yg=()=>{const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,i]=d.useState(!0),[l,c]=d.useState(!1),[o,u]=d.useState(null),[f,h]=d.useState(null);d.useEffect(()=>{p()},[a]);async function p(){r(!0);try{const j=await b.getContainers(a);t(j.containers||[])}catch(j){console.error("Failed to load containers:",j)}finally{r(!1)}}async function v(j,k){try{if(k==="start")await b.startContainer(j);else if(k==="stop")await b.stopContainer(j);else if(k==="restart")await b.restartContainer(j);else if(k==="remove"){if(!confirm("Remove this container?"))return;await b.removeContainer(j,!0)}p()}catch(m){console.error(`Failed to ${k} container:`,m)}}function N(j){switch(j){case"running":return"status-active";case"exited":return"status-stopped";case"paused":return"status-warning";default:return"status-stopped"}}return n?s.jsx("div",{className:"loading",children:"Loading containers..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("div",{className:"filter-toggle",children:s.jsxs("label",{children:[s.jsx("input",{type:"checkbox",checked:a,onChange:j=>i(j.target.checked)}),"Show stopped containers"]})}),s.jsx("button",{className:"btn btn-primary",onClick:()=>c(!0),children:"Run Container"})]}),e.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No containers"}),s.jsx("p",{children:"Run your first container to get started."})]}):s.jsx("div",{className:"docker-list",children:e.map(j=>s.jsxs("div",{className:"docker-item",children:[s.jsxs("div",{className:"docker-item-info",children:[s.jsx("div",{className:"docker-item-icon",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"})})}),s.jsxs("div",{className:"docker-item-details",children:[s.jsx("h3",{children:j.name}),s.jsxs("div",{className:"docker-item-meta",children:[s.jsx("span",{className:"mono",children:j.id.substring(0,12)}),s.jsx("span",{children:j.image}),j.ports&&s.jsx("span",{children:j.ports})]})]})]}),s.jsx("div",{className:"docker-item-status",children:s.jsxs("span",{className:`status-badge ${N(j.state)}`,children:[s.jsx("span",{className:"status-dot"}),j.state]})}),s.jsx("div",{className:"docker-item-actions",children:j.state==="running"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>u(j),children:"Logs"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>h(j),children:"Exec"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>v(j.id,"restart"),children:"Restart"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>v(j.id,"stop"),children:"Stop"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>v(j.id,"start"),children:"Start"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>v(j.id,"remove"),children:"Remove"})]})})]},j.id))}),l&&s.jsx(jg,{onClose:()=>c(!1),onCreated:p}),o&&s.jsx(Ng,{container:o,onClose:()=>u(null)}),f&&s.jsx(bg,{container:f,onClose:()=>h(null)})]})},jg=({onClose:e,onCreated:t})=>{const[n,r]=d.useState({image:"",name:"",ports:"",volumes:"",env:""}),[a,i]=d.useState(!1),[l,c]=d.useState("");function o(f){r({...n,[f.target.name]:f.target.value})}async function u(f){f.preventDefault(),c(""),i(!0);try{const h={image:n.image,name:n.name||void 0,ports:n.ports?n.ports.split(",").map(p=>p.trim()):[],volumes:n.volumes?n.volumes.split(",").map(p=>p.trim()):[],env:n.env?Object.fromEntries(n.env.split(`-`).filter(p=>p.includes("=")).map(p=>{const[v,...N]=p.split("=");return[v.trim(),N.join("=").trim()]})):{}};await b.runContainer(h),t(),e()}catch(h){c(h.message||"Failed to run container")}finally{i(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Run Container"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),l&&s.jsx("div",{className:"error-message",children:l}),s.jsxs("form",{onSubmit:u,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Image *"}),s.jsx("input",{type:"text",name:"image",value:n.image,onChange:o,placeholder:"nginx:latest",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Container Name"}),s.jsx("input",{type:"text",name:"name",value:n.name,onChange:o,placeholder:"my-container"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Ports (comma-separated)"}),s.jsx("input",{type:"text",name:"ports",value:n.ports,onChange:o,placeholder:"8080:80, 443:443"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Volumes (comma-separated)"}),s.jsx("input",{type:"text",name:"volumes",value:n.volumes,onChange:o,placeholder:"/host/path:/container/path"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Environment Variables (one per line, KEY=value)"}),s.jsx("textarea",{name:"env",value:n.env,onChange:o,placeholder:`NODE_ENV=production-API_KEY=xxx`,rows:4})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:a,children:a?"Running...":"Run Container"})]})]})]})})},Ng=({container:e,onClose:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState(!0);d.useEffect(()=>{l()},[e]);async function l(){try{const c=await b.getContainerLogs(e.id,200);r(c.logs||"No logs available")}catch{r("Failed to load logs")}finally{i(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal modal-lg",onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:["Logs: ",e.name]}),s.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsx("pre",{className:"log-viewer",children:a?"Loading...":n})}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{className:"btn btn-secondary",onClick:l,children:"Refresh"}),s.jsx("button",{className:"btn btn-primary",onClick:t,children:"Close"})]})]})})},bg=({container:e,onClose:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState([]),[l,c]=d.useState(!1),[o,u]=d.useState([]),[f,h]=d.useState(-1),p=qr.useRef(null),v=qr.useRef(null);d.useEffect(()=>{v.current&&v.current.focus()},[]),d.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[a]);async function N(m){if(m.preventDefault(),!n.trim()||l)return;const x=n.trim();i(g=>[...g,{type:"command",text:`$ ${x}`}]),u(g=>[x,...g.slice(0,49)]),h(-1),r(""),c(!0);try{const g=await b.execContainer(e.id,x);g.output&&i(y=>[...y,{type:"output",text:g.output}]),g.error&&i(y=>[...y,{type:"error",text:g.error}]),g.exit_code!==0&&i(y=>[...y,{type:"info",text:`Exit code: ${g.exit_code}`}])}catch(g){i(y=>[...y,{type:"error",text:g.message||"Failed to execute command"}])}finally{c(!1),v.current&&v.current.focus()}}function j(m){if(m.key==="ArrowUp"){if(m.preventDefault(),o.length>0&&f<o.length-1){const x=f+1;h(x),r(o[x])}}else if(m.key==="ArrowDown")if(m.preventDefault(),f>0){const x=f-1;h(x),r(o[x])}else f===0&&(h(-1),r(""))}function k(){i([])}return s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal modal-lg",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:["Exec: ",e.name]}),s.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),s.jsxs("div",{className:"modal-body exec-modal-body",children:[s.jsxs("div",{className:"exec-output",ref:p,children:[a.length===0?s.jsxs("div",{className:"exec-welcome",children:[s.jsxs("p",{children:["Execute commands in container ",s.jsx("code",{children:e.name})]}),s.jsx("p",{className:"text-muted",children:"Type a command and press Enter"})]}):a.map((m,x)=>s.jsx("div",{className:`exec-line exec-${m.type}`,children:s.jsx("pre",{children:m.text})},x)),l&&s.jsxs("div",{className:"exec-line exec-loading",children:[s.jsx("span",{className:"spinner-inline"})," Running..."]})]}),s.jsxs("form",{onSubmit:N,className:"exec-input-form",children:[s.jsx("span",{className:"exec-prompt",children:"$"}),s.jsx("input",{ref:v,type:"text",value:n,onChange:m=>r(m.target.value),onKeyDown:j,placeholder:"Enter command...",className:"exec-input",disabled:l,autoComplete:"off",spellCheck:"false"}),s.jsx("button",{type:"submit",className:"btn btn-primary btn-sm",disabled:l||!n.trim(),children:"Run"})]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{className:"btn btn-secondary",onClick:k,children:"Clear"}),s.jsx("button",{className:"btn btn-primary",onClick:t,children:"Close"})]})]})})},wg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(!0),[i,l]=d.useState(!1);d.useEffect(()=>{c()},[]);async function c(){a(!0);try{const u=await b.getImages();n(u.images||[])}catch(u){console.error("Failed to load images:",u)}finally{a(!1)}}async function o(u){if(confirm("Remove this image?"))try{await b.removeImage(u,!0),e.success("Image removed successfully"),c()}catch(f){console.error("Failed to remove image:",f),e.error("Failed to remove image. It may be in use by a container.")}}return r?s.jsx("div",{className:"loading",children:"Loading images..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Docker Images"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>l(!0),children:"Pull Image"})]}),t.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No images"}),s.jsx("p",{children:"Pull your first image to get started."})]}):s.jsx("div",{className:"docker-list",children:t.map(u=>s.jsxs("div",{className:"docker-item",children:[s.jsxs("div",{className:"docker-item-info",children:[s.jsx("div",{className:"docker-item-icon image-icon",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),s.jsxs("div",{className:"docker-item-details",children:[s.jsxs("h3",{children:[u.repository,":",u.tag]}),s.jsxs("div",{className:"docker-item-meta",children:[s.jsx("span",{className:"mono",children:u.id.substring(0,12)}),s.jsx("span",{children:u.size}),s.jsx("span",{children:u.created})]})]})]}),s.jsx("div",{className:"docker-item-actions",children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>o(u.id),children:"Remove"})})]},u.id))}),i&&s.jsx(kg,{onClose:()=>l(!1),onPulled:c})]})},kg=({onClose:e,onPulled:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState("latest"),[l,c]=d.useState(!1),[o,u]=d.useState("");async function f(h){h.preventDefault(),u(""),c(!0);try{await b.pullImage(n,a),t(),e()}catch(p){u(p.message||"Failed to pull image")}finally{c(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Pull Image"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),o&&s.jsx("div",{className:"error-message",children:o}),s.jsxs("form",{onSubmit:f,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Image Name *"}),s.jsx("input",{type:"text",value:n,onChange:h=>r(h.target.value),placeholder:"nginx, mysql, redis",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Tag"}),s.jsx("input",{type:"text",value:a,onChange:h=>i(h.target.value),placeholder:"latest"})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:l,children:l?"Pulling...":"Pull Image"})]})]})]})})},Sg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(!0),[i,l]=d.useState(!1);d.useEffect(()=>{c()},[]);async function c(){a(!0);try{const f=await b.getNetworks();n(f.networks||[])}catch(f){console.error("Failed to load networks:",f)}finally{a(!1)}}async function o(f){if(confirm("Remove this network?"))try{await b.removeNetwork(f),e.success("Network removed successfully"),c()}catch(h){console.error("Failed to remove network:",h),e.error("Failed to remove network. It may be in use.")}}if(r)return s.jsx("div",{className:"loading",children:"Loading networks..."});const u=["bridge","host","none"];return s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Docker Networks"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>l(!0),children:"Create Network"})]}),s.jsx("div",{className:"docker-list",children:t.map(f=>s.jsxs("div",{className:"docker-item",children:[s.jsxs("div",{className:"docker-item-info",children:[s.jsx("div",{className:"docker-item-icon network-icon",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]})}),s.jsxs("div",{className:"docker-item-details",children:[s.jsx("h3",{children:f.name}),s.jsxs("div",{className:"docker-item-meta",children:[s.jsx("span",{className:"mono",children:f.id.substring(0,12)}),s.jsxs("span",{children:["Driver: ",f.driver]}),s.jsxs("span",{children:["Scope: ",f.scope]})]})]})]}),s.jsx("div",{className:"docker-item-actions",children:!u.includes(f.name)&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>o(f.id),children:"Remove"})})]},f.id))}),i&&s.jsx(Cg,{onClose:()=>l(!1),onCreated:c})]})},Cg=({onClose:e,onCreated:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState("bridge"),[l,c]=d.useState(!1),[o,u]=d.useState("");async function f(h){h.preventDefault(),u(""),c(!0);try{await b.createNetwork(n,a),t(),e()}catch(p){u(p.message||"Failed to create network")}finally{c(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create Network"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),o&&s.jsx("div",{className:"error-message",children:o}),s.jsxs("form",{onSubmit:f,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Network Name *"}),s.jsx("input",{type:"text",value:n,onChange:h=>r(h.target.value),placeholder:"my-network",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Driver"}),s.jsxs("select",{value:a,onChange:h=>i(h.target.value),children:[s.jsx("option",{value:"bridge",children:"bridge"}),s.jsx("option",{value:"overlay",children:"overlay"}),s.jsx("option",{value:"macvlan",children:"macvlan"})]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:l,children:l?"Creating...":"Create Network"})]})]})]})})},Pg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(!0),[i,l]=d.useState(!1);d.useEffect(()=>{c()},[]);async function c(){a(!0);try{const u=await b.getVolumes();n(u.volumes||[])}catch(u){console.error("Failed to load volumes:",u)}finally{a(!1)}}async function o(u){if(confirm("Remove this volume? All data will be lost."))try{await b.removeVolume(u,!0),e.success("Volume removed successfully"),c()}catch(f){console.error("Failed to remove volume:",f),e.error("Failed to remove volume. It may be in use.")}}return r?s.jsx("div",{className:"loading",children:"Loading volumes..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Docker Volumes"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>l(!0),children:"Create Volume"})]}),t.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No volumes"}),s.jsx("p",{children:"Create a volume for persistent data storage."})]}):s.jsx("div",{className:"docker-list",children:t.map(u=>s.jsxs("div",{className:"docker-item",children:[s.jsxs("div",{className:"docker-item-info",children:[s.jsx("div",{className:"docker-item-icon volume-icon",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),s.jsxs("div",{className:"docker-item-details",children:[s.jsx("h3",{children:u.name}),s.jsx("div",{className:"docker-item-meta",children:s.jsxs("span",{children:["Driver: ",u.driver]})})]})]}),s.jsx("div",{className:"docker-item-actions",children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>o(u.name),children:"Remove"})})]},u.name))}),i&&s.jsx(_g,{onClose:()=>l(!1),onCreated:c})]})},_g=({onClose:e,onCreated:t})=>{const[n,r]=d.useState(""),[a,i]=d.useState(!1),[l,c]=d.useState("");async function o(u){u.preventDefault(),c(""),i(!0);try{await b.createVolume(n),t(),e()}catch(f){c(f.message||"Failed to create volume")}finally{i(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:u=>u.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create Volume"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),l&&s.jsx("div",{className:"error-message",children:l}),s.jsxs("form",{onSubmit:o,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Volume Name *"}),s.jsx("input",{type:"text",value:n,onChange:u=>r(u.target.value),placeholder:"my-volume",required:!0})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:a,children:a?"Creating...":"Create Volume"})]})]})]})})},Eg=()=>{var c,o,u,f;const[e,t]=d.useState("mysql"),[n,r]=d.useState(null),[a,i]=d.useState(!0);d.useEffect(()=>{l()},[]);async function l(){try{const h=await b.getDatabaseStatus();r(h),!h.mysql.running&&h.postgresql.running&&t("postgresql")}catch(h){console.error("Failed to get database status:",h)}finally{i(!1)}}return a?s.jsx("div",{className:"loading",children:"Checking database servers..."}):s.jsxs("div",{children:[s.jsxs("header",{className:"top-bar",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Databases"}),s.jsx("div",{className:"subtitle",children:"Manage MySQL and PostgreSQL databases"})]}),s.jsx("div",{className:"top-bar-actions",children:s.jsxs("div",{className:"db-status-indicators",children:[s.jsxs("span",{className:`db-status-indicator ${(c=n==null?void 0:n.mysql)!=null&&c.running?"active":"inactive"}`,children:[s.jsx("span",{className:"status-dot"}),"MySQL"]}),s.jsxs("span",{className:`db-status-indicator ${(o=n==null?void 0:n.postgresql)!=null&&o.running?"active":"inactive"}`,children:[s.jsx("span",{className:"status-dot"}),"PostgreSQL"]})]})})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${e==="mysql"?"active":""}`,onClick:()=>t("mysql"),disabled:!((u=n==null?void 0:n.mysql)!=null&&u.installed),children:"MySQL / MariaDB"}),s.jsx("button",{className:`tab ${e==="postgresql"?"active":""}`,onClick:()=>t("postgresql"),disabled:!((f=n==null?void 0:n.postgresql)!=null&&f.installed),children:"PostgreSQL"}),s.jsx("button",{className:`tab ${e==="backups"?"active":""}`,onClick:()=>t("backups"),children:"Backups"})]}),s.jsxs("div",{className:"tab-content",children:[e==="mysql"&&s.jsx(Tg,{status:n==null?void 0:n.mysql}),e==="postgresql"&&s.jsx(Lg,{status:n==null?void 0:n.postgresql}),e==="backups"&&s.jsx(Dg,{})]})]})},Tg=({status:e})=>{const t=Se(),[n,r]=d.useState([]),[a,i]=d.useState([]),[l,c]=d.useState(!0),[o,u]=d.useState("databases"),[f,h]=d.useState(!1),[p,v]=d.useState(!1),[N,j]=d.useState(null);d.useEffect(()=>{e!=null&&e.running?k():c(!1)},[e]);async function k(){c(!0);try{const[y,S]=await Promise.all([b.getMySQLDatabases(),b.getMySQLUsers()]);r(y.databases||[]),i(S.users||[])}catch(y){console.error("Failed to load MySQL data:",y)}finally{c(!1)}}async function m(y){if(confirm(`Drop database "${y}"? This cannot be undone!`))try{await b.dropMySQLDatabase(y),t.success(`Database "${y}" dropped successfully`),k()}catch(S){console.error("Failed to drop database:",S),t.error("Failed to drop database")}}async function x(y){try{const S=await b.backupMySQLDatabase(y);S.success&&t.success(`Backup created: ${S.backup_path}`)}catch(S){console.error("Failed to backup database:",S),t.error("Failed to create backup")}}async function g(y,S){if(confirm(`Drop user "${y}"@"${S}"?`))try{await b.dropMySQLUser(y,S),t.success(`User "${y}" dropped successfully`),k()}catch(E){console.error("Failed to drop user:",E),t.error("Failed to drop user")}}return e!=null&&e.running?l?s.jsx("div",{className:"loading",children:"Loading MySQL data..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsxs("div",{className:"view-toggle",children:[s.jsxs("button",{className:`btn btn-sm ${o==="databases"?"btn-primary":"btn-secondary"}`,onClick:()=>u("databases"),children:["Databases (",n.length,")"]}),s.jsxs("button",{className:`btn btn-sm ${o==="users"?"btn-primary":"btn-secondary"}`,onClick:()=>u("users"),children:["Users (",a.length,")"]})]}),o==="databases"?s.jsx("button",{className:"btn btn-primary",onClick:()=>h(!0),children:"Create Database"}):s.jsx("button",{className:"btn btn-primary",onClick:()=>v(!0),children:"Create User"})]}),o==="databases"?n.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No databases"}),s.jsx("p",{children:"Create your first MySQL database."})]}):s.jsx("div",{className:"db-list",children:n.map(y=>s.jsxs("div",{className:"db-item",children:[s.jsxs("div",{className:"db-item-info",children:[s.jsx("div",{className:"db-item-icon mysql",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),s.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}),s.jsxs("div",{className:"db-item-details",children:[s.jsx("h3",{children:y.name}),s.jsxs("div",{className:"db-item-meta",children:[s.jsx("span",{children:_o(y.size)}),s.jsx("span",{children:"MySQL"})]})]})]}),s.jsxs("div",{className:"db-item-actions",children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(y),children:"Tables"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(y.name),children:"Backup"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>m(y.name),children:"Drop"})]})]},y.name))}):a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No users"}),s.jsx("p",{children:"Create your first MySQL user."})]}):s.jsx("div",{className:"db-list",children:a.map(y=>s.jsxs("div",{className:"db-item",children:[s.jsxs("div",{className:"db-item-info",children:[s.jsx("div",{className:"db-item-icon user",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}),s.jsxs("div",{className:"db-item-details",children:[s.jsx("h3",{children:y.user}),s.jsx("div",{className:"db-item-meta",children:s.jsxs("span",{children:["Host: ",y.host]})})]})]}),s.jsx("div",{className:"db-item-actions",children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(y.user,y.host),children:"Drop"})})]},`${y.user}@${y.host}`))}),f&&s.jsx(Fg,{onClose:()=>h(!1),onCreated:k}),p&&s.jsx(Mg,{databases:n,onClose:()=>v(!1),onCreated:k}),N&&s.jsx(Uh,{database:N,dbType:"mysql",onClose:()=>j(null)})]}):s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"MySQL is not running"}),s.jsx("p",{children:"Start the MySQL server to manage databases."})]})},Lg=({status:e})=>{const t=Se(),[n,r]=d.useState([]),[a,i]=d.useState([]),[l,c]=d.useState(!0),[o,u]=d.useState("databases"),[f,h]=d.useState(!1),[p,v]=d.useState(!1),[N,j]=d.useState(null);d.useEffect(()=>{e!=null&&e.running?k():c(!1)},[e]);async function k(){c(!0);try{const[y,S]=await Promise.all([b.getPostgreSQLDatabases(),b.getPostgreSQLUsers()]);r(y.databases||[]),i(S.users||[])}catch(y){console.error("Failed to load PostgreSQL data:",y)}finally{c(!1)}}async function m(y){if(confirm(`Drop database "${y}"? This cannot be undone!`))try{await b.dropPostgreSQLDatabase(y),t.success(`Database "${y}" dropped successfully`),k()}catch(S){console.error("Failed to drop database:",S),t.error("Failed to drop database")}}async function x(y){try{const S=await b.backupPostgreSQLDatabase(y);S.success&&t.success(`Backup created: ${S.backup_path}`)}catch(S){console.error("Failed to backup database:",S),t.error("Failed to create backup")}}async function g(y){if(confirm(`Drop user "${y}"?`))try{await b.dropPostgreSQLUser(y),t.success(`User "${y}" dropped successfully`),k()}catch(S){console.error("Failed to drop user:",S),t.error("Failed to drop user")}}return e!=null&&e.running?l?s.jsx("div",{className:"loading",children:"Loading PostgreSQL data..."}):s.jsxs("div",{children:[s.jsxs("div",{className:"section-header",children:[s.jsxs("div",{className:"view-toggle",children:[s.jsxs("button",{className:`btn btn-sm ${o==="databases"?"btn-primary":"btn-secondary"}`,onClick:()=>u("databases"),children:["Databases (",n.length,")"]}),s.jsxs("button",{className:`btn btn-sm ${o==="users"?"btn-primary":"btn-secondary"}`,onClick:()=>u("users"),children:["Users (",a.length,")"]})]}),o==="databases"?s.jsx("button",{className:"btn btn-primary",onClick:()=>h(!0),children:"Create Database"}):s.jsx("button",{className:"btn btn-primary",onClick:()=>v(!0),children:"Create User"})]}),o==="databases"?n.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No databases"}),s.jsx("p",{children:"Create your first PostgreSQL database."})]}):s.jsx("div",{className:"db-list",children:n.map(y=>s.jsxs("div",{className:"db-item",children:[s.jsxs("div",{className:"db-item-info",children:[s.jsx("div",{className:"db-item-icon postgresql",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),s.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}),s.jsxs("div",{className:"db-item-details",children:[s.jsx("h3",{children:y.name}),s.jsxs("div",{className:"db-item-meta",children:[s.jsx("span",{children:_o(y.size)}),s.jsx("span",{children:"PostgreSQL"})]})]})]}),s.jsxs("div",{className:"db-item-actions",children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(y),children:"Tables"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(y.name),children:"Backup"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>m(y.name),children:"Drop"})]})]},y.name))}):a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No users"}),s.jsx("p",{children:"Create your first PostgreSQL user."})]}):s.jsx("div",{className:"db-list",children:a.map(y=>s.jsxs("div",{className:"db-item",children:[s.jsxs("div",{className:"db-item-info",children:[s.jsx("div",{className:"db-item-icon user",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}),s.jsxs("div",{className:"db-item-details",children:[s.jsx("h3",{children:y.user}),s.jsx("div",{className:"db-item-meta",children:s.jsx("span",{children:"PostgreSQL User"})})]})]}),s.jsx("div",{className:"db-item-actions",children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(y.user),children:"Drop"})})]},y.user))}),f&&s.jsx(Ag,{onClose:()=>h(!1),onCreated:k}),p&&s.jsx($g,{databases:n,onClose:()=>v(!1),onCreated:k}),N&&s.jsx(Uh,{database:N,dbType:"postgresql",onClose:()=>j(null)})]}):s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"PostgreSQL is not running"}),s.jsx("p",{children:"Start the PostgreSQL server to manage databases."})]})},Dg=()=>{const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,i]=d.useState("all");d.useEffect(()=>{l()},[a]);async function l(){r(!0);try{const o=a==="all"?null:a,u=await b.getDatabaseBackups(o);t(u.backups||[])}catch(o){console.error("Failed to load backups:",o)}finally{r(!1)}}async function c(o){if(confirm("Delete this backup?"))try{await b.deleteDatabaseBackup(o),l()}catch(u){console.error("Failed to delete backup:",u)}}return n?s.jsx("div",{className:"loading",children:"Loading backups..."}):s.jsxs("div",{children:[s.jsx("div",{className:"section-header",children:s.jsxs("div",{className:"view-toggle",children:[s.jsx("button",{className:`btn btn-sm ${a==="all"?"btn-primary":"btn-secondary"}`,onClick:()=>i("all"),children:"All"}),s.jsx("button",{className:`btn btn-sm ${a==="mysql"?"btn-primary":"btn-secondary"}`,onClick:()=>i("mysql"),children:"MySQL"}),s.jsx("button",{className:`btn btn-sm ${a==="postgresql"?"btn-primary":"btn-secondary"}`,onClick:()=>i("postgresql"),children:"PostgreSQL"})]})}),e.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("h3",{children:"No backups"}),s.jsx("p",{children:"Database backups will appear here."})]}):s.jsx("div",{className:"db-list",children:e.map(o=>s.jsxs("div",{className:"db-item",children:[s.jsxs("div",{className:"db-item-info",children:[s.jsx("div",{className:`db-item-icon ${o.type}`,children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeWidth:"2",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),s.jsxs("div",{className:"db-item-details",children:[s.jsx("h3",{children:o.database}),s.jsxs("div",{className:"db-item-meta",children:[s.jsx("span",{className:"mono",children:o.filename}),s.jsx("span",{children:_o(o.size)}),s.jsx("span",{children:new Date(o.created_at).toLocaleString()})]})]})]}),s.jsxs("div",{className:"db-item-actions",children:[s.jsx("span",{className:`db-type-badge ${o.type}`,children:o.type==="mysql"?"MySQL":"PostgreSQL"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>c(o.filename),children:"Delete"})]})]},o.filename))})]})},Fg=({onClose:e,onCreated:t})=>{const[n,r]=d.useState({name:"",charset:"utf8mb4",collation:"utf8mb4_unicode_ci",create_user:!0,user_password:""}),[a,i]=d.useState(!1),[l,c]=d.useState(""),[o,u]=d.useState(null);async function f(h){h.preventDefault(),c(""),i(!0);try{const p=await b.createMySQLDatabase(n);p.success&&(p.password?u({database:n.name,user:p.user,password:p.password}):(t(),e()))}catch(p){c(p.message||"Failed to create database")}finally{i(!1)}}return o?s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Database Created"}),s.jsx("button",{className:"modal-close",onClick:()=>{t(),e()},children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"credentials-box",children:[s.jsx("p",{children:"Save these credentials - the password won't be shown again!"}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Database:"}),s.jsx("code",{children:o.database})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Username:"}),s.jsx("code",{children:o.user})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Password:"}),s.jsx("code",{children:o.password})]})]})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{className:"btn btn-primary",onClick:()=>{t(),e()},children:"Done"})})]})}):s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create MySQL Database"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),l&&s.jsx("div",{className:"error-message",children:l}),s.jsxs("form",{onSubmit:f,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Name *"}),s.jsx("input",{type:"text",value:n.name,onChange:h=>r({...n,name:h.target.value}),placeholder:"my_database",required:!0,pattern:"[a-zA-Z0-9_]+"})]}),s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Character Set"}),s.jsxs("select",{value:n.charset,onChange:h=>r({...n,charset:h.target.value}),children:[s.jsx("option",{value:"utf8mb4",children:"utf8mb4"}),s.jsx("option",{value:"utf8",children:"utf8"}),s.jsx("option",{value:"latin1",children:"latin1"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Collation"}),s.jsxs("select",{value:n.collation,onChange:h=>r({...n,collation:h.target.value}),children:[s.jsx("option",{value:"utf8mb4_unicode_ci",children:"utf8mb4_unicode_ci"}),s.jsx("option",{value:"utf8mb4_general_ci",children:"utf8mb4_general_ci"}),s.jsx("option",{value:"utf8_general_ci",children:"utf8_general_ci"})]})]})]}),s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:n.create_user,onChange:h=>r({...n,create_user:h.target.checked})}),"Create user with same name and full privileges"]})}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:a,children:a?"Creating...":"Create Database"})]})]})]})})},Mg=({databases:e,onClose:t,onCreated:n})=>{const[r,a]=d.useState({username:"",password:"",host:"localhost",database:"",privileges:"ALL"}),[i,l]=d.useState(!1),[c,o]=d.useState(""),[u,f]=d.useState(null);async function h(){try{const v=await b.generateDatabasePassword();a({...r,password:v.password})}catch(v){console.error("Failed to generate password:",v)}}async function p(v){v.preventDefault(),o(""),l(!0);try{const N=await b.createMySQLUser(r);N.success&&f({username:r.username,password:N.password,host:r.host})}catch(N){o(N.message||"Failed to create user")}finally{l(!1)}}return u?s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal",onClick:v=>v.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"User Created"}),s.jsx("button",{className:"modal-close",onClick:()=>{n(),t()},children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"credentials-box",children:[s.jsx("p",{children:"Save these credentials!"}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Username:"}),s.jsx("code",{children:u.username})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Password:"}),s.jsx("code",{children:u.password})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Host:"}),s.jsx("code",{children:u.host})]})]})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{className:"btn btn-primary",onClick:()=>{n(),t()},children:"Done"})})]})}):s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal",onClick:v=>v.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create MySQL User"}),s.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),c&&s.jsx("div",{className:"error-message",children:c}),s.jsxs("form",{onSubmit:p,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Username *"}),s.jsx("input",{type:"text",value:r.username,onChange:v=>a({...r,username:v.target.value}),placeholder:"db_user",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Password"}),s.jsxs("div",{className:"input-with-button",children:[s.jsx("input",{type:"text",value:r.password,onChange:v=>a({...r,password:v.target.value}),placeholder:"Leave empty to auto-generate"}),s.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:h,children:"Generate"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Host"}),s.jsxs("select",{value:r.host,onChange:v=>a({...r,host:v.target.value}),children:[s.jsx("option",{value:"localhost",children:"localhost"}),s.jsx("option",{value:"%",children:"% (any host)"}),s.jsx("option",{value:"127.0.0.1",children:"127.0.0.1"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Grant privileges on database"}),s.jsxs("select",{value:r.database,onChange:v=>a({...r,database:v.target.value}),children:[s.jsx("option",{value:"",children:"-- None --"}),e.map(v=>s.jsx("option",{value:v.name,children:v.name},v.name))]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:i,children:i?"Creating...":"Create User"})]})]})]})})},Ag=({onClose:e,onCreated:t})=>{const[n,r]=d.useState({name:"",encoding:"UTF8",create_user:!0}),[a,i]=d.useState(!1),[l,c]=d.useState(""),[o,u]=d.useState(null);async function f(h){h.preventDefault(),c(""),i(!0);try{const p=await b.createPostgreSQLDatabase(n);p.success&&(p.password?u({database:n.name,user:p.user,password:p.password}):(t(),e()))}catch(p){c(p.message||"Failed to create database")}finally{i(!1)}}return o?s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Database Created"}),s.jsx("button",{className:"modal-close",onClick:()=>{t(),e()},children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"credentials-box",children:[s.jsx("p",{children:"Save these credentials!"}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Database:"}),s.jsx("code",{children:o.database})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Username:"}),s.jsx("code",{children:o.user})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Password:"}),s.jsx("code",{children:o.password})]})]})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{className:"btn btn-primary",onClick:()=>{t(),e()},children:"Done"})})]})}):s.jsx("div",{className:"modal-overlay",onClick:e,children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create PostgreSQL Database"}),s.jsx("button",{className:"modal-close",onClick:e,children:"×"})]}),l&&s.jsx("div",{className:"error-message",children:l}),s.jsxs("form",{onSubmit:f,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Name *"}),s.jsx("input",{type:"text",value:n.name,onChange:h=>r({...n,name:h.target.value}),placeholder:"my_database",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Encoding"}),s.jsxs("select",{value:n.encoding,onChange:h=>r({...n,encoding:h.target.value}),children:[s.jsx("option",{value:"UTF8",children:"UTF8"}),s.jsx("option",{value:"LATIN1",children:"LATIN1"}),s.jsx("option",{value:"SQL_ASCII",children:"SQL_ASCII"})]})]}),s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:n.create_user,onChange:h=>r({...n,create_user:h.target.checked})}),"Create user with same name and full privileges"]})}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:e,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:a,children:a?"Creating...":"Create Database"})]})]})]})})},$g=({databases:e,onClose:t,onCreated:n})=>{const[r,a]=d.useState({username:"",password:"",database:""}),[i,l]=d.useState(!1),[c,o]=d.useState(""),[u,f]=d.useState(null);async function h(){try{const v=await b.generateDatabasePassword();a({...r,password:v.password})}catch(v){console.error("Failed to generate password:",v)}}async function p(v){v.preventDefault(),o(""),l(!0);try{const N=await b.createPostgreSQLUser(r);N.success&&f({username:r.username,password:N.password})}catch(N){o(N.message||"Failed to create user")}finally{l(!1)}}return u?s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal",onClick:v=>v.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"User Created"}),s.jsx("button",{className:"modal-close",onClick:()=>{n(),t()},children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"credentials-box",children:[s.jsx("p",{children:"Save these credentials!"}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Username:"}),s.jsx("code",{children:u.username})]}),s.jsxs("div",{className:"credential-item",children:[s.jsx("label",{children:"Password:"}),s.jsx("code",{children:u.password})]})]})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{className:"btn btn-primary",onClick:()=>{n(),t()},children:"Done"})})]})}):s.jsx("div",{className:"modal-overlay",onClick:t,children:s.jsxs("div",{className:"modal",onClick:v=>v.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create PostgreSQL User"}),s.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),c&&s.jsx("div",{className:"error-message",children:c}),s.jsxs("form",{onSubmit:p,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Username *"}),s.jsx("input",{type:"text",value:r.username,onChange:v=>a({...r,username:v.target.value}),placeholder:"db_user",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Password"}),s.jsxs("div",{className:"input-with-button",children:[s.jsx("input",{type:"text",value:r.password,onChange:v=>a({...r,password:v.target.value}),placeholder:"Leave empty to auto-generate"}),s.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:h,children:"Generate"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Grant privileges on database"}),s.jsxs("select",{value:r.database,onChange:v=>a({...r,database:v.target.value}),children:[s.jsx("option",{value:"",children:"-- None --"}),e.map(v=>s.jsx("option",{value:v.name,children:v.name},v.name))]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:t,children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:i,children:i?"Creating...":"Create User"})]})]})]})})},Uh=({database:e,dbType:t,onClose:n})=>{const[r,a]=d.useState([]),[i,l]=d.useState(!0);d.useEffect(()=>{c()},[e,t]);async function c(){try{let o;t==="mysql"?o=await b.getMySQLTables(e.name):o=await b.getPostgreSQLTables(e.name),a(o.tables||[])}catch(o){console.error("Failed to load tables:",o)}finally{l(!1)}}return s.jsx("div",{className:"modal-overlay",onClick:n,children:s.jsxs("div",{className:"modal",onClick:o=>o.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:["Tables in ",e.name]}),s.jsx("button",{className:"modal-close",onClick:n,children:"×"})]}),s.jsx("div",{className:"modal-body",children:i?s.jsx("div",{className:"loading",children:"Loading tables..."}):r.length===0?s.jsx("p",{className:"hint",children:"No tables in this database."}):s.jsx("div",{className:"tables-list",children:r.map(o=>s.jsxs("div",{className:"table-item",children:[s.jsx("span",{className:"table-name",children:o.name}),s.jsxs("span",{className:"table-rows",children:[o.rows.toLocaleString()," rows"]})]},o.name))})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{className:"btn btn-primary",onClick:n,children:"Close"})})]})})};function _o(e){if(!e||e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const Rg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState([]),[i,l]=d.useState(null),[c,o]=d.useState(!0),[u,f]=d.useState(""),[h,p]=d.useState(!1),[v,N]=d.useState(!1),[j,k]=d.useState(null),[m,x]=d.useState(""),[g,y]=d.useState(""),[S,E]=d.useState(!1),[T,P]=d.useState(""),[O,w]=d.useState(!1);d.useEffect(()=>{L()},[]);async function L(){try{o(!0);const[_,I,Q]=await Promise.all([b.getDomains(),b.getApps(),b.getDomainsSslStatus().catch(()=>null)]);n(_.domains||[]),a(I.apps||[]),l(Q)}catch(_){f("Failed to load data"),console.error(_)}finally{o(!1)}}async function U(_){if(_.preventDefault(),!(!m||!g))try{w(!0),await b.createDomain({name:m,application_id:parseInt(g),is_primary:S}),p(!1),x(""),y(""),E(!1),L()}catch(I){f(I.message)}finally{w(!1)}}async function V(_){if(confirm(`Are you sure you want to delete ${_.name}?`))try{await b.deleteDomain(_.id),L()}catch(I){f(I.message)}}async function H(_){if(_.preventDefault(),!(!j||!T))try{w(!0),await b.enableSsl(j.id,T),N(!1),P(""),k(null),L()}catch(I){f(I.message)}finally{w(!1)}}async function B(_){if(confirm(`Disable SSL for ${_.name}?`))try{await b.disableSsl(_.id),L()}catch(I){f(I.message)}}async function z(_){try{w(!0),await b.renewDomainSsl(_.id),L()}catch(I){f(I.message)}finally{w(!1)}}async function J(_){try{const I=await b.verifyDomain(_.id);I.verified?e.success(`Domain verified! IP: ${I.ip_address}`):e.error(`Domain verification failed: ${I.error}`)}catch(I){f(I.message)}}function R(_){const I=r.find(Q=>Q.id===_);return I?I.name:"Unknown"}return c?s.jsx("div",{className:"loading",children:"Loading domains..."}):s.jsxs("div",{children:[s.jsxs("header",{className:"top-bar",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Domains & SSL"}),s.jsx("p",{className:"subtitle",children:"Manage your domains and SSL certificates"})]}),s.jsxs("div",{className:"top-bar-actions",children:[s.jsxs("button",{className:"btn btn-secondary",onClick:L,children:[s.jsx(xl,{size:16}),"Refresh"]}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>p(!0),children:[s.jsx(pa,{size:16}),"Add Domain"]})]})]}),u&&s.jsxs("div",{className:"error-banner",children:[u,s.jsx("button",{onClick:()=>f(""),style:{float:"right",background:"none",border:"none",cursor:"pointer"},children:"×"})]}),i&&s.jsxs("div",{className:"ssl-status-bar",children:[s.jsxs("div",{className:"ssl-status-item",children:[s.jsx("div",{className:`ssl-status-icon ${i.certbot_installed?"active":"inactive"}`,children:i.certbot_installed?s.jsx(br,{size:24}):s.jsx(Qx,{size:24})}),s.jsxs("div",{className:"ssl-status-info",children:[s.jsx("h4",{children:"Certbot"}),s.jsx("span",{children:i.certbot_installed?"Installed":"Not Installed"})]})]}),s.jsxs("div",{className:"ssl-status-item",children:[s.jsx("div",{className:"ssl-status-icon active",children:s.jsx(fi,{size:24})}),s.jsxs("div",{className:"ssl-status-info",children:[s.jsx("h4",{children:"Certificates"}),s.jsxs("span",{children:[i.total_certificates," active"]})]})]})]}),s.jsx("h2",{className:"section-title",children:"Domains"}),t.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx(Pn,{size:48}),s.jsx("h3",{children:"No domains configured"}),s.jsx("p",{children:"Add a domain to your application to get started."}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>p(!0),children:[s.jsx(pa,{size:16}),"Add Domain"]})]}):s.jsx("div",{className:"domain-list",children:t.map(_=>s.jsxs("div",{className:"domain-item",children:[s.jsxs("div",{className:"domain-item-info",children:[s.jsx("div",{className:`domain-item-icon ${_.ssl_enabled?"ssl":""}`,children:_.ssl_enabled?s.jsx(br,{size:20}):s.jsx(Pn,{size:20})}),s.jsxs("div",{className:"domain-item-details",children:[s.jsxs("h3",{children:[_.name,_.is_primary&&s.jsx("span",{className:"primary-badge",children:"Primary"})]}),s.jsxs("div",{className:"domain-item-meta",children:[s.jsxs("span",{className:"app-link",children:[s.jsx(Ch,{size:12}),R(_.application_id)]}),_.ssl_enabled&&s.jsxs("span",{className:"ssl-badge",children:[s.jsx(fi,{size:12}),"SSL Active"]})]})]})]}),s.jsxs("div",{className:"domain-item-actions",children:[s.jsxs("a",{href:`${_.ssl_enabled?"https":"http"}://${_.name}`,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm",children:[s.jsx(Ux,{size:14}),"Visit"]}),s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>J(_),children:[s.jsx(Wx,{size:14}),"Verify DNS"]}),_.ssl_enabled?s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>z(_),disabled:O,children:[s.jsx(xl,{size:14}),"Renew SSL"]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>B(_),children:s.jsx(Vx,{size:14})})]}):s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>{k(_),N(!0)},children:[s.jsx(fi,{size:14}),"Enable SSL"]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>V(_),children:s.jsx(Kx,{size:14})})]})]},_.id))}),i&&i.certificates&&i.certificates.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"section-title",style:{marginTop:"40px"},children:"SSL Certificates"}),s.jsx("div",{className:"cert-list",children:i.certificates.map((_,I)=>{var Q;return s.jsxs("div",{className:"cert-item",children:[s.jsxs("div",{className:"cert-item-info",children:[s.jsx("div",{className:"cert-item-icon",children:s.jsx(br,{size:20})}),s.jsxs("div",{className:"cert-item-details",children:[s.jsx("h3",{children:_.name}),s.jsxs("div",{className:"cert-item-meta",children:[s.jsxs("span",{children:[s.jsx(Pn,{size:12}),(Q=_.domains)==null?void 0:Q.join(", ")]}),_.expiry&&s.jsxs("span",{className:_.expiry_valid?"valid":"expiring",children:[s.jsx(Ox,{size:12}),"Expires: ",_.expiry]})]})]})]}),s.jsx("div",{className:"cert-status",children:_.expiry_valid?s.jsxs("span",{className:"status-badge status-active",children:[s.jsx(Sh,{size:14}),"Valid"]}):s.jsxs("span",{className:"status-badge status-warning",children:[s.jsx(Aa,{size:14}),"Expiring Soon"]})})]},I)})})]}),h&&s.jsx("div",{className:"modal-overlay",onClick:()=>p(!1),children:s.jsxs("div",{className:"modal",onClick:_=>_.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Add Domain"}),s.jsx("button",{className:"modal-close",onClick:()=>p(!1),children:"×"})]}),s.jsxs("form",{onSubmit:U,children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Domain Name"}),s.jsx("input",{type:"text",placeholder:"example.com",value:m,onChange:_=>x(_.target.value),required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Application"}),s.jsxs("select",{value:g,onChange:_=>y(_.target.value),required:!0,children:[s.jsx("option",{value:"",children:"Select an application"}),r.map(_=>s.jsx("option",{value:_.id,children:_.name},_.id))]})]}),s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:S,onChange:_=>E(_.target.checked)}),"Set as primary domain"]})}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>p(!1),children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:O,children:O?"Adding...":"Add Domain"})]})]})]})}),v&&j&&s.jsx("div",{className:"modal-overlay",onClick:()=>N(!1),children:s.jsxs("div",{className:"modal",onClick:_=>_.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Enable SSL Certificate"}),s.jsx("button",{className:"modal-close",onClick:()=>N(!1),children:"×"})]}),s.jsxs("form",{onSubmit:H,children:[s.jsxs("div",{className:"ssl-info-box",children:[s.jsx(br,{size:32}),s.jsxs("div",{children:[s.jsx("h4",{children:"Free SSL from Let's Encrypt"}),s.jsxs("p",{children:["A free SSL certificate will be obtained for ",s.jsx("strong",{children:j.name})]})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Email Address"}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:T,onChange:_=>P(_.target.value),required:!0}),s.jsx("p",{className:"hint",children:"Required for certificate expiration notifications"})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>N(!1),children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:O,children:O?"Obtaining Certificate...":"Enable SSL"})]})]})]})})]})},Og=()=>{const e=Se(),[t,n]=d.useState(null),[r,a]=d.useState(null),[i,l]=d.useState(null),[c,o]=d.useState([]),[u,f]=d.useState(!0),[h,p]=d.useState(null),[v,N]=d.useState("overview"),[j,k]=d.useState({enabled:!1,check_interval:60,alert_email:"",alert_webhook:""}),[m,x]=d.useState({cpu_percent:90,memory_percent:90,disk_percent:90,load_average:5}),[g,y]=d.useState(""),[S,E]=d.useState("");d.useEffect(()=>{T()},[]);const T=async()=>{try{f(!0);const[B,z,J,R]=await Promise.all([b.getMonitoringStatus(),b.getMonitoringConfig(),b.getMonitoringThresholds(),b.getAlertHistory(50)]);n(B),a(z),l(J.thresholds),o(R.alerts||[]),z&&k({enabled:z.enabled||!1,check_interval:z.check_interval||60,alert_email:z.alert_email||"",alert_webhook:z.alert_webhook||""}),J.thresholds&&x(J.thresholds)}catch(B){p(B.message)}finally{f(!1)}},P=async()=>{try{t!=null&&t.monitoring_active?await b.stopMonitoring():await b.startMonitoring(),T()}catch(B){p(B.message)}},O=async B=>{B.preventDefault();try{await b.updateMonitoringConfig(j),T()}catch(z){p(z.message)}},w=async B=>{B.preventDefault();try{await b.updateMonitoringThresholds(m),T()}catch(z){p(z.message)}},L=async()=>{try{await b.testEmailAlert(g||j.alert_email),e.success("Test email sent successfully")}catch(B){e.error(B.message)}},U=async()=>{try{await b.testWebhookAlert(S||j.alert_webhook),e.success("Test webhook sent successfully")}catch(B){e.error(B.message)}},V=B=>{switch(B){case"critical":return"badge-danger";case"warning":return"badge-warning";case"info":return"badge-info";default:return"badge-secondary"}},H=B=>new Date(B).toLocaleString();return u?s.jsx("div",{className:"page",children:s.jsx("div",{className:"loading",children:"Loading monitoring data..."})}):s.jsxs("div",{className:"page monitoring-page",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Monitoring & Alerts"}),s.jsx("p",{className:"page-subtitle",children:"System monitoring and alert configuration"})]}),s.jsx("div",{className:"page-actions",children:s.jsx("button",{className:`btn ${t!=null&&t.monitoring_active?"btn-danger":"btn-primary"}`,onClick:P,children:t!=null&&t.monitoring_active?s.jsxs(s.Fragment,{children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),s.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}),"Stop Monitoring"]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Start Monitoring"]})})})]}),h&&s.jsxs("div",{className:"alert alert-danger",children:[h,s.jsx("button",{onClick:()=>p(null),className:"alert-close",children:"×"})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${v==="overview"?"active":""}`,onClick:()=>N("overview"),children:"Overview"}),s.jsx("button",{className:`tab ${v==="alerts"?"active":""}`,onClick:()=>N("alerts"),children:"Alert History"}),s.jsx("button",{className:`tab ${v==="config"?"active":""}`,onClick:()=>N("config"),children:"Configuration"}),s.jsx("button",{className:`tab ${v==="thresholds"?"active":""}`,onClick:()=>N("thresholds"),children:"Thresholds"})]}),v==="overview"&&s.jsxs("div",{className:"monitoring-overview",children:[s.jsxs("div",{className:"stats-grid",children:[s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon status",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:s.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Monitoring Status"}),s.jsx("span",{className:`stat-value ${t!=null&&t.monitoring_active?"text-success":"text-muted"}`,children:t!=null&&t.monitoring_active?"Active":"Inactive"})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon alerts",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Recent Alerts"}),s.jsx("span",{className:"stat-value",children:c.length})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon interval",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Check Interval"}),s.jsxs("span",{className:"stat-value",children:[(r==null?void 0:r.check_interval)||60,"s"]})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon notifications",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),s.jsx("polyline",{points:"22,6 12,13 2,6"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Notifications"}),s.jsxs("span",{className:"stat-value",children:[r!=null&&r.alert_email?"Email":"",r!=null&&r.alert_email&&(r!=null&&r.alert_webhook)?" + ":"",r!=null&&r.alert_webhook?"Webhook":"",!(r!=null&&r.alert_email)&&!(r!=null&&r.alert_webhook)?"None":""]})]})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-header",children:s.jsx("h3",{children:"Current Thresholds"})}),s.jsx("div",{className:"card-body",children:s.jsxs("div",{className:"threshold-grid",children:[s.jsxs("div",{className:"threshold-item",children:[s.jsx("span",{className:"threshold-label",children:"CPU Usage"}),s.jsxs("span",{className:"threshold-value",children:[(i==null?void 0:i.cpu_percent)||90,"%"]})]}),s.jsxs("div",{className:"threshold-item",children:[s.jsx("span",{className:"threshold-label",children:"Memory Usage"}),s.jsxs("span",{className:"threshold-value",children:[(i==null?void 0:i.memory_percent)||90,"%"]})]}),s.jsxs("div",{className:"threshold-item",children:[s.jsx("span",{className:"threshold-label",children:"Disk Usage"}),s.jsxs("span",{className:"threshold-value",children:[(i==null?void 0:i.disk_percent)||90,"%"]})]}),s.jsxs("div",{className:"threshold-item",children:[s.jsx("span",{className:"threshold-label",children:"Load Average"}),s.jsx("span",{className:"threshold-value",children:(i==null?void 0:i.load_average)||5})]})]})})]}),c.length>0&&s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-header",children:s.jsx("h3",{children:"Recent Alerts"})}),s.jsx("div",{className:"card-body",children:s.jsx("div",{className:"alert-list",children:c.slice(0,5).map((B,z)=>s.jsxs("div",{className:"alert-item",children:[s.jsx("span",{className:`badge ${V(B.severity)}`,children:B.severity}),s.jsx("span",{className:"alert-message",children:B.message}),s.jsx("span",{className:"alert-time",children:H(B.timestamp)})]},z))})})]})]}),v==="alerts"&&s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-header",children:[s.jsx("h3",{children:"Alert History"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:T,children:"Refresh"})]}),s.jsx("div",{className:"card-body",children:c.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),s.jsx("h3",{children:"No Alerts"}),s.jsx("p",{children:"No alerts have been triggered yet."})]}):s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Severity"}),s.jsx("th",{children:"Type"}),s.jsx("th",{children:"Message"}),s.jsx("th",{children:"Value"}),s.jsx("th",{children:"Threshold"}),s.jsx("th",{children:"Time"})]})}),s.jsx("tbody",{children:c.map((B,z)=>{var J;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("span",{className:`badge ${V(B.severity)}`,children:B.severity})}),s.jsx("td",{children:B.type}),s.jsx("td",{children:B.message}),s.jsx("td",{children:(J=B.value)==null?void 0:J.toFixed(1)}),s.jsx("td",{children:B.threshold}),s.jsx("td",{children:H(B.timestamp)})]},z)})})]})})]}),v==="config"&&s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-header",children:s.jsx("h3",{children:"Monitoring Configuration"})}),s.jsx("div",{className:"card-body",children:s.jsxs("form",{onSubmit:O,children:[s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:j.enabled,onChange:B=>k({...j,enabled:B.target.checked})}),s.jsx("span",{children:"Enable Monitoring"})]})}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Check Interval (seconds)"}),s.jsx("input",{type:"number",value:j.check_interval,onChange:B=>k({...j,check_interval:parseInt(B.target.value)}),min:"10",max:"3600"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Alert Email"}),s.jsxs("div",{className:"input-group",children:[s.jsx("input",{type:"email",value:j.alert_email,onChange:B=>k({...j,alert_email:B.target.value}),placeholder:"[email protected]"}),s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:L,disabled:!j.alert_email,children:"Test"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Webhook URL"}),s.jsxs("div",{className:"input-group",children:[s.jsx("input",{type:"url",value:j.alert_webhook,onChange:B=>k({...j,alert_webhook:B.target.value}),placeholder:"https://hooks.slack.com/..."}),s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:U,disabled:!j.alert_webhook,children:"Test"})]})]}),s.jsx("div",{className:"form-actions",children:s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save Configuration"})})]})})]}),v==="thresholds"&&s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-header",children:s.jsx("h3",{children:"Alert Thresholds"})}),s.jsx("div",{className:"card-body",children:s.jsxs("form",{onSubmit:w,children:[s.jsxs("div",{className:"threshold-form-grid",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"CPU Usage (%)"}),s.jsx("input",{type:"number",value:m.cpu_percent,onChange:B=>x({...m,cpu_percent:parseInt(B.target.value)}),min:"1",max:"100"}),s.jsx("span",{className:"form-help",children:"Alert when CPU exceeds this percentage"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Memory Usage (%)"}),s.jsx("input",{type:"number",value:m.memory_percent,onChange:B=>x({...m,memory_percent:parseInt(B.target.value)}),min:"1",max:"100"}),s.jsx("span",{className:"form-help",children:"Alert when memory exceeds this percentage"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Disk Usage (%)"}),s.jsx("input",{type:"number",value:m.disk_percent,onChange:B=>x({...m,disk_percent:parseInt(B.target.value)}),min:"1",max:"100"}),s.jsx("span",{className:"form-help",children:"Alert when disk exceeds this percentage"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Load Average"}),s.jsx("input",{type:"number",step:"0.1",value:m.load_average,onChange:B=>x({...m,load_average:parseFloat(B.target.value)}),min:"0.1",max:"100"}),s.jsx("span",{className:"form-help",children:"Alert when load average exceeds this value"})]})]}),s.jsx("div",{className:"form-actions",children:s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save Thresholds"})})]})})]})]})},Bg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(null),[i,l]=d.useState([]),[c,o]=d.useState(null),[u,f]=d.useState([]),[h,p]=d.useState(!0),[v,N]=d.useState(null),[j,k]=d.useState("backups"),[m,x]=d.useState("all"),[g,y]=d.useState(!1),[S,E]=d.useState(!1),[T,P]=d.useState(!1),[O,w]=d.useState(null),[L,U]=d.useState({type:"application",applicationId:"",includeDb:!1,dbType:"mysql",dbName:"",dbUser:"",dbPassword:"",dbHost:"localhost"}),[V,H]=d.useState({name:"",backupType:"application",target:"",scheduleTime:"02:00",days:["daily"]}),[B,z]=d.useState({enabled:!1,retention_days:30});d.useEffect(()=>{J()},[]);const J=async()=>{try{p(!0);const[D,W,fe,Ce,bt]=await Promise.all([b.getBackups(),b.getBackupStats(),b.getBackupSchedules(),b.getBackupConfig(),b.getApps()]);n(D.backups||[]),a(W),l(fe.schedules||[]),o(Ce),f(bt.applications||[]),Ce&&z({enabled:Ce.enabled||!1,retention_days:Ce.retention_days||30})}catch(D){N(D.message)}finally{p(!1)}},R=async D=>{D.preventDefault();try{if(L.type==="application"){const W=L.includeDb?{type:L.dbType,name:L.dbName,user:L.dbUser,password:L.dbPassword,host:L.dbHost}:null;await b.backupApplication(parseInt(L.applicationId),L.includeDb,W)}else await b.backupDatabase(L.dbType,L.dbName,L.dbUser,L.dbPassword,L.dbHost);y(!1),C(),J()}catch(W){N(W.message)}},_=async D=>{if(window.confirm("Are you sure you want to delete this backup?"))try{await b.deleteBackup(D),J()}catch(W){N(W.message)}},I=async()=>{if(O&&window.confirm("Are you sure you want to restore this backup? This may overwrite existing data."))try{O.type==="application"?await b.restoreApplication(O.path):await b.restoreDatabase(O.path,O.database_type,O.database_name),P(!1),w(null),e.success("Backup restored successfully")}catch(D){e.error(D.message)}},Q=async D=>{D.preventDefault();try{await b.addBackupSchedule(V.name,V.backupType,V.target,V.scheduleTime,V.days),E(!1),G(),J()}catch(W){N(W.message)}},Y=async D=>{if(window.confirm("Are you sure you want to remove this schedule?"))try{await b.removeBackupSchedule(D),J()}catch(W){N(W.message)}},ve=async D=>{D.preventDefault();try{await b.updateBackupConfig(B),J()}catch(W){N(W.message)}},ne=async()=>{if(window.confirm(`This will delete backups older than ${B.retention_days} days. Continue?`))try{const D=await b.cleanupBackups(B.retention_days);e.success(D.message),J()}catch(D){e.error(D.message)}},C=()=>{U({type:"application",applicationId:"",includeDb:!1,dbType:"mysql",dbName:"",dbUser:"",dbPassword:"",dbHost:"localhost"})},G=()=>{H({name:"",backupType:"application",target:"",scheduleTime:"02:00",days:["daily"]})},F=D=>{if(!D)return"0 B";const W=["B","KB","MB","GB","TB"];let fe=0,Ce=D;for(;Ce>=1024&&fe<W.length-1;)Ce/=1024,fe++;return`${Ce.toFixed(1)} ${W[fe]}`},ee=D=>new Date(D).toLocaleString(),ge=m==="all"?t:t.filter(D=>D.type===m);return h?s.jsx("div",{className:"page",children:s.jsx("div",{className:"loading",children:"Loading backup data..."})}):s.jsxs("div",{className:"page backups-page",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Backups"}),s.jsx("p",{className:"page-subtitle",children:"Manage application and database backups"})]}),s.jsxs("div",{className:"page-actions",children:[s.jsxs("button",{className:"btn btn-secondary",onClick:()=>E(!0),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Add Schedule"]}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>y(!0),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Backup"]})]})]}),v&&s.jsxs("div",{className:"alert alert-danger",children:[v,s.jsx("button",{onClick:()=>N(null),className:"alert-close",children:"×"})]}),s.jsxs("div",{className:"stats-grid",children:[s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon backups",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Total Backups"}),s.jsx("span",{className:"stat-value",children:(r==null?void 0:r.total_backups)||0})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon apps",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Application Backups"}),s.jsx("span",{className:"stat-value",children:(r==null?void 0:r.application_backups)||0})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon databases",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),s.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Database Backups"}),s.jsx("span",{className:"stat-value",children:(r==null?void 0:r.database_backups)||0})]})]}),s.jsxs("div",{className:"stat-card",children:[s.jsx("div",{className:"stat-icon size",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",ry:"2"}),s.jsx("line",{x1:"6",y1:"6",x2:"6.01",y2:"6"}),s.jsx("line",{x1:"6",y1:"18",x2:"6.01",y2:"18"})]})}),s.jsxs("div",{className:"stat-content",children:[s.jsx("span",{className:"stat-label",children:"Total Size"}),s.jsx("span",{className:"stat-value",children:(r==null?void 0:r.total_size_human)||"0 B"})]})]})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${j==="backups"?"active":""}`,onClick:()=>k("backups"),children:"Backups"}),s.jsx("button",{className:`tab ${j==="schedules"?"active":""}`,onClick:()=>k("schedules"),children:"Schedules"}),s.jsx("button",{className:`tab ${j==="settings"?"active":""}`,onClick:()=>k("settings"),children:"Settings"})]}),j==="backups"&&s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-header",children:[s.jsx("h3",{children:"Backup List"}),s.jsxs("div",{className:"card-actions",children:[s.jsxs("select",{value:m,onChange:D=>x(D.target.value),className:"filter-select",children:[s.jsx("option",{value:"all",children:"All Types"}),s.jsx("option",{value:"application",children:"Applications"}),s.jsx("option",{value:"database",children:"Databases"})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:J,children:"Refresh"})]})]}),s.jsx("div",{className:"card-body",children:ge.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),s.jsx("h3",{children:"No Backups"}),s.jsx("p",{children:"No backups found. Create your first backup to get started."}),s.jsx("button",{className:"btn btn-primary",onClick:()=>y(!0),children:"Create Backup"})]}):s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Type"}),s.jsx("th",{children:"Size"}),s.jsx("th",{children:"Created"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:ge.map((D,W)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsxs("div",{className:"backup-name",children:[D.type==="application"?s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",className:"icon-app",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}):s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",className:"icon-db",children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),s.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]}),s.jsx("span",{children:D.name||D.app_name})]})}),s.jsx("td",{children:s.jsx("span",{className:`badge badge-${D.type==="application"?"primary":"info"}`,children:D.type})}),s.jsx("td",{children:F(D.size)}),s.jsx("td",{children:ee(D.timestamp)}),s.jsx("td",{children:s.jsxs("div",{className:"action-buttons",children:[s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{w(D),P(!0)},title:"Restore",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",children:[s.jsx("polyline",{points:"1 4 1 10 7 10"}),s.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}),s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>_(D.path),title:"Delete",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})})]},W))})]})})]}),j==="schedules"&&s.jsxs("div",{className:"card",children:[s.jsxs("div",{className:"card-header",children:[s.jsx("h3",{children:"Backup Schedules"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>E(!0),children:"Add Schedule"})]}),s.jsx("div",{className:"card-body",children:i.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),s.jsx("h3",{children:"No Schedules"}),s.jsx("p",{children:"No backup schedules configured. Add a schedule for automated backups."}),s.jsx("button",{className:"btn btn-primary",onClick:()=>E(!0),children:"Add Schedule"})]}):s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Name"}),s.jsx("th",{children:"Type"}),s.jsx("th",{children:"Target"}),s.jsx("th",{children:"Time"}),s.jsx("th",{children:"Days"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:i.map(D=>{var W;return s.jsxs("tr",{children:[s.jsx("td",{children:D.name}),s.jsx("td",{children:s.jsx("span",{className:`badge badge-${D.backup_type==="application"?"primary":"info"}`,children:D.backup_type})}),s.jsx("td",{children:D.target}),s.jsx("td",{children:D.schedule_time}),s.jsx("td",{children:((W=D.days)==null?void 0:W.join(", "))||"daily"}),s.jsx("td",{children:s.jsx("span",{className:`badge badge-${D.enabled?"success":"secondary"}`,children:D.enabled?"Active":"Disabled"})}),s.jsx("td",{children:s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>Y(D.id),title:"Remove",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]},D.id)})})]})})]}),j==="settings"&&s.jsxs("div",{className:"card",children:[s.jsx("div",{className:"card-header",children:s.jsx("h3",{children:"Backup Settings"})}),s.jsx("div",{className:"card-body",children:s.jsxs("form",{onSubmit:ve,children:[s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:B.enabled,onChange:D=>z({...B,enabled:D.target.checked})}),s.jsx("span",{children:"Enable Scheduled Backups"})]})}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Retention Period (days)"}),s.jsx("input",{type:"number",value:B.retention_days,onChange:D=>z({...B,retention_days:parseInt(D.target.value)}),min:"1",max:"365"}),s.jsx("span",{className:"form-help",children:"Backups older than this will be deleted during cleanup"})]}),s.jsxs("div",{className:"form-actions",children:[s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save Settings"}),s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:ne,children:"Run Cleanup Now"})]})]})})]}),g&&s.jsx("div",{className:"modal-overlay",onClick:()=>y(!1),children:s.jsxs("div",{className:"modal",onClick:D=>D.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create Backup"}),s.jsx("button",{className:"modal-close",onClick:()=>y(!1),children:"×"})]}),s.jsxs("form",{onSubmit:R,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Backup Type"}),s.jsxs("select",{value:L.type,onChange:D=>U({...L,type:D.target.value}),children:[s.jsx("option",{value:"application",children:"Application"}),s.jsx("option",{value:"database",children:"Database Only"})]})]}),L.type==="application"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Application"}),s.jsxs("select",{value:L.applicationId,onChange:D=>U({...L,applicationId:D.target.value}),required:!0,children:[s.jsx("option",{value:"",children:"Select Application"}),u.map(D=>s.jsx("option",{value:D.id,children:D.name},D.id))]})]}),s.jsx("div",{className:"form-group",children:s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:L.includeDb,onChange:D=>U({...L,includeDb:D.target.checked})}),s.jsx("span",{children:"Include Database"})]})})]}),(L.type==="database"||L.includeDb)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Type"}),s.jsxs("select",{value:L.dbType,onChange:D=>U({...L,dbType:D.target.value}),children:[s.jsx("option",{value:"mysql",children:"MySQL"}),s.jsx("option",{value:"postgresql",children:"PostgreSQL"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Database Name"}),s.jsx("input",{type:"text",value:L.dbName,onChange:D=>U({...L,dbName:D.target.value}),required:!0})]}),s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Username"}),s.jsx("input",{type:"text",value:L.dbUser,onChange:D=>U({...L,dbUser:D.target.value})})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Password"}),s.jsx("input",{type:"password",value:L.dbPassword,onChange:D=>U({...L,dbPassword:D.target.value})})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Host"}),s.jsx("input",{type:"text",value:L.dbHost,onChange:D=>U({...L,dbHost:D.target.value})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>y(!1),children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Create Backup"})]})]})]})}),S&&s.jsx("div",{className:"modal-overlay",onClick:()=>E(!1),children:s.jsxs("div",{className:"modal",onClick:D=>D.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Add Backup Schedule"}),s.jsx("button",{className:"modal-close",onClick:()=>E(!1),children:"×"})]}),s.jsxs("form",{onSubmit:Q,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Schedule Name"}),s.jsx("input",{type:"text",value:V.name,onChange:D=>H({...V,name:D.target.value}),placeholder:"Daily App Backup",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Backup Type"}),s.jsxs("select",{value:V.backupType,onChange:D=>H({...V,backupType:D.target.value}),children:[s.jsx("option",{value:"application",children:"Application"}),s.jsx("option",{value:"database",children:"Database"})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Target"}),s.jsx("input",{type:"text",value:V.target,onChange:D=>H({...V,target:D.target.value}),placeholder:"App name or database name",required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Time"}),s.jsx("input",{type:"time",value:V.scheduleTime,onChange:D=>H({...V,scheduleTime:D.target.value}),required:!0})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>E(!1),children:"Cancel"}),s.jsx("button",{type:"submit",className:"btn btn-primary",children:"Add Schedule"})]})]})]})}),T&&O&&s.jsx("div",{className:"modal-overlay",onClick:()=>P(!1),children:s.jsxs("div",{className:"modal",onClick:D=>D.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Restore Backup"}),s.jsx("button",{className:"modal-close",onClick:()=>P(!1),children:"×"})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"restore-warning",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),s.jsx("h3",{children:"Warning"}),s.jsx("p",{children:"Restoring this backup will overwrite existing data. This action cannot be undone."})]}),s.jsxs("div",{className:"restore-details",children:[s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-label",children:"Backup Name:"}),s.jsx("span",{className:"detail-value",children:O.name||O.app_name})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-label",children:"Type:"}),s.jsx("span",{className:"detail-value",children:O.type})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-label",children:"Created:"}),s.jsx("span",{className:"detail-value",children:ee(O.timestamp)})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"detail-label",children:"Size:"}),s.jsx("span",{className:"detail-value",children:F(O.size)})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>P(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-danger",onClick:I,children:"Restore Backup"})]})]})})]})},Ig=()=>{const[e,t]=d.useState("logs");return s.jsxs("div",{className:"page terminal-page",children:[s.jsx("div",{className:"page-header",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Terminal & Logs"}),s.jsx("p",{className:"page-subtitle",children:"View logs, manage processes and services"})]})}),s.jsxs("div",{className:"tabs",children:[s.jsxs("button",{className:`tab ${e==="logs"?"active":""}`,onClick:()=>t("logs"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),"Log Files"]}),s.jsxs("button",{className:`tab ${e==="journal"?"active":""}`,onClick:()=>t("journal"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"9"}),s.jsx("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),s.jsx("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}),"System Journal"]}),s.jsxs("button",{className:`tab ${e==="processes"?"active":""}`,onClick:()=>t("processes"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),"Processes"]}),s.jsxs("button",{className:`tab ${e==="services"?"active":""}`,onClick:()=>t("services"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Services"]})]}),s.jsxs("div",{className:"tab-content",children:[e==="logs"&&s.jsx(qg,{}),e==="journal"&&s.jsx(Ug,{}),e==="processes"&&s.jsx(zg,{}),e==="services"&&s.jsx(Vg,{})]})]})},qg=()=>{const[e,t]=d.useState([]),[n,r]=d.useState(null),[a,i]=d.useState(""),[l,c]=d.useState(!0),[o,u]=d.useState(!1),[f,h]=d.useState(null),[p,v]=d.useState(100),[N,j]=d.useState(""),[k,m]=d.useState(!1),x=d.useRef(null),g=d.useRef(null);d.useEffect(()=>{y()},[]),d.useEffect(()=>(k&&n&&(g.current=setInterval(()=>{S(n,!1)},3e3)),()=>{g.current&&clearInterval(g.current)}),[k,n]);async function y(){try{const w=await b.getLogFiles();t(w.logs||[])}catch(w){h(w.message)}finally{c(!1)}}async function S(w,L=!0){var U;L&&u(!0);try{let V;N.trim()?V=await b.searchLog(w,N,p):V=await b.readLog(w,p),i(V.content||((U=V.lines)==null?void 0:U.join(`-`))||"No content"),r(w),x.current&&(x.current.scrollTop=x.current.scrollHeight)}catch(V){i(`Error loading log: ${V.message}`)}finally{u(!1)}}async function E(){if(n&&confirm(`Clear ${n}? This cannot be undone.`))try{await b.clearLog(n),i("Log cleared.")}catch(w){h(w.message)}}function T(){if(!a)return;const w=new Blob([a],{type:"text/plain"}),L=URL.createObjectURL(w),U=document.createElement("a");U.href=L,U.download=n?n.split("/").pop():"log.txt",U.click(),URL.revokeObjectURL(L)}function P(w){return w.includes("error")?"error":w.includes("access")?"access":w.includes("nginx")?"nginx":w.includes("mysql")||w.includes("postgres")?"database":"default"}function O(w){if(!w)return"0 B";const L=["B","KB","MB","GB"];let U=0;for(;w>=1024&&U<L.length-1;)w/=1024,U++;return`${w.toFixed(1)} ${L[U]}`}return l?s.jsx("div",{className:"loading",children:"Loading log files..."}):s.jsxs("div",{className:"logs-container",children:[f&&s.jsxs("div",{className:"alert alert-danger",children:[f,s.jsx("button",{onClick:()=>h(null),className:"alert-close",children:"×"})]}),s.jsxs("div",{className:"logs-layout",children:[s.jsxs("div",{className:"logs-sidebar",children:[s.jsxs("div",{className:"sidebar-header",children:[s.jsx("h3",{children:"Log Files"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:y,children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),s.jsx("div",{className:"log-files-list",children:e.length===0?s.jsx("div",{className:"empty-hint",children:"No log files found"}):e.map((w,L)=>s.jsxs("div",{className:`log-file-item ${n===w.path?"active":""}`,onClick:()=>S(w.path),children:[s.jsx("div",{className:`log-icon ${P(w.path)}`,children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),s.jsxs("div",{className:"log-file-info",children:[s.jsx("span",{className:"log-file-name",children:w.name}),s.jsx("span",{className:"log-file-path",children:w.path})]}),s.jsx("span",{className:"log-file-size",children:O(w.size)})]},L))})]}),s.jsxs("div",{className:"logs-viewer",children:[s.jsxs("div",{className:"viewer-toolbar",children:[s.jsxs("div",{className:"toolbar-left",children:[s.jsxs("div",{className:"search-input",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{type:"text",value:N,onChange:w=>j(w.target.value),onKeyDown:w=>w.key==="Enter"&&n&&S(n),placeholder:"Search pattern..."})]}),s.jsxs("select",{value:p,onChange:w=>v(parseInt(w.target.value)),className:"lines-select",children:[s.jsx("option",{value:50,children:"50 lines"}),s.jsx("option",{value:100,children:"100 lines"}),s.jsx("option",{value:200,children:"200 lines"}),s.jsx("option",{value:500,children:"500 lines"}),s.jsx("option",{value:1e3,children:"1000 lines"})]})]}),s.jsxs("div",{className:"toolbar-right",children:[s.jsxs("label",{className:"auto-refresh-toggle",children:[s.jsx("input",{type:"checkbox",checked:k,onChange:w=>m(w.target.checked)}),s.jsx("span",{children:"Auto-refresh"})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>n&&S(n),disabled:!n||o,children:"Refresh"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:T,disabled:!a,children:"Download"}),s.jsx("button",{className:"btn btn-danger btn-sm",onClick:E,disabled:!n,children:"Clear"})]})]}),s.jsx("div",{className:"log-content",ref:x,children:n?o?s.jsx("div",{className:"loading",children:"Loading log content..."}):s.jsx("pre",{children:a}):s.jsxs("div",{className:"empty-viewer",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"48",height:"48",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]}),s.jsx("p",{children:"Select a log file to view its contents"})]})})]})]})]})},Ug=()=>{const[e,t]=d.useState(""),[n,r]=d.useState(!1),[a,i]=d.useState(""),[l,c]=d.useState(100),[o,u]=d.useState(""),[f]=d.useState(["nginx","apache2","mysql","mariadb","postgresql","php-fpm","docker","sshd","cron","systemd"]);async function h(){r(!0);try{const p=await b.getJournalLogs(a||null,l);t(p.content||p.logs||"No logs available")}catch(p){t(`Error: ${p.message}`)}finally{r(!1)}}return d.useEffect(()=>{h()},[]),s.jsxs("div",{className:"journal-container",children:[s.jsxs("div",{className:"journal-controls",children:[s.jsxs("div",{className:"control-group",children:[s.jsx("label",{children:"Service/Unit"}),s.jsxs("div",{className:"input-with-suggestions",children:[s.jsx("input",{type:"text",value:a,onChange:p=>i(p.target.value),placeholder:"All services"}),s.jsx("div",{className:"quick-units",children:f.map(p=>s.jsx("button",{className:`unit-chip ${a===p?"active":""}`,onClick:()=>i(a===p?"":p),children:p},p))})]})]}),s.jsxs("div",{className:"control-group",children:[s.jsx("label",{children:"Lines"}),s.jsxs("select",{value:l,onChange:p=>c(parseInt(p.target.value)),children:[s.jsx("option",{value:50,children:"50"}),s.jsx("option",{value:100,children:"100"}),s.jsx("option",{value:200,children:"200"}),s.jsx("option",{value:500,children:"500"})]})]}),s.jsxs("div",{className:"control-group",children:[s.jsx("label",{children:"Priority"}),s.jsxs("select",{value:o,onChange:p=>u(p.target.value),children:[s.jsx("option",{value:"",children:"All"}),s.jsx("option",{value:"0",children:"Emergency"}),s.jsx("option",{value:"1",children:"Alert"}),s.jsx("option",{value:"2",children:"Critical"}),s.jsx("option",{value:"3",children:"Error"}),s.jsx("option",{value:"4",children:"Warning"}),s.jsx("option",{value:"5",children:"Notice"}),s.jsx("option",{value:"6",children:"Info"}),s.jsx("option",{value:"7",children:"Debug"})]})]}),s.jsx("button",{className:"btn btn-primary",onClick:h,disabled:n,children:n?"Loading...":"Load Logs"})]}),s.jsx("div",{className:"journal-viewer",children:s.jsx("pre",{children:n?"Loading journal logs...":e})})]})},zg=()=>{var k;const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(!0),[i,l]=d.useState("cpu"),[c,o]=d.useState(50),[u,f]=d.useState(""),[h,p]=d.useState(null);d.useEffect(()=>{v()},[i,c]);async function v(){try{const m=await b.getProcesses(c,i);n(m.processes||[])}catch(m){console.error("Failed to load processes:",m)}finally{a(!1)}}async function N(m,x=!1){const g=x?`Force kill process ${m}? This may cause data loss.`:`Kill process ${m}?`;if(confirm(g))try{await b.killProcess(m,x),e.success(`Process ${m} killed successfully`),v(),p(null)}catch(y){e.error(`Failed to kill process: ${y.message}`)}}const j=t.filter(m=>{var x,g;return((x=m.name)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((g=m.command)==null?void 0:g.toLowerCase().includes(u.toLowerCase()))||String(m.pid).includes(u)});return r?s.jsx("div",{className:"loading",children:"Loading processes..."}):s.jsxs("div",{className:"processes-container",children:[s.jsxs("div",{className:"processes-toolbar",children:[s.jsx("div",{className:"toolbar-left",children:s.jsxs("div",{className:"search-input",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{type:"text",value:u,onChange:m=>f(m.target.value),placeholder:"Search processes..."})]})}),s.jsxs("div",{className:"toolbar-right",children:[s.jsxs("select",{value:i,onChange:m=>l(m.target.value),children:[s.jsx("option",{value:"cpu",children:"Sort by CPU"}),s.jsx("option",{value:"memory",children:"Sort by Memory"}),s.jsx("option",{value:"pid",children:"Sort by PID"}),s.jsx("option",{value:"name",children:"Sort by Name"})]}),s.jsxs("select",{value:c,onChange:m=>o(parseInt(m.target.value)),children:[s.jsx("option",{value:25,children:"25 processes"}),s.jsx("option",{value:50,children:"50 processes"}),s.jsx("option",{value:100,children:"100 processes"})]}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:v,children:"Refresh"})]})]}),s.jsx("div",{className:"processes-table-wrapper",children:s.jsxs("table",{className:"table processes-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"PID"}),s.jsx("th",{children:"Name"}),s.jsx("th",{children:"User"}),s.jsx("th",{children:"CPU %"}),s.jsx("th",{children:"Memory %"}),s.jsx("th",{children:"Memory"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:j.map(m=>{var x;return s.jsxs("tr",{className:(h==null?void 0:h.pid)===m.pid?"selected":"",onClick:()=>p(m),children:[s.jsx("td",{className:"mono",children:m.pid}),s.jsx("td",{children:s.jsx("div",{className:"process-name",children:s.jsx("span",{children:m.name})})}),s.jsx("td",{children:m.user}),s.jsx("td",{children:s.jsxs("div",{className:"usage-cell",children:[s.jsx("div",{className:"usage-bar cpu",style:{width:`${Math.min(m.cpu_percent||0,100)}%`}}),s.jsxs("span",{children:[(m.cpu_percent||0).toFixed(1),"%"]})]})}),s.jsx("td",{children:s.jsxs("div",{className:"usage-cell",children:[s.jsx("div",{className:"usage-bar memory",style:{width:`${Math.min(m.memory_percent||0,100)}%`}}),s.jsxs("span",{children:[(m.memory_percent||0).toFixed(1),"%"]})]})}),s.jsx("td",{children:Jc((x=m.memory_info)==null?void 0:x.rss)}),s.jsx("td",{children:s.jsx("span",{className:`badge badge-${Hg(m.status)}`,children:m.status})}),s.jsx("td",{children:s.jsxs("div",{className:"action-buttons",children:[s.jsx("button",{className:"btn btn-secondary btn-xs",onClick:g=>{g.stopPropagation(),N(m.pid)},title:"Kill",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"12",height:"12",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),s.jsx("button",{className:"btn btn-danger btn-xs",onClick:g=>{g.stopPropagation(),N(m.pid,!0)},title:"Force Kill",children:s.jsxs("svg",{viewBox:"0 0 24 24",width:"12",height:"12",children:[s.jsx("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})})]})})]},m.pid)})})]})}),h&&s.jsxs("div",{className:"process-details-panel",children:[s.jsxs("div",{className:"panel-header",children:[s.jsx("h3",{children:"Process Details"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>p(null),children:"Close"})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("div",{className:"details-grid",children:[s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"PID"}),s.jsx("span",{className:"detail-value mono",children:h.pid})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"Name"}),s.jsx("span",{className:"detail-value",children:h.name})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"User"}),s.jsx("span",{className:"detail-value",children:h.user})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"Status"}),s.jsx("span",{className:"detail-value",children:h.status})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"CPU"}),s.jsxs("span",{className:"detail-value",children:[(h.cpu_percent||0).toFixed(2),"%"]})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"Memory"}),s.jsx("span",{className:"detail-value",children:Jc((k=h.memory_info)==null?void 0:k.rss)})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"Threads"}),s.jsx("span",{className:"detail-value",children:h.num_threads})]}),s.jsxs("div",{className:"detail-item",children:[s.jsx("span",{className:"detail-label",children:"Created"}),s.jsx("span",{className:"detail-value",children:h.create_time?new Date(h.create_time*1e3).toLocaleString():"-"})]})]}),h.command&&s.jsxs("div",{className:"command-line",children:[s.jsx("span",{className:"detail-label",children:"Command"}),s.jsx("code",{children:h.command})]})]})]})]})},Vg=()=>{const e=Se(),[t,n]=d.useState([]),[r,a]=d.useState(!0),[i,l]=d.useState(null),[c,o]=d.useState(null),[u,f]=d.useState(""),[h,p]=d.useState(!1);d.useEffect(()=>{v()},[]);async function v(){try{const m=await b.getServicesStatus();n(m.services||[])}catch(m){console.error("Failed to load services:",m)}finally{a(!1)}}async function N(m,x){l(`${m}-${x}`);try{await b.controlService(m,x),e.success(`Service ${m} ${x}ed successfully`),await v()}catch(g){e.error(`Failed to ${x} ${m}: ${g.message}`)}finally{l(null)}}async function j(m){o(m),p(!0);try{const x=await b.getJournalLogs(m,100);f(x.content||x.logs||"No logs available")}catch(x){f(`Error loading logs: ${x.message}`)}}function k(m){return m==="running"||m==="active"?"success":m==="stopped"||m==="inactive"?"secondary":m==="failed"?"danger":"warning"}return r?s.jsx("div",{className:"loading",children:"Loading services..."}):s.jsxs("div",{className:"services-container",children:[s.jsx("div",{className:"services-toolbar",children:s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:v,children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),"Refresh"]})}),s.jsx("div",{className:"services-grid",children:t.length===0?s.jsx("div",{className:"empty-state",children:s.jsx("p",{children:"No services found"})}):t.map(m=>s.jsxs("div",{className:"service-card",children:[s.jsxs("div",{className:"service-header",children:[s.jsxs("div",{className:"service-info",children:[s.jsx("span",{className:`status-dot ${k(m.status)}`}),s.jsx("h4",{children:m.name})]}),s.jsx("span",{className:`badge badge-${k(m.status)}`,children:m.status})]}),m.description&&s.jsx("p",{className:"service-description",children:m.description}),s.jsxs("div",{className:"service-meta",children:[m.pid&&s.jsxs("span",{className:"meta-item",children:[s.jsx("span",{className:"meta-label",children:"PID:"})," ",m.pid]}),m.memory&&s.jsxs("span",{className:"meta-item",children:[s.jsx("span",{className:"meta-label",children:"Memory:"})," ",m.memory]})]}),s.jsxs("div",{className:"service-actions",children:[m.status==="running"||m.status==="active"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>N(m.name,"restart"),disabled:i===`${m.name}-restart`,children:i===`${m.name}-restart`?"...":"Restart"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>N(m.name,"stop"),disabled:i===`${m.name}-stop`,children:i===`${m.name}-stop`?"...":"Stop"})]}):s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>N(m.name,"start"),disabled:i===`${m.name}-start`,children:i===`${m.name}-start`?"...":"Start"}),s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(m.name),children:"Logs"})]})]},m.name))}),h&&s.jsx("div",{className:"modal-overlay",onClick:()=>p(!1),children:s.jsxs("div",{className:"modal modal-lg",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:["Logs: ",c]}),s.jsx("button",{className:"modal-close",onClick:()=>p(!1),children:"×"})]}),s.jsx("div",{className:"modal-body",children:s.jsx("div",{className:"modal-log-viewer",children:s.jsx("pre",{children:u})})}),s.jsx("div",{className:"modal-footer",children:s.jsx("button",{className:"btn btn-secondary",onClick:()=>p(!1),children:"Close"})})]})})]})};function Jc(e){if(!e)return"-";const t=["B","KB","MB","GB"];let n=0;for(;e>=1024&&n<t.length-1;)e/=1024,n++;return`${e.toFixed(1)} ${t[n]}`}function Hg(e){switch(e==null?void 0:e.toLowerCase()){case"running":case"sleeping":return"success";case"stopped":case"zombie":return"danger";case"idle":case"disk-sleep":return"warning";default:return"secondary"}}const Wg=()=>{const[e,t]=d.useState("profile");return s.jsxs("div",{className:"page settings-page",children:[s.jsx("div",{className:"page-header",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Settings"}),s.jsx("p",{className:"page-subtitle",children:"Manage your account and system preferences"})]})}),s.jsxs("div",{className:"settings-layout",children:[s.jsxs("nav",{className:"settings-nav",children:[s.jsxs("button",{className:`settings-nav-item ${e==="profile"?"active":""}`,onClick:()=>t("profile"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Profile"]}),s.jsxs("button",{className:`settings-nav-item ${e==="security"?"active":""}`,onClick:()=>t("security"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Security"]}),s.jsxs("button",{className:`settings-nav-item ${e==="appearance"?"active":""}`,onClick:()=>t("appearance"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),s.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),s.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),s.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),s.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),s.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),s.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),"Appearance"]}),s.jsxs("button",{className:`settings-nav-item ${e==="notifications"?"active":""}`,onClick:()=>t("notifications"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),"Notifications"]}),s.jsxs("button",{className:`settings-nav-item ${e==="system"?"active":""}`,onClick:()=>t("system"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),"System Info"]}),s.jsxs("button",{className:`settings-nav-item ${e==="about"?"active":""}`,onClick:()=>t("about"),children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),"About"]})]}),s.jsxs("div",{className:"settings-content",children:[e==="profile"&&s.jsx(Qg,{}),e==="security"&&s.jsx(Kg,{}),e==="appearance"&&s.jsx(Gg,{}),e==="notifications"&&s.jsx(Yg,{}),e==="system"&&s.jsx(Xg,{}),e==="about"&&s.jsx(Jg,{})]})]})]})},Qg=()=>{const{user:e,updateUser:t}=rs(),[n,r]=d.useState({username:"",email:""}),[a,i]=d.useState(!1),[l,c]=d.useState(null);d.useEffect(()=>{e&&r({username:e.username||"",email:e.email||""})},[e]);async function o(u){u.preventDefault(),i(!0),c(null);try{await t(n),c({type:"success",text:"Profile updated successfully"})}catch(f){c({type:"error",text:f.message})}finally{i(!1)}}return s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"Profile Settings"}),s.jsx("p",{children:"Update your personal information"})]}),l&&s.jsx("div",{className:`alert alert-${l.type==="success"?"success":"danger"}`,children:l.text}),s.jsxs("form",{onSubmit:o,className:"settings-form",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Username"}),s.jsx("input",{type:"text",value:n.username,onChange:u=>r({...n,username:u.target.value}),required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Email Address"}),s.jsx("input",{type:"email",value:n.email,onChange:u=>r({...n,email:u.target.value}),required:!0})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Role"}),s.jsx("input",{type:"text",value:(e==null?void 0:e.role)||"user",disabled:!0,className:"input-disabled"}),s.jsx("span",{className:"form-help",children:"Contact an administrator to change your role"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Member Since"}),s.jsx("input",{type:"text",value:e!=null&&e.created_at?new Date(e.created_at).toLocaleDateString():"-",disabled:!0,className:"input-disabled"})]}),s.jsx("div",{className:"form-actions",children:s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:a,children:a?"Saving...":"Save Changes"})})]})]})},Kg=()=>{const{updateUser:e}=rs(),[t,n]=d.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[r,a]=d.useState(!1),[i,l]=d.useState(null);async function c(o){if(o.preventDefault(),l(null),t.newPassword!==t.confirmPassword){l({type:"error",text:"Passwords do not match"});return}if(t.newPassword.length<8){l({type:"error",text:"Password must be at least 8 characters"});return}a(!0);try{await e({password:t.newPassword}),l({type:"success",text:"Password changed successfully"}),n({currentPassword:"",newPassword:"",confirmPassword:""})}catch(u){l({type:"error",text:u.message})}finally{a(!1)}}return s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"Security Settings"}),s.jsx("p",{children:"Manage your password and security preferences"})]}),i&&s.jsx("div",{className:`alert alert-${i.type==="success"?"success":"danger"}`,children:i.text}),s.jsxs("form",{onSubmit:c,className:"settings-form",children:[s.jsx("h3",{children:"Change Password"}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Current Password"}),s.jsx("input",{type:"password",value:t.currentPassword,onChange:o=>n({...t,currentPassword:o.target.value}),placeholder:"Enter current password"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"New Password"}),s.jsx("input",{type:"password",value:t.newPassword,onChange:o=>n({...t,newPassword:o.target.value}),placeholder:"Enter new password",required:!0}),s.jsx("span",{className:"form-help",children:"Minimum 8 characters"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Confirm New Password"}),s.jsx("input",{type:"password",value:t.confirmPassword,onChange:o=>n({...t,confirmPassword:o.target.value}),placeholder:"Confirm new password",required:!0})]}),s.jsx("div",{className:"form-actions",children:s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:r,children:r?"Changing...":"Change Password"})})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Sessions"}),s.jsx("p",{children:"Manage your active sessions"}),s.jsxs("div",{className:"session-item current",children:[s.jsxs("div",{className:"session-info",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"session-device",children:"Current Session"}),s.jsx("span",{className:"session-details",children:"This device - Active now"})]})]}),s.jsx("span",{className:"badge badge-success",children:"Current"})]})]})]})},Gg=()=>{const[e,t]=d.useState(()=>localStorage.getItem("theme")||"dark");function n(r){t(r),localStorage.setItem("theme",r),document.documentElement.setAttribute("data-theme",r)}return s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"Appearance"}),s.jsx("p",{children:"Customize the look and feel of your dashboard"})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Theme"}),s.jsx("p",{children:"Select your preferred color scheme"}),s.jsxs("div",{className:"theme-options",children:[s.jsxs("button",{className:`theme-option ${e==="dark"?"active":""}`,onClick:()=>n("dark"),children:[s.jsxs("div",{className:"theme-preview dark",children:[s.jsx("div",{className:"preview-sidebar"}),s.jsxs("div",{className:"preview-content",children:[s.jsx("div",{className:"preview-card"}),s.jsx("div",{className:"preview-card"})]})]}),s.jsx("span",{children:"Dark"})]}),s.jsxs("button",{className:`theme-option ${e==="light"?"active":""}`,onClick:()=>n("light"),children:[s.jsxs("div",{className:"theme-preview light",children:[s.jsx("div",{className:"preview-sidebar"}),s.jsxs("div",{className:"preview-content",children:[s.jsx("div",{className:"preview-card"}),s.jsx("div",{className:"preview-card"})]})]}),s.jsx("span",{children:"Light"})]}),s.jsxs("button",{className:`theme-option ${e==="system"?"active":""}`,onClick:()=>n("system"),children:[s.jsxs("div",{className:"theme-preview system",children:[s.jsx("div",{className:"preview-sidebar"}),s.jsxs("div",{className:"preview-content",children:[s.jsx("div",{className:"preview-card"}),s.jsx("div",{className:"preview-card"})]})]}),s.jsx("span",{children:"System"})]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Density"}),s.jsx("p",{children:"Adjust the spacing and size of elements"}),s.jsxs("div",{className:"density-options",children:[s.jsxs("label",{className:"radio-option",children:[s.jsx("input",{type:"radio",name:"density",value:"comfortable",defaultChecked:!0}),s.jsx("span",{children:"Comfortable"})]}),s.jsxs("label",{className:"radio-option",children:[s.jsx("input",{type:"radio",name:"density",value:"compact"}),s.jsx("span",{children:"Compact"})]})]})]})]})},Yg=()=>{const[e,t]=d.useState({emailAlerts:!0,serverAlerts:!0,securityAlerts:!0,backupAlerts:!1,deployAlerts:!0});function n(r){t({...e,[r]:!e[r]})}return s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"Notification Settings"}),s.jsx("p",{children:"Choose what notifications you want to receive"})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Email Notifications"}),s.jsxs("div",{className:"notification-options",children:[s.jsxs("div",{className:"notification-item",children:[s.jsxs("div",{className:"notification-info",children:[s.jsx("span",{className:"notification-title",children:"Server Alerts"}),s.jsx("span",{className:"notification-desc",children:"Get notified when server metrics exceed thresholds"})]}),s.jsxs("label",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.serverAlerts,onChange:()=>n("serverAlerts")}),s.jsx("span",{className:"toggle-slider"})]})]}),s.jsxs("div",{className:"notification-item",children:[s.jsxs("div",{className:"notification-info",children:[s.jsx("span",{className:"notification-title",children:"Security Alerts"}),s.jsx("span",{className:"notification-desc",children:"Get notified about security events and login attempts"})]}),s.jsxs("label",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.securityAlerts,onChange:()=>n("securityAlerts")}),s.jsx("span",{className:"toggle-slider"})]})]}),s.jsxs("div",{className:"notification-item",children:[s.jsxs("div",{className:"notification-info",children:[s.jsx("span",{className:"notification-title",children:"Backup Notifications"}),s.jsx("span",{className:"notification-desc",children:"Get notified when backups complete or fail"})]}),s.jsxs("label",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.backupAlerts,onChange:()=>n("backupAlerts")}),s.jsx("span",{className:"toggle-slider"})]})]}),s.jsxs("div",{className:"notification-item",children:[s.jsxs("div",{className:"notification-info",children:[s.jsx("span",{className:"notification-title",children:"Deployment Notifications"}),s.jsx("span",{className:"notification-desc",children:"Get notified when deployments complete or fail"})]}),s.jsxs("label",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.deployAlerts,onChange:()=>n("deployAlerts")}),s.jsx("span",{className:"toggle-slider"})]})]})]})]})]})},Xg=()=>{var l,c,o,u,f,h,p,v,N,j,k,m,x,g;const{isAdmin:e}=rs(),[t,n]=d.useState(null),[r,a]=d.useState(!0);d.useEffect(()=>{e&&i()},[e]);async function i(){try{const y=await b.getSystemMetrics();n(y)}catch(y){console.error("Failed to load metrics:",y)}finally{a(!1)}}return e?r?s.jsx("div",{className:"loading",children:"Loading system information..."}):s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"System Information"}),s.jsx("p",{children:"View system details and server information"})]}),s.jsxs("div",{className:"system-info-grid",children:[s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"CPU"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Usage"}),s.jsxs("span",{className:"info-value",children:[((c=(l=t==null?void 0:t.cpu)==null?void 0:l.percent)==null?void 0:c.toFixed(1))||0,"%"]})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Cores"}),s.jsx("span",{className:"info-value",children:((o=t==null?void 0:t.cpu)==null?void 0:o.count)||"-"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Load Average"}),s.jsx("span",{className:"info-value",children:(u=t==null?void 0:t.cpu)!=null&&u.load_avg?t.cpu.load_avg.map(y=>y.toFixed(2)).join(", "):"-"})]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Memory"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Usage"}),s.jsxs("span",{className:"info-value",children:[((h=(f=t==null?void 0:t.memory)==null?void 0:f.percent)==null?void 0:h.toFixed(1))||0,"%"]})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Used"}),s.jsx("span",{className:"info-value",children:ws((p=t==null?void 0:t.memory)==null?void 0:p.used)})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Total"}),s.jsx("span",{className:"info-value",children:ws((v=t==null?void 0:t.memory)==null?void 0:v.total)})]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Disk"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Usage"}),s.jsxs("span",{className:"info-value",children:[((j=(N=t==null?void 0:t.disk)==null?void 0:N.percent)==null?void 0:j.toFixed(1))||0,"%"]})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Used"}),s.jsx("span",{className:"info-value",children:ws((k=t==null?void 0:t.disk)==null?void 0:k.used)})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Total"}),s.jsx("span",{className:"info-value",children:ws((m=t==null?void 0:t.disk)==null?void 0:m.total)})]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Network"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Bytes Sent"}),s.jsx("span",{className:"info-value",children:ws((x=t==null?void 0:t.network)==null?void 0:x.bytes_sent)})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Bytes Received"}),s.jsx("span",{className:"info-value",children:ws((g=t==null?void 0:t.network)==null?void 0:g.bytes_recv)})]})]})]})]}),(t==null?void 0:t.system)&&s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"System Details"}),s.jsxs("div",{className:"info-list",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Hostname"}),s.jsx("span",{className:"info-value",children:t.system.hostname||"-"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Platform"}),s.jsx("span",{className:"info-value",children:t.system.platform||"-"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"OS Version"}),s.jsx("span",{className:"info-value",children:t.system.version||"-"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Uptime"}),s.jsx("span",{className:"info-value",children:Zg(t.system.uptime)})]})]})]})]}):s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"System Information"}),s.jsx("p",{children:"View system details and server information"})]}),s.jsx("div",{className:"alert alert-warning",children:"Admin access required to view system information."})]})},Jg=()=>s.jsxs("div",{className:"settings-section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{children:"About ServerKit"}),s.jsx("p",{children:"Server management made simple"})]}),s.jsxs("div",{className:"about-card",children:[s.jsx("div",{className:"about-logo",children:s.jsx("svg",{viewBox:"0 0 24 24",width:"48",height:"48",stroke:"currentColor",fill:"none",strokeWidth:"1.5",children:s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})}),s.jsx("h3",{children:"ServerKit"}),s.jsx("p",{className:"version",children:"Version 1.0.0"}),s.jsx("p",{className:"description",children:"A modern, lightweight server management panel for managing web applications, databases, domains, and more. Built with Flask and React."})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Features"}),s.jsxs("ul",{className:"feature-list",children:[s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Application Management (PHP, Python, Node.js, Docker)"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Domain & SSL Certificate Management"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Database Management (MySQL, PostgreSQL)"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Docker Container Management"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"System Monitoring & Alerts"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Automated Backups"]}),s.jsxs("li",{children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Git Deployment with Webhooks"]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"Links"}),s.jsxs("div",{className:"link-list",children:[s.jsxs("a",{href:"https://github.com/serverkit",target:"_blank",rel:"noopener noreferrer",className:"link-item",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:s.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"})}),"GitHub Repository"]}),s.jsxs("a",{href:"#",className:"link-item",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]}),"Documentation"]}),s.jsxs("a",{href:"#",className:"link-item",children:[s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Support"]})]})]}),s.jsxs("div",{className:"settings-card",children:[s.jsx("h3",{children:"License"}),s.jsx("p",{className:"license-text",children:"ServerKit is open source software licensed under the MIT License."})]})]});function ws(e){if(!e)return"-";const t=["B","KB","MB","GB","TB"];let n=0;for(;e>=1024&&n<t.length-1;)e/=1024,n++;return`${e.toFixed(1)} ${t[n]}`}function Zg(e){if(!e)return"-";const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),a=[];return t>0&&a.push(`${t}d`),n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),a.join(" ")||"< 1m"}function Oa({size:e="md",className:t=""}){const n={sm:"spinner-sm",md:"spinner-md",lg:"spinner-lg"};return s.jsx("div",{className:`spinner ${n[e]||"spinner-md"} ${t}`,children:s.jsx("div",{className:"spinner-ring"})})}const ey={danger:Aa,warning:$x,info:bo};function Ba({isOpen:e,title:t,message:n,confirmText:r="Confirm",cancelText:a="Cancel",variant:i="danger",onConfirm:l,onCancel:c}){if(!e)return null;const o=ey[i]||Aa;return s.jsx("div",{className:"modal-overlay",onClick:c,children:s.jsxs("div",{className:"modal confirm-dialog",onClick:u=>u.stopPropagation(),children:[s.jsxs("div",{className:"confirm-dialog-content",children:[s.jsx("div",{className:`confirm-dialog-icon confirm-dialog-icon-${i}`,children:s.jsx(o,{size:32})}),s.jsx("h2",{className:"confirm-dialog-title",children:t}),s.jsx("p",{className:"confirm-dialog-message",children:n})]}),s.jsxs("div",{className:"confirm-dialog-actions",children:[s.jsx("button",{className:"btn btn-secondary",onClick:c,children:a}),s.jsx("button",{className:`btn btn-${i==="danger"?"danger":"primary"}`,onClick:l,children:r})]})]})})}function ty(){const[e,t]=d.useState("/home"),[n,r]=d.useState([]),[a,i]=d.useState(null),[l,c]=d.useState(!0),[o,u]=d.useState(!1),[f,h]=d.useState(""),[p,v]=d.useState(null),[N,j]=d.useState(null),[k,m]=d.useState(null),[x,g]=d.useState(""),[y,S]=d.useState(null),[E,T]=d.useState(!1),[P,O]=d.useState(!1),[w,L]=d.useState(!1),[U,V]=d.useState(!1),[H,B]=d.useState(""),[z,J]=d.useState(""),[R,_]=d.useState(null),[I,Q]=d.useState(""),[Y,ve]=d.useState(null),[ne,C]=d.useState(""),[G,F]=d.useState(null),[ee,ge]=d.useState(null),D=d.useRef(null),W=Se();d.useEffect(()=>{fe(e),Ce()},[e,o]);const fe=async $=>{c(!0),v(null);try{const me=await b.browseFiles($,o);r(me.entries||[]),i(me.parent),t(me.path)}catch(me){W.error(`Failed to load directory: ${me.message}`)}finally{c(!1)}},Ce=async()=>{try{const $=await b.getDiskUsage(e);j($)}catch($){console.error("Failed to load disk usage:",$)}},bt=async()=>{if(!f.trim()){v(null);return}c(!0);try{const $=await b.searchFiles(e,f);v($.results||[])}catch($){W.error(`Search failed: ${$.message}`)}finally{c(!1)}},as=$=>{$.is_dir?(t($.path),m(null),S(null)):A($)},A=async $=>{if(m($),$.is_editable)try{const me=await b.readFile($.path);g(me.content)}catch(me){W.error(`Failed to read file: ${me.message}`)}},Ne=()=>{k&&k.is_editable&&S(k)},Ns=async()=>{if(y)try{await b.writeFile(y.path,x),W.success("File saved successfully"),S(null),fe(e)}catch($){W.error(`Failed to save file: ${$.message}`)}},Jn=async()=>{if(!H.trim())return;const $=`${e}/${H}`;try{await b.createFile($),W.success("File created successfully"),T(!1),B(""),fe(e)}catch(me){W.error(`Failed to create file: ${me.message}`)}},Zn=async()=>{if(!z.trim())return;const $=`${e}/${z}`;try{await b.createDirectory($),W.success("Folder created successfully"),O(!1),J(""),fe(e)}catch(me){W.error(`Failed to create folder: ${me.message}`)}},er=async $=>{ge({title:"Delete Confirmation",message:`Are you sure you want to delete "${$.name}"? ${$.is_dir?"This will delete all contents inside.":""}`,confirmText:"Delete",variant:"danger",onConfirm:async()=>{try{await b.deleteFile($.path),W.success(`${$.is_dir?"Folder":"File"} deleted successfully`),m(null),fe(e)}catch(me){W.error(`Failed to delete: ${me.message}`)}ge(null)},onCancel:()=>ge(null)})},tr=async()=>{if(!(!R||!I.trim()))try{await b.renameFile(R.path,I),W.success("Renamed successfully"),L(!1),_(null),Q(""),fe(e)}catch($){W.error(`Failed to rename: ${$.message}`)}},sr=async()=>{if(!(!Y||!ne.trim()))try{await b.changeFilePermissions(Y.path,ne),W.success("Permissions changed successfully"),V(!1),ve(null),C(""),fe(e)}catch($){W.error(`Failed to change permissions: ${$.message}`)}},nr=async $=>{const me=$.target.files[0];if(me)try{await b.uploadFile(e,me,rr=>{F(rr)}),W.success("File uploaded successfully"),fe(e)}catch(rr){W.error(`Upload failed: ${rr.message}`)}finally{F(null),D.current&&(D.current.value="")}},K=$=>{b.downloadFile($.path)},De=$=>{_($),Q($.name),L(!0)},Ia=$=>{ve($),C($.permissions_octal||"755"),V(!0)},zh=$=>{if($.is_dir)return"folder";const me=$.name.split(".").pop().toLowerCase();return{js:"javascript",jsx:"javascript",ts:"javascript",tsx:"javascript",py:"python",rb:"ruby",php:"php",java:"java",html:"html",css:"css",less:"css",scss:"css",json:"json",xml:"xml",yaml:"yaml",yml:"yaml",md:"markdown",txt:"text",log:"text",sh:"terminal",bash:"terminal",jpg:"image",jpeg:"image",png:"image",gif:"image",svg:"image",pdf:"pdf",doc:"document",docx:"document",zip:"archive",tar:"archive",gz:"archive",rar:"archive"}[me]||"file"},Eo=p||n;return s.jsxs("div",{className:"file-manager",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-content",children:[s.jsx("h1",{children:"File Manager"}),s.jsx("p",{className:"page-description",children:"Browse, edit, and manage your server files"})]}),s.jsxs("div",{className:"page-header-actions",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>{var $;return($=D.current)==null?void 0:$.click()},children:"Upload"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>O(!0),children:"New Folder"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>T(!0),children:"New File"}),s.jsx("input",{type:"file",ref:D,style:{display:"none"},onChange:nr})]})]}),G!==null&&s.jsxs("div",{className:"upload-progress",children:[s.jsx("div",{className:"progress-bar",children:s.jsx("div",{className:"progress-fill",style:{width:`${G}%`}})}),s.jsxs("span",{children:[Math.round(G),"%"]})]}),s.jsxs("div",{className:"file-manager-toolbar",children:[s.jsxs("div",{className:"path-breadcrumb",children:[s.jsx("button",{className:"btn btn-icon",onClick:()=>a&&t(a),disabled:!a,children:s.jsx("span",{className:"icon",children:"arrow_back"})}),s.jsx("span",{className:"current-path",children:e})]}),s.jsxs("div",{className:"toolbar-actions",children:[s.jsxs("div",{className:"search-box",children:[s.jsx("input",{type:"text",placeholder:"Search files...",value:f,onChange:$=>h($.target.value),onKeyDown:$=>$.key==="Enter"&&bt()}),s.jsx("button",{className:"btn btn-icon",onClick:bt,children:s.jsx("span",{className:"icon",children:"search"})}),p&&s.jsx("button",{className:"btn btn-icon",onClick:()=>v(null),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:o,onChange:$=>u($.target.checked)}),"Show hidden"]}),s.jsx("button",{className:"btn btn-icon",onClick:()=>fe(e),children:s.jsx("span",{className:"icon",children:"refresh"})})]})]}),N&&s.jsxs("div",{className:"disk-usage-bar",children:[s.jsxs("div",{className:"disk-usage-info",children:[s.jsxs("span",{children:["Disk Usage: ",N.used_human," / ",N.total_human]}),s.jsxs("span",{children:[N.percent,"% used"]})]}),s.jsx("div",{className:"disk-progress",children:s.jsx("div",{className:`disk-progress-fill ${N.percent>90?"critical":N.percent>75?"warning":""}`,style:{width:`${N.percent}%`}})})]}),s.jsxs("div",{className:"file-manager-content",children:[s.jsx("div",{className:"file-list-container",children:l?s.jsx("div",{className:"loading-state",children:s.jsx(Oa,{})}):Eo.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"folder_open"}),s.jsx("p",{children:p?"No files found matching your search":"This directory is empty"})]}):s.jsxs("div",{className:"file-list",children:[s.jsxs("div",{className:"file-list-header",children:[s.jsx("span",{className:"col-name",children:"Name"}),s.jsx("span",{className:"col-size",children:"Size"}),s.jsx("span",{className:"col-modified",children:"Modified"}),s.jsx("span",{className:"col-permissions",children:"Permissions"}),s.jsx("span",{className:"col-actions",children:"Actions"})]}),Eo.map($=>s.jsxs("div",{className:`file-item ${(k==null?void 0:k.path)===$.path?"selected":""}`,onClick:()=>as($),children:[s.jsxs("span",{className:"col-name",children:[s.jsx("span",{className:`file-icon ${zh($)}`}),$.name,$.is_link&&s.jsx("span",{className:"link-indicator",children:"→"})]}),s.jsx("span",{className:"col-size",children:$.is_dir?"-":$.size_human}),s.jsx("span",{className:"col-modified",children:new Date($.modified).toLocaleDateString()}),s.jsx("span",{className:"col-permissions",children:$.permissions}),s.jsxs("span",{className:"col-actions",onClick:me=>me.stopPropagation(),children:[!$.is_dir&&s.jsx("button",{className:"btn btn-icon btn-sm",onClick:()=>K($),title:"Download",children:s.jsx("span",{className:"icon",children:"download"})}),s.jsx("button",{className:"btn btn-icon btn-sm",onClick:()=>De($),title:"Rename",children:s.jsx("span",{className:"icon",children:"edit"})}),s.jsx("button",{className:"btn btn-icon btn-sm",onClick:()=>Ia($),title:"Permissions",children:s.jsx("span",{className:"icon",children:"lock"})}),s.jsx("button",{className:"btn btn-icon btn-sm btn-danger",onClick:()=>er($),title:"Delete",children:s.jsx("span",{className:"icon",children:"delete"})})]})]},$.path))]})}),k&&!k.is_dir&&s.jsxs("div",{className:"file-preview",children:[s.jsxs("div",{className:"preview-header",children:[s.jsx("h3",{children:k.name}),s.jsxs("div",{className:"preview-actions",children:[k.is_editable&&!y&&s.jsx("button",{className:"btn btn-primary btn-sm",onClick:Ne,children:"Edit"}),y&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>S(null),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:Ns,children:"Save"})]}),s.jsx("button",{className:"btn btn-icon btn-sm",onClick:()=>m(null),children:s.jsx("span",{className:"icon",children:"close"})})]})]}),s.jsxs("div",{className:"preview-info",children:[s.jsxs("span",{children:["Size: ",k.size_human]}),s.jsxs("span",{children:["Owner: ",k.owner]}),s.jsxs("span",{children:["Group: ",k.group]}),k.mime_type&&s.jsxs("span",{children:["Type: ",k.mime_type]})]}),k.is_editable?s.jsx("textarea",{className:"file-editor",value:x,onChange:$=>g($.target.value),readOnly:!y,spellCheck:!1}):s.jsxs("div",{className:"preview-unavailable",children:[s.jsx("span",{className:"icon",children:"visibility_off"}),s.jsx("p",{children:"Preview not available for this file type"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>K(k),children:"Download File"})]})]})]}),E&&s.jsx("div",{className:"modal-overlay",onClick:()=>T(!1),children:s.jsxs("div",{className:"modal",onClick:$=>$.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create New File"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>T(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"File Name"}),s.jsx("input",{type:"text",value:H,onChange:$=>B($.target.value),placeholder:"example.txt",autoFocus:!0})]}),s.jsxs("p",{className:"text-muted",children:["File will be created in: ",e]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>T(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:Jn,children:"Create File"})]})]})}),P&&s.jsx("div",{className:"modal-overlay",onClick:()=>O(!1),children:s.jsxs("div",{className:"modal",onClick:$=>$.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create New Folder"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>O(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Folder Name"}),s.jsx("input",{type:"text",value:z,onChange:$=>J($.target.value),placeholder:"new-folder",autoFocus:!0})]}),s.jsxs("p",{className:"text-muted",children:["Folder will be created in: ",e]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>O(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:Zn,children:"Create Folder"})]})]})}),w&&s.jsx("div",{className:"modal-overlay",onClick:()=>L(!1),children:s.jsxs("div",{className:"modal",onClick:$=>$.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:["Rename ",R!=null&&R.is_dir?"Folder":"File"]}),s.jsx("button",{className:"btn btn-icon",onClick:()=>L(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"New Name"}),s.jsx("input",{type:"text",value:I,onChange:$=>Q($.target.value),autoFocus:!0})]})}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>L(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:tr,children:"Rename"})]})]})}),U&&s.jsx("div",{className:"modal-overlay",onClick:()=>V(!1),children:s.jsxs("div",{className:"modal",onClick:$=>$.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Change Permissions"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>V(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Permissions (Octal)"}),s.jsx("input",{type:"text",value:ne,onChange:$=>C($.target.value),placeholder:"755",maxLength:4,autoFocus:!0})]}),s.jsxs("p",{className:"text-muted",children:["Current: ",Y==null?void 0:Y.permissions," (",Y==null?void 0:Y.permissions_octal,")"]}),s.jsxs("div",{className:"permissions-help",children:[s.jsx("p",{children:"Common permissions:"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("code",{children:"755"})," - Owner: rwx, Group/Other: rx (directories)"]}),s.jsxs("li",{children:[s.jsx("code",{children:"644"})," - Owner: rw, Group/Other: r (files)"]}),s.jsxs("li",{children:[s.jsx("code",{children:"600"})," - Owner: rw only (private files)"]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>V(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:sr,children:"Apply"})]})]})}),ee&&s.jsx(Ba,{title:ee.title,message:ee.message,confirmText:ee.confirmText,variant:ee.variant,onConfirm:ee.onConfirm,onCancel:ee.onCancel})]})}function sy(){var as;const[e,t]=d.useState(null),[n,r]=d.useState([]),[a,i]=d.useState([]),[l,c]=d.useState(null),[o,u]=d.useState(""),[f,h]=d.useState(!0),[p,v]=d.useState("overview"),[N,j]=d.useState(!1),[k,m]=d.useState(!1),[x,g]=d.useState(!1),[y,S]=d.useState({username:"",password:"",homeDir:""}),[E,T]=d.useState(null),[P,O]=d.useState(""),[w,L]=d.useState("vsftpd"),[U,V]=d.useState(null),[H,B]=d.useState(!1),z=Se();d.useEffect(()=>{J()},[]);const J=async()=>{h(!0);try{await Promise.all([R(),I(),Q()])}catch(A){console.error("Failed to load FTP data:",A)}finally{h(!1)}},R=async()=>{try{const A=await b.getFTPStatus();t(A),A.active_server&&_(A.active_server)}catch(A){console.error("Failed to load FTP status:",A)}},_=async A=>{try{const Ne=await b.getFTPConfig(A);c(Ne)}catch(Ne){console.error("Failed to load FTP config:",Ne)}},I=async()=>{try{const A=await b.getFTPUsers();r(A.users||[])}catch(A){console.error("Failed to load FTP users:",A)}},Q=async()=>{try{const A=await b.getFTPConnections();i(A.connections||[])}catch(A){console.error("Failed to load FTP connections:",A)}},Y=async()=>{try{const A=await b.getFTPLogs(200);u(A.content||"No logs available")}catch{u("Failed to load logs")}},ve=async A=>{if(e!=null&&e.active_server){B(!0);try{await b.controlFTPService(A,e.active_server),z.success(`FTP server ${A}ed successfully`),await R()}catch(Ne){z.error(`Failed to ${A} FTP server: ${Ne.message}`)}finally{B(!1)}}},ne=async()=>{B(!0);try{await b.installFTPServer(w),z.success(`${w} installed successfully`),g(!1),await J()}catch(A){z.error(`Failed to install: ${A.message}`)}finally{B(!1)}},C=async()=>{if(y.username.trim()){B(!0);try{const A=await b.createFTPUser(y.username,y.password||null,y.homeDir||null);z.success(`User created. Password: ${A.password}`),j(!1),S({username:"",password:"",homeDir:""}),await I()}catch(A){z.error(`Failed to create user: ${A.message}`)}finally{B(!1)}}},G=async A=>{V({title:"Delete FTP User",message:`Are you sure you want to delete user "${A}"?`,confirmText:"Delete",variant:"danger",onConfirm:async()=>{try{await b.deleteFTPUser(A,!1),z.success("User deleted successfully"),await I()}catch(Ne){z.error(`Failed to delete user: ${Ne.message}`)}V(null)},onCancel:()=>V(null)})},F=async(A,Ne)=>{try{await b.toggleFTPUser(A,!Ne),z.success(`User ${Ne?"disabled":"enabled"} successfully`),await I()}catch(Ns){z.error(`Failed to toggle user: ${Ns.message}`)}},ee=async()=>{if(E){B(!0);try{const A=await b.changeFTPPassword(E,P||null);z.success(`Password changed. New password: ${A.password}`),m(!1),T(null),O("")}catch(A){z.error(`Failed to change password: ${A.message}`)}finally{B(!1)}}},ge=async A=>{try{await b.disconnectFTPSession(A),z.success("Session disconnected"),await Q()}catch(Ne){z.error(`Failed to disconnect: ${Ne.message}`)}},D=async()=>{B(!0);try{const A=await b.testFTPConnection("localhost",21);A.success?z.success(A.message):z.error(A.error)}catch(A){z.error(`Connection test failed: ${A.message}`)}finally{B(!1)}},W=A=>{T(A),O(""),m(!0)};if(f)return s.jsx("div",{className:"page-loading",children:s.jsx(Oa,{size:"lg"})});const fe=e==null?void 0:e.any_installed,Ce=e==null?void 0:e.any_running,bt=e==null?void 0:e.active_server;return s.jsxs("div",{className:"ftp-server",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-content",children:[s.jsx("h1",{children:"FTP Server"}),s.jsx("p",{className:"page-description",children:"Manage FTP users and file transfer settings"})]}),s.jsx("div",{className:"page-header-actions",children:fe?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:D,disabled:H,children:"Test Connection"}),Ce?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>ve("restart"),disabled:H,children:"Restart"}),s.jsx("button",{className:"btn btn-danger",onClick:()=>ve("stop"),disabled:H,children:"Stop"})]}):s.jsx("button",{className:"btn btn-primary",onClick:()=>ve("start"),disabled:H,children:"Start"})]}):s.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"Install FTP Server"})})]}),fe?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-cards",children:[s.jsxs("div",{className:`status-card ${Ce?"success":"warning"}`,children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:Ce?"check_circle":"pause_circle"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Server Status"}),s.jsx("span",{className:"status-value",children:Ce?"Running":"Stopped"})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"dns"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Active Server"}),s.jsx("span",{className:"status-value",children:bt||"None"})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"people"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"FTP Users"}),s.jsx("span",{className:"status-value",children:n.length})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"lan"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Active Connections"}),s.jsx("span",{className:"status-value",children:a.length})]})]})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${p==="overview"?"active":""}`,onClick:()=>v("overview"),children:"Overview"}),s.jsx("button",{className:`tab ${p==="users"?"active":""}`,onClick:()=>v("users"),children:"Users"}),s.jsx("button",{className:`tab ${p==="connections"?"active":""}`,onClick:()=>{v("connections"),Q()},children:"Connections"}),s.jsx("button",{className:`tab ${p==="logs"?"active":""}`,onClick:()=>{v("logs"),Y()},children:"Logs"})]}),s.jsxs("div",{className:"tab-content",children:[p==="overview"&&s.jsxs("div",{className:"overview-tab",children:[s.jsxs("div",{className:"config-section",children:[s.jsx("h3",{children:"Server Configuration"}),l!=null&&l.settings?s.jsxs("div",{className:"config-grid",children:[s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"Port"}),s.jsx("span",{className:"config-value",children:l.settings.listen_port||l.settings.port||21})]}),s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"Anonymous Access"}),s.jsx("span",{className:`config-value ${l.settings.anonymous_enable?"warning":"success"}`,children:l.settings.anonymous_enable?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"Local Users"}),s.jsx("span",{className:"config-value",children:l.settings.local_enable?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"Write Permission"}),s.jsx("span",{className:"config-value",children:l.settings.write_enable?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"Chroot Users"}),s.jsx("span",{className:"config-value",children:l.settings.chroot_local_user?"Yes":"No"})]}),s.jsxs("div",{className:"config-item",children:[s.jsx("span",{className:"config-label",children:"SSL/TLS"}),s.jsx("span",{className:`config-value ${l.settings.ssl_enable?"success":"warning"}`,children:l.settings.ssl_enable?"Enabled":"Disabled"})]})]}):s.jsx("p",{className:"text-muted",children:"Configuration not available"})]}),s.jsxs("div",{className:"info-section",children:[s.jsx("h3",{children:"Connection Information"}),s.jsxs("div",{className:"info-grid",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Host"}),s.jsx("code",{children:"Your server IP or domain"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Port"}),s.jsx("code",{children:"21"})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Protocol"}),s.jsxs("code",{children:["FTP",(as=l==null?void 0:l.settings)!=null&&as.ssl_enable?"S":""]})]})]})]})]}),p==="users"&&s.jsxs("div",{className:"users-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"FTP Users"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>j(!0),children:"Add User"})]}),n.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"person_add"}),s.jsx("p",{children:"No FTP users configured"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>j(!0),children:"Create First User"})]}):s.jsx("div",{className:"users-table",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Username"}),s.jsx("th",{children:"Home Directory"}),s.jsx("th",{children:"Usage"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:n.map(A=>s.jsxs("tr",{children:[s.jsxs("td",{children:[s.jsx("span",{className:"user-name",children:A.username}),A.in_userlist&&s.jsx("span",{className:"badge badge-info",children:"FTP"})]}),s.jsxs("td",{children:[s.jsx("code",{children:A.home}),!A.home_exists&&s.jsx("span",{className:"badge badge-warning",children:"Missing"})]}),s.jsx("td",{children:A.home_size_human}),s.jsx("td",{children:s.jsx("span",{className:`status-badge ${A.is_active?"active":"inactive"}`,children:A.is_active?"Active":"Disabled"})}),s.jsxs("td",{className:"actions",children:[s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>W(A.username),title:"Change Password",children:s.jsx("span",{className:"icon",children:"key"})}),s.jsx("button",{className:`btn btn-sm ${A.is_active?"btn-warning":"btn-success"}`,onClick:()=>F(A.username,A.is_active),title:A.is_active?"Disable":"Enable",children:s.jsx("span",{className:"icon",children:A.is_active?"block":"check"})}),s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>G(A.username),title:"Delete",children:s.jsx("span",{className:"icon",children:"delete"})})]})]},A.username))})]})})]}),p==="connections"&&s.jsxs("div",{className:"connections-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Active Connections"}),s.jsxs("button",{className:"btn btn-secondary",onClick:Q,children:[s.jsx("span",{className:"icon",children:"refresh"}),"Refresh"]})]}),a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"lan"}),s.jsx("p",{children:"No active connections"})]}):s.jsx("div",{className:"connections-table",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Local Address"}),s.jsx("th",{children:"Remote Address"}),s.jsx("th",{children:"State"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:a.map((A,Ne)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{children:A.local})}),s.jsx("td",{children:s.jsx("code",{children:A.remote})}),s.jsx("td",{children:s.jsx("span",{className:"status-badge active",children:A.state})}),s.jsx("td",{children:s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>ge(A.pid),title:"Disconnect",children:s.jsx("span",{className:"icon",children:"close"})})})]},Ne))})]})})]}),p==="logs"&&s.jsxs("div",{className:"logs-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Server Logs"}),s.jsxs("button",{className:"btn btn-secondary",onClick:Y,children:[s.jsx("span",{className:"icon",children:"refresh"}),"Refresh"]})]}),s.jsx("div",{className:"log-viewer",children:s.jsx("pre",{children:o})})]})]})]}):s.jsxs("div",{className:"empty-state-large",children:[s.jsx("span",{className:"icon",children:"cloud_upload"}),s.jsx("h2",{children:"No FTP Server Installed"}),s.jsx("p",{children:"Install an FTP server to enable file transfers on your server."}),s.jsx("button",{className:"btn btn-primary btn-lg",onClick:()=>g(!0),children:"Install FTP Server"})]}),x&&s.jsx("div",{className:"modal-overlay",onClick:()=>g(!1),children:s.jsxs("div",{className:"modal",onClick:A=>A.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Install FTP Server"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>g(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Select FTP Server"}),s.jsxs("select",{value:w,onChange:A=>L(A.target.value),children:[s.jsx("option",{value:"vsftpd",children:"vsftpd (Recommended)"}),s.jsx("option",{value:"proftpd",children:"ProFTPD"})]})]}),s.jsx("div",{className:"install-info",children:w==="vsftpd"?s.jsxs("p",{children:[s.jsx("strong",{children:"vsftpd"})," is a secure, fast, and stable FTP server. It's the default choice for most Ubuntu/Debian systems."]}):s.jsxs("p",{children:[s.jsx("strong",{children:"ProFTPD"})," is a highly configurable FTP server with advanced features and Apache-like configuration syntax."]})})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>g(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:ne,disabled:H,children:H?"Installing...":"Install"})]})]})}),N&&s.jsx("div",{className:"modal-overlay",onClick:()=>j(!1),children:s.jsxs("div",{className:"modal",onClick:A=>A.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create FTP User"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>j(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Username *"}),s.jsx("input",{type:"text",value:y.username,onChange:A=>S({...y,username:A.target.value}),placeholder:"ftpuser"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Password (leave empty to auto-generate)"}),s.jsx("input",{type:"password",value:y.password,onChange:A=>S({...y,password:A.target.value}),placeholder:"Auto-generated if empty"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Home Directory (optional)"}),s.jsx("input",{type:"text",value:y.homeDir,onChange:A=>S({...y,homeDir:A.target.value}),placeholder:"/home/ftp/username"})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>j(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:C,disabled:H||!y.username.trim(),children:H?"Creating...":"Create User"})]})]})}),k&&s.jsx("div",{className:"modal-overlay",onClick:()=>m(!1),children:s.jsxs("div",{className:"modal",onClick:A=>A.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Change Password"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>m(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("p",{children:["Changing password for user: ",s.jsx("strong",{children:E})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"New Password (leave empty to auto-generate)"}),s.jsx("input",{type:"password",value:P,onChange:A=>O(A.target.value),placeholder:"Auto-generated if empty"})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>m(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:ee,disabled:H,children:H?"Changing...":"Change Password"})]})]})}),U&&s.jsx(Ba,{title:U.title,message:U.message,confirmText:U.confirmText,variant:U.variant,onConfirm:U.onConfirm,onCancel:U.onCancel})]})}function ny(){const[e,t]=d.useState([]),[n,r]=d.useState(null),[a,i]=d.useState([]),[l,c]=d.useState([]),[o,u]=d.useState(null),[f,h]=d.useState(!0),[p,v]=d.useState("versions"),[N,j]=d.useState(!1),[k,m]=d.useState(!1),[x,g]=d.useState(!1),[y,S]=d.useState("8.2"),[E,T]=d.useState(""),[P,O]=d.useState({name:"",user:"www-data",group:"www-data",listen:"",pm:"dynamic",pm_max_children:5,pm_start_servers:2,pm_min_spare_servers:1,pm_max_spare_servers:3}),[w,L]=d.useState(!1),[U,V]=d.useState(null),H=Se(),B=["8.0","8.1","8.2","8.3"];d.useEffect(()=>{z()},[]),d.useEffect(()=>{n&&J(n)},[n]);const z=async()=>{var C;h(!0);try{const G=await b.getPHPVersions();if(t(G.versions||[]),((C=G.versions)==null?void 0:C.length)>0){const F=G.versions.find(ee=>ee.is_default)||G.versions[0];r(F.version)}}catch(G){H.error(`Failed to load PHP versions: ${G.message}`)}finally{h(!1)}},J=async C=>{try{const[G,F,ee]=await Promise.all([b.getPHPExtensions(C).catch(()=>({extensions:[]})),b.getPHPPools(C).catch(()=>({pools:[]})),b.getPHPFPMStatus(C).catch(()=>null)]);i(G.extensions||[]),c(F.pools||[]),u(ee)}catch(G){console.error("Failed to load version details:",G)}},R=async()=>{L(!0);try{await b.installPHPVersion(y),H.success(`PHP ${y} installation started`),j(!1),await z()}catch(C){H.error(`Failed to install PHP ${y}: ${C.message}`)}finally{L(!1)}},_=async C=>{L(!0);try{await b.setDefaultPHPVersion(C),H.success(`PHP ${C} is now the default version`),await z()}catch(G){H.error(`Failed to set default version: ${G.message}`)}finally{L(!1)}},I=async()=>{if(!(!E.trim()||!n)){L(!0);try{await b.installPHPExtension(n,E),H.success(`Extension ${E} installation started`),m(!1),T(""),await J(n)}catch(C){H.error(`Failed to install extension: ${C.message}`)}finally{L(!1)}}},Q=async()=>{if(!(!P.name.trim()||!n)){L(!0);try{const C={...P,listen:P.listen||`/run/php/php${n}-fpm-${P.name}.sock`};await b.createPHPPool(n,C),H.success(`Pool ${P.name} created successfully`),g(!1),O({name:"",user:"www-data",group:"www-data",listen:"",pm:"dynamic",pm_max_children:5,pm_start_servers:2,pm_min_spare_servers:1,pm_max_spare_servers:3}),await J(n)}catch(C){H.error(`Failed to create pool: ${C.message}`)}finally{L(!1)}}},Y=async C=>{V({title:"Delete Pool",message:`Are you sure you want to delete the pool "${C}"?`,confirmText:"Delete",variant:"danger",onConfirm:async()=>{try{await b.deletePHPPool(n,C),H.success(`Pool ${C} deleted`),await J(n)}catch(G){H.error(`Failed to delete pool: ${G.message}`)}V(null)},onCancel:()=>V(null)})},ve=async()=>{if(n){L(!0);try{await b.restartPHPFPM(n),H.success(`PHP-FPM ${n} restarted`),await J(n)}catch(C){H.error(`Failed to restart PHP-FPM: ${C.message}`)}finally{L(!1)}}},ne=e.find(C=>C.version===n);return f?s.jsx("div",{className:"page-loading",children:s.jsx(Oa,{size:"lg"})}):s.jsxs("div",{className:"php-management",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-content",children:[s.jsx("h1",{children:"PHP Management"}),s.jsx("p",{className:"page-description",children:"Manage PHP versions, extensions, and FPM pools"})]}),s.jsxs("div",{className:"page-header-actions",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ve,disabled:!n||w,children:"Restart FPM"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>j(!0),children:"Install PHP Version"})]})]}),e.length===0?s.jsxs("div",{className:"empty-state-large",children:[s.jsx("span",{className:"icon",children:"code"}),s.jsx("h2",{children:"No PHP Versions Installed"}),s.jsx("p",{children:"Install a PHP version to get started with PHP development."}),s.jsx("button",{className:"btn btn-primary btn-lg",onClick:()=>j(!0),children:"Install PHP"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"version-selector",children:[s.jsx("label",{children:"Active Version:"}),s.jsx("select",{value:n||"",onChange:C=>r(C.target.value),children:e.map(C=>s.jsxs("option",{value:C.version,children:["PHP ",C.version," ",C.is_default?"(Default)":""]},C.version))}),ne&&!ne.is_default&&s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>_(n),disabled:w,children:"Set as Default"})]}),o&&s.jsxs("div",{className:"status-cards",children:[s.jsxs("div",{className:`status-card ${o.active?"success":"warning"}`,children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:o.active?"check_circle":"error"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"FPM Status"}),s.jsx("span",{className:"status-value",children:o.active?"Running":"Stopped"})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"extension"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Extensions"}),s.jsx("span",{className:"status-value",children:a.length})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"layers"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"FPM Pools"}),s.jsx("span",{className:"status-value",children:l.length})]})]})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${p==="versions"?"active":""}`,onClick:()=>v("versions"),children:"Installed Versions"}),s.jsx("button",{className:`tab ${p==="extensions"?"active":""}`,onClick:()=>v("extensions"),children:"Extensions"}),s.jsx("button",{className:`tab ${p==="pools"?"active":""}`,onClick:()=>v("pools"),children:"FPM Pools"})]}),s.jsxs("div",{className:"tab-content",children:[p==="versions"&&s.jsx("div",{className:"versions-tab",children:s.jsx("div",{className:"versions-grid",children:e.map(C=>s.jsxs("div",{className:`version-card ${C.version===n?"selected":""}`,onClick:()=>r(C.version),children:[s.jsxs("div",{className:"version-header",children:[s.jsxs("span",{className:"version-number",children:["PHP ",C.version]}),C.is_default&&s.jsx("span",{className:"badge badge-primary",children:"Default"})]}),s.jsxs("div",{className:"version-details",children:[s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"label",children:"Binary:"}),s.jsx("code",{children:C.binary||`/usr/bin/php${C.version}`})]}),s.jsxs("div",{className:"detail-row",children:[s.jsx("span",{className:"label",children:"FPM:"}),s.jsx("span",{className:`status ${C.fpm_active?"active":"inactive"}`,children:C.fpm_active?"Running":"Stopped"})]})]}),s.jsx("div",{className:"version-actions",children:!C.is_default&&s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:G=>{G.stopPropagation(),_(C.version)},children:"Set Default"})})]},C.version))})}),p==="extensions"&&s.jsxs("div",{className:"extensions-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsxs("h3",{children:["Installed Extensions (PHP ",n,")"]}),s.jsx("button",{className:"btn btn-primary",onClick:()=>m(!0),children:"Install Extension"})]}),a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"extension"}),s.jsx("p",{children:"No extensions found"})]}):s.jsx("div",{className:"extensions-grid",children:a.map(C=>s.jsxs("div",{className:"extension-card",children:[s.jsx("span",{className:"extension-name",children:C.name||C}),C.version&&s.jsx("span",{className:"extension-version",children:C.version})]},C.name||C))})]}),p==="pools"&&s.jsxs("div",{className:"pools-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsxs("h3",{children:["FPM Pools (PHP ",n,")"]}),s.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"Create Pool"})]}),l.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"layers"}),s.jsx("p",{children:"No FPM pools configured"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"Create Pool"})]}):s.jsx("div",{className:"pools-table",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Pool Name"}),s.jsx("th",{children:"User"}),s.jsx("th",{children:"Listen"}),s.jsx("th",{children:"Process Manager"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:l.map(C=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("strong",{children:C.name})}),s.jsxs("td",{children:[C.user,":",C.group]}),s.jsx("td",{children:s.jsx("code",{children:C.listen})}),s.jsx("td",{children:s.jsx("span",{className:"badge",children:C.pm||"dynamic"})}),s.jsx("td",{children:s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>Y(C.name),disabled:C.name==="www",title:C.name==="www"?"Cannot delete default pool":"Delete pool",children:s.jsx("span",{className:"icon",children:"delete"})})})]},C.name))})]})})]})]})]}),N&&s.jsx("div",{className:"modal-overlay",onClick:()=>j(!1),children:s.jsxs("div",{className:"modal",onClick:C=>C.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Install PHP Version"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>j(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"PHP Version"}),s.jsx("select",{value:y,onChange:C=>S(C.target.value),children:B.map(C=>s.jsxs("option",{value:C,disabled:e.some(G=>G.version===C),children:["PHP ",C," ",e.some(G=>G.version===C)?"(Installed)":""]},C))})]}),s.jsxs("p",{className:"text-muted",children:["This will install PHP ",y," with common extensions including cli, fpm, mysql, pgsql, sqlite3, curl, gd, mbstring, xml, and zip."]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>j(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:R,disabled:w||e.some(C=>C.version===y),children:w?"Installing...":"Install"})]})]})}),k&&s.jsx("div",{className:"modal-overlay",onClick:()=>m(!1),children:s.jsxs("div",{className:"modal",onClick:C=>C.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Install PHP Extension"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>m(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Extension Name"}),s.jsx("input",{type:"text",value:E,onChange:C=>T(C.target.value),placeholder:"e.g., redis, imagick, xdebug"})]}),s.jsxs("div",{className:"common-extensions",children:[s.jsx("p",{className:"text-muted",children:"Common extensions:"}),s.jsx("div",{className:"extension-chips",children:["redis","imagick","xdebug","memcached","opcache","intl","soap","ldap"].map(C=>s.jsx("button",{className:"chip",onClick:()=>T(C),children:C},C))})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>m(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:I,disabled:w||!E.trim(),children:w?"Installing...":"Install"})]})]})}),x&&s.jsx("div",{className:"modal-overlay",onClick:()=>g(!1),children:s.jsxs("div",{className:"modal modal-lg",onClick:C=>C.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Create FPM Pool"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>g(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Pool Name *"}),s.jsx("input",{type:"text",value:P.name,onChange:C=>O({...P,name:C.target.value}),placeholder:"myapp"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Process Manager"}),s.jsxs("select",{value:P.pm,onChange:C=>O({...P,pm:C.target.value}),children:[s.jsx("option",{value:"dynamic",children:"Dynamic"}),s.jsx("option",{value:"static",children:"Static"}),s.jsx("option",{value:"ondemand",children:"On Demand"})]})]})]}),s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"User"}),s.jsx("input",{type:"text",value:P.user,onChange:C=>O({...P,user:C.target.value})})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Group"}),s.jsx("input",{type:"text",value:P.group,onChange:C=>O({...P,group:C.target.value})})]})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Listen Socket (leave empty for default)"}),s.jsx("input",{type:"text",value:P.listen,onChange:C=>O({...P,listen:C.target.value}),placeholder:`/run/php/php${n}-fpm-${P.name||"poolname"}.sock`})]}),P.pm==="dynamic"&&s.jsxs("div",{className:"form-row form-row-4",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Max Children"}),s.jsx("input",{type:"number",value:P.pm_max_children,onChange:C=>O({...P,pm_max_children:parseInt(C.target.value)}),min:"1"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Start Servers"}),s.jsx("input",{type:"number",value:P.pm_start_servers,onChange:C=>O({...P,pm_start_servers:parseInt(C.target.value)}),min:"1"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Min Spare"}),s.jsx("input",{type:"number",value:P.pm_min_spare_servers,onChange:C=>O({...P,pm_min_spare_servers:parseInt(C.target.value)}),min:"1"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Max Spare"}),s.jsx("input",{type:"number",value:P.pm_max_spare_servers,onChange:C=>O({...P,pm_max_spare_servers:parseInt(C.target.value)}),min:"1"})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>g(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:Q,disabled:w||!P.name.trim(),children:w?"Creating...":"Create Pool"})]})]})}),U&&s.jsx(Ba,{title:U.title,message:U.message,confirmText:U.confirmText,variant:U.variant,onConfirm:U.onConfirm,onCancel:U.onCancel})]})}function ry(){var G;const[e,t]=d.useState(null),[n,r]=d.useState([]),[a,i]=d.useState([]),[l,c]=d.useState(!0),[o,u]=d.useState("overview"),[f,h]=d.useState(!1),[p,v]=d.useState(!1),[N,j]=d.useState(!1),[k,m]=d.useState(""),[x,g]=d.useState({port:"",protocol:"tcp"}),[y,S]=d.useState("ufw"),[E,T]=d.useState(!1),[P,O]=d.useState(null),w=Se(),L=[{port:22,name:"SSH",protocol:"tcp"},{port:80,name:"HTTP",protocol:"tcp"},{port:443,name:"HTTPS",protocol:"tcp"},{port:21,name:"FTP",protocol:"tcp"},{port:25,name:"SMTP",protocol:"tcp"},{port:3306,name:"MySQL",protocol:"tcp"},{port:5432,name:"PostgreSQL",protocol:"tcp"},{port:6379,name:"Redis",protocol:"tcp"},{port:27017,name:"MongoDB",protocol:"tcp"}];d.useEffect(()=>{U()},[]);const U=async()=>{c(!0);try{await Promise.all([V(),H(),B()])}catch(F){console.error("Failed to load firewall data:",F)}finally{c(!1)}},V=async()=>{try{const F=await b.getFirewallStatus();t(F)}catch(F){console.error("Failed to load status:",F)}},H=async()=>{try{const F=await b.getFirewallRules();r(F.rules||[])}catch(F){console.error("Failed to load rules:",F)}},B=async()=>{try{const F=await b.getBlockedIPs();i(F.blocked_ips||[])}catch(F){console.error("Failed to load blocked IPs:",F)}},z=async()=>{T(!0);try{await b.enableFirewall(),w.success("Firewall enabled"),await V()}catch(F){w.error(`Failed to enable firewall: ${F.message}`)}finally{T(!1)}},J=async()=>{O({title:"Disable Firewall",message:"Are you sure you want to disable the firewall? This will leave your server unprotected.",confirmText:"Disable",variant:"danger",onConfirm:async()=>{T(!0);try{await b.disableFirewall(),w.success("Firewall disabled"),await V()}catch(F){w.error(`Failed to disable firewall: ${F.message}`)}finally{T(!1),O(null)}},onCancel:()=>O(null)})},R=async()=>{if(k.trim()){T(!0);try{await b.blockIP(k),w.success(`IP ${k} blocked`),h(!1),m(""),await B(),await H()}catch(F){w.error(`Failed to block IP: ${F.message}`)}finally{T(!1)}}},_=async F=>{O({title:"Unblock IP",message:`Are you sure you want to unblock ${F}?`,confirmText:"Unblock",variant:"warning",onConfirm:async()=>{try{await b.unblockIP(F),w.success(`IP ${F} unblocked`),await B(),await H()}catch(ee){w.error(`Failed to unblock IP: ${ee.message}`)}O(null)},onCancel:()=>O(null)})},I=async()=>{if(x.port){T(!0);try{await b.allowPort(parseInt(x.port),x.protocol),w.success(`Port ${x.port}/${x.protocol} allowed`),v(!1),g({port:"",protocol:"tcp"}),await H()}catch(F){w.error(`Failed to allow port: ${F.message}`)}finally{T(!1)}}},Q=async(F,ee)=>{T(!0);try{await b.allowPort(F,ee),w.success(`Port ${F}/${ee} allowed`),await H()}catch(ge){w.error(`Failed to allow port: ${ge.message}`)}finally{T(!1)}},Y=async(F,ee)=>{O({title:"Remove Port Rule",message:`Are you sure you want to remove the rule for port ${F}/${ee}?`,confirmText:"Remove",variant:"danger",onConfirm:async()=>{try{await b.denyPort(parseInt(F),ee),w.success(`Port ${F}/${ee} rule removed`),await H()}catch(ge){w.error(`Failed to remove port: ${ge.message}`)}O(null)},onCancel:()=>O(null)})},ve=async()=>{T(!0);try{await b.installFirewall(y),w.success(`${y.toUpperCase()} installed successfully`),j(!1),await U()}catch(F){w.error(`Failed to install firewall: ${F.message}`)}finally{T(!1)}},ne=e==null?void 0:e.any_active,C=e==null?void 0:e.active_firewall;return l?s.jsx("div",{className:"page-loading",children:s.jsx(Oa,{size:"lg"})}):s.jsxs("div",{className:"firewall-page",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-content",children:[s.jsx("h1",{children:"Firewall"}),s.jsx("p",{className:"page-description",children:"Manage firewall rules and IP blocking"})]}),s.jsx("div",{className:"page-header-actions",children:e!=null&&e.any_installed?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>h(!0),children:"Block IP"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>v(!0),children:"Allow Port"}),ne?s.jsx("button",{className:"btn btn-danger",onClick:J,disabled:E,children:"Disable Firewall"}):s.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:"Enable Firewall"})]}):s.jsx("button",{className:"btn btn-primary",onClick:()=>j(!0),children:"Install Firewall"})})]}),e!=null&&e.any_installed?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"status-cards",children:[s.jsxs("div",{className:`status-card ${ne?"success":"danger"}`,children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:ne?"shield":"shield_outlined"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Firewall Status"}),s.jsx("span",{className:"status-value",children:ne?"Active":"Inactive"})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"dns"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Firewall Type"}),s.jsx("span",{className:"status-value",children:(C==null?void 0:C.toUpperCase())||"None"})]})]}),s.jsxs("div",{className:"status-card",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"rule"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Active Rules"}),s.jsx("span",{className:"status-value",children:n.length})]})]}),s.jsxs("div",{className:"status-card warning",children:[s.jsx("div",{className:"status-icon",children:s.jsx("span",{className:"icon",children:"block"})}),s.jsxs("div",{className:"status-info",children:[s.jsx("span",{className:"status-label",children:"Blocked IPs"}),s.jsx("span",{className:"status-value",children:a.length})]})]})]}),s.jsxs("div",{className:"tabs",children:[s.jsx("button",{className:`tab ${o==="overview"?"active":""}`,onClick:()=>u("overview"),children:"Overview"}),s.jsx("button",{className:`tab ${o==="rules"?"active":""}`,onClick:()=>u("rules"),children:"Rules"}),s.jsx("button",{className:`tab ${o==="blocked"?"active":""}`,onClick:()=>u("blocked"),children:"Blocked IPs"}),s.jsx("button",{className:`tab ${o==="quick"?"active":""}`,onClick:()=>u("quick"),children:"Quick Actions"})]}),s.jsxs("div",{className:"tab-content",children:[o==="overview"&&s.jsxs("div",{className:"overview-tab",children:[s.jsxs("div",{className:"info-card",children:[s.jsx("h3",{children:"Firewall Information"}),s.jsxs("div",{className:"info-grid",children:[s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Type"}),s.jsx("span",{className:"info-value",children:C==null?void 0:C.toUpperCase()})]}),s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Status"}),s.jsx("span",{className:`info-value ${ne?"text-success":"text-danger"}`,children:ne?"Active":"Inactive"})]}),C==="firewalld"&&((G=e==null?void 0:e.firewalld)==null?void 0:G.default_zone)&&s.jsxs("div",{className:"info-item",children:[s.jsx("span",{className:"info-label",children:"Default Zone"}),s.jsx("span",{className:"info-value",children:e.firewalld.default_zone})]})]})]}),s.jsxs("div",{className:"protection-summary",children:[s.jsx("h3",{children:"Protection Summary"}),s.jsxs("div",{className:"summary-grid",children:[s.jsxs("div",{className:"summary-item",children:[s.jsx("span",{className:"summary-icon text-success",children:s.jsx("span",{className:"icon",children:"check_circle"})}),s.jsxs("span",{className:"summary-text",children:[n.filter(F=>F.type==="port"||F.port).length," ports allowed"]})]}),s.jsxs("div",{className:"summary-item",children:[s.jsx("span",{className:"summary-icon text-success",children:s.jsx("span",{className:"icon",children:"check_circle"})}),s.jsxs("span",{className:"summary-text",children:[n.filter(F=>F.type==="service"||F.service).length," services allowed"]})]}),s.jsxs("div",{className:"summary-item",children:[s.jsx("span",{className:"summary-icon text-danger",children:s.jsx("span",{className:"icon",children:"block"})}),s.jsxs("span",{className:"summary-text",children:[a.length," IPs blocked"]})]})]})]})]}),o==="rules"&&s.jsxs("div",{className:"rules-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Firewall Rules"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>v(!0),children:"Add Rule"})]}),n.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"rule"}),s.jsx("p",{children:"No rules configured"})]}):s.jsx("div",{className:"rules-table",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Type"}),s.jsx("th",{children:"Target"}),s.jsx("th",{children:"Protocol"}),s.jsx("th",{children:"Actions"})]})}),s.jsx("tbody",{children:n.map((F,ee)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("span",{className:"badge badge-info",children:F.type})}),s.jsxs("td",{children:[F.type==="service"&&F.service,F.type==="port"&&F.port,F.type==="rich"&&s.jsx("code",{className:"rule-code",children:F.rule})]}),s.jsx("td",{children:F.protocol||"-"}),s.jsx("td",{children:F.type==="port"&&s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>Y(F.port,F.protocol),children:s.jsx("span",{className:"icon",children:"delete"})})})]},ee))})]})})]}),o==="blocked"&&s.jsxs("div",{className:"blocked-tab",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h3",{children:"Blocked IP Addresses"}),s.jsx("button",{className:"btn btn-primary",onClick:()=>h(!0),children:"Block IP"})]}),a.length===0?s.jsxs("div",{className:"empty-state",children:[s.jsx("span",{className:"icon",children:"verified_user"}),s.jsx("p",{children:"No blocked IPs"})]}):s.jsx("div",{className:"blocked-list",children:a.map((F,ee)=>s.jsxs("div",{className:"blocked-item",children:[s.jsxs("div",{className:"blocked-info",children:[s.jsx("span",{className:"blocked-ip",children:F.ip}),s.jsx("code",{className:"blocked-rule",children:F.rule})]}),s.jsx("button",{className:"btn btn-sm btn-warning",onClick:()=>_(F.ip),children:"Unblock"})]},ee))})]}),o==="quick"&&s.jsxs("div",{className:"quick-tab",children:[s.jsx("h3",{children:"Quick Port Access"}),s.jsx("p",{className:"text-muted",children:"One-click enable/disable common service ports"}),s.jsx("div",{className:"quick-ports",children:L.map(({port:F,name:ee,protocol:ge})=>{const D=n.some(W=>(W.port===String(F)||W.port===F)&&W.protocol===ge);return s.jsxs("div",{className:"quick-port-item",children:[s.jsxs("div",{className:"port-info",children:[s.jsx("span",{className:"port-name",children:ee}),s.jsxs("span",{className:"port-number",children:[F,"/",ge]})]}),s.jsx("div",{className:"port-status",children:D?s.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>Y(F,ge),disabled:E,children:"Block"}):s.jsx("button",{className:"btn btn-sm btn-success",onClick:()=>Q(F,ge),disabled:E,children:"Allow"})})]},F)})})]})]})]}):s.jsxs("div",{className:"empty-state-large",children:[s.jsx("span",{className:"icon",children:"security"}),s.jsx("h2",{children:"No Firewall Installed"}),s.jsx("p",{children:"Install a firewall to protect your server from unauthorized access."}),s.jsx("button",{className:"btn btn-primary btn-lg",onClick:()=>j(!0),children:"Install Firewall"})]}),f&&s.jsx("div",{className:"modal-overlay",onClick:()=>h(!1),children:s.jsxs("div",{className:"modal",onClick:F=>F.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Block IP Address"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>h(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"IP Address"}),s.jsx("input",{type:"text",value:k,onChange:F=>m(F.target.value),placeholder:"192.168.1.100 or 10.0.0.0/24"})]}),s.jsx("p",{className:"text-muted",children:"You can block a single IP (192.168.1.100) or a range using CIDR notation (10.0.0.0/24)."})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>h(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-danger",onClick:R,disabled:E||!k.trim(),children:E?"Blocking...":"Block IP"})]})]})}),p&&s.jsx("div",{className:"modal-overlay",onClick:()=>v(!1),children:s.jsxs("div",{className:"modal",onClick:F=>F.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Allow Port"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>v(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsx("div",{className:"modal-body",children:s.jsxs("div",{className:"form-row",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Port Number"}),s.jsx("input",{type:"number",value:x.port,onChange:F=>g({...x,port:F.target.value}),placeholder:"8080",min:"1",max:"65535"})]}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Protocol"}),s.jsxs("select",{value:x.protocol,onChange:F=>g({...x,protocol:F.target.value}),children:[s.jsx("option",{value:"tcp",children:"TCP"}),s.jsx("option",{value:"udp",children:"UDP"})]})]})]})}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>v(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:I,disabled:E||!x.port,children:E?"Adding...":"Allow Port"})]})]})}),N&&s.jsx("div",{className:"modal-overlay",onClick:()=>j(!1),children:s.jsxs("div",{className:"modal",onClick:F=>F.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{children:"Install Firewall"}),s.jsx("button",{className:"btn btn-icon",onClick:()=>j(!1),children:s.jsx("span",{className:"icon",children:"close"})})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"form-group",children:[s.jsx("label",{children:"Select Firewall"}),s.jsxs("select",{value:y,onChange:F=>S(F.target.value),children:[s.jsx("option",{value:"ufw",children:"UFW (Recommended for Ubuntu)"}),s.jsx("option",{value:"firewalld",children:"firewalld (CentOS/RHEL)"})]})]}),s.jsx("div",{className:"install-info",children:y==="ufw"?s.jsxs("p",{children:[s.jsx("strong",{children:"UFW (Uncomplicated Firewall)"})," is a simple and easy-to-use firewall for Ubuntu and Debian systems. It provides a user-friendly interface for iptables."]}):s.jsxs("p",{children:[s.jsx("strong",{children:"firewalld"})," is a dynamically managed firewall with zone-based configuration. It's the default firewall on CentOS and RHEL systems."]})})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>j(!1),children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:ve,disabled:E,children:E?"Installing...":"Install"})]})]})}),P&&s.jsx(Ba,{title:P.title,message:P.message,confirmText:P.confirmText,variant:P.variant,onConfirm:P.onConfirm,onCancel:P.onCancel})]})}function ay({children:e}){const{isAuthenticated:t,loading:n}=rs();return n?s.jsx("div",{className:"loading",children:"Loading..."}):t?e:s.jsx(Nh,{to:"/login"})}function Zc({children:e}){const{isAuthenticated:t,loading:n}=rs();return n?s.jsx("div",{className:"loading",children:"Loading..."}):t?s.jsx(Nh,{to:"/"}):e}function iy(){return s.jsxs(mx,{children:[s.jsx(be,{path:"/login",element:s.jsx(Zc,{children:s.jsx(sg,{})})}),s.jsx(be,{path:"/register",element:s.jsx(Zc,{children:s.jsx(ng,{})})}),s.jsxs(be,{path:"/",element:s.jsx(ay,{children:s.jsx(ev,{})}),children:[s.jsx(be,{index:!0,element:s.jsx(tg,{})}),s.jsx(be,{path:"apps",element:s.jsx(rg,{})}),s.jsx(be,{path:"apps/:id",element:s.jsx(ig,{})}),s.jsx(be,{path:"domains",element:s.jsx(Rg,{})}),s.jsx(be,{path:"databases",element:s.jsx(Eg,{})}),s.jsx(be,{path:"ssl",element:s.jsx("div",{className:"page",children:"SSL Certificates"})}),s.jsx(be,{path:"docker",element:s.jsx(gg,{})}),s.jsx(be,{path:"php",element:s.jsx(ny,{})}),s.jsx(be,{path:"firewall",element:s.jsx(ry,{})}),s.jsx(be,{path:"files",element:s.jsx(ty,{})}),s.jsx(be,{path:"ftp",element:s.jsx(sy,{})}),s.jsx(be,{path:"monitoring",element:s.jsx(Og,{})}),s.jsx(be,{path:"backups",element:s.jsx(Bg,{})}),s.jsx(be,{path:"terminal",element:s.jsx(Ig,{})}),s.jsx(be,{path:"settings",element:s.jsx(Wg,{})})]})]})}function ly(){return s.jsx(Nx,{children:s.jsx(Ex,{children:s.jsxs(Lx,{children:[s.jsx(iy,{}),s.jsx(Jx,{})]})})})}yi.createRoot(document.getElementById("root")).render(s.jsx(qr.StrictMode,{children:s.jsx(ly,{})}));diff --git a/frontend/dist/assets/index-zpQn1_s8.css b/frontend/dist/assets/index-zpQn1_s8.cssdeleted file mode 100644index 08499e6e..00000000--- a/frontend/dist/assets/index-zpQn1_s8.css+++ /dev/null@@ -1 +0,0 @@-*{margin:0;padding:0;box-sizing:border-box;outline:none}html{font-size:16px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background-color:#09090b;color:#f4f4f5;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;font-size:14px;line-height:1.5;min-height:100vh}a{color:inherit;text-decoration:none}button{font-family:inherit}img{max-width:100%;height:auto}ul,ol{list-style:none}::selection{background:#6366f1;color:#fff}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#09090b}::-webkit-scrollbar-thumb{background:#3f3f46;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#71717a}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:1.25;letter-spacing:-.5px}h1{font-size:24px}h2{font-size:18px}h3{font-size:16px}h4{font-size:14px}.text-primary{color:#f4f4f5}.text-secondary{color:#a1a1aa}.text-tertiary{color:#71717a}.text-success{color:#10b981}.text-warning{color:#f59e0b}.text-danger{color:#ef4444}.text-accent{color:#6366f1}.font-normal{font-weight:400}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.mono{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.subtitle{color:#71717a;margin-top:4px;font-size:14px}.section-title{font-size:18px;margin-bottom:20px;font-weight:600}.sidebar{width:280px;background-color:#0f0f11;border-right:1px solid #27272a;display:flex;flex-direction:column;position:fixed;height:100vh;z-index:30}@media (max-width: 768px){.sidebar{display:none}}.brand{padding:24px 32px;font-size:16px;font-weight:700;letter-spacing:-.5px;color:#f4f4f5;display:flex;align-items:center;justify-content:flex-start;gap:12px;border-bottom:1px solid #27272a}.brand-logo{width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:linear-gradient(135deg,#6366f1,#a9abf7);border-radius:8px;color:#fff}.menu-label{padding:24px 32px 8px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#71717a}.nav{display:flex;flex-direction:column;padding:0 16px;gap:4px}.nav-item{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:10px 16px;color:#a1a1aa;text-decoration:none;border-radius:6px;transition:all .2s ease;font-weight:500}.nav-item:hover{background-color:#27272a;color:#f4f4f5}.nav-item.active{background-color:#6366f126;color:#6366f1}.nav-item svg{width:20px;height:20px;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;fill:none}.user-profile{margin-top:auto;padding:20px;border-top:1px solid #27272a;display:flex;align-items:center;justify-content:flex-start;gap:12px}.avatar{width:36px;height:36px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background-color:#27272a;border-radius:9999px;color:#a1a1aa;font-weight:600}.dashboard-layout{display:flex;min-height:100vh}.main-content{margin-left:280px;flex:1;padding:40px;overflow-y:auto}@media (max-width: 768px){.main-content{margin-left:0;padding:20px}}.top-bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:40px}.top-bar h1{font-size:24px;font-weight:600;letter-spacing:-.5px}@media (max-width: 768px){.top-bar{flex-direction:column;align-items:flex-start;gap:16px}}.top-bar-actions{display:flex;gap:12px}.page{font-size:24px;color:#a1a1aa}.loading{display:flex;align-items:center;justify-content:center;min-height:100vh;color:#a1a1aa}.stats-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:24px;margin-bottom:32px}@media (max-width: 1280px){.stats-strip{grid-template-columns:repeat(2,1fr)}}@media (max-width: 640px){.stats-strip{grid-template-columns:1fr}}.dashboard-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:24px}.overview-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:24px}@media (max-width: 768px){.overview-grid{grid-template-columns:1fr}}.btn{display:inline-flex;align-items:center;gap:8px;padding:8px 20px;border-radius:8px;border:1px solid transparent;font-size:13px;font-weight:500;cursor:pointer;transition:all .2s ease;background:none}.btn:disabled{opacity:.6;cursor:not-allowed}.btn svg{width:16px;height:16px}.btn-primary{background-color:#6366f1;color:#fff;box-shadow:0 4px 12px #6366f14d}.btn-primary:hover:not(:disabled){background-color:#4f46e5}.btn-secondary{background-color:transparent;border-color:#3f3f46;color:#f4f4f5}.btn-secondary:hover:not(:disabled){background-color:#27272a}.btn-danger{background:#ef4444;color:#fff}.btn-danger:hover:not(:disabled){background:#dc2626}.btn-ghost{background:transparent;color:#a1a1aa}.btn-ghost:hover:not(:disabled){background-color:#27272a;color:#f4f4f5}.btn-sm{padding:4px 8px;font-size:11px}.btn-lg{padding:12px 24px;font-size:14px}.btn-full{width:100%;justify-content:center}.btn-icon{padding:8px}.btn-icon svg{width:18px;height:18px}.btn-expand{background:none;border:none;color:#71717a;cursor:pointer;padding:4px 8px;font-size:12px;display:flex;align-items:center;justify-content:flex-start;gap:4px;transition:color .2s ease}.btn-expand:hover{color:#f4f4f5}.card{background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease;padding:24px;position:relative;overflow:hidden}.card:hover{border-color:#3f3f46}.card:hover{transform:translateY(-2px)}.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.card h3{font-size:16px;font-weight:600;color:#f4f4f5;margin-bottom:4px}.card-link{color:#a1a1aa;text-decoration:none;font-size:13px;transition:color .2s ease}.card-link:hover{color:#6366f1}.app-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:10px;font-size:18px;font-weight:700;color:#fff}.metric-row{margin-top:24px;padding-top:20px;border-top:1px solid #27272a;display:flex;align-items:center;justify-content:space-between;font-size:12px;color:#a1a1aa}.metric-item{display:flex;flex-direction:column;gap:4px}.metric-value{font-weight:600;color:#f4f4f5;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px}.stat-card{background:#18181b;padding:20px;border-radius:12px;border:1px solid #27272a;display:flex;flex-direction:column;gap:8px}.stat-label{font-size:12px;color:#71717a;text-transform:uppercase;font-weight:600}.stat-value{font-size:20px;font-weight:700;color:#f4f4f5}.stat-suffix{font-size:14px;color:#71717a;font-weight:400}.progress-bar{height:4px;background:#27272a;border-radius:2px;overflow:hidden;margin-top:4px}.progress-fill{height:100%;border-radius:2px;transition:width .2s ease}.empty-state{text-align:center;padding:64px 20px;background:#18181b;border-radius:12px;border:1px solid #27272a}.empty-state svg{color:#71717a;margin-bottom:16px}.empty-state h3{font-size:16px;font-weight:600;margin-bottom:8px}.empty-state p{color:#a1a1aa;margin-bottom:24px}.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.section-header h3{font-size:16px;font-weight:600}.danger-zone{border-color:#ef44444d;background:#ef44440d}.danger-zone h4{color:#ef4444;margin-bottom:8px}.danger-zone p{color:#a1a1aa;margin-bottom:16px}.modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#000000b3;display:flex;align-items:center;justify-content:center;z-index:40;padding:20px;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.modal{background:#18181b;border:1px solid #27272a;border-radius:16px;width:100%;max-width:560px;max-height:90vh;overflow-y:auto}.modal::-webkit-scrollbar{width:6px;height:6px}.modal::-webkit-scrollbar-track{background:#09090b}.modal::-webkit-scrollbar-thumb{background:#3f3f46;border-radius:4px}.modal::-webkit-scrollbar-thumb:hover{background:#71717a}.modal-lg{max-width:800px}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:24px;border-bottom:1px solid #27272a}.modal-header h2{font-size:18px;font-weight:600}.modal-close{background:none;border:none;color:#71717a;font-size:24px;cursor:pointer;line-height:1;padding:4px;transition:color .2s ease}.modal-close:hover{color:#f4f4f5}.modal-body{padding:24px;max-height:60vh;overflow-y:auto}.modal-body::-webkit-scrollbar{width:6px;height:6px}.modal-body::-webkit-scrollbar-track{background:#09090b}.modal-body::-webkit-scrollbar-thumb{background:#3f3f46;border-radius:4px}.modal-body::-webkit-scrollbar-thumb:hover{background:#71717a}.modal form{padding:24px}.modal-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:24px;padding-top:24px;border-top:1px solid #27272a}.app-type-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:16px;padding:24px}.app-type-card{background:#09090b;border:1px solid #27272a;border-radius:12px;padding:24px;text-align:center;cursor:pointer;transition:all .2s ease}.app-type-card:hover{border-color:#6366f1;background:#27272a}.app-type-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:12px;font-size:20px;font-weight:700;color:#fff;margin:0 auto 16px}.app-type-card h3{font-size:14px;font-weight:600;margin-bottom:4px;color:#f4f4f5}.app-type-card p{font-size:12px;color:#71717a;line-height:1.5}.confirm-dialog{max-width:400px;text-align:center}.confirm-dialog-content{padding:32px 24px 24px}.confirm-dialog-icon{width:64px;height:64px;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:50%;margin:0 auto 16px}.confirm-dialog-icon svg{width:32px;height:32px}.confirm-dialog-icon-danger{background:#ef444426;color:#ef4444}.confirm-dialog-icon-warning{background:#f59e0b26;color:#f59e0b}.confirm-dialog-icon-info{background:#6366f126;color:#6366f1}.confirm-dialog-title{font-size:18px;font-weight:600;margin-bottom:8px}.confirm-dialog-message{font-size:12px;color:#a1a1aa;line-height:1.6}.confirm-dialog-actions{display:flex;gap:12px;justify-content:center;padding:16px 24px 24px}.form-group{margin-bottom:20px}.form-group label{display:block;font-size:13px;font-weight:500;color:#a1a1aa;margin-bottom:8px}.form-group input,.form-group select,.form-group textarea{width:100%;padding:12px 16px;background:#09090b;border:1px solid #27272a;border-radius:8px;color:#f4f4f5;font-size:14px;transition:border-color .2s ease}.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:#6366f1;outline:none}.form-group input::placeholder,.form-group select::placeholder,.form-group textarea::placeholder{color:#71717a}.form-group select{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 16px center;padding-right:40px}.form-group textarea{font-family:Fira Code,Monaco,Consolas,monospace;resize:vertical;min-height:120px}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}@media (max-width: 768px){.form-row{grid-template-columns:1fr}}.install-form,.env-form,.command-input{display:flex;gap:12px;margin-bottom:24px}.install-form input,.env-form input,.command-input input{flex:1;width:100%;padding:12px 16px;background:#09090b;border:1px solid #27272a;border-radius:8px;color:#f4f4f5;font-size:14px;transition:border-color .2s ease}.install-form input:focus,.env-form input:focus,.command-input input:focus{border-color:#6366f1;outline:none}.install-form input::placeholder,.env-form input::placeholder,.command-input input::placeholder{color:#71717a}.hint{color:#71717a;font-size:13px;margin-bottom:16px}.error-message{background:#ef44441a;border:1px solid rgba(239,68,68,.2);color:#ef4444;padding:12px 16px;border-radius:8px;margin-bottom:20px;font-size:13px}.error-banner{background:#ef44441a;border:1px solid rgba(239,68,68,.2);color:#ef4444;padding:12px 16px;border-radius:8px;margin-bottom:24px}.filter-toggle{display:flex;align-items:center;justify-content:flex-start;gap:8px}.filter-toggle label{display:flex;align-items:center;justify-content:flex-start;gap:8px;color:#a1a1aa;font-size:13px;cursor:pointer}.filter-toggle input[type=checkbox]{width:16px;height:16px;accent-color:#6366f1}.code-editor{width:100%;min-height:400px;padding:16px;background:#09090b;border:1px solid #27272a;border-radius:8px;color:#f4f4f5;font-family:Fira Code,Monaco,Consolas,monospace;font-size:13px;line-height:1.6;resize:vertical;transition:border-color .2s ease}.code-editor:focus{border-color:#6366f1}.status-badge{display:flex;align-items:center;gap:6px;padding:4px 10px;border-radius:9999px;font-size:11px;font-weight:600;border:1px solid transparent}.status-dot{width:6px;height:6px;background:currentColor;border-radius:9999px}.status-active{background:#10b9811a;color:#10b981;border-color:#10b98133}.status-warning{background:#f59e0b1a;color:#f59e0b;border-color:#f59e0b33}.status-stopped{background:#71717a1a;color:#71717a;border-color:#71717a33}.status-error{background:#ef44441a;color:#ef4444;border-color:#ef444433}.app-type{background:#27272a;padding:2px 8px;border-radius:4px;font-weight:600;font-size:10px;letter-spacing:.5px;text-transform:uppercase}.ssl-badge{background:#10b9811a;color:#10b981;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600}.active-badge{background:#10b9811a;color:#10b981;padding:4px 12px;border-radius:9999px;font-size:12px;font-weight:600}.db-type-badge{display:inline-flex;align-items:center;gap:4px;background:#27272a;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.3px}.db-type-badge.mysql{color:#f29111}.db-type-badge.postgresql{color:#336791}.privilege-tag{background:#6366f126;color:#6366f1;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.3px}.table-tag{background:#27272a;border:1px solid #27272a;padding:6px 12px;border-radius:6px;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;color:#a1a1aa}.tabs{display:flex;gap:4px;border-bottom:1px solid #27272a;margin-bottom:24px;overflow-x:auto}.tabs::-webkit-scrollbar{width:6px;height:6px}.tabs::-webkit-scrollbar-track{background:#09090b}.tabs::-webkit-scrollbar-thumb{background:#3f3f46;border-radius:4px}.tabs::-webkit-scrollbar-thumb:hover{background:#71717a}@media (max-width: 768px){.tabs{overflow-x:auto;-webkit-overflow-scrolling:touch}}.tab{background:none;border:none;padding:12px 20px;color:#a1a1aa;font-size:14px;font-weight:500;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;transition:all .2s ease;white-space:nowrap}.tab:hover{color:#f4f4f5}.tab.active{color:#6366f1;border-bottom-color:#6366f1}.tab-content{min-height:400px}.list-base{display:flex;flex-direction:column;gap:8px}.info-list{display:flex;flex-direction:column;gap:12px}.info-item{display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid #27272a}.info-item:last-child{border-bottom:none}.info-label{color:#71717a;font-size:13px}.info-value{color:#f4f4f5;font-weight:500}.info-value.mono{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px}.packages-list{display:flex;flex-direction:column;gap:8px}.package-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.package-item:hover{border-color:#3f3f46}.package-name{font-weight:500}.package-version{color:#71717a;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px}.env-list{display:flex;flex-direction:column;gap:8px}.env-item{display:flex;align-items:center;gap:16px;padding:12px 16px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.env-item:hover{border-color:#3f3f46}.env-key{font-weight:600;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;color:#6366f1;min-width:150px}.env-value{flex:1;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;color:#a1a1aa;word-break:break-all}.plugins-list,.themes-list{display:flex;flex-direction:column;gap:8px}.plugin-item,.theme-item{display:flex;align-items:center;justify-content:space-between;padding:16px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.plugin-item:hover,.theme-item:hover{border-color:#3f3f46}.plugin-item.active,.theme-item.active{border-color:#10b981;background:#10b9810d}.plugin-info,.theme-info{display:flex;align-items:center;justify-content:flex-start;gap:12px}.plugin-name,.theme-name{font-weight:500}.plugin-version,.theme-version{color:#71717a;font-size:12px}.backups-list{display:flex;flex-direction:column;gap:8px}.backup-item{display:flex;align-items:center;justify-content:space-between;padding:16px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.backup-item:hover{border-color:#3f3f46}.backup-info{display:flex;align-items:center;justify-content:flex-start;gap:20px}.backup-name{font-weight:500;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px}.backup-size,.backup-date{color:#71717a;font-size:13px}.domains-list{display:flex;flex-direction:column;gap:8px}.domain-item{display:flex;align-items:center;justify-content:flex-start;gap:8px}.domain-item a{color:#6366f1;transition:color .2s ease}.domain-item a:hover{text-decoration:underline}.tables-list{display:flex;flex-wrap:wrap;gap:8px}.privileges-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid #27272a}.services-grid{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:24px}.service-item{display:flex;align-items:center;justify-content:flex-start;gap:8px;padding:8px 16px;background:#18181b;border:1px solid #27272a;border-radius:8px;font-size:13px}.service-dot{width:8px;height:8px;border-radius:9999px}.service-dot.running{background:#10b981;box-shadow:0 0 8px #10b981}.service-dot.stopped{background:#71717a}.service-name{font-weight:500;color:#f4f4f5}.service-status{color:#71717a;font-size:12px}.live-indicator{color:#10b981;font-size:12px;font-weight:500}.live-indicator:before{content:"";display:inline-block;width:6px;height:6px;background:#10b981;border-radius:9999px;margin-right:4px;animation:pulse 2s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.log-viewer{background:#09090b;border:1px solid #27272a;border-radius:8px;padding:16px;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;max-height:500px;overflow-y:auto;line-height:1.5}.log-viewer::-webkit-scrollbar{width:6px;height:6px}.log-viewer::-webkit-scrollbar-track{background:#09090b}.log-viewer::-webkit-scrollbar-thumb{background:#3f3f46;border-radius:4px}.log-viewer::-webkit-scrollbar-thumb:hover{background:#71717a}.log-controls{display:flex;align-items:center;justify-content:flex-start;gap:12px}.log-controls select{padding:8px 12px;background:#09090b;border:1px solid #27272a;border-radius:6px;color:#f4f4f5;font-size:13px}.command-output{background:#09090b;border:1px solid #27272a;border-radius:8px;padding:16px;margin-top:20px}.command-output pre{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;white-space:pre-wrap;word-break:break-all;color:#f4f4f5}.command-output.error{border-color:#ef4444}.command-output .stderr{color:#ef4444}.quick-commands{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}.credentials-box{background:#09090b;border:1px solid #27272a;border-radius:8px;padding:16px;margin:16px 0}.credentials-box h4{font-size:14px;font-weight:600;margin-bottom:12px;color:#10b981}.credentials-box .warning{font-size:12px;color:#f59e0b;margin-bottom:12px;display:flex;align-items:center;justify-content:flex-start;gap:6px}.credential-row{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:8px 0;border-bottom:1px solid #27272a}.credential-row:last-child{border-bottom:none}.credential-label{font-size:12px;color:#71717a;min-width:80px}.credential-value{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;font-size:13px;color:#f4f4f5;background:#27272a;padding:4px 8px;border-radius:4px;flex:1}.credential-copy{background:none;border:none;color:#71717a;cursor:pointer;padding:4px;transition:color .2s ease}.credential-copy:hover{color:#6366f1}.toast-container{position:fixed;top:16px;right:16px;z-index:9999;display:flex;flex-direction:column;gap:8px;max-width:400px;pointer-events:none}.toast{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-radius:6px;background:#18181b;border:1px solid #27272a;box-shadow:0 10px 15px #0000004d;pointer-events:auto;animation:toast-slide-in .3s ease-out}.toast-icon{flex-shrink:0;display:flex;align-items:center;justify-content:center}.toast-icon svg{width:18px;height:18px}.toast-message{flex:1;font-size:12px;line-height:1.4;color:#f4f4f5}.toast-dismiss{flex-shrink:0;background:none;border:none;padding:4px;cursor:pointer;color:#71717a;border-radius:4px;transition:all .2s ease}.toast-dismiss:hover{color:#f4f4f5;background:#27272a}.toast-success{border-color:#10b9814d;background:#10b9811a}.toast-success .toast-icon{color:#10b981}.toast-error{border-color:#ef44444d;background:#ef44441a}.toast-error .toast-icon{color:#ef4444}.toast-warning{border-color:#f59e0b4d;background:#f59e0b1a}.toast-warning .toast-icon{color:#f59e0b}.toast-info{border-color:#6366f14d;background:#6366f11a}.toast-info .toast-icon{color:#6366f1}@keyframes toast-slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.spinner{display:inline-flex;align-items:center;justify-content:center}.spinner-sm{width:16px;height:16px}.spinner-sm .spinner-ring{width:16px;height:16px;border-width:2px}.spinner-md{width:24px;height:24px}.spinner-md .spinner-ring{width:24px;height:24px;border-width:3px}.spinner-lg{width:40px;height:40px}.spinner-lg .spinner-ring{width:40px;height:40px;border-width:4px}.spinner-ring{border-radius:50%;border-style:solid;border-color:#6366f14d;border-top-color:#6366f1;animation:spinner-rotate .8s linear infinite}@keyframes spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.loading-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:32px;color:#a1a1aa}.loading-state span{font-size:12px}.btn-loading{position:relative;pointer-events:none;color:transparent!important}.btn-loading .spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.btn-loading .spinner .spinner-ring{border-color:#27272a;border-top-color:#f4f4f5}.btn-loading.btn-primary .spinner .spinner-ring{border-color:#ffffff4d;border-top-color:#fff}.btn-loading.btn-secondary .spinner .spinner-ring{border-color:#f4f4f54d;border-top-color:#f4f4f5}.btn-loading.btn-danger .spinner .spinner-ring{border-color:#ffffff4d;border-top-color:#fff}.auth-container{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.auth-card{width:100%;max-width:400px;background:#18181b;border:1px solid #27272a;border-radius:16px;padding:40px}.auth-header{text-align:center;margin-bottom:32px}.auth-header .brand-logo{width:48px;height:48px;margin:0 auto 16px}.auth-header h1{font-size:24px;font-weight:700;margin-bottom:8px}.auth-header p{color:#a1a1aa}.auth-footer{text-align:center;margin-top:24px;color:#a1a1aa}.auth-footer a{color:#6366f1;font-weight:500}.auth-footer a:hover{text-decoration:underline}.dashboard-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:24px;margin-bottom:32px}@media (max-width: 1280px){.dashboard-stats{grid-template-columns:repeat(2,1fr)}}@media (max-width: 640px){.dashboard-stats{grid-template-columns:1fr}}.system-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:24px;margin-bottom:32px}.metric-card{background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease;padding:20px}.metric-card:hover{border-color:#3f3f46}.metric-card .metric-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.metric-card .metric-header h4{font-size:12px;color:#71717a;text-transform:uppercase;font-weight:600}.metric-card .metric-header .metric-icon{color:#71717a}.metric-card .metric-main{display:flex;align-items:center;justify-content:flex-start;gap:12px;margin-bottom:12px}.metric-card .metric-main .metric-value{font-size:28px;font-weight:700;color:#f4f4f5;line-height:1}.metric-card .metric-main .metric-unit{font-size:14px;color:#71717a;align-self:flex-end;margin-bottom:4px}.metric-card .metric-sub{font-size:12px;color:#a1a1aa}.quick-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:32px}.quick-action-card{background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease;cursor:pointer;padding:20px;text-align:center}.quick-action-card:hover{border-color:#3f3f46}.quick-action-card:hover{transform:translateY(-2px)}.quick-action-card .action-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#6366f126;color:#6366f1;margin:0 auto 16px;border-radius:12px}.quick-action-card h4{font-size:14px;font-weight:600;margin-bottom:4px}.quick-action-card p{font-size:12px;color:#71717a}.activity-list{display:flex;flex-direction:column;gap:12px}.activity-item{display:flex;align-items:center;justify-content:flex-start;gap:16px;padding:12px 0;border-bottom:1px solid #27272a}.activity-item:last-child{border-bottom:none}.activity-icon{width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:#27272a;border-radius:8px;color:#a1a1aa;flex-shrink:0}.activity-icon.success{background:#10b9811a;color:#10b981}.activity-icon.warning{background:#f59e0b1a;color:#f59e0b}.activity-icon.error{background:#ef44441a;color:#ef4444}.activity-content{flex:1;min-width:0}.activity-content p{font-size:13px;color:#f4f4f5;margin-bottom:4px}.activity-content span{font-size:12px;color:#71717a}.uptime-display{display:flex;align-items:center;justify-content:flex-start;gap:24px;padding:20px;background:#18181b;border:1px solid #27272a;border-radius:12px;margin-bottom:24px}.uptime-item{text-align:center}.uptime-item .uptime-value{font-size:24px;font-weight:700;color:#f4f4f5}.uptime-item .uptime-label{font-size:10px;color:#71717a;text-transform:uppercase;letter-spacing:.5px}.uptime-separator{color:#71717a;font-size:24px;font-weight:700}.apps-list{display:flex;flex-direction:column;gap:12px}.app-row{display:flex;align-items:center;gap:20px;padding:16px 20px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.app-row:hover{border-color:#3f3f46}.app-info{display:flex;align-items:center;justify-content:flex-start;gap:16px;flex:1;min-width:0}.app-details{min-width:0}.app-details h3{font-size:15px;font-weight:600;color:#f4f4f5;margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.app-meta{display:flex;align-items:center;justify-content:flex-start;gap:12px;font-size:12px;color:#71717a}.app-meta a{color:#a1a1aa;transition:color .2s ease}.app-meta a:hover{color:#6366f1}.app-status{flex-shrink:0}.app-actions{display:flex;gap:8px;flex-shrink:0}.app-header-info{display:flex;align-items:center;justify-content:flex-start;gap:20px}@media (max-width: 768px){.app-header-info{flex-direction:column;align-items:flex-start}}.app-header-title{display:flex;align-items:center;justify-content:flex-start;gap:16px}.app-header-title h1{font-size:24px}.deploy-tab{display:flex;flex-direction:column;gap:20px}.deploy-tab .deploy-setup{padding:32px 0}.deploy-tab .deploy-header{margin-bottom:20px}.deploy-tab .deploy-status-card{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;background:#18181b;border:1px solid #27272a;border-radius:8px}@media (max-width: 768px){.deploy-tab .deploy-status-card{flex-direction:column;align-items:flex-start}}.deploy-tab .deploy-repo-info{display:flex;align-items:center;gap:12px}.deploy-tab .deploy-repo-info svg{flex-shrink:0;color:#a1a1aa}.deploy-tab .deploy-repo-info>div{display:flex;flex-direction:column;gap:4px}.deploy-tab .deploy-repo-info .repo-url{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;color:#f4f4f5;word-break:break-all}.deploy-tab .deploy-repo-info .repo-branch{font-size:10px;color:#71717a}.deploy-tab .deploy-actions{display:flex;gap:8px;flex-shrink:0}.deploy-tab .deploy-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:20px}.deploy-tab .webhook-url{display:flex;align-items:center;gap:12px;margin-top:12px;padding:12px;background:#27272a;border-radius:6px}.deploy-tab .webhook-url code{flex:1;font-size:10px;color:#a1a1aa;word-break:break-all}.deploy-tab .webhook-url .btn{flex-shrink:0}.deploy-tab .scripts-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}.deploy-tab .script-section h4{font-size:12px;font-weight:500;color:#a1a1aa;margin-bottom:8px}.deploy-tab .script-code{padding:12px;background:#27272a;border-radius:6px;font-family:Fira Code,Monaco,Consolas,monospace;font-size:10px;color:#a1a1aa;overflow-x:auto;white-space:pre-wrap;word-break:break-word;margin:0}.deploy-tab .card-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #27272a}.deploy-tab .checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer}.deploy-tab .checkbox-label input[type=checkbox]{width:18px;height:18px;cursor:pointer}.deploy-tab .checkbox-label span{font-size:12px;color:#f4f4f5}.deploy-tab .form-help{display:block;margin-top:4px;font-size:10px;color:#71717a}.deploy-tab textarea{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;resize:vertical;min-height:80px}.deploy-tab .text-danger{color:#ef4444;font-size:12px}.deploy-tab .text-muted{color:#71717a;font-size:12px}.docker-list{display:flex;flex-direction:column;gap:12px}.docker-item{display:flex;align-items:center;gap:20px;padding:16px 20px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.docker-item:hover{border-color:#3f3f46}.docker-item-info{display:flex;align-items:center;justify-content:flex-start;gap:16px;flex:1;min-width:0}.docker-item-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#27272a;border-radius:8px;color:#2496ed}.docker-item-icon.image-icon{color:#a78bfa}.docker-item-icon.network-icon{color:#34d399}.docker-item-icon.volume-icon{color:#fbbf24}.docker-item-details{min-width:0}.docker-item-details h3{font-size:14px;font-weight:600;color:#f4f4f5;margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.docker-item-meta{display:flex;align-items:center;justify-content:flex-start;gap:12px;font-size:12px;color:#71717a;flex-wrap:wrap}.docker-item-meta .mono{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;background:#27272a;padding:2px 6px;border-radius:4px}.docker-item-status{flex-shrink:0}.docker-item-actions{display:flex;gap:8px;flex-shrink:0}.exec-modal-body{display:flex;flex-direction:column;height:400px}.exec-output{flex:1;background:#18181b;border:1px solid #27272a;border-radius:6px;padding:16px;overflow-y:auto;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;margin-bottom:12px}.exec-welcome{color:#a1a1aa;text-align:center;padding:32px 0}.exec-welcome p{margin-bottom:8px}.exec-welcome code{background:#27272a;padding:4px 8px;border-radius:4px;color:#6366f1}.exec-line{margin-bottom:8px}.exec-line pre{margin:0;white-space:pre-wrap;word-break:break-all}.exec-line.exec-command{color:#6366f1;font-weight:500}.exec-line.exec-output{color:#f4f4f5}.exec-line.exec-error{color:#ef4444}.exec-line.exec-info{color:#71717a;font-size:10px}.exec-line.exec-loading{color:#a1a1aa;display:flex;align-items:center;gap:8px}.spinner-inline{display:inline-block;width:14px;height:14px;border:2px solid #27272a;border-top-color:#6366f1;border-radius:50%;animation:spin .8s linear infinite}.exec-input-form{display:flex;align-items:center;gap:8px;background:#18181b;border:1px solid #27272a;border-radius:6px;padding:8px 12px}.exec-input-form:focus-within{border-color:#6366f1}.exec-prompt{color:#6366f1;font-family:Fira Code,Monaco,Consolas,monospace;font-weight:600}.exec-input{flex:1;border:none;background:transparent;color:#f4f4f5;font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;outline:none}.exec-input::placeholder{color:#71717a}.exec-input:disabled{opacity:.5}.db-status{display:flex;gap:24px;margin-bottom:24px}@media (max-width: 768px){.db-status{flex-direction:column}}.db-status-item{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:16px 24px;background:#18181b;border:1px solid #27272a;border-radius:12px;flex:1}.status-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:10px;font-size:20px;font-weight:700}.status-icon.mysql{background:linear-gradient(135deg,#00758f,#f29111);color:#fff}.status-icon.postgresql{background:linear-gradient(135deg,#336791,#5f9ab8);color:#fff}.status-info h3{font-size:16px;font-weight:600;margin-bottom:4px}.status-info span{font-size:13px;color:#a1a1aa}.status-info span.running{color:#10b981}.status-info span.stopped{color:#ef4444}.db-list{display:flex;flex-direction:column;gap:12px}.db-item{display:flex;align-items:center;gap:20px;padding:16px 20px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.db-item:hover{border-color:#3f3f46}.db-item-info{display:flex;align-items:center;justify-content:flex-start;gap:16px;flex:1;min-width:0}.db-item-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#27272a;border-radius:8px}.db-item-icon.mysql{color:#f29111}.db-item-icon.postgresql{color:#336791}.db-item-icon.user{color:#6366f1}.db-item-details{min-width:0}.db-item-details h3{font-size:14px;font-weight:600;color:#f4f4f5;margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.db-item-meta{display:flex;align-items:center;justify-content:flex-start;gap:12px;font-size:12px;color:#71717a;flex-wrap:wrap}.db-item-meta .mono{font-family:Fira Code,Monaco,Consolas,monospace;font-size:12px;background:#27272a;padding:2px 6px;border-radius:4px}.db-item-meta .host{color:#a1a1aa}.db-item-actions{display:flex;gap:8px;flex-shrink:0}.users-header{display:flex;align-items:center;justify-content:space-between;margin:32px 0 16px;padding-top:24px;border-top:1px solid #27272a}.users-header h3{font-size:16px;font-weight:600}.ssl-status-bar{display:flex;gap:24px;margin-bottom:32px}@media (max-width: 768px){.ssl-status-bar{flex-direction:column}}.ssl-status-item{display:flex;align-items:center;justify-content:flex-start;gap:16px;padding:20px;background:#18181b;border:1px solid #27272a;border-radius:12px;flex:1}.ssl-status-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:10px}.ssl-status-icon.active{background:#10b9811a;color:#10b981}.ssl-status-icon.inactive{background:#ef44441a;color:#ef4444}.ssl-status-info h4{font-size:16px;font-weight:600;margin-bottom:4px}.ssl-status-info span{font-size:13px;color:#a1a1aa}.domain-list{display:flex;flex-direction:column;gap:12px}.domain-item{display:flex;align-items:center;gap:20px;padding:16px 20px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.domain-item:hover{border-color:#3f3f46}.domain-item-info{display:flex;align-items:center;justify-content:flex-start;gap:16px;flex:1;min-width:0}.domain-item-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#27272a;border-radius:8px;color:#a1a1aa}.domain-item-icon.ssl{background:#10b9811a;color:#10b981}.domain-item-details{min-width:0}.domain-item-details h3{font-size:14px;font-weight:600;color:#f4f4f5;margin-bottom:4px;display:flex;align-items:center;justify-content:flex-start;gap:8px}.primary-badge{background:#6366f126;color:#6366f1;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600;text-transform:uppercase}.domain-item-meta{display:flex;align-items:center;justify-content:flex-start;gap:16px;font-size:12px;color:#71717a}.domain-item-meta span{display:flex;align-items:center;justify-content:flex-start;gap:4px}.app-link{color:#a1a1aa}.ssl-badge{color:#10b981}.domain-item-actions{display:flex;gap:8px;flex-shrink:0;flex-wrap:wrap}.cert-list{display:flex;flex-direction:column;gap:12px}.cert-item{display:flex;align-items:center;gap:20px;padding:16px 20px;background-color:#18181b;border:1px solid #27272a;border-radius:12px;transition:border-color .2s ease}.cert-item:hover{border-color:#3f3f46}.cert-item-info{display:flex;align-items:center;justify-content:flex-start;gap:16px;flex:1;min-width:0}.cert-item-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:#10b9811a;border-radius:8px;color:#10b981}.cert-item-details{min-width:0}.cert-item-details h3{font-size:14px;font-weight:600;color:#f4f4f5;margin-bottom:4px}.cert-item-meta{display:flex;align-items:center;justify-content:flex-start;gap:16px;font-size:12px;color:#71717a}.cert-item-meta span{display:flex;align-items:center;justify-content:flex-start;gap:4px}.cert-item-meta span.valid{color:#10b981}.cert-item-meta span.expiring{color:#f59e0b}.cert-status{flex-shrink:0}.ssl-info-box{display:flex;align-items:center;justify-content:flex-start;gap:16px;padding:20px;background:#10b9811a;border:1px solid rgba(16,185,129,.2);border-radius:8px;margin-bottom:20px;color:#10b981}.ssl-info-box h4{font-size:14px;font-weight:600;margin-bottom:4px}.ssl-info-box p{font-size:12px;color:#a1a1aa}.ssl-info-box p strong{color:#f4f4f5}.checkbox-label{display:flex;align-items:center;justify-content:flex-start;gap:8px;cursor:pointer}.checkbox-label input[type=checkbox]{width:16px;height:16px;accent-color:#6366f1}.monitoring-page .monitoring-overview{display:flex;flex-direction:column;gap:24px}.monitoring-page .threshold-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:24px}.monitoring-page .threshold-item{display:flex;justify-content:space-between;align-items:center;padding:16px;background:var(--bg-secondary);border-radius:6px}.monitoring-page .threshold-label{color:var(--text-secondary);font-size:12px}.monitoring-page .threshold-value{font-size:18px;font-weight:600;color:var(--primary)}.monitoring-page .threshold-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:24px}.monitoring-page .alert-list{display:flex;flex-direction:column;gap:8px}.monitoring-page .alert-item{display:flex;align-items:center;gap:16px;padding:8px 16px;background:var(--bg-secondary);border-radius:6px}.monitoring-page .alert-item .badge{flex-shrink:0}.monitoring-page .alert-item .alert-message{flex:1;font-size:12px}.monitoring-page .alert-item .alert-time{color:var(--text-tertiary);font-size:10px;white-space:nowrap}.monitoring-page .stat-icon{width:48px;height:48px;border-radius:8px;display:flex;align-items:center;justify-content:center}.monitoring-page .stat-icon svg{stroke:currentColor;fill:none;stroke-width:2}.monitoring-page .stat-icon.status{background:#22c55e1a;color:#10b981}.monitoring-page .stat-icon.alerts{background:#ef44441a;color:#ef4444}.monitoring-page .stat-icon.interval{background:#3b82f61a;color:#6366f1}.monitoring-page .stat-icon.notifications{background:#a855f71a;color:#a855f7}.monitoring-page .text-success{color:#10b981}.monitoring-page .text-muted{color:var(--text-tertiary)}.monitoring-page .input-group{display:flex;gap:8px}.monitoring-page .input-group input{flex:1}.monitoring-page .input-group .btn{flex-shrink:0}.monitoring-page .checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer}.monitoring-page .checkbox-label input[type=checkbox]{width:18px;height:18px;cursor:pointer}.monitoring-page .checkbox-label span{font-size:12px;color:var(--text-primary)}.monitoring-page .form-help{display:block;margin-top:4px;font-size:10px;color:var(--text-tertiary)}.backups-page .stat-icon{width:48px;height:48px;border-radius:8px;display:flex;align-items:center;justify-content:center}.backups-page .stat-icon svg{stroke:currentColor;fill:none;stroke-width:2}.backups-page .stat-icon.backups{background:#22c55e1a;color:#10b981}.backups-page .stat-icon.apps{background:#3b82f61a;color:#6366f1}.backups-page .stat-icon.databases{background:#a855f71a;color:#a855f7}.backups-page .stat-icon.size{background:#f973161a;color:#f59e0b}.backups-page .filter-select{padding:4px 8px;border:1px solid var(--border-color);border-radius:4px;background:var(--bg-secondary);color:var(--text-primary);font-size:12px}.backups-page .backup-name{display:flex;align-items:center;gap:8px}.backups-page .backup-name svg{stroke:currentColor;fill:none;stroke-width:2;flex-shrink:0}.backups-page .backup-name .icon-app{color:#6366f1}.backups-page .backup-name .icon-db{color:#a855f7}.backups-page .action-buttons{display:flex;gap:4px}.backups-page .checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer}.backups-page .checkbox-label input[type=checkbox]{width:18px;height:18px;cursor:pointer}.backups-page .checkbox-label span{font-size:12px;color:var(--text-primary)}.backups-page .form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}.backups-page .form-help{display:block;margin-top:4px;font-size:10px;color:var(--text-tertiary)}.backups-page .restore-warning{text-align:center;padding:24px;background:#ef44441a;border-radius:6px;margin-bottom:24px}.backups-page .restore-warning svg{stroke:#ef4444;fill:none;stroke-width:2;margin-bottom:8px}.backups-page .restore-warning h3{color:#ef4444;margin-bottom:8px}.backups-page .restore-warning p{color:var(--text-secondary);font-size:12px}.backups-page .restore-details{background:var(--bg-secondary);border-radius:6px;padding:16px}.backups-page .restore-details .detail-row{display:flex;justify-content:space-between;padding:4px 0}.backups-page .restore-details .detail-row:not(:last-child){border-bottom:1px solid var(--border-color)}.backups-page .restore-details .detail-label{color:var(--text-tertiary);font-size:12px}.backups-page .restore-details .detail-value{font-weight:500;font-size:12px}.terminal-page .tabs .tab{display:flex;align-items:center;gap:8px}.terminal-page .tabs .tab svg{stroke:currentColor;fill:none;stroke-width:2}.logs-container{height:calc(100vh - 280px);min-height:500px}.logs-layout{display:grid;grid-template-columns:300px 1fr;gap:24px;height:100%}@media (max-width: 1024px){.logs-layout{grid-template-columns:1fr;grid-template-rows:auto 1fr}}.logs-sidebar{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px;display:flex;flex-direction:column;overflow:hidden}.logs-sidebar .sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid var(--border-color)}.logs-sidebar .sidebar-header h3{font-size:12px;font-weight:600;margin:0}.log-files-list{flex:1;overflow-y:auto;padding:8px}.log-files-list .empty-hint{padding:24px;text-align:center;color:var(--text-tertiary);font-size:12px}.log-file-item{display:flex;align-items:center;gap:8px;padding:8px 16px;border-radius:6px;cursor:pointer;transition:all .15s ease}.log-file-item:hover{background:var(--bg-tertiary)}.log-file-item.active{background:var(--primary);color:#fff}.log-file-item.active .log-file-path,.log-file-item.active .log-file-size{color:#ffffffb3}.log-file-item.active .log-icon{background:#fff3;color:#fff}.log-file-item .log-icon{width:32px;height:32px;border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--bg-tertiary)}.log-file-item .log-icon svg{stroke:currentColor;fill:none;stroke-width:2}.log-file-item .log-icon.error{color:#ef4444}.log-file-item .log-icon.access{color:#10b981}.log-file-item .log-icon.nginx{color:#6366f1}.log-file-item .log-icon.database{color:#a855f7}.log-file-item .log-file-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.log-file-item .log-file-name{font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.log-file-item .log-file-path{font-size:10px;color:var(--text-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.log-file-item .log-file-size{font-size:10px;color:var(--text-tertiary);flex-shrink:0}.logs-viewer{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px;display:flex;flex-direction:column;overflow:hidden}.viewer-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:8px 16px;border-bottom:1px solid var(--border-color);flex-wrap:wrap}.viewer-toolbar .toolbar-left,.viewer-toolbar .toolbar-right{display:flex;align-items:center;gap:8px}.search-input{display:flex;align-items:center;gap:8px;padding:4px 8px;background:var(--bg-tertiary);border:1px solid var(--border-color);border-radius:6px}.search-input svg{stroke:var(--text-tertiary);fill:none;stroke-width:2;flex-shrink:0}.search-input input{border:none;background:none;padding:0;font-size:12px;width:180px}.search-input input:focus{outline:none}.lines-select{padding:4px 8px;border:1px solid var(--border-color);border-radius:4px;background:var(--bg-tertiary);color:var(--text-primary);font-size:12px}.auto-refresh-toggle{display:flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:var(--text-secondary)}.auto-refresh-toggle input{cursor:pointer}.log-content{flex:1;overflow:auto;padding:16px;background:#1a1a2e}.log-content pre{margin:0;font-family:JetBrains Mono,Fira Code,monospace;font-size:12px;line-height:1.6;color:#e2e8f0;white-space:pre-wrap;word-break:break-all}.log-content .empty-viewer{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--text-tertiary)}.log-content .empty-viewer svg{stroke:currentColor;fill:none;stroke-width:1.5;margin-bottom:16px;opacity:.5}.log-content .empty-viewer p{font-size:12px}.journal-container{display:flex;flex-direction:column;gap:24px;height:calc(100vh - 280px);min-height:500px}.journal-controls{display:flex;align-items:flex-end;gap:24px;flex-wrap:wrap}.journal-controls .control-group{display:flex;flex-direction:column;gap:4px}.journal-controls .control-group label{font-size:10px;font-weight:500;color:var(--text-secondary)}.journal-controls .control-group input,.journal-controls .control-group select{padding:4px 8px;border:1px solid var(--border-color);border-radius:4px;background:var(--bg-secondary);font-size:12px}.journal-controls .control-group input{width:200px}.input-with-suggestions{display:flex;flex-direction:column;gap:8px}.quick-units{display:flex;flex-wrap:wrap;gap:4px}.unit-chip{padding:2px 8px;border:1px solid var(--border-color);border-radius:9999px;background:var(--bg-secondary);font-size:10px;cursor:pointer;transition:all .15s ease}.unit-chip:hover{border-color:var(--primary);color:var(--primary)}.unit-chip.active{background:var(--primary);border-color:var(--primary);color:#fff}.journal-viewer{flex:1;background:#1a1a2e;border-radius:8px;overflow:auto;padding:16px}.journal-viewer pre{margin:0;font-family:JetBrains Mono,Fira Code,monospace;font-size:12px;line-height:1.6;color:#e2e8f0;white-space:pre-wrap;word-break:break-all}.processes-container{display:flex;flex-direction:column;gap:24px}.processes-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.processes-toolbar .toolbar-left,.processes-toolbar .toolbar-right{display:flex;align-items:center;gap:8px}.processes-toolbar select{padding:4px 8px;border:1px solid var(--border-color);border-radius:4px;background:var(--bg-secondary);font-size:12px}.processes-table-wrapper{overflow-x:auto;background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px}.processes-table{width:100%;min-width:800px}.processes-table th{position:sticky;top:0;background:var(--bg-secondary);z-index:1}.processes-table tr{cursor:pointer;transition:background .15s ease}.processes-table tr:hover{background:var(--bg-tertiary)}.processes-table tr.selected{background:#3b82f61a}.processes-table .mono{font-family:JetBrains Mono,monospace;font-size:10px}.processes-table .process-name{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.processes-table .usage-cell{position:relative;min-width:100px}.processes-table .usage-cell .usage-bar{position:absolute;left:0;top:50%;transform:translateY(-50%);height:4px;border-radius:2px;opacity:.3}.processes-table .usage-cell .usage-bar.cpu{background:#6366f1}.processes-table .usage-cell .usage-bar.memory{background:#a855f7}.processes-table .usage-cell span{position:relative;font-size:10px;font-family:monospace}.processes-table .action-buttons{display:flex;gap:4px}.btn-xs{padding:2px 6px;font-size:11px}.btn-xs svg{stroke:currentColor;fill:none;stroke-width:2}.process-details-panel{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px;overflow:hidden}.process-details-panel .panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid var(--border-color)}.process-details-panel .panel-header h3{font-size:16px;font-weight:600;margin:0}.process-details-panel .panel-body{padding:16px}.process-details-panel .details-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:16px}.process-details-panel .detail-item{display:flex;flex-direction:column;gap:4px}.process-details-panel .detail-item .detail-label{font-size:10px;color:var(--text-tertiary)}.process-details-panel .detail-item .detail-value{font-size:12px;font-weight:500}.process-details-panel .detail-item .detail-value.mono{font-family:monospace}.process-details-panel .command-line{margin-top:16px;padding-top:16px;border-top:1px solid var(--border-color)}.process-details-panel .command-line .detail-label{display:block;font-size:10px;color:var(--text-tertiary);margin-bottom:4px}.process-details-panel .command-line code{display:block;padding:8px;background:var(--bg-tertiary);border-radius:4px;font-family:monospace;font-size:10px;word-break:break-all}.services-container{display:flex;flex-direction:column;gap:24px}.services-toolbar{display:flex;align-items:center;gap:8px}.services-toolbar .btn svg{stroke:currentColor;fill:none;stroke-width:2}.services-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px}.service-card{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:8px}.service-card .service-header{display:flex;align-items:center;justify-content:space-between;gap:16px}.service-card .service-header .service-info{display:flex;align-items:center;gap:8px}.service-card .service-header .service-info .status-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.service-card .service-header .service-info .status-dot.success{background:#10b981}.service-card .service-header .service-info .status-dot.danger{background:#ef4444}.service-card .service-header .service-info .status-dot.warning{background:#f59e0b}.service-card .service-header .service-info .status-dot.secondary{background:var(--text-tertiary)}.service-card .service-header .service-info h4{font-size:12px;font-weight:600;margin:0}.service-card .service-description{font-size:10px;color:var(--text-secondary);margin:0}.service-card .service-meta{display:flex;gap:16px;font-size:10px;color:var(--text-tertiary)}.service-card .service-meta .meta-label{color:var(--text-secondary)}.service-card .service-actions{display:flex;gap:4px;margin-top:8px;padding-top:8px;border-top:1px solid var(--border-color)}.modal-lg{max-width:900px;width:90%}.modal-log-viewer{max-height:500px;overflow:auto;background:#1a1a2e;border-radius:6px;padding:16px}.modal-log-viewer pre{margin:0;font-family:JetBrains Mono,monospace;font-size:12px;line-height:1.6;color:#e2e8f0;white-space:pre-wrap;word-break:break-all}.settings-page{padding:24px;max-width:1200px;margin:0 auto}.settings-header{margin-bottom:32px}.settings-header h1{font-size:1.75rem;font-weight:600;color:#f4f4f5;margin:0 0 4px}.settings-header p{color:#a1a1aa;margin:0}.settings-content{display:flex;gap:32px}@media (max-width: 900px){.settings-content{flex-direction:column}}.settings-nav{flex:0 0 220px}@media (max-width: 900px){.settings-nav{flex:none}}.settings-nav ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:4px}@media (max-width: 900px){.settings-nav ul{flex-direction:row;flex-wrap:wrap}}.settings-nav li button{width:100%;display:flex;align-items:center;gap:8px;padding:8px 12px;background:transparent;border:none;border-radius:6px;color:#a1a1aa;font-size:.9rem;cursor:pointer;transition:all .2s ease;text-align:left}@media (max-width: 900px){.settings-nav li button{width:auto}}.settings-nav li button:hover{background:#27272a;color:#f4f4f5}.settings-nav li button.active{background:#6366f1;color:#fff}.settings-nav li button .nav-icon{font-size:1.1rem;width:20px;text-align:center}.settings-sections{flex:1;min-width:0}.settings-section{background:#18181b;border:1px solid #27272a;border-radius:8px;padding:24px;margin-bottom:24px}.settings-section:last-child{margin-bottom:0}.section-header{display:flex;align-items:center;gap:8px;margin-bottom:24px;padding-bottom:16px;border-bottom:1px solid #27272a}.section-header .section-icon{font-size:1.25rem;color:#6366f1}.section-header h2{font-size:1.1rem;font-weight:600;color:#f4f4f5;margin:0}.settings-form{display:flex;flex-direction:column;gap:24px}.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px}.form-group{display:flex;flex-direction:column;gap:4px}.form-group label{font-size:.85rem;font-weight:500;color:#a1a1aa}.form-group input,.form-group select{padding:8px 12px;background:#27272a;border:1px solid #27272a;border-radius:6px;color:#f4f4f5;font-size:.9rem;transition:border-color .2s ease}.form-group input:focus,.form-group select:focus{outline:none;border-color:#6366f1}.form-group input:disabled,.form-group select:disabled{opacity:.6;cursor:not-allowed}.form-group .input-hint{font-size:.8rem;color:#71717a}.form-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #27272a}.form-actions.no-border{border-top:none;padding-top:0}.password-section .password-fields{display:flex;flex-direction:column;gap:16px}.password-section .password-requirements{font-size:.8rem;color:#71717a;margin-top:4px}.theme-options{display:flex;gap:16px;flex-wrap:wrap}.theme-option{flex:1;min-width:150px;padding:16px;background:#27272a;border:2px solid #27272a;border-radius:6px;cursor:pointer;transition:all .2s ease;text-align:center}.theme-option:hover{border-color:#6366f1}.theme-option.active{border-color:#6366f1;background:#6366f11a}.theme-option .theme-icon{font-size:2rem;margin-bottom:8px}.theme-option .theme-name{font-weight:500;color:#f4f4f5;margin-bottom:4px}.theme-option .theme-desc{font-size:.8rem;color:#a1a1aa}.notification-settings{display:flex;flex-direction:column;gap:16px}.notification-item{display:flex;justify-content:space-between;align-items:center;padding:16px;background:#27272a;border-radius:6px}.notification-item .notification-info{flex:1}.notification-item .notification-info .notification-label{font-weight:500;color:#f4f4f5;margin-bottom:4px}.notification-item .notification-info .notification-desc{font-size:.85rem;color:#a1a1aa}.toggle-switch{position:relative;width:48px;height:26px}.toggle-switch input{opacity:0;width:0;height:0}.toggle-switch input:checked+.toggle-slider{background:#6366f1}.toggle-switch input:checked+.toggle-slider:before{transform:translate(22px)}.toggle-switch input:focus+.toggle-slider{box-shadow:0 0 0 2px #6366f14d}.toggle-switch .toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#27272a;border-radius:26px;transition:all .3s ease}.toggle-switch .toggle-slider:before{content:"";position:absolute;height:20px;width:20px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:transform .3s ease}.system-info-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px}.info-card{padding:16px;background:#27272a;border-radius:6px;text-align:center}.info-card .info-icon{font-size:1.5rem;color:#6366f1;margin-bottom:8px}.info-card .info-label{font-size:.8rem;color:#a1a1aa;margin-bottom:4px}.info-card .info-value{font-size:1.25rem;font-weight:600;color:#f4f4f5}.info-card .info-bar{margin-top:8px;height:6px;background:#27272a;border-radius:3px;overflow:hidden}.info-card .info-bar .info-bar-fill{height:100%;background:#6366f1;border-radius:3px;transition:width .3s ease}.info-card .info-bar .info-bar-fill.warning{background:#f59e0b}.info-card .info-bar .info-bar-fill.danger{background:#ef4444}.about-section .app-info{display:flex;align-items:center;gap:24px;margin-bottom:24px;padding-bottom:24px;border-bottom:1px solid #27272a}.about-section .app-info .app-logo{width:64px;height:64px;background:linear-gradient(135deg,#6366f1,#4f46e5);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:2rem}.about-section .app-info .app-details .app-name{font-size:1.25rem;font-weight:600;color:#f4f4f5;margin-bottom:4px}.about-section .app-info .app-details .app-version{font-size:.9rem;color:#a1a1aa}.about-section .features-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px;margin-bottom:24px}.about-section .features-list .feature-item{display:flex;align-items:center;gap:8px;padding:8px;color:#a1a1aa}.about-section .features-list .feature-item .feature-check{color:#10b981}.about-section .about-links{display:flex;gap:16px;flex-wrap:wrap}.about-section .about-links a{display:flex;align-items:center;gap:4px;padding:8px 12px;background:#27272a;border-radius:6px;color:#a1a1aa;text-decoration:none;transition:all .2s ease}.about-section .about-links a:hover{background:#6366f1;color:#fff}.settings-message{padding:8px 12px;border-radius:6px;margin-bottom:16px;display:flex;align-items:center;gap:8px}.settings-message.success{background:#10b98126;color:#10b981;border:1px solid rgba(16,185,129,.3)}.settings-message.error{background:#ef444426;color:#ef4444;border:1px solid rgba(239,68,68,.3)}.settings-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:64px;color:#a1a1aa}.settings-loading .spinner{width:40px;height:40px;border:3px solid #27272a;border-top-color:#6366f1;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:16px}@keyframes spin{to{transform:rotate(360deg)}}.file-manager .page-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:24px;flex-wrap:wrap;gap:16px}.file-manager .page-header .page-header-content h1{font-size:24px;font-weight:600;margin:0 0 4px}.file-manager .page-header .page-header-content .page-description{color:var(--text-secondary);margin:0}.file-manager .page-header .page-header-actions{display:flex;gap:8px}.file-manager .upload-progress{display:flex;align-items:center;gap:12px;padding:12px 16px;background:var(--card-bg);border-radius:8px;margin-bottom:16px}.file-manager .upload-progress .progress-bar{flex:1;height:8px;background:var(--border-color);border-radius:4px;overflow:hidden}.file-manager .upload-progress .progress-bar .progress-fill{height:100%;background:var(--primary);transition:width .3s ease}.file-manager .upload-progress span{font-size:13px;font-weight:500;color:var(--text-secondary);min-width:40px}.file-manager .file-manager-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--card-bg);border-radius:8px;margin-bottom:16px;gap:16px;flex-wrap:wrap}.file-manager .file-manager-toolbar .path-breadcrumb{display:flex;align-items:center;gap:8px}.file-manager .file-manager-toolbar .path-breadcrumb .current-path{font-family:var(--font-mono);font-size:13px;color:var(--text-primary);background:var(--bg-tertiary);padding:6px 12px;border-radius:4px}.file-manager .file-manager-toolbar .toolbar-actions{display:flex;align-items:center;gap:12px}.file-manager .file-manager-toolbar .toolbar-actions .search-box{display:flex;align-items:center;gap:4px;background:var(--bg-tertiary);border-radius:6px;padding:0 4px}.file-manager .file-manager-toolbar .toolbar-actions .search-box input{background:transparent;border:none;padding:8px 12px;font-size:13px;width:200px}.file-manager .file-manager-toolbar .toolbar-actions .search-box input:focus{outline:none}.file-manager .file-manager-toolbar .toolbar-actions .checkbox-label{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text-secondary);cursor:pointer}.file-manager .file-manager-toolbar .toolbar-actions .checkbox-label input[type=checkbox]{width:16px;height:16px}.file-manager .disk-usage-bar{padding:12px 16px;background:var(--card-bg);border-radius:8px;margin-bottom:16px}.file-manager .disk-usage-bar .disk-usage-info{display:flex;justify-content:space-between;font-size:13px;color:var(--text-secondary);margin-bottom:8px}.file-manager .disk-usage-bar .disk-progress{height:6px;background:var(--border-color);border-radius:3px;overflow:hidden}.file-manager .disk-usage-bar .disk-progress .disk-progress-fill{height:100%;background:var(--primary);transition:width .3s ease}.file-manager .disk-usage-bar .disk-progress .disk-progress-fill.warning{background:var(--warning)}.file-manager .disk-usage-bar .disk-progress .disk-progress-fill.critical{background:var(--danger)}.file-manager .file-manager-content{display:grid;grid-template-columns:1fr 400px;gap:16px}@media (max-width: 1200px){.file-manager .file-manager-content{grid-template-columns:1fr}}.file-manager .file-list-container{background:var(--card-bg);border-radius:8px;overflow:hidden}.file-manager .file-list-container .loading-state,.file-manager .file-list-container .empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px;color:var(--text-tertiary)}.file-manager .file-list-container .loading-state .icon,.file-manager .file-list-container .empty-state .icon{font-size:48px;margin-bottom:16px}.file-manager .file-list .file-list-header{display:grid;grid-template-columns:1fr 100px 120px 120px 120px;padding:12px 16px;background:var(--bg-tertiary);font-size:12px;font-weight:600;text-transform:uppercase;color:var(--text-tertiary);border-bottom:1px solid var(--border-color)}.file-manager .file-list .file-item{display:grid;grid-template-columns:1fr 100px 120px 120px 120px;padding:12px 16px;border-bottom:1px solid var(--border-color);cursor:pointer;transition:background .2s}.file-manager .file-list .file-item:hover{background:var(--bg-tertiary)}.file-manager .file-list .file-item.selected{background:rgba(var(--primary-rgb),.1)}.file-manager .file-list .file-item .col-name{display:flex;align-items:center;gap:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-manager .file-list .file-item .col-name .file-icon{width:20px;height:20px;display:flex;align-items:center;justify-content:center}.file-manager .file-list .file-item .col-name .file-icon.folder:before{content:"📁"}.file-manager .file-list .file-item .col-name .file-icon.file:before{content:"📄"}.file-manager .file-list .file-item .col-name .file-icon.javascript:before{content:"📜"}.file-manager .file-list .file-item .col-name .file-icon.python:before{content:"🐍"}.file-manager .file-list .file-item .col-name .file-icon.image:before{content:"🖼️"}.file-manager .file-list .file-item .col-name .file-icon.text:before{content:"📝"}.file-manager .file-list .file-item .col-name .file-icon.archive:before{content:"📦"}.file-manager .file-list .file-item .col-name .file-icon.terminal:before{content:"⚡"}.file-manager .file-list .file-item .col-name .link-indicator{color:var(--text-tertiary);font-size:12px}.file-manager .file-list .file-item .col-size,.file-manager .file-list .file-item .col-modified,.file-manager .file-list .file-item .col-permissions{font-size:13px;color:var(--text-secondary)}.file-manager .file-list .file-item .col-permissions{font-family:var(--font-mono);font-size:12px}.file-manager .file-list .file-item .col-actions{display:flex;gap:4px;justify-content:flex-end}.file-manager .file-list .file-item .col-actions .btn-icon{opacity:0;transition:opacity .2s}.file-manager .file-list .file-item:hover .col-actions .btn-icon{opacity:1}.file-manager .file-preview{background:var(--card-bg);border-radius:8px;display:flex;flex-direction:column;max-height:calc(100vh - 300px)}.file-manager .file-preview .preview-header{display:flex;justify-content:space-between;align-items:center;padding:16px;border-bottom:1px solid var(--border-color)}.file-manager .file-preview .preview-header h3{margin:0;font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-manager .file-preview .preview-header .preview-actions{display:flex;gap:8px}.file-manager .file-preview .preview-info{display:flex;gap:16px;padding:12px 16px;background:var(--bg-tertiary);font-size:12px;color:var(--text-secondary);flex-wrap:wrap}.file-manager .file-preview .file-editor{flex:1;padding:16px;font-family:var(--font-mono);font-size:13px;line-height:1.5;background:var(--bg-primary);border:none;resize:none;color:var(--text-primary)}.file-manager .file-preview .file-editor:focus{outline:none}.file-manager .file-preview .file-editor[readonly]{background:var(--bg-tertiary)}.file-manager .file-preview .preview-unavailable{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px;color:var(--text-tertiary)}.file-manager .file-preview .preview-unavailable .icon{font-size:48px;margin-bottom:16px}.file-manager .file-preview .preview-unavailable p{margin-bottom:16px}.file-manager .permissions-help{margin-top:16px;padding:12px;background:var(--bg-tertiary);border-radius:6px;font-size:13px}.file-manager .permissions-help p{margin:0 0 8px;font-weight:500}.file-manager .permissions-help ul{margin:0;padding-left:20px}.file-manager .permissions-help ul li{margin-bottom:4px}.file-manager .permissions-help ul code{background:var(--bg-primary);padding:2px 6px;border-radius:4px}.ftp-server .page-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:24px;flex-wrap:wrap;gap:16px}.ftp-server .page-header .page-header-content h1{font-size:24px;font-weight:600;margin:0 0 4px}.ftp-server .page-header .page-header-content .page-description{color:var(--text-secondary);margin:0}.ftp-server .page-header .page-header-actions{display:flex;gap:8px}.ftp-server .page-loading{display:flex;justify-content:center;align-items:center;min-height:400px}.ftp-server .empty-state-large{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:80px 24px;background:var(--card-bg);border-radius:12px;text-align:center}.ftp-server .empty-state-large .icon{font-size:64px;color:var(--text-tertiary);margin-bottom:24px}.ftp-server .empty-state-large h2{margin:0 0 12px;font-size:24px;font-weight:600}.ftp-server .empty-state-large p{margin:0 0 24px;color:var(--text-secondary);max-width:400px}.ftp-server .status-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}.ftp-server .status-card{display:flex;align-items:center;gap:16px;padding:20px;background:var(--card-bg);border-radius:12px;border-left:4px solid var(--border-color)}.ftp-server .status-card.success{border-left-color:var(--success)}.ftp-server .status-card.success .status-icon{color:var(--success)}.ftp-server .status-card.warning{border-left-color:var(--warning)}.ftp-server .status-card.warning .status-icon{color:var(--warning)}.ftp-server .status-card .status-icon .icon{font-size:32px}.ftp-server .status-card .status-info{display:flex;flex-direction:column;gap:4px}.ftp-server .status-card .status-info .status-label{font-size:13px;color:var(--text-secondary)}.ftp-server .status-card .status-info .status-value{font-size:18px;font-weight:600}.ftp-server .tabs{display:flex;gap:4px;margin-bottom:24px;border-bottom:1px solid var(--border-color)}.ftp-server .tabs .tab{padding:12px 20px;background:none;border:none;font-size:14px;font-weight:500;color:var(--text-secondary);cursor:pointer;position:relative;transition:color .2s}.ftp-server .tabs .tab:hover{color:var(--text-primary)}.ftp-server .tabs .tab.active{color:var(--primary)}.ftp-server .tabs .tab.active:after{content:"";position:absolute;bottom:-1px;left:0;right:0;height:2px;background:var(--primary)}.ftp-server .tab-content .section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.ftp-server .tab-content .section-header h3{margin:0;font-size:16px;font-weight:600}.ftp-server .tab-content .empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px;background:var(--card-bg);border-radius:8px;color:var(--text-tertiary)}.ftp-server .tab-content .empty-state .icon{font-size:48px;margin-bottom:16px}.ftp-server .tab-content .empty-state p{margin-bottom:16px}.ftp-server .overview-tab{display:grid;grid-template-columns:1fr 1fr;gap:24px}@media (max-width: 900px){.ftp-server .overview-tab{grid-template-columns:1fr}}.ftp-server .overview-tab .config-section,.ftp-server .overview-tab .info-section{background:var(--card-bg);border-radius:8px;padding:20px}.ftp-server .overview-tab .config-section h3,.ftp-server .overview-tab .info-section h3{margin:0 0 16px;font-size:16px;font-weight:600}.ftp-server .overview-tab .config-grid,.ftp-server .overview-tab .info-grid{display:grid;gap:12px}.ftp-server .overview-tab .config-item,.ftp-server .overview-tab .info-item{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid var(--border-color)}.ftp-server .overview-tab .config-item:last-child,.ftp-server .overview-tab .info-item:last-child{border-bottom:none}.ftp-server .overview-tab .config-item .config-label,.ftp-server .overview-tab .info-item .config-label,.ftp-server .overview-tab .config-item .info-label,.ftp-server .overview-tab .info-item .info-label{font-size:13px;color:var(--text-secondary)}.ftp-server .overview-tab .config-item .config-value,.ftp-server .overview-tab .info-item .config-value{font-size:13px;font-weight:500}.ftp-server .overview-tab .config-item .config-value.success,.ftp-server .overview-tab .info-item .config-value.success{color:var(--success)}.ftp-server .overview-tab .config-item .config-value.warning,.ftp-server .overview-tab .info-item .config-value.warning{color:var(--warning)}.ftp-server .overview-tab .config-item code,.ftp-server .overview-tab .info-item code{font-family:var(--font-mono);font-size:13px;background:var(--bg-tertiary);padding:4px 8px;border-radius:4px}.ftp-server .users-tab .users-table,.ftp-server .connections-tab .users-table,.ftp-server .users-tab .connections-table,.ftp-server .connections-tab .connections-table{background:var(--card-bg);border-radius:8px;overflow:hidden}.ftp-server .users-tab .users-table table,.ftp-server .connections-tab .users-table table,.ftp-server .users-tab .connections-table table,.ftp-server .connections-tab .connections-table table{width:100%;border-collapse:collapse}.ftp-server .users-tab .users-table table th,.ftp-server .connections-tab .users-table table th,.ftp-server .users-tab .connections-table table th,.ftp-server .connections-tab .connections-table table th,.ftp-server .users-tab .users-table table td,.ftp-server .connections-tab .users-table table td,.ftp-server .users-tab .connections-table table td,.ftp-server .connections-tab .connections-table table td{padding:12px 16px;text-align:left}.ftp-server .users-tab .users-table table th,.ftp-server .connections-tab .users-table table th,.ftp-server .users-tab .connections-table table th,.ftp-server .connections-tab .connections-table table th{background:var(--bg-tertiary);font-size:12px;font-weight:600;text-transform:uppercase;color:var(--text-tertiary)}.ftp-server .users-tab .users-table table td,.ftp-server .connections-tab .users-table table td,.ftp-server .users-tab .connections-table table td,.ftp-server .connections-tab .connections-table table td{border-bottom:1px solid var(--border-color);font-size:13px}.ftp-server .users-tab .users-table table td:last-child,.ftp-server .connections-tab .users-table table td:last-child,.ftp-server .users-tab .connections-table table td:last-child,.ftp-server .connections-tab .connections-table table td:last-child{border-bottom:none}.ftp-server .users-tab .users-table table td code,.ftp-server .connections-tab .users-table table td code,.ftp-server .users-tab .connections-table table td code,.ftp-server .connections-tab .connections-table table td code{font-family:var(--font-mono);font-size:12px;background:var(--bg-tertiary);padding:2px 6px;border-radius:4px}.ftp-server .users-tab .users-table table tr:last-child td,.ftp-server .connections-tab .users-table table tr:last-child td,.ftp-server .users-tab .connections-table table tr:last-child td,.ftp-server .connections-tab .connections-table table tr:last-child td{border-bottom:none}.ftp-server .users-tab .users-table .user-name,.ftp-server .connections-tab .users-table .user-name,.ftp-server .users-tab .connections-table .user-name,.ftp-server .connections-tab .connections-table .user-name{font-weight:500;margin-right:8px}.ftp-server .users-tab .users-table .badge,.ftp-server .connections-tab .users-table .badge,.ftp-server .users-tab .connections-table .badge,.ftp-server .connections-tab .connections-table .badge{display:inline-block;padding:2px 8px;font-size:11px;font-weight:500;border-radius:4px}.ftp-server .users-tab .users-table .badge.badge-info,.ftp-server .connections-tab .users-table .badge.badge-info,.ftp-server .users-tab .connections-table .badge.badge-info,.ftp-server .connections-tab .connections-table .badge.badge-info{background:rgba(var(--primary-rgb),.1);color:var(--primary)}.ftp-server .users-tab .users-table .badge.badge-warning,.ftp-server .connections-tab .users-table .badge.badge-warning,.ftp-server .users-tab .connections-table .badge.badge-warning,.ftp-server .connections-tab .connections-table .badge.badge-warning{background:#ffc1071a;color:#f59e0b}.ftp-server .users-tab .users-table .status-badge,.ftp-server .connections-tab .users-table .status-badge,.ftp-server .users-tab .connections-table .status-badge,.ftp-server .connections-tab .connections-table .status-badge{display:inline-block;padding:4px 10px;font-size:12px;font-weight:500;border-radius:4px}.ftp-server .users-tab .users-table .status-badge.active,.ftp-server .connections-tab .users-table .status-badge.active,.ftp-server .users-tab .connections-table .status-badge.active,.ftp-server .connections-tab .connections-table .status-badge.active{background:#22c55e1a;color:var(--success)}.ftp-server .users-tab .users-table .status-badge.inactive,.ftp-server .connections-tab .users-table .status-badge.inactive,.ftp-server .users-tab .connections-table .status-badge.inactive,.ftp-server .connections-tab .connections-table .status-badge.inactive{background:#9ca3af1a;color:var(--text-tertiary)}.ftp-server .users-tab .users-table .actions,.ftp-server .connections-tab .users-table .actions,.ftp-server .users-tab .connections-table .actions,.ftp-server .connections-tab .connections-table .actions{display:flex;gap:4px}.ftp-server .logs-tab .log-viewer{background:var(--card-bg);border-radius:8px;padding:16px;max-height:500px;overflow:auto}.ftp-server .logs-tab .log-viewer pre{margin:0;font-family:var(--font-mono);font-size:12px;line-height:1.6;white-space:pre-wrap;word-break:break-all;color:var(--text-secondary)}.ftp-server .install-info{padding:16px;background:var(--bg-tertiary);border-radius:8px;margin-top:16px}.ftp-server .install-info p{margin:0;font-size:14px;line-height:1.6}.ftp-server .install-info p strong{color:var(--primary)}.php-management .page-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:24px;flex-wrap:wrap;gap:16px}.php-management .page-header .page-header-content h1{font-size:24px;font-weight:600;margin:0 0 4px}.php-management .page-header .page-header-content .page-description{color:#a1a1aa;margin:0}.php-management .page-header .page-header-actions{display:flex;gap:8px}.php-management .page-loading{display:flex;justify-content:center;align-items:center;min-height:400px}.php-management .empty-state-large{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:80px 24px;background:#18181b;border-radius:12px;text-align:center}.php-management .empty-state-large .icon{font-size:64px;color:#71717a;margin-bottom:24px}.php-management .empty-state-large h2{margin:0 0 12px;font-size:24px;font-weight:600}.php-management .empty-state-large p{margin:0 0 24px;color:#a1a1aa;max-width:400px}.php-management .version-selector{display:flex;align-items:center;gap:12px;margin-bottom:24px;padding:16px;background:#18181b;border-radius:8px}.php-management .version-selector label{font-weight:500;color:#a1a1aa}.php-management .version-selector select{min-width:200px}.php-management .status-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}.php-management .status-card{display:flex;align-items:center;gap:16px;padding:20px;background:#18181b;border-radius:12px;border-left:4px solid #27272a}.php-management .status-card.success{border-left-color:#10b981}.php-management .status-card.success .status-icon{color:#10b981}.php-management .status-card.warning{border-left-color:#f59e0b}.php-management .status-card.warning .status-icon{color:#f59e0b}.php-management .status-card .status-icon .icon{font-size:32px}.php-management .status-card .status-info{display:flex;flex-direction:column;gap:4px}.php-management .status-card .status-info .status-label{font-size:12px;color:#a1a1aa}.php-management .status-card .status-info .status-value{font-size:18px;font-weight:600}.php-management .tabs{display:flex;gap:4px;margin-bottom:24px;border-bottom:1px solid #27272a}.php-management .tabs .tab{padding:12px 20px;background:none;border:none;font-size:14px;font-weight:500;color:#a1a1aa;cursor:pointer;position:relative;transition:color .15s ease}.php-management .tabs .tab:hover{color:#f4f4f5}.php-management .tabs .tab.active{color:#6366f1}.php-management .tabs .tab.active:after{content:"";position:absolute;bottom:-1px;left:0;right:0;height:2px;background:#6366f1}.php-management .tab-content .section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.php-management .tab-content .section-header h3{margin:0;font-size:16px;font-weight:600}.php-management .tab-content .empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px;background:#18181b;border-radius:8px;color:#71717a}.php-management .tab-content .empty-state .icon{font-size:48px;margin-bottom:16px}.php-management .tab-content .empty-state p{margin-bottom:16px}.php-management .versions-tab .versions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.php-management .version-card{background:#18181b;border-radius:8px;padding:20px;border:1px solid #27272a;cursor:pointer;transition:all .15s ease}.php-management .version-card:hover{border-color:#3f3f46}.php-management .version-card.selected{border-color:#6366f1;box-shadow:0 0 0 1px #6366f1}.php-management .version-card .version-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.php-management .version-card .version-header .version-number{font-size:18px;font-weight:600;color:#777bb4}.php-management .version-card .version-details{margin-bottom:16px}.php-management .version-card .version-details .detail-row{display:flex;justify-content:space-between;align-items:center;padding:8px 0;font-size:12px}.php-management .version-card .version-details .detail-row .label{color:#71717a}.php-management .version-card .version-details .detail-row code{font-family:Fira Code,Monaco,Consolas,monospace;font-size:10px;background:#27272a;padding:4px 8px;border-radius:4px}.php-management .version-card .version-details .detail-row .status.active{color:#10b981}.php-management .version-card .version-details .detail-row .status.inactive{color:#71717a}.php-management .version-card .version-actions{display:flex;gap:8px}.php-management .extensions-tab .extensions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}.php-management .extension-card{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#18181b;border-radius:6px;border:1px solid #27272a}.php-management .extension-card .extension-name{font-weight:500}.php-management .extension-card .extension-version{font-size:12px;color:#71717a}.php-management .common-extensions{margin-top:16px}.php-management .common-extensions .extension-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.php-management .common-extensions .extension-chips .chip{padding:4px 12px;background:#27272a;border:1px solid #27272a;border-radius:9999px;font-size:12px;cursor:pointer;transition:all .15s ease}.php-management .common-extensions .extension-chips .chip:hover{background:#6366f1;color:#fff;border-color:#6366f1}.php-management .pools-tab .pools-table{background:#18181b;border-radius:8px;overflow:hidden}.php-management .pools-tab .pools-table table{width:100%;border-collapse:collapse}.php-management .pools-tab .pools-table table th,.php-management .pools-tab .pools-table table td{padding:12px 16px;text-align:left}.php-management .pools-tab .pools-table table th{background:#27272a;font-size:10px;font-weight:600;text-transform:uppercase;color:#71717a}.php-management .pools-tab .pools-table table td{border-bottom:1px solid #27272a;font-size:12px}.php-management .pools-tab .pools-table table td code{font-family:Fira Code,Monaco,Consolas,monospace;font-size:10px;background:#27272a;padding:4px 8px;border-radius:4px}.php-management .pools-tab .pools-table table tr:last-child td{border-bottom:none}.php-management .form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}.php-management .form-row.form-row-4{grid-template-columns:repeat(4,1fr)}.firewall-page .page-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:24px;flex-wrap:wrap;gap:16px}.firewall-page .page-header .page-header-content h1{font-size:24px;font-weight:600;margin:0 0 4px}.firewall-page .page-header .page-header-content .page-description{color:#a1a1aa;margin:0}.firewall-page .page-header .page-header-actions{display:flex;gap:8px}.firewall-page .page-loading{display:flex;justify-content:center;align-items:center;min-height:400px}.firewall-page .empty-state-large{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:80px 24px;background:#18181b;border-radius:12px;text-align:center}.firewall-page .empty-state-large .icon{font-size:64px;color:#71717a;margin-bottom:24px}.firewall-page .empty-state-large h2{margin:0 0 12px;font-size:24px;font-weight:600}.firewall-page .empty-state-large p{margin:0 0 24px;color:#a1a1aa;max-width:400px}.firewall-page .status-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}.firewall-page .status-card{display:flex;align-items:center;gap:16px;padding:20px;background:#18181b;border-radius:12px;border-left:4px solid #27272a}.firewall-page .status-card.success{border-left-color:#10b981}.firewall-page .status-card.success .status-icon{color:#10b981}.firewall-page .status-card.danger{border-left-color:#ef4444}.firewall-page .status-card.danger .status-icon{color:#ef4444}.firewall-page .status-card.warning{border-left-color:#f59e0b}.firewall-page .status-card.warning .status-icon{color:#f59e0b}.firewall-page .status-card .status-icon .icon{font-size:32px}.firewall-page .status-card .status-info{display:flex;flex-direction:column;gap:4px}.firewall-page .status-card .status-info .status-label{font-size:12px;color:#a1a1aa}.firewall-page .status-card .status-info .status-value{font-size:18px;font-weight:600}.firewall-page .tabs{display:flex;gap:4px;margin-bottom:24px;border-bottom:1px solid #27272a}.firewall-page .tabs .tab{padding:12px 20px;background:none;border:none;font-size:14px;font-weight:500;color:#a1a1aa;cursor:pointer;position:relative;transition:color .15s ease}.firewall-page .tabs .tab:hover{color:#f4f4f5}.firewall-page .tabs .tab.active{color:#6366f1}.firewall-page .tabs .tab.active:after{content:"";position:absolute;bottom:-1px;left:0;right:0;height:2px;background:#6366f1}.firewall-page .tab-content .section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.firewall-page .tab-content .section-header h3{margin:0;font-size:16px;font-weight:600}.firewall-page .tab-content .empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px;background:#18181b;border-radius:8px;color:#71717a}.firewall-page .tab-content .empty-state .icon{font-size:48px;margin-bottom:16px}.firewall-page .tab-content .empty-state p{margin-bottom:16px}.firewall-page .overview-tab{display:grid;grid-template-columns:1fr 1fr;gap:24px}@media (max-width: 768px){.firewall-page .overview-tab{grid-template-columns:1fr}}.firewall-page .overview-tab .info-card,.firewall-page .overview-tab .protection-summary{background:#18181b;border-radius:8px;padding:20px}.firewall-page .overview-tab .info-card h3,.firewall-page .overview-tab .protection-summary h3{margin:0 0 16px;font-size:16px;font-weight:600}.firewall-page .overview-tab .info-grid{display:grid;gap:12px}.firewall-page .overview-tab .info-item{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid #27272a}.firewall-page .overview-tab .info-item:last-child{border-bottom:none}.firewall-page .overview-tab .info-item .info-label{font-size:12px;color:#a1a1aa}.firewall-page .overview-tab .info-item .info-value{font-size:12px;font-weight:500}.firewall-page .overview-tab .info-item .info-value.text-success{color:#10b981}.firewall-page .overview-tab .info-item .info-value.text-danger{color:#ef4444}.firewall-page .overview-tab .summary-grid{display:flex;flex-direction:column;gap:12px}.firewall-page .overview-tab .summary-item{display:flex;align-items:center;gap:12px}.firewall-page .overview-tab .summary-item .summary-icon.text-success{color:#10b981}.firewall-page .overview-tab .summary-item .summary-icon.text-danger{color:#ef4444}.firewall-page .overview-tab .summary-item .summary-text{font-size:12px}.firewall-page .rules-tab .rules-table{background:#18181b;border-radius:8px;overflow:hidden}.firewall-page .rules-tab .rules-table table{width:100%;border-collapse:collapse}.firewall-page .rules-tab .rules-table table th,.firewall-page .rules-tab .rules-table table td{padding:12px 16px;text-align:left}.firewall-page .rules-tab .rules-table table th{background:#27272a;font-size:10px;font-weight:600;text-transform:uppercase;color:#71717a}.firewall-page .rules-tab .rules-table table td{border-bottom:1px solid #27272a;font-size:12px}.firewall-page .rules-tab .rules-table table td .rule-code{font-family:Fira Code,Monaco,Consolas,monospace;font-size:10px;background:#27272a;padding:4px 8px;border-radius:4px}.firewall-page .rules-tab .rules-table table tr:last-child td{border-bottom:none}.firewall-page .blocked-tab .blocked-list{display:flex;flex-direction:column;gap:12px}.firewall-page .blocked-tab .blocked-item{display:flex;justify-content:space-between;align-items:center;padding:16px;background:#18181b;border-radius:8px;border:1px solid #27272a}.firewall-page .blocked-tab .blocked-item .blocked-info{display:flex;flex-direction:column;gap:4px}.firewall-page .blocked-tab .blocked-item .blocked-info .blocked-ip{font-weight:600;color:#ef4444}.firewall-page .blocked-tab .blocked-item .blocked-info .blocked-rule{font-family:Fira Code,Monaco,Consolas,monospace;font-size:10px;color:#71717a}.firewall-page .quick-tab h3{margin:0 0 8px;font-size:16px;font-weight:600}.firewall-page .quick-tab .quick-ports{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin-top:24px}.firewall-page .quick-tab .quick-port-item{display:flex;justify-content:space-between;align-items:center;padding:16px;background:#18181b;border-radius:8px;border:1px solid #27272a}.firewall-page .quick-tab .quick-port-item .port-info{display:flex;flex-direction:column;gap:4px}.firewall-page .quick-tab .quick-port-item .port-info .port-name{font-weight:500}.firewall-page .quick-tab .quick-port-item .port-info .port-number{font-size:12px;color:#71717a;font-family:Fira Code,Monaco,Consolas,monospace}.firewall-page .install-info{padding:16px;background:#27272a;border-radius:8px;margin-top:16px}.firewall-page .install-info p{margin:0;font-size:12px;line-height:1.6}.firewall-page .install-info p strong{color:#6366f1}.firewall-page .form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}diff --git a/frontend/dist/index.html b/frontend/dist/index.htmlindex ad5cc6fb..c7e27ce5 100644--- a/frontend/dist/index.html+++ b/frontend/dist/index.html@@ -6,8 +6,8 @@<link rel="icon" type="image/svg+xml" href="/vite.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>React Dashboard Template</title>- <script type="module" crossorigin src="/assets/index-BT_A2C8f.js"></script>- <link rel="stylesheet" crossorigin href="/assets/index-zpQn1_s8.css">+ <script type="module" crossorigin src="/assets/index-URe4pgfM.js"></script>+ <link rel="stylesheet" crossorigin href="/assets/index-B_wqBYsy.css"></head><body>diff --git a/frontend/src/styles/components/_env-vars.less b/frontend/src/styles/components/_env-vars.lessindex a9b56a4e..3042ea96 100644--- a/frontend/src/styles/components/_env-vars.less+++ b/frontend/src/styles/components/_env-vars.less@@ -7,7 +7,7 @@display: flex;justify-content: space-between;align-items: center;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;h3 {margin: 0;@@ -15,29 +15,29 @@.header-actions {display: flex;- gap: @spacing-sm;+ gap: @space-2;}}.hint {color: @text-tertiary;font-size: @font-size-sm;- margin-bottom: @spacing-lg;+ margin-bottom: @space-6;}}// Add new variable form.env-add-form {- background: @surface-secondary;- border: 1px solid @border-color;+ background: @bg-card;+ border: 1px solid @border-subtle;border-radius: @radius-md;- padding: @spacing-md;- margin-bottom: @spacing-lg;+ padding: @space-4;+ margin-bottom: @space-6;.env-form-row {display: flex;- gap: @spacing-sm;- margin-bottom: @spacing-sm;+ gap: @space-2;+ margin-bottom: @space-2;}.env-key-input {@@ -57,8 +57,8 @@justify-content: center;width: 40px;height: 40px;- background: @surface-tertiary;- border: 1px solid @border-color;+ background: @bg-hover;+ border: 1px solid @border-subtle;border-radius: @radius-sm;cursor: pointer;color: @text-tertiary;@@ -69,14 +69,14 @@}&:hover {- border-color: @primary;- color: @primary;+ border-color: @accent-primary;+ color: @accent-primary;}&:has(input:checked) {- background: fade(@primary, 20%);- border-color: @primary;- color: @primary;+ background: fade(@accent-primary, 20%);+ border-color: @accent-primary;+ color: @accent-primary;}}@@ -90,7 +90,7 @@// Filter.env-filter {position: relative;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;input {width: 100%;@@ -119,18 +119,18 @@.env-list {display: flex;flex-direction: column;- gap: @spacing-sm;+ gap: @space-2;}.env-item {- background: @surface-secondary;- border: 1px solid @border-color;+ background: @bg-card;+ border: 1px solid @border-subtle;border-radius: @radius-md;- padding: @spacing-md;+ padding: @space-4;transition: border-color 0.2s;&:hover {- border-color: @border-light;+ border-color: @border-active;}&.is-secret {@@ -141,7 +141,7 @@display: flex;justify-content: space-between;align-items: center;- margin-bottom: @spacing-xs;+ margin-bottom: @space-1;}.env-key {@@ -150,7 +150,7 @@color: @text-primary;display: flex;align-items: center;- gap: @spacing-xs;+ gap: @space-1;.secret-badge {color: @warning;@@ -159,7 +159,7 @@.env-item-actions {display: flex;- gap: @spacing-xs;+ gap: @space-1;opacity: 0;transition: opacity 0.2s;}@@ -173,20 +173,20 @@font-size: @font-size-sm;color: @text-secondary;word-break: break-all;- padding: @spacing-xs 0;+ padding: @space-1 0;}.env-description {font-size: @font-size-xs;color: @text-tertiary;- margin-top: @spacing-xs;+ margin-top: @space-1;font-style: italic;}.env-edit-row {display: flex;- gap: @spacing-sm;- margin-top: @spacing-sm;+ gap: @space-2;+ margin-top: @space-2;input {flex: 1;@@ -209,7 +209,7 @@transition: all 0.2s;&:hover {- background: @surface-tertiary;+ background: @bg-hover;color: @text-primary;}@@ -222,10 +222,10 @@// Empty state.env-empty {text-align: center;- padding: @spacing-xl;+ padding: @space-8;color: @text-tertiary;- background: @surface-secondary;- border: 1px dashed @border-color;+ background: @bg-card;+ border: 1px dashed @border-subtle;border-radius: @radius-md;}@@ -234,9 +234,9 @@display: flex;justify-content: space-between;align-items: center;- margin-top: @spacing-lg;- padding-top: @spacing-md;- border-top: 1px solid @border-color;+ margin-top: @space-6;+ padding-top: @space-4;+ border-top: 1px solid @border-subtle;.env-count {color: @text-tertiary;@@ -246,17 +246,17 @@// Import modal specific.import-file-upload {- margin-bottom: @spacing-md;+ margin-bottom: @space-4;}.import-textarea {width: 100%;font-family: @font-mono;font-size: @font-size-sm;- background: @surface-primary;- border: 1px solid @border-color;+ background: @bg-body;+ border: 1px solid @border-subtle;border-radius: @radius-sm;- padding: @spacing-md;+ padding: @space-4;resize: vertical;min-height: 200px;diff --git a/frontend/src/styles/components/_notifications.less b/frontend/src/styles/components/_notifications.lessindex 7fbe8efe..645ffa16 100644--- a/frontend/src/styles/components/_notifications.less+++ b/frontend/src/styles/components/_notifications.less@@ -5,13 +5,13 @@.notification-channels {display: flex;flex-direction: column;- gap: @spacing-md;+ gap: @space-4;}.notification-channel-card {- border: 1px solid @border-color;+ border: 1px solid @border-subtle;border-radius: @radius-lg;- background: @surface-secondary;+ background: @bg-card;overflow: hidden;transition: border-color 0.2s;@@ -23,13 +23,13 @@.channel-header {display: flex;align-items: center;- gap: @spacing-md;- padding: @spacing-md @spacing-lg;+ gap: @space-4;+ padding: @space-4 @space-6;cursor: pointer;transition: background 0.2s;&:hover {- background: @surface-tertiary;+ background: @bg-hover;}}@@ -39,7 +39,7 @@display: flex;align-items: center;justify-content: center;- background: @surface-tertiary;+ background: @bg-hover;border-radius: @radius-md;flex-shrink: 0;@@ -48,7 +48,7 @@}.notification-channel-card.enabled & svg {- color: @primary;+ color: @accent-primary;}}@@ -57,7 +57,7 @@min-width: 0;h3 {- margin: 0 0 @spacing-xs 0;+ margin: 0 0 @space-1 0;font-size: @font-size-md;}@@ -71,7 +71,7 @@.channel-status {display: flex;align-items: center;- gap: @spacing-md;+ gap: @space-4;}.expand-icon {@@ -84,9 +84,9 @@}.channel-config {- padding: @spacing-lg;- border-top: 1px solid @border-color;- background: @surface-primary;+ padding: @space-6;+ border-top: 1px solid @border-subtle;+ background: @bg-body;}.toggle-switch-label {@@ -102,7 +102,7 @@.form-row {display: grid;grid-template-columns: 1fr 1fr;- gap: @spacing-md;+ gap: @space-4;@media (max-width: 600px) {grid-template-columns: 1fr;@@ -112,16 +112,16 @@.severity-toggles {display: flex;flex-wrap: wrap;- gap: @spacing-sm;+ gap: @space-2;}.severity-toggle {display: flex;align-items: center;- gap: @spacing-xs;- padding: @spacing-xs @spacing-sm;+ gap: @space-1;+ padding: @space-1 @space-2;border-radius: @radius-sm;- background: @surface-tertiary;+ background: @bg-hover;cursor: pointer;transition: all 0.2s;font-size: @font-size-sm;@@ -131,8 +131,8 @@}span {- padding: 2px @spacing-xs;- border-radius: @radius-xs;+ padding: 2px @space-1;+ border-radius: @radius-sm;}&.critical span {@@ -146,8 +146,8 @@}&.info span {- background: fade(@info, 20%);- color: @info;+ background: fade(@accent-primary, 20%);+ color: @accent-primary;}&.success span {@@ -171,8 +171,8 @@.channel-actions {display: flex;justify-content: flex-end;- gap: @spacing-sm;- margin-top: @spacing-lg;- padding-top: @spacing-md;- border-top: 1px solid @border-color;+ gap: @space-2;+ margin-top: @space-6;+ padding-top: @space-4;+ border-top: 1px solid @border-subtle;}diff --git a/frontend/src/styles/components/_two-factor.less b/frontend/src/styles/components/_two-factor.lessindex 779a6f87..fe20ab46 100644--- a/frontend/src/styles/components/_two-factor.less+++ b/frontend/src/styles/components/_two-factor.less@@ -6,8 +6,8 @@.totp-inputs {display: flex;justify-content: center;- gap: @spacing-sm;- margin: @spacing-lg 0;+ gap: @space-2;+ margin: @space-6 0;}.totp-input {@@ -16,16 +16,16 @@font-size: 24px;font-weight: 600;text-align: center;- border: 2px solid @border-color;+ border: 2px solid @border-subtle;border-radius: @radius-md;- background: @surface-secondary;+ background: @bg-card;color: @text-primary;transition: all 0.2s;&:focus {- border-color: @primary;+ border-color: @accent-primary;outline: none;- box-shadow: 0 0 0 3px fade(@primary, 20%);+ box-shadow: 0 0 0 3px fade(@accent-primary, 20%);}&::placeholder {@@ -38,14 +38,14 @@display: flex;flex-direction: column;align-items: center;- gap: @spacing-sm;- margin-top: @spacing-lg;+ gap: @space-2;+ margin-top: @space-6;}.link-button {background: none;border: none;- color: @primary;+ color: @accent-primary;cursor: pointer;font-size: @font-size-sm;padding: 0;@@ -57,16 +57,16 @@// 2FA Card in Settings.two-fa-card {- border: 1px solid @border-color;+ border: 1px solid @border-subtle;border-radius: @radius-lg;- padding: @spacing-lg;- margin-bottom: @spacing-lg;+ padding: @space-6;+ margin-bottom: @space-6;}.two-fa-header {display: flex;- gap: @spacing-md;- margin-bottom: @spacing-lg;+ gap: @space-4;+ margin-bottom: @space-6;.two-fa-icon {width: 48px;@@ -74,14 +74,14 @@display: flex;align-items: center;justify-content: center;- background: fade(@primary, 15%);+ background: fade(@accent-primary, 15%);border-radius: @radius-md;- color: @primary;+ color: @accent-primary;flex-shrink: 0;}h3 {- margin: 0 0 @spacing-xs 0;+ margin: 0 0 @space-1 0;}p {@@ -94,7 +94,7 @@.two-fa-disabled {.two-fa-description {color: @text-secondary;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;}}@@ -102,8 +102,8 @@.two-fa-status {display: flex;align-items: center;- gap: @spacing-sm;- margin-bottom: @spacing-md;+ gap: @space-2;+ margin-bottom: @space-4;}.two-fa-info {@@ -112,13 +112,13 @@}.two-fa-backup-info {- background: @surface-tertiary;- padding: @spacing-sm @spacing-md;+ background: @bg-hover;+ padding: @space-2 @space-4;border-radius: @radius-sm;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;display: flex;flex-direction: column;- gap: @spacing-xs;+ gap: @space-1;.warning-text {color: @warning;@@ -128,7 +128,7 @@.two-fa-actions {display: flex;- gap: @spacing-sm;+ gap: @space-2;}}@@ -136,12 +136,12 @@.setup-steps {display: flex;flex-direction: column;- gap: @spacing-lg;+ gap: @space-6;}.setup-step {display: flex;- gap: @spacing-md;+ gap: @space-4;.step-number {width: 28px;@@ -149,7 +149,7 @@display: flex;align-items: center;justify-content: center;- background: @primary;+ background: @accent-primary;color: white;border-radius: 50%;font-weight: 600;@@ -161,12 +161,12 @@flex: 1;h4 {- margin: 0 0 @spacing-xs 0;+ margin: 0 0 @space-1 0;}p {color: @text-secondary;- margin: 0 0 @spacing-md 0;+ margin: 0 0 @space-4 0;font-size: @font-size-sm;}}@@ -175,10 +175,10 @@.qr-code-container {display: flex;justify-content: center;- padding: @spacing-md;+ padding: @space-4;background: white;border-radius: @radius-md;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;}.qr-code {@@ -187,30 +187,30 @@}.qr-fallback {- background: @surface-tertiary;- padding: @spacing-md;+ background: @bg-hover;+ padding: @space-4;border-radius: @radius-md;text-align: center;.secret-key {display: block;font-size: @font-size-lg;- padding: @spacing-sm;- margin-top: @spacing-sm;- background: @surface-primary;+ padding: @space-2;+ margin-top: @space-2;+ background: @bg-body;border-radius: @radius-sm;word-break: break-all;}}.manual-entry {- margin-top: @spacing-md;+ margin-top: @space-4;font-size: @font-size-sm;color: @text-secondary;summary {cursor: pointer;- color: @primary;+ color: @accent-primary;&:hover {text-decoration: underline;@@ -218,11 +218,11 @@}p {- margin: @spacing-xs 0;+ margin: @space-1 0;}code {- background: @surface-tertiary;+ background: @bg-hover;padding: 2px 6px;border-radius: @radius-sm;}@@ -233,7 +233,7 @@font-weight: 600;text-align: center;letter-spacing: 0.5em;- padding: @spacing-md;+ padding: @space-4;width: 100%;max-width: 200px;}@@ -241,12 +241,12 @@// Warning Box.warning-box {display: flex;- gap: @spacing-md;- padding: @spacing-md;+ gap: @space-4;+ padding: @space-4;background: fade(@warning, 10%);border: 1px solid fade(@warning, 30%);border-radius: @radius-md;- margin-bottom: @spacing-lg;+ margin-bottom: @space-6;svg {flex-shrink: 0;@@ -263,21 +263,21 @@.error-text {color: @danger;font-size: @font-size-sm;- margin-top: @spacing-xs;+ margin-top: @space-1;}// Backup Codes Grid.backup-codes-grid {display: grid;grid-template-columns: repeat(2, 1fr);- gap: @spacing-sm;- margin-bottom: @spacing-lg;+ gap: @space-2;+ margin-bottom: @space-6;}.backup-code {display: block;- padding: @spacing-sm @spacing-md;- background: @surface-tertiary;+ padding: @space-2 @space-4;+ background: @bg-hover;border-radius: @radius-sm;text-align: center;font-size: @font-size-md;@@ -287,10 +287,10 @@.backup-codes-actions {display: flex;justify-content: center;- gap: @spacing-sm;+ gap: @space-2;.btn svg {- margin-right: @spacing-xs;+ margin-right: @space-1;}}diff --git a/frontend/src/styles/pages/_security.less b/frontend/src/styles/pages/_security.lessindex de3dc6ed..03969451 100644--- a/frontend/src/styles/pages/_security.less+++ b/frontend/src/styles/pages/_security.less@@ -5,14 +5,14 @@.security-page {.tabs-nav {display: flex;- gap: @spacing-xs;- margin-bottom: @spacing-lg;- border-bottom: 1px solid @border-color;- padding-bottom: @spacing-sm;+ gap: @space-1;+ margin-bottom: @space-6;+ border-bottom: 1px solid @border-subtle;+ padding-bottom: @space-2;overflow-x: auto;.tab-btn {- padding: @spacing-sm @spacing-md;+ padding: @space-2 @space-4;border: none;background: none;color: @text-secondary;@@ -22,12 +22,12 @@transition: all 0.2s;&:hover {- background: @surface-tertiary;+ background: @bg-hover;color: @text-primary;}&.active {- background: @primary;+ background: @accent-primary;color: white;}}@@ -39,18 +39,18 @@.stats-grid {display: grid;grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));- gap: @spacing-md;- margin-bottom: @spacing-lg;+ gap: @space-4;+ margin-bottom: @space-6;}.stat-card {display: flex;align-items: center;- gap: @spacing-md;- padding: @spacing-lg;- background: @surface-secondary;+ gap: @space-4;+ padding: @space-6;+ background: @bg-card;border-radius: @radius-lg;- border: 1px solid @border-color;+ border: 1px solid @border-subtle;&.success {border-color: fade(@success, 30%);@@ -68,8 +68,8 @@}&.info {- border-color: fade(@info, 30%);- .stat-icon { color: @info; background: fade(@info, 15%); }+ border-color: fade(@accent-primary, 30%);+ .stat-icon { color: @accent-primary; background: fade(@accent-primary, 15%); }}}@@ -79,7 +79,7 @@display: flex;align-items: center;justify-content: center;- background: @surface-tertiary;+ background: @bg-hover;border-radius: @radius-md;flex-shrink: 0;}@@ -102,7 +102,7 @@.security-grid {display: grid;grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));- gap: @spacing-md;+ gap: @space-4;}}@@ -111,7 +111,7 @@.scan-options {display: grid;grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));- gap: @spacing-lg;+ gap: @space-6;align-items: start;}@@ -119,14 +119,14 @@display: flex;flex-direction: column;align-items: center;- gap: @spacing-sm;+ gap: @space-2;text-align: center;.btn-lg {display: flex;align-items: center;- gap: @spacing-sm;- padding: @spacing-md @spacing-xl;+ gap: @space-2;+ padding: @space-4 @space-8;font-size: @font-size-md;svg {@@ -143,13 +143,13 @@.scan-custom {label {display: block;- margin-bottom: @spacing-sm;+ margin-bottom: @space-2;font-weight: 500;}.input-group {display: flex;- gap: @spacing-sm;+ gap: @space-2;input {flex: 1;@@ -158,13 +158,13 @@}.scan-progress {- margin-top: @spacing-lg;- border-color: @info;+ margin-top: @space-6;+ border-color: @accent-primary;.progress-info {display: flex;align-items: center;- gap: @spacing-md;+ gap: @space-4;.spinner {width: 32px;@@ -175,7 +175,7 @@margin: 0;&:not(:last-child) {- margin-bottom: @spacing-xs;+ margin-bottom: @space-1;}}}@@ -197,17 +197,17 @@display: flex;flex-direction: column;align-items: center;- padding: @spacing-xl;+ padding: @space-8;text-align: center;svg {color: @success;- margin-bottom: @spacing-md;+ margin-bottom: @space-4;}p {font-size: @font-size-lg;- margin-bottom: @spacing-xs;+ margin-bottom: @space-1;}}}@@ -216,19 +216,19 @@.integrity-tab {.description {color: @text-secondary;- margin-bottom: @spacing-lg;+ margin-bottom: @space-6;}.integrity-actions {display: flex;- gap: @spacing-md;+ gap: @space-4;}.change-section {- margin-bottom: @spacing-lg;+ margin-bottom: @space-6;h4 {- margin-bottom: @spacing-sm;+ margin-bottom: @space-2;color: @warning;}}@@ -237,16 +237,16 @@list-style: none;padding: 0;margin: 0;- background: @surface-tertiary;+ background: @bg-hover;border-radius: @radius-md;max-height: 300px;overflow-y: auto;li {- padding: @spacing-sm @spacing-md;+ padding: @space-2 @space-4;font-family: @font-mono;font-size: @font-size-sm;- border-bottom: 1px solid @border-color;+ border-bottom: 1px solid @border-subtle;&:last-child {border-bottom: none;@@ -264,10 +264,10 @@.failed-login-summary {display: flex;align-items: baseline;- gap: @spacing-sm;+ gap: @space-2;.count {- font-size: @font-size-xxl;+ font-size: @font-size-2xl;font-weight: 700;&.danger {@@ -281,11 +281,11 @@}.recent-failures {- margin-top: @spacing-md;+ margin-top: @space-4;summary {cursor: pointer;- color: @primary;+ color: @accent-primary;&:hover {text-decoration: underline;@@ -293,9 +293,9 @@}pre {- margin-top: @spacing-sm;- padding: @spacing-md;- background: @surface-tertiary;+ margin-top: @space-2;+ padding: @space-4;+ background: @bg-hover;border-radius: @radius-md;font-size: @font-size-xs;max-height: 200px;@@ -306,17 +306,17 @@.events-list {display: flex;flex-direction: column;- gap: @spacing-sm;+ gap: @space-2;}.event-item {display: flex;align-items: flex-start;- gap: @spacing-md;- padding: @spacing-md;- background: @surface-tertiary;+ gap: @space-4;+ padding: @space-4;+ background: @bg-hover;border-radius: @radius-md;- border-left: 3px solid @border-color;+ border-left: 3px solid @border-subtle;&.malware {border-left-color: @danger;@@ -340,7 +340,7 @@.event-message {display: block;- margin-bottom: @spacing-xs;+ margin-bottom: @space-1;}.event-time {@@ -353,21 +353,21 @@// Settings Tab.settings-tab {.card {- margin-bottom: @spacing-lg;+ margin-bottom: @space-6;}.form-actions {- margin-top: @spacing-lg;+ margin-top: @space-6;}}// Shared Components.not-installed {text-align: center;- padding: @spacing-lg;+ padding: @space-6;p {- margin-bottom: @spacing-md;+ margin-bottom: @space-4;color: @text-secondary;}}@@ -375,15 +375,15 @@.info-list {display: flex;flex-direction: column;- gap: @spacing-sm;+ gap: @space-2;}.info-item {display: flex;justify-content: space-between;align-items: center;- padding: @spacing-sm 0;- border-bottom: 1px solid @border-color;+ padding: @space-2 0;+ border-bottom: 1px solid @border-subtle;&:last-child {border-bottom: none;@@ -406,5 +406,5 @@.loading-sm {color: @text-tertiary;font-size: @font-size-sm;- padding: @spacing-md;+ padding: @space-4;}