From cb61a7d4574f0944c864bc95d07b768419925ce2 Mon Sep 17 00:00:00 2001
From: Alex
Date: Mon, 16 Nov 2026 02:35:04 +0000
Subject: [PATCH] LocalPing: self-hosted uptime monitor with static public
status site
---
.env.example | 15 +
.gitattributes | 2 +
.gitignore | 5 +
CLAUDE.md | 166 +
README.md | 23 +
__tests__/services/backupService.test.js | 710 ++
__tests__/services/monitorService.test.js | 174 +
__tests__/services/pingService.test.js | 230 +
ecosystem.config.js | 31 +
install.sh | 420 +
jest.config.js | 19 +
package-lock.json | 9090 +++++++++++++++++
package.json | 67 +
prisma/schema.prisma | 227 +
scripts/README.md | 38 +
scripts/create-db-user.sh | 46 +
scripts/download-cdn-libs.js | 204 +
scripts/download-cdn-libs.sh | 81 +
scripts/init-postgres.sh | 95 +
scripts/run-tests.sh | 28 +
scripts/test-backup.sh | 28 +
scripts/verify-ping-data.js | 113 +
src/app.js | 240 +
src/cli/localping.js | 228 +
src/config/db.js | 880 ++
src/config/prisma.js | 91 +
src/config/sessionStore.js | 136 +
src/electron/main.js | 99 +
src/electron/preload.js | 5 +
src/middleware/auth.js | 191 +
src/middleware/setupCheck.js | 42 +
src/public/android-icon-192x192.png | Bin 0 -> 21121 bytes
src/public/apple-touch-icon.png | Bin 0 -> 18183 bytes
src/public/browserconfig.xml | 2 +
src/public/favicon-16x16.png | Bin 0 -> 709 bytes
src/public/favicon-32x32.png | Bin 0 -> 1146 bytes
src/public/favicon.ico | Bin 0 -> 1150 bytes
src/public/js/admin-new.js | 3304 ++++++
src/public/js/admin.js | 934 ++
src/public/js/notifications.js | 339 +
src/public/js/public.js | 2271 ++++
src/public/manifest.json | 11 +
src/public/ms-icon-150x150.png | Bin 0 -> 12643 bytes
src/public/ms-icon-310x310.png | Bin 0 -> 61343 bytes
src/public/ms-icon-70x70.png | Bin 0 -> 2592 bytes
src/public/vendor/axios.min.js | 3 +
src/public/vendor/chart.js | 14 +
src/public/vendor/font-awesome/all.min.css | 9 +
.../font-awesome/webfonts/fa-brands-400.woff2 | Bin 0 -> 108020 bytes
.../webfonts/fa-regular-400.woff2 | Bin 0 -> 24948 bytes
.../font-awesome/webfonts/fa-solid-900.woff2 | Bin 0 -> 150124 bytes
.../webfonts/fa-v4compatibility.woff2 | Bin 0 -> 4564 bytes
src/public/vendor/marked.min.js | 69 +
src/public/vendor/tailwindcss.js | 83 +
src/routes/admin.js | 1248 +++
src/routes/api.js | 537 +
src/routes/public.js | 788 ++
src/routes/setup.js | 192 +
src/routes/site.js | 147 +
src/services/actionService.js | 235 +
src/services/backupService.js | 451 +
src/services/cacheService.js | 124 +
src/services/dataRetentionService.js | 336 +
src/services/eventDetectionService.js | 566 +
src/services/faviconService.js | 307 +
src/services/gatewayService.js | 85 +
src/services/incidentService.js | 262 +
src/services/monitorService.js | 683 ++
src/services/notificationService.js | 394 +
src/services/pingService.js | 321 +
src/services/sqliteService.js | 322 +
src/services/workers/pingWorker.js | 259 +
src/services/workers/workerPool.js | 284 +
src/site/brand/icon-180.png | Bin 0 -> 14713 bytes
src/site/brand/icon-192.png | Bin 0 -> 15747 bytes
src/site/brand/icon-32.png | Bin 0 -> 1808 bytes
src/site/brand/icon-512.png | Bin 0 -> 63090 bytes
src/site/brand/icon.svg | 1 +
src/site/index.html | 37 +
src/site/site.css | 64 +
src/site/site.js | 125 +
src/utils/colors.js | 11 +
src/views/admin/index.ejs | 2213 ++++
src/views/admin/login.ejs | 144 +
src/views/admin/site.html | 21 +
src/views/layout.ejs | 37 +
src/views/public/index.ejs | 1151 +++
src/views/setup/wizard.ejs | 185 +
test-api.js | 606 ++
89 files changed, 32899 insertions(+)
create mode 100644 .env.example
create mode 100644 .gitattributes
create mode 100644 .gitignore
create mode 100644 CLAUDE.md
create mode 100644 README.md
create mode 100644 __tests__/services/backupService.test.js
create mode 100644 __tests__/services/monitorService.test.js
create mode 100644 __tests__/services/pingService.test.js
create mode 100644 ecosystem.config.js
create mode 100755 install.sh
create mode 100644 jest.config.js
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 prisma/schema.prisma
create mode 100644 scripts/README.md
create mode 100755 scripts/create-db-user.sh
create mode 100755 scripts/download-cdn-libs.js
create mode 100755 scripts/download-cdn-libs.sh
create mode 100755 scripts/init-postgres.sh
create mode 100755 scripts/run-tests.sh
create mode 100755 scripts/test-backup.sh
create mode 100755 scripts/verify-ping-data.js
create mode 100644 src/app.js
create mode 100644 src/cli/localping.js
create mode 100644 src/config/db.js
create mode 100644 src/config/prisma.js
create mode 100644 src/config/sessionStore.js
create mode 100644 src/electron/main.js
create mode 100644 src/electron/preload.js
create mode 100644 src/middleware/auth.js
create mode 100644 src/middleware/setupCheck.js
create mode 100644 src/public/android-icon-192x192.png
create mode 100644 src/public/apple-touch-icon.png
create mode 100644 src/public/browserconfig.xml
create mode 100644 src/public/favicon-16x16.png
create mode 100644 src/public/favicon-32x32.png
create mode 100644 src/public/favicon.ico
create mode 100644 src/public/js/admin-new.js
create mode 100644 src/public/js/admin.js
create mode 100644 src/public/js/notifications.js
create mode 100644 src/public/js/public.js
create mode 100644 src/public/manifest.json
create mode 100644 src/public/ms-icon-150x150.png
create mode 100644 src/public/ms-icon-310x310.png
create mode 100644 src/public/ms-icon-70x70.png
create mode 100644 src/public/vendor/axios.min.js
create mode 100644 src/public/vendor/chart.js
create mode 100644 src/public/vendor/font-awesome/all.min.css
create mode 100644 src/public/vendor/font-awesome/webfonts/fa-brands-400.woff2
create mode 100644 src/public/vendor/font-awesome/webfonts/fa-regular-400.woff2
create mode 100644 src/public/vendor/font-awesome/webfonts/fa-solid-900.woff2
create mode 100644 src/public/vendor/font-awesome/webfonts/fa-v4compatibility.woff2
create mode 100644 src/public/vendor/marked.min.js
create mode 100644 src/public/vendor/tailwindcss.js
create mode 100644 src/routes/admin.js
create mode 100644 src/routes/api.js
create mode 100644 src/routes/public.js
create mode 100644 src/routes/setup.js
create mode 100644 src/routes/site.js
create mode 100644 src/services/actionService.js
create mode 100644 src/services/backupService.js
create mode 100644 src/services/cacheService.js
create mode 100644 src/services/dataRetentionService.js
create mode 100644 src/services/eventDetectionService.js
create mode 100644 src/services/faviconService.js
create mode 100644 src/services/gatewayService.js
create mode 100644 src/services/incidentService.js
create mode 100644 src/services/monitorService.js
create mode 100644 src/services/notificationService.js
create mode 100644 src/services/pingService.js
create mode 100644 src/services/sqliteService.js
create mode 100644 src/services/workers/pingWorker.js
create mode 100644 src/services/workers/workerPool.js
create mode 100644 src/site/brand/icon-180.png
create mode 100644 src/site/brand/icon-192.png
create mode 100644 src/site/brand/icon-32.png
create mode 100644 src/site/brand/icon-512.png
create mode 100644 src/site/brand/icon.svg
create mode 100644 src/site/index.html
create mode 100644 src/site/site.css
create mode 100644 src/site/site.js
create mode 100644 src/utils/colors.js
create mode 100644 src/views/admin/index.ejs
create mode 100644 src/views/admin/login.ejs
create mode 100644 src/views/admin/site.html
create mode 100644 src/views/layout.ejs
create mode 100644 src/views/public/index.ejs
create mode 100644 src/views/setup/wizard.ejs
create mode 100755 test-api.js
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..8c3191e
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,15 @@
+# Server Configuration
+API_PORT=8000
+NODE_ENV=production
+SESSION_SECRET=change_me_to_a_random_string
+
+# Notification Settings
+NOTIFICATION_ENABLED=false
+NOTIFICATION_METHOD=dbus
+
+# Monitoring
+PING_INTERVAL=60
+ALERT_COOLDOWN=300
+
+# API Authentication
+ADMIN_API_KEY=localping-admin-key-12345
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfe0770
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7f6c91b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+node_modules/
+.env
+data/
+logs/
+*.log
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..470d9bc
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,166 @@
+# CLAUDE.md
+
+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+
+## Project Overview
+
+LocalPing is a self-hosted uptime monitoring system for homelabs. It monitors services using ICMP, TCP, UDP, HTTP/HTTPS protocols with real-time dashboards and historical tracking. Data is stored in PostgreSQL via Prisma ORM.
+
+## Commands
+
+```bash
+# Development
+npm run dev # Start with nodemon (auto-reload)
+npm start # Start production server
+
+# Database (Prisma)
+npm run prisma:generate # Generate Prisma client after schema changes
+npm run prisma:push # Push schema changes to database
+npm run prisma:studio # Open Prisma Studio GUI
+
+# Testing
+npm test # Run all tests
+npm run test:watch # Run tests in watch mode
+npm run test:coverage # Run tests with coverage
+npm run test:backup # Run backup service tests only
+
+# Production (PM2)
+npm run pm2:start # Start with PM2
+npm run pm2:stop # Stop all PM2 processes
+npm run pm2:restart # Restart all PM2 processes
+npm run pm2:logs # View PM2 logs
+
+# Other
+npm run gui # Launch Electron GUI
+npm run web # Start in web-only mode
+npm run verify:ping # Verify ping data integrity
+```
+
+### ICMP Capabilities (Linux)
+```bash
+sudo setcap cap_net_raw=ep $(which node)
+```
+
+## Architecture
+
+### Entry Point & Server
+- `src/app.js` - Express server with WebSocket support, session management, route loading, and graceful shutdown handling
+
+### Database Layer (Prisma)
+- `prisma/schema.prisma` - Database schema definition with 12 models
+- `src/config/prisma.js` - Prisma client singleton and connection management
+- `src/services/cacheService.js` - In-memory caching layer for database queries
+
+### Core Services
+- `src/services/monitorService.js` - Central monitoring orchestrator. Manages ping intervals, status tracking (in-memory Map), alert cooldowns, and retry logic
+- `src/services/pingService.js` - Ping execution layer. Delegates to worker pool for multi-threaded pings
+- `src/services/workers/workerPool.js` - Thread pool manager (size: 2-8 based on CPU cores)
+- `src/services/workers/pingWorker.js` - Worker thread for executing individual pings
+
+### Notification & Events
+- `src/services/notificationService.js` - Discord webhook notifications for monitor status changes and incidents
+- `src/services/eventDetectionService.js` - Rule-based event detection and auto-incident creation
+
+### Routes
+- `src/routes/api.js` - REST API endpoints (`/api/*`) - requires API key auth
+- `src/routes/admin.js` - Admin panel routes (`/admin/*`) - requires session auth
+- `src/routes/public.js` - Public status page routes (`/`)
+- `src/routes/setup.js` - First-time setup wizard (`/setup`)
+
+### Middleware
+- `src/middleware/auth.js` - API key validation, rate limiting, input validation
+- `src/middleware/setupCheck.js` - Redirects to setup wizard if not configured
+
+### Views
+- `src/views/*.ejs` - EJS templates for admin panel, public dashboard, and setup wizard
+
+## Database Schema (Prisma)
+
+Models defined in `prisma/schema.prisma`:
+- `Target` - Monitor configurations (host, protocol, interval, etc.)
+- `PingResult` - Individual ping results with timestamps
+- `Statistic` - Daily aggregated statistics per target (unique on targetId + date)
+- `Alert` - Status change alerts
+- `Incident` - Manual/auto-created incidents
+- `EventRule` - Event detection rules for auto-incidents
+- `Action` - Target-specific actions
+- `Favicon` - Cached favicons for apps
+- `NotificationSettings` - Discord webhook configuration (singleton)
+- `AdminSettings` - Session duration, data retention, debug logging (singleton)
+- `PublicUISettings` - Public dashboard customization (singleton)
+- `Post` - Blog posts
+
+## Key Patterns
+
+### Monitor Status Flow
+1. `monitorService.startMonitoring()` loads enabled targets
+2. Each target gets an interval timer calling `pingTarget()`
+3. `pingService.ping()` delegates to worker pool
+4. Results stored via `prisma.pingResult.create()`
+5. Status changes trigger `notificationService` and `eventDetectionService`
+
+### Database Query Pattern (Prisma)
+```javascript
+const { getPrisma } = require('../config/prisma');
+const prisma = getPrisma();
+
+// Find all enabled targets
+const targets = await prisma.target.findMany({ where: { enabled: true } });
+
+// Find by ID
+const target = await prisma.target.findUnique({ where: { id: targetId } });
+
+// Create
+await prisma.pingResult.create({ data: { targetId, success: true, responseTime: 50 } });
+
+// Update
+await prisma.target.update({ where: { id }, data: { name: 'New Name' } });
+
+// Delete
+await prisma.target.delete({ where: { id } });
+
+// Raw SQL (for complex queries)
+const result = await prisma.$queryRaw`SELECT * FROM targets WHERE enabled = true`;
+```
+
+### Non-Blocking Design
+- Initial pings run in background (`setImmediate`, `Promise.allSettled`)
+- Database writes deferred with `setImmediate`
+- Worker pool prevents ping operations from blocking main thread
+
+## Environment Variables
+
+```env
+DATABASE_URL="postgresql://localping:localping@localhost:5432/localping"
+API_PORT=8000 # Server port
+SESSION_SECRET=... # Express session secret
+PING_INTERVAL=60 # Default ping interval (seconds)
+ALERT_COOLDOWN=300 # Alert cooldown (seconds)
+```
+
+## Testing
+
+Tests are in `__tests__/` directory using Jest:
+- `__tests__/services/backupService.test.js` - Export/import functionality
+- `__tests__/services/pingService.test.js` - Ping service tests
+
+Run single test file:
+```bash
+npx jest __tests__/services/backupService.test.js
+```
+
+## Migration Note
+
+This codebase was migrated from a custom MongoDB-style PostgreSQL wrapper (`pg` package with `db.collection()` API) to Prisma ORM. Some route files may still contain legacy patterns that need to be updated to use the Prisma client.
+
+Legacy pattern (to be replaced):
+```javascript
+const db = getDB();
+await db.collection('targets').find({}).toArray();
+```
+
+New Prisma pattern:
+```javascript
+const prisma = getPrisma();
+await prisma.target.findMany();
+```
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9d5055e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+# LocalPing
+
+Self-hosted uptime monitor for homelabs: ICMP/TCP/UDP/HTTP(S) checks, incident log, news posts, admin panel, and a fast static public status site.
+
+## Install
+```bash
+git clone https://github.com/YOUR-ORG/localping.git && cd localping
+sudo ./install.sh # Ubuntu 22.04+: Node, Postgres, systemd service
+```
+Then open `http://:8000/setup` to create the admin account.
+
+## Public site
+The public frontend is plain HTML/CSS/JS in `src/site` (no build step, ~10 KB). It reads a slim JSON API (`/api/site/summary`, `/api/site/news`) and supports:
+- service **tiers** (featured / normal / background), per-service **explainers** (β) and a **public link** switch, edited in *Admin β Site*
+- custom **name, accent colour and app icon** (also used for the PWA manifest), in *Admin β Site*
+- `SITE_DIR=/path/to/theme` to serve your own theme; `SITE_HOSTS=status.example.com` to limit it to certain hostnames
+- `SITE_NAME`, `SITE_URL` env vars for RSS
+
+Edit the About page and footer in `src/site`.
+
+## Dev
+`npm install && npx prisma db push && npm run dev`. Tests: `npm test`.
+License: MIT.
diff --git a/__tests__/services/backupService.test.js b/__tests__/services/backupService.test.js
new file mode 100644
index 0000000..d19f85b
--- /dev/null
+++ b/__tests__/services/backupService.test.js
@@ -0,0 +1,710 @@
+// Mock uuid before requiring backupService
+jest.mock('uuid', () => ({
+ v4: () => {
+ return 'test-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now();
+ }
+}));
+
+const backupService = require('../../src/services/backupService');
+const { getDB } = require('../../src/config/db');
+
+// Simple UUID generator for tests
+function generateId() {
+ return 'test-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now();
+}
+
+// Mock the database with shared state
+const mockCollections = {
+ targets: [],
+ incidents: [],
+ posts: [],
+ pingResults: [],
+ statistics: [],
+ actions: [],
+ alerts: [],
+ adminSettings: [],
+ publicUISettings: [],
+ favicons: []
+};
+
+jest.mock('../../src/config/db', () => {
+
+ const createMockCollection = (name) => {
+ return {
+ find: (query = {}) => ({
+ toArray: async () => {
+ let results = mockCollections[name] || [];
+ // Simple query matching
+ if (Object.keys(query).length > 0) {
+ results = results.filter(item => {
+ return Object.keys(query).every(key => {
+ if (query[key] && typeof query[key] === 'object' && '$in' in query[key]) {
+ return query[key].$in.includes(item[key]);
+ }
+ return item[key] === query[key];
+ });
+ });
+ }
+ return results;
+ }
+ }),
+ findOne: async (query = {}) => {
+ const items = mockCollections[name] || [];
+ if (Object.keys(query).length === 0) {
+ return items[0] || null;
+ }
+ return items.find(item => {
+ return Object.keys(query).every(key => item[key] === query[key]);
+ }) || null;
+ },
+ insertOne: async (doc) => {
+ if (!mockCollections[name]) {
+ mockCollections[name] = [];
+ }
+ if (!doc._id) {
+ // Generate a simple ID for testing
+ doc._id = 'test-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now();
+ }
+ mockCollections[name].push(doc);
+ return { insertedId: doc._id };
+ },
+ updateOne: async (query, update) => {
+ const items = mockCollections[name] || [];
+ const index = items.findIndex(item => {
+ return Object.keys(query).every(key => item[key] === query[key]);
+ });
+ if (index !== -1 && update.$set) {
+ items[index] = { ...items[index], ...update.$set };
+ return { modifiedCount: 1 };
+ }
+ return { modifiedCount: 0 };
+ },
+ deleteOne: async (query) => {
+ const items = mockCollections[name] || [];
+ const index = items.findIndex(item => {
+ return Object.keys(query).every(key => item[key] === query[key]);
+ });
+ if (index !== -1) {
+ items.splice(index, 1);
+ return { deletedCount: 1 };
+ }
+ return { deletedCount: 0 };
+ }
+ };
+ };
+
+ return {
+ getDB: () => ({
+ collection: (name) => createMockCollection(name),
+ query: async (sql, params) => {
+ // Simple mock for SQL queries used in positions endpoint
+ if (sql.includes('SELECT _id FROM targets WHERE _id IN')) {
+ const targetIds = params;
+ const targets = mockCollections.targets.filter(t => targetIds.includes(t._id));
+ return { rows: targets.map(t => ({ _id: t._id })) };
+ }
+ return { rows: [] };
+ }
+ })
+ };
+});
+
+describe('BackupService', () => {
+ let mockDB;
+
+ beforeEach(async () => {
+ jest.clearAllMocks();
+ mockDB = getDB();
+ // Clear all collections
+ Object.keys(mockCollections).forEach(key => {
+ mockCollections[key] = [];
+ });
+ });
+
+ describe('exportData', () => {
+ it('should export full data when full option is true', async () => {
+ // Setup test data
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Test Target',
+ host: 'example.com',
+ protocol: 'HTTP',
+ port: 80,
+ auth: JSON.stringify({ username: 'test', password: 'pass' }),
+ quickCommands: JSON.stringify(['cmd1', 'cmd2'])
+ });
+
+ const result = await backupService.exportData({ full: true });
+
+ expect(result).toHaveProperty('version');
+ expect(result).toHaveProperty('exportDate');
+ expect(result).toHaveProperty('data');
+ expect(result.data).toHaveProperty('targets');
+ expect(result.data.targets).toHaveLength(1);
+ expect(result.data.targets[0].name).toBe('Test Target');
+ // Should parse JSON fields
+ expect(typeof result.data.targets[0].auth).toBe('object');
+ expect(Array.isArray(result.data.targets[0].quickCommands)).toBe(true);
+ });
+
+ it('should export only monitors when monitors option is true', async () => {
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Test Target',
+ host: 'example.com'
+ });
+
+ const result = await backupService.exportData({ monitors: true });
+
+ expect(result.data).toHaveProperty('targets');
+ expect(result.data.targets).toHaveLength(1);
+ expect(result.data).not.toHaveProperty('incidents');
+ expect(result.data).not.toHaveProperty('posts');
+ });
+
+ it('should export incidents when incidents option is true', async () => {
+ const incidentId = generateId();
+ await mockDB.collection('incidents').insertOne({
+ _id: incidentId,
+ title: 'Test Incident',
+ status: 'investigating'
+ });
+
+ const result = await backupService.exportData({ incidents: true });
+
+ expect(result.data).toHaveProperty('incidents');
+ expect(result.data.incidents).toHaveLength(1);
+ expect(result.data.incidents[0].title).toBe('Test Incident');
+ });
+
+ it('should export posts when posts option is true', async () => {
+ const postId = generateId();
+ await mockDB.collection('posts').insertOne({
+ _id: postId,
+ title: 'Test Post',
+ content: 'Test Content'
+ });
+
+ const result = await backupService.exportData({ posts: true });
+
+ expect(result.data).toHaveProperty('posts');
+ expect(result.data.posts).toHaveLength(1);
+ expect(result.data.posts[0].title).toBe('Test Post');
+ });
+
+ it('should export data points when dataPoints option is true', async () => {
+ const pingId = generateId();
+ const statId = generateId();
+ await mockDB.collection('pingResults').insertOne({
+ _id: pingId,
+ targetId: generateId(),
+ success: true,
+ responseTime: 100
+ });
+ await mockDB.collection('statistics').insertOne({
+ _id: statId,
+ targetId: generateId(),
+ date: new Date(),
+ totalPings: 100
+ });
+
+ const result = await backupService.exportData({ dataPoints: true });
+
+ expect(result.data).toHaveProperty('pingResults');
+ expect(result.data).toHaveProperty('statistics');
+ expect(result.data).toHaveProperty('ping_results'); // Legacy format
+ expect(result.data).toHaveProperty('daily_stats'); // Legacy format
+ expect(result.data.pingResults).toHaveLength(1);
+ expect(result.data.statistics).toHaveLength(1);
+ });
+
+ it('should export settings when settings option is true', async () => {
+ await mockDB.collection('adminSettings').insertOne({
+ _id: 'settings',
+ sessionDurationDays: 30
+ });
+ await mockDB.collection('publicUISettings').insertOne({
+ _id: 'settings',
+ title: 'Test Title'
+ });
+
+ const result = await backupService.exportData({ settings: true });
+
+ expect(result.data).toHaveProperty('adminSettings');
+ expect(result.data).toHaveProperty('publicUISettings');
+ expect(result.data.adminSettings.sessionDurationDays).toBe(30);
+ expect(result.data.publicUISettings.title).toBe('Test Title');
+ });
+
+ it('should parse JSON fields in targets correctly', async () => {
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Test Target',
+ auth: JSON.stringify({ username: 'user', password: 'pass' }),
+ quickCommands: JSON.stringify(['cmd1', 'cmd2'])
+ });
+
+ const result = await backupService.exportData({ monitors: true });
+
+ expect(typeof result.data.targets[0].auth).toBe('object');
+ expect(result.data.targets[0].auth.username).toBe('user');
+ expect(Array.isArray(result.data.targets[0].quickCommands)).toBe(true);
+ expect(result.data.targets[0].quickCommands[0]).toBe('cmd1');
+ });
+
+ it('should handle invalid JSON in auth field gracefully', async () => {
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Test Target',
+ auth: 'invalid json {'
+ });
+
+ const result = await backupService.exportData({ monitors: true });
+
+ expect(result.data.targets[0].auth).toBeNull();
+ });
+
+ it('should return empty arrays when collections are empty', async () => {
+ const result = await backupService.exportData({ monitors: true });
+
+ expect(result.data.targets).toEqual([]);
+ });
+ });
+
+ describe('importData', () => {
+ it('should import targets successfully', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Imported Target',
+ host: 'example.com',
+ protocol: 'HTTP',
+ port: 80,
+ auth: { username: 'user', password: 'pass' },
+ quickCommands: ['cmd1']
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('targets');
+ expect(result.imported.targets.imported).toBe(1);
+
+ // Verify target was imported
+ const imported = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(imported).toBeTruthy();
+ expect(imported.name).toBe('Imported Target');
+ // Auth should be stringified
+ expect(typeof imported.auth).toBe('string');
+ });
+
+ it('should skip existing targets when overwrite is false', async () => {
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Existing Target',
+ host: 'old.com'
+ });
+
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Existing Target',
+ host: 'new.com'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData, { overwrite: false });
+
+ expect(result.imported.targets.skipped).toBe(1);
+
+ // Verify target was not updated
+ const existing = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(existing.host).toBe('old.com');
+ });
+
+ it('should update existing targets when overwrite is true', async () => {
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Existing Target',
+ host: 'old.com'
+ });
+
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Existing Target',
+ host: 'new.com'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData, { overwrite: true });
+
+ expect(result.imported.targets.updated).toBe(1);
+
+ // Verify target was updated
+ const updated = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(updated.host).toBe('new.com');
+ });
+
+ it('should handle targets with same name but different ID', async () => {
+ const existingId = generateId();
+ const newId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: existingId,
+ name: 'Same Name',
+ host: 'old.com'
+ });
+
+ const importData = {
+ data: {
+ targets: [{
+ _id: newId,
+ name: 'Same Name',
+ host: 'new.com'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData, { overwrite: true });
+
+ // Should update existing target with same name
+ expect(result.imported.targets.updated).toBe(1);
+
+ const updated = await mockDB.collection('targets').findOne({ _id: existingId });
+ expect(updated.host).toBe('new.com');
+ });
+
+ it('should import incidents successfully', async () => {
+ const incidentId = generateId();
+ const importData = {
+ data: {
+ incidents: [{
+ _id: incidentId,
+ title: 'Imported Incident',
+ status: 'investigating'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('incidents');
+ expect(result.imported.incidents.imported).toBe(1);
+
+ const imported = await mockDB.collection('incidents').findOne({ _id: incidentId });
+ expect(imported).toBeTruthy();
+ expect(imported.title).toBe('Imported Incident');
+ });
+
+ it('should import posts successfully', async () => {
+ const postId = generateId();
+ const importData = {
+ data: {
+ posts: [{
+ _id: postId,
+ title: 'Imported Post',
+ content: 'Content'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('posts');
+ expect(result.imported.posts.imported).toBe(1);
+ });
+
+ it('should import pingResults successfully', async () => {
+ const pingId = generateId();
+ const targetId = generateId();
+ const importData = {
+ data: {
+ pingResults: [{
+ _id: pingId,
+ targetId: targetId,
+ success: true,
+ responseTime: 100
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('pingResults');
+ expect(result.imported.pingResults.imported).toBe(1);
+ });
+
+ it('should import statistics successfully', async () => {
+ const statId = generateId();
+ const targetId = generateId();
+ const importData = {
+ data: {
+ statistics: [{
+ _id: statId,
+ targetId: targetId,
+ date: new Date(),
+ totalPings: 100
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('statistics');
+ expect(result.imported.statistics.imported).toBe(1);
+ });
+
+ it('should import legacy ping_results format', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ ping_results: [{
+ targetId: targetId,
+ success: 1,
+ responseTime: 100,
+ timestamp: new Date()
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('ping_results');
+ expect(result.imported.ping_results.imported).toBe(1);
+ });
+
+ it('should import legacy daily_stats format', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ daily_stats: [{
+ targetId: targetId,
+ date: new Date(),
+ totalPings: 100,
+ successfulPings: 95,
+ avgResponseTime: 50
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('daily_stats');
+ expect(result.imported.daily_stats.imported).toBe(1);
+ });
+
+ it('should import settings successfully', async () => {
+ const importData = {
+ data: {
+ adminSettings: {
+ _id: 'settings',
+ sessionDurationDays: 60
+ },
+ publicUISettings: {
+ _id: 'settings',
+ title: 'New Title'
+ }
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('adminSettings');
+ expect(result.imported).toHaveProperty('publicUISettings');
+ expect(result.imported.adminSettings.imported).toBe(1);
+ expect(result.imported.publicUISettings.imported).toBe(1);
+ });
+
+ it('should update settings when overwrite is true', async () => {
+ await mockDB.collection('adminSettings').insertOne({
+ _id: 'settings',
+ sessionDurationDays: 30
+ });
+
+ const importData = {
+ data: {
+ adminSettings: {
+ _id: 'settings',
+ sessionDurationDays: 60
+ }
+ }
+ };
+
+ const result = await backupService.importData(importData, { overwrite: true });
+
+ expect(result.imported.adminSettings.updated).toBe(1);
+
+ const updated = await mockDB.collection('adminSettings').findOne({ _id: 'settings' });
+ expect(updated.sessionDurationDays).toBe(60);
+ });
+
+ it('should import favicons successfully', async () => {
+ const faviconId = generateId();
+ const importData = {
+ data: {
+ favicons: [{
+ _id: faviconId,
+ appUrl: 'https://example.com',
+ favicon: 'data:image/png;base64,...'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported).toHaveProperty('favicons');
+ expect(result.imported.favicons.imported).toBe(1);
+ });
+
+ it('should stringify object auth field when importing', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Test',
+ auth: { username: 'user', password: 'pass' }
+ }]
+ }
+ };
+
+ await backupService.importData(importData);
+
+ const imported = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(typeof imported.auth).toBe('string');
+ const parsed = JSON.parse(imported.auth);
+ expect(parsed.username).toBe('user');
+ });
+
+ it('should stringify array quickCommands when importing', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Test',
+ quickCommands: ['cmd1', 'cmd2']
+ }]
+ }
+ };
+
+ await backupService.importData(importData);
+
+ const imported = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(typeof imported.quickCommands).toBe('string');
+ const parsed = JSON.parse(imported.quickCommands);
+ expect(Array.isArray(parsed)).toBe(true);
+ expect(parsed[0]).toBe('cmd1');
+ });
+
+ it('should throw error for invalid import data format', async () => {
+ const importData = { invalid: 'format' };
+
+ await expect(backupService.importData(importData)).rejects.toThrow('Invalid import data format');
+ });
+
+ it('should handle errors gracefully and continue with other imports', async () => {
+ const targetId = generateId();
+ const importData = {
+ data: {
+ targets: [{
+ _id: targetId,
+ name: 'Valid Target'
+ }],
+ incidents: [{
+ // Missing required _id - this will cause an error when trying to insert
+ title: 'Invalid Incident'
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ // Targets should still be imported
+ expect(result.imported.targets.imported).toBe(1);
+ // Incidents import should either succeed (if _id is auto-generated) or have errors
+ // The mock will auto-generate _id, so it might succeed. Let's check that targets were imported
+ expect(result.imported.targets).toBeDefined();
+ // If incidents failed, there should be errors, otherwise it should be imported
+ if (result.errors.length > 0) {
+ expect(result.errors.some(e => e.type === 'incidents')).toBe(true);
+ } else {
+ // If no errors, incidents should have been imported (with auto-generated _id)
+ expect(result.imported.incidents).toBeDefined();
+ }
+ });
+
+ it('should skip duplicate pingResults', async () => {
+ const pingId = generateId();
+ const targetId = generateId();
+
+ await mockDB.collection('pingResults').insertOne({
+ _id: pingId,
+ targetId: targetId,
+ success: true
+ });
+
+ const importData = {
+ data: {
+ pingResults: [{
+ _id: pingId,
+ targetId: targetId,
+ success: true
+ }]
+ }
+ };
+
+ const result = await backupService.importData(importData);
+
+ expect(result.imported.pingResults.imported).toBe(0);
+ });
+
+ it('should handle round-trip export/import correctly', async () => {
+ // Create test data
+ const targetId = generateId();
+ await mockDB.collection('targets').insertOne({
+ _id: targetId,
+ name: 'Round Trip Test',
+ host: 'example.com',
+ protocol: 'HTTP',
+ port: 80,
+ auth: JSON.stringify({ username: 'user', password: 'pass' }),
+ quickCommands: JSON.stringify(['cmd1'])
+ });
+
+ // Export
+ const exported = await backupService.exportData({ monitors: true });
+
+ // Clear database
+ await mockDB.collection('targets').deleteOne({ _id: targetId });
+
+ // Import
+ const importResult = await backupService.importData(exported);
+
+ expect(importResult.imported.targets.imported).toBe(1);
+
+ // Verify data integrity
+ const imported = await mockDB.collection('targets').findOne({ _id: targetId });
+ expect(imported.name).toBe('Round Trip Test');
+ expect(imported.host).toBe('example.com');
+ // Auth should be stringified after import
+ expect(typeof imported.auth).toBe('string');
+ const parsedAuth = JSON.parse(imported.auth);
+ expect(parsedAuth.username).toBe('user');
+ });
+ });
+});
+
diff --git a/__tests__/services/monitorService.test.js b/__tests__/services/monitorService.test.js
new file mode 100644
index 0000000..9260b0e
--- /dev/null
+++ b/__tests__/services/monitorService.test.js
@@ -0,0 +1,174 @@
+jest.useFakeTimers();
+
+jest.mock('../../src/services/pingService', () => ({
+ ping: jest.fn(),
+}));
+
+jest.mock('../../src/services/notificationService', () => ({
+ getMonitorDownDelayMinutes: jest.fn().mockResolvedValue(1),
+}));
+
+jest.mock('../../src/config/prisma', () => ({
+ getPrisma: () => ({
+ adminSettings: { findUnique: jest.fn().mockResolvedValue({ debugLogging: false }) },
+ pingResult: { create: jest.fn().mockResolvedValue({}) },
+ statistic: {
+ findUnique: jest.fn().mockResolvedValue(null),
+ create: jest.fn().mockResolvedValue({}),
+ update: jest.fn().mockResolvedValue({}),
+ aggregate: jest.fn().mockResolvedValue({ _sum: { totalPings: 0, successfulPings: 0 } }),
+ },
+ alert: { create: jest.fn().mockResolvedValue({}) },
+ }),
+}));
+
+jest.mock('../../src/services/eventDetectionService', () => ({
+ evaluateRules: jest.fn().mockResolvedValue(undefined),
+}));
+
+const pingService = require('../../src/services/pingService');
+const monitorService = require('../../src/services/monitorService');
+
+const target = {
+ id: 'monitor-delay-test',
+ _id: 'monitor-delay-test',
+ name: 'Delay test',
+ host: 'example.test',
+ protocol: 'HTTPS',
+ interval: 60,
+ retries: 0,
+};
+
+function settle() {
+ return Promise.resolve().then(() => Promise.resolve());
+}
+
+describe('MonitorService sustained outage notifications', () => {
+ beforeEach(() => {
+ monitorService.stopAllMonitoring();
+ monitorService.setNotificationDelayMinutes(1);
+ monitorService.handleTargetDown = jest.fn().mockResolvedValue({});
+ monitorService.handleTargetUp = jest.fn().mockResolvedValue({});
+ pingService.ping.mockReset();
+ });
+
+ afterEach(() => {
+ monitorService.stopAllMonitoring();
+ });
+
+ it('does not notify for an outage that recovers before the delay', async () => {
+ pingService.ping.mockResolvedValueOnce({ success: false, responseTime: null })
+ .mockResolvedValueOnce({ success: true, responseTime: 12 });
+
+ await monitorService.pingTarget(target);
+ await settle();
+ jest.advanceTimersByTime(59 * 1000);
+ await monitorService.pingTarget(target);
+ jest.runOnlyPendingTimers();
+ await settle();
+
+ expect(monitorService.handleTargetDown).not.toHaveBeenCalled();
+ // Recovery is still recorded internally; only the external notification
+ // is suppressed because the outage did not reach the configured delay.
+ expect(monitorService.handleTargetUp).toHaveBeenCalledTimes(1);
+ expect(monitorService.handleTargetUp).toHaveBeenCalledWith(
+ target,
+ 12,
+ expect.any(Number),
+ false,
+ );
+ expect(monitorService.getNotificationState(target.id).notificationSent).toBe(false);
+ });
+
+ it('sends one down notification after the configured delay and then one recovery notification', async () => {
+ pingService.ping.mockResolvedValueOnce({ success: false, responseTime: null })
+ .mockResolvedValueOnce({ success: true, responseTime: 18 });
+
+ await monitorService.pingTarget(target);
+ await settle();
+ expect(monitorService.handleTargetDown).not.toHaveBeenCalled();
+
+ jest.advanceTimersByTime(60 * 1000);
+ await settle();
+ expect(monitorService.handleTargetDown).toHaveBeenCalledTimes(1);
+
+ await monitorService.pingTarget(target);
+ jest.runOnlyPendingTimers();
+ await settle();
+ expect(monitorService.handleTargetUp).toHaveBeenCalledTimes(1);
+ expect(monitorService.handleTargetUp).toHaveBeenCalledWith(
+ target,
+ 18,
+ expect.any(Number),
+ true,
+ );
+ });
+
+ it('uses the in-memory delay when the settings lookup fails', async () => {
+ const notificationService = require('../../src/services/notificationService');
+ notificationService.getMonitorDownDelayMinutes.mockRejectedValueOnce(new Error('database unavailable'));
+ monitorService.setNotificationDelayMinutes(1);
+ pingService.ping.mockResolvedValueOnce({ success: false, responseTime: null });
+
+ await monitorService.pingTarget(target);
+ await settle();
+ jest.advanceTimersByTime(60 * 1000);
+ await settle();
+
+ expect(monitorService.handleTargetDown).toHaveBeenCalledTimes(1);
+ });
+
+ it('reschedules an active outage when the global delay changes', async () => {
+ const notificationService = require('../../src/services/notificationService');
+ notificationService.getMonitorDownDelayMinutes.mockResolvedValue(1);
+ monitorService.setNotificationDelayMinutes(5);
+ pingService.ping.mockResolvedValueOnce({ success: false, responseTime: null });
+
+ monitorService.startTargetMonitor({ ...target, interval: 3600 });
+ await monitorService.pingTarget(target, monitorService.monitorGeneration.get(target.id));
+ await settle();
+
+ jest.advanceTimersByTime(30 * 1000);
+ monitorService.setNotificationDelayMinutes(1);
+ await settle();
+ jest.advanceTimersByTime(30 * 1000);
+ await settle();
+
+ expect(monitorService.handleTargetDown).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not let an older settings lookup replace a newer delay', async () => {
+ const notificationService = require('../../src/services/notificationService');
+ let resolveDelay;
+ notificationService.getMonitorDownDelayMinutes.mockReturnValueOnce(new Promise(resolve => {
+ resolveDelay = resolve;
+ }));
+ monitorService.setNotificationDelayMinutes(5);
+ pingService.ping.mockResolvedValueOnce({ success: false, responseTime: null });
+
+ await monitorService.pingTarget(target);
+ await settle();
+ monitorService.setNotificationDelayMinutes(1);
+ resolveDelay(5);
+ await settle();
+
+ expect(monitorService.notificationDelayMinutes).toBe(1);
+ });
+
+ it('ignores a ping result from a monitor generation that was restarted', async () => {
+ let resolvePing;
+ pingService.ping.mockReturnValueOnce(new Promise(resolve => { resolvePing = resolve; }));
+
+ monitorService.startTargetMonitor(target);
+ const oldGeneration = monitorService.monitorGeneration.get(target.id);
+ const oldPing = monitorService.pingTarget(target, oldGeneration);
+ monitorService.startTargetMonitor(target);
+
+ resolvePing({ success: false, responseTime: null });
+ await oldPing;
+ await settle();
+
+ expect(monitorService.getTargetStatus(target.id)).toBe('unknown');
+ expect(monitorService.getNotificationState(target.id).downSince).toBeNull();
+ });
+});
diff --git a/__tests__/services/pingService.test.js b/__tests__/services/pingService.test.js
new file mode 100644
index 0000000..2b4d7f2
--- /dev/null
+++ b/__tests__/services/pingService.test.js
@@ -0,0 +1,230 @@
+const pingService = require('../../src/services/pingService');
+const axios = require('axios');
+const tcpPing = require('tcp-ping');
+
+jest.mock('axios');
+jest.mock('tcp-ping');
+jest.mock('child_process');
+
+describe('PingService', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ describe('ping method - protocol validation', () => {
+ it('should return error for unknown protocol', async () => {
+ const target = {
+ host: 'example.com',
+ protocol: 'UNKNOWN',
+ port: 80,
+ };
+
+ const result = await pingService.ping(target);
+
+ expect(result.success).toBe(false);
+ expect(result.error).toContain('Unknown protocol');
+ });
+
+ it('should handle case-insensitive protocol', async () => {
+ const target = {
+ host: 'example.com',
+ protocol: 'tcp',
+ port: 80,
+ };
+
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(null, true);
+ });
+
+ const result = await pingService.ping(target);
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('TCP');
+ });
+ });
+
+ describe('pingTCP method', () => {
+ it('should successfully ping TCP host', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(null, true);
+ });
+
+ const result = await pingService.pingTCP('example.com', 80, Date.now());
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('TCP');
+ expect(result.responseTime).toBeGreaterThanOrEqual(0);
+ });
+
+ it('should handle TCP connection failure', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(new Error('Connection refused'), false);
+ });
+
+ const result = await pingService.pingTCP('example.com', 80, Date.now());
+
+ expect(result.success).toBe(false);
+ expect(result.error).toContain('Connection refused');
+ expect(result.protocol).toBe('TCP');
+ });
+
+ it('should use default port 80 for TCP', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(null, true);
+ });
+
+ const result = await pingService.pingTCP('example.com', 80, Date.now());
+
+ expect(tcpPing.probe).toHaveBeenCalledWith('example.com', 80, expect.any(Function));
+ });
+ });
+
+ describe('pingUDP method', () => {
+ it('should successfully send UDP ping', async () => {
+ const result = await pingService.pingUDP('example.com', 53, Date.now());
+
+ // UDP is expected to timeout or fail without a listening server
+ expect(result.protocol).toBe('UDP');
+ expect(result.responseTime).toBeGreaterThanOrEqual(0);
+ });
+
+ it('should handle UDP timeout', async () => {
+ const result = await pingService.pingUDP('example.com', 53, Date.now());
+
+ // Without a real server, UDP will timeout
+ expect(result).toHaveProperty('responseTime');
+ expect(result).toHaveProperty('protocol', 'UDP');
+ });
+
+ it('should use default port 53 for UDP', async () => {
+ const result = await pingService.pingUDP('example.com', 53, Date.now());
+
+ expect(result).toHaveProperty('protocol', 'UDP');
+ });
+ });
+
+ describe('pingHTTP method', () => {
+ it('should successfully ping HTTP endpoint', async () => {
+ axios.mockResolvedValue({ status: 200 });
+
+ const result = await pingService.pingHTTP('http://example.com/', Date.now());
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('HTTP');
+ expect(result.responseTime).toBeGreaterThanOrEqual(0);
+ });
+
+ it('should handle HTTP timeout', async () => {
+ axios.mockRejectedValue(new Error('Request timeout'));
+
+ const result = await pingService.pingHTTP('http://example.com/', Date.now());
+
+ expect(result.success).toBe(false);
+ expect(result.error).toContain('Request timeout');
+ });
+
+ it('should use port 443 for HTTPS by default', async () => {
+ axios.mockResolvedValue({ status: 200 });
+
+ const result = await pingService.pingHTTP('https://example.com/', Date.now());
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('HTTPS');
+ });
+
+ it('should use custom port in HTTP URL', async () => {
+ axios.mockResolvedValue({ status: 200 });
+
+ const result = await pingService.pingHTTP('http://example.com:8080/', Date.now());
+
+ expect(result.success).toBe(true);
+ });
+ });
+
+ describe('ping routing', () => {
+ it('should route TCP protocol correctly', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(null, true);
+ });
+
+ const target = {
+ host: 'example.com',
+ protocol: 'TCP',
+ port: 80,
+ };
+
+ const result = await pingService.ping(target);
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('TCP');
+ });
+
+ it('should route HTTP protocol correctly', async () => {
+ axios.mockResolvedValue({ status: 200 });
+
+ const target = {
+ host: 'example.com',
+ protocol: 'HTTP',
+ port: 80,
+ path: '/',
+ };
+
+ const result = await pingService.ping(target);
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('HTTP');
+ });
+
+ it('should route HTTPS protocol correctly', async () => {
+ axios.mockResolvedValue({ status: 200 });
+
+ const target = {
+ host: 'example.com',
+ protocol: 'HTTPS',
+ port: 443,
+ path: '/',
+ };
+
+ const result = await pingService.ping(target);
+
+ expect(result.success).toBe(true);
+ expect(result.protocol).toBe('HTTPS');
+ });
+ });
+
+ describe('response structure', () => {
+ it('should always include success, responseTime, and protocol', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(null, true);
+ });
+
+ const result = await pingService.pingTCP('example.com', 80, Date.now());
+
+ expect(result).toHaveProperty('success');
+ expect(result).toHaveProperty('responseTime');
+ expect(result).toHaveProperty('protocol');
+ });
+
+ it('should include error message when ping fails', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ callback(new Error('Network error'), false);
+ });
+
+ const result = await pingService.pingTCP('example.com', 80, Date.now());
+
+ expect(result).toHaveProperty('error');
+ expect(typeof result.error).toBe('string');
+ });
+
+ it('should measure response time accurately', async () => {
+ tcpPing.probe.mockImplementation((host, port, callback) => {
+ setTimeout(() => callback(null, true), 10);
+ });
+
+ const startTime = Date.now();
+ const result = await pingService.pingTCP('example.com', 80, startTime);
+
+ expect(result.responseTime).toBeGreaterThanOrEqual(10);
+ });
+ });
+});
diff --git a/ecosystem.config.js b/ecosystem.config.js
new file mode 100644
index 0000000..6494683
--- /dev/null
+++ b/ecosystem.config.js
@@ -0,0 +1,31 @@
+module.exports = {
+ apps: [
+ {
+ name: 'localping',
+ script: './src/app.js',
+ args: '--mode all',
+ instances: 1,
+ exec_mode: 'fork',
+ env: {
+ NODE_ENV: 'production',
+ API_PORT: 8000,
+ ADMIN_PORT: 8000,
+ PUBLIC_PORT: 8000,
+ },
+ error_file: './logs/error.log',
+ out_file: './logs/out.log',
+ log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
+ merge_logs: true,
+ autorestart: true,
+ ignore_watch: [
+ 'logs',
+ 'node_modules',
+ 'data',
+ 'prisma',
+ 'scripts',
+ '.git',
+ ],
+ max_memory_restart: '512M',
+ },
+ ],
+};
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..97e8d3c
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,420 @@
+#!/bin/bash
+
+set -e
+
+echo "π LocalPing Installation Script"
+echo "=================================="
+
+# Check for the privileges required to install packages and manage systemd.
+if [[ $EUID -ne 0 ]]; then
+ echo "β This script must be run as root"
+ exit 1
+fi
+
+# Parse arguments
+REPO_URL="${1:-https://github.com/YOUR-ORG/localping.git}"
+BRANCH="${2:-main}"
+INSTALL_DIR="${3:-/opt/localping}"
+SKIP_UPDATE="${4:-false}"
+
+echo "π Installation Configuration:"
+echo " Repository: $REPO_URL"
+echo " Branch: $BRANCH"
+echo " Install Path: $INSTALL_DIR"
+echo ""
+
+# Detect if already installed
+IS_UPDATE=false
+if [ -d "$INSTALL_DIR" ]; then
+ if [ -f "$INSTALL_DIR/.env" ] && [ -f "$INSTALL_DIR/package.json" ]; then
+ echo "β Existing LocalPing installation detected at $INSTALL_DIR"
+ echo ""
+ echo "What will be updated:"
+ echo " β’ Source code (latest version from $BRANCH branch)"
+ echo " β’ Dependencies (npm packages)"
+ echo " β’ Systemd service configuration"
+ echo ""
+ echo "What will be preserved:"
+ echo " β’ PostgreSQL database"
+ echo " β’ Configuration (.env file)"
+ echo " β’ Admin credentials"
+ echo ""
+
+ # Only ask for confirmation if running in interactive terminal and not skipping confirmation
+ if [ "$SKIP_UPDATE" != "true" ] && [ -t 0 ]; then
+ read -p "Continue with update? (y/n) " -n 1 -r
+ echo
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+ echo "β Update cancelled."
+ exit 0
+ fi
+ fi
+ IS_UPDATE=true
+ else
+ echo "β οΈ Directory exists at $INSTALL_DIR but is not a valid LocalPing installation"
+ echo "β Please remove the directory or use a different path"
+ exit 1
+ fi
+fi
+
+echo "π¦ Installing system dependencies..."
+apt-get update -qq 2>/dev/null || apt-get update
+
+# Install minimal dependencies
+apt-get install -y -qq \
+ curl \
+ git \
+ build-essential \
+ python3 \
+ libnotify-bin \
+ 2>/dev/null || apt-get install -y \
+ curl \
+ git \
+ build-essential \
+ python3 \
+ libnotify-bin
+
+# Install Node.js if not present
+if ! command -v node &> /dev/null; then
+ echo "π¦ Installing Node.js v20..."
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - 2>/dev/null
+ apt-get install -y -qq nodejs 2>/dev/null || apt-get install -y nodejs
+fi
+
+# Install git if not present (shouldn't happen but just in case)
+if ! command -v git &> /dev/null; then
+ echo "π¦ Installing git..."
+ apt-get install -y -qq git 2>/dev/null || apt-get install -y git
+fi
+
+echo "β
System dependencies installed"
+
+# Clone or update repository
+if [ "$IS_UPDATE" = false ]; then
+ echo "π₯ Cloning LocalPing repository..."
+ mkdir -p "$(dirname "$INSTALL_DIR")"
+ git clone --branch "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
+else
+ echo "π Updating LocalPing repository..."
+ cd "$INSTALL_DIR"
+ # Fetch the requested branch and make the working tree exactly match it.
+ # `checkout -B` only changes tracked files, so the installation's .env,
+ # data, and logs remain untouched.
+ git fetch --prune origin "$BRANCH"
+ git checkout -B "$BRANCH" "origin/$BRANCH"
+fi
+
+cd "$INSTALL_DIR"
+
+# Validate required files exist
+if [ ! -f ".env.example" ]; then
+ echo "β .env.example not found at $INSTALL_DIR"
+ echo "The repository may be corrupted. Please try again."
+ exit 1
+fi
+
+echo "π₯ Installing npm dependencies..."
+npm install --silent 2>/dev/null || npm install
+
+echo "π Creating data directory..."
+mkdir -p "$INSTALL_DIR/data"
+
+echo "ποΈ Setting up PostgreSQL..."
+# Install PostgreSQL if not present
+if ! command -v psql &> /dev/null; then
+ echo "π¦ Installing PostgreSQL..."
+ apt-get install -y -qq postgresql postgresql-contrib 2>/dev/null || apt-get install -y postgresql postgresql-contrib
+ systemctl enable postgresql
+ systemctl start postgresql
+ echo "β
PostgreSQL installed"
+else
+ echo "β PostgreSQL already installed"
+ # Ensure PostgreSQL is running
+ systemctl start postgresql 2>/dev/null || true
+fi
+
+# Wait for PostgreSQL to be ready
+sleep 2
+
+# Reuse database settings from an existing installation. This prevents an
+# update from generating a new password that does not match the existing
+# PostgreSQL role.
+EXISTING_DATABASE_URL=""
+if [ -f ".env" ]; then
+ # .env is the installation's own configuration file and is needed here so
+ # Prisma and the service use the same credentials as the database setup.
+ set -a
+ # shellcheck disable=SC1091
+ . ./.env
+ set +a
+ EXISTING_DATABASE_URL="${DATABASE_URL:-}"
+fi
+
+DB_HOST="${DB_HOST:-localhost}"
+DB_PORT="${DB_PORT:-5432}"
+DB_NAME="${DB_NAME:-localping}"
+DB_USER="${DB_USER:-localping}"
+GENERATED_DB_PASSWORD=false
+if [ -z "${DB_PASSWORD:-}" ]; then
+ DB_PASSWORD=$(openssl rand -base64 24 | tr -d "=+/" | cut -c1-24)
+ GENERATED_DB_PASSWORD=true
+fi
+
+case "$DB_NAME" in
+ ""|*[!A-Za-z0-9_]* ) echo "β DB_NAME may only contain letters, numbers, and underscores"; exit 1 ;;
+esac
+case "$DB_USER" in
+ ""|*[!A-Za-z0-9_]* ) echo "β DB_USER may only contain letters, numbers, and underscores"; exit 1 ;;
+esac
+
+run_as_postgres() {
+ if ! command -v runuser >/dev/null 2>&1; then
+ echo "β runuser is required to configure PostgreSQL as the postgres user"
+ exit 1
+ fi
+ runuser -u postgres -- "$@"
+}
+
+# Create database and user if they don't exist
+echo "π§ Configuring PostgreSQL database..."
+if ! run_as_postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'" | grep -q '^1$'; then
+ run_as_postgres psql -v ON_ERROR_STOP=1 -v db_password="$DB_PASSWORD" -c "CREATE USER \"$DB_USER\" WITH PASSWORD :'db_password';"
+elif [ "$GENERATED_DB_PASSWORD" = true ] && [ -z "$EXISTING_DATABASE_URL" ]; then
+ # A partially completed installation may have a role but no saved
+ # connection URL. Make the generated credentials usable before saving them.
+ run_as_postgres psql -v ON_ERROR_STOP=1 -v db_password="$DB_PASSWORD" -c "ALTER ROLE \"$DB_USER\" WITH PASSWORD :'db_password';"
+fi
+
+if ! run_as_postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='$DB_NAME'" | grep -q '^1$'; then
+ run_as_postgres psql -v ON_ERROR_STOP=1 -c "CREATE DATABASE \"$DB_NAME\" OWNER \"$DB_USER\";"
+fi
+run_as_postgres psql -v ON_ERROR_STOP=1 -c "GRANT ALL PRIVILEGES ON DATABASE \"$DB_NAME\" TO \"$DB_USER\";"
+
+# Configure PostgreSQL for local-only access (security)
+PG_MAJOR_VERSION=$(run_as_postgres psql -tAc "SHOW server_version;" | xargs | cut -d. -f1)
+PG_HBA_FILE="/etc/postgresql/$PG_MAJOR_VERSION/main/pg_hba.conf"
+
+if [ -f "$PG_HBA_FILE" ]; then
+ # Ensure local connections use md5 (password) authentication
+ if ! grep -q "^local.*$DB_NAME.*$DB_USER.*md5" "$PG_HBA_FILE"; then
+ # Add local connection rule if it doesn't exist
+ printf 'local %s %s md5\n' "$DB_NAME" "$DB_USER" >> "$PG_HBA_FILE"
+ fi
+ # Ensure host connections are restricted to localhost only
+ if ! grep -q "^host.*$DB_NAME.*$DB_USER.*127.0.0.1/32.*md5" "$PG_HBA_FILE"; then
+ printf 'host %s %s 127.0.0.1/32 md5\n' "$DB_NAME" "$DB_USER" >> "$PG_HBA_FILE"
+ fi
+ # Reload PostgreSQL configuration
+ systemctl reload postgresql 2>/dev/null || run_as_postgres pg_ctl reload -D "/var/lib/postgresql/$PG_MAJOR_VERSION/main" 2>/dev/null || true
+fi
+
+echo "β
PostgreSQL database configured"
+
+echo "π§ Setting up environment file..."
+if [ ! -f ".env" ]; then
+ # Generate secure random strings
+ SESSION_SECRET=$(openssl rand -base64 32)
+ ADMIN_API_KEY=$(openssl rand -hex 16)
+
+ cat > .env << EOF
+# Server Configuration
+API_PORT=8000
+NODE_ENV=production
+SESSION_SECRET=$SESSION_SECRET
+
+# Database Configuration
+DB_HOST=localhost
+DB_PORT=5432
+DB_NAME=$DB_NAME
+DB_USER=$DB_USER
+DB_PASSWORD=$DB_PASSWORD
+DATABASE_URL=postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME
+
+# Notification Settings
+NOTIFICATION_ENABLED=true
+NOTIFICATION_METHOD=dbus
+
+# Monitoring
+PING_INTERVAL=60
+ALERT_COOLDOWN=300
+
+# API Authentication
+ADMIN_API_KEY=$ADMIN_API_KEY
+
+# Admin Credentials (set during first-time setup)
+# ADMIN_PASSWORD=
+# ADMIN_USERNAME=
+EOF
+ echo "β
.env file created with secure values"
+else
+ if [ "$IS_UPDATE" = true ]; then
+ echo "β Preserving existing .env file"
+ # Add database settings required by Prisma to older installations
+ # without replacing any existing application configuration.
+ if ! grep -q "^DB_HOST=" .env; then
+ {
+ echo ""
+ echo "# Database Configuration"
+ echo "DB_HOST=$DB_HOST"
+ echo "DB_PORT=$DB_PORT"
+ echo "DB_NAME=$DB_NAME"
+ echo "DB_USER=$DB_USER"
+ echo "DB_PASSWORD=$DB_PASSWORD"
+ } >> .env
+ echo "β
Added database configuration to .env"
+ else
+ grep -q "^DB_PORT=" .env || echo "DB_PORT=$DB_PORT" >> .env
+ grep -q "^DB_NAME=" .env || echo "DB_NAME=$DB_NAME" >> .env
+ grep -q "^DB_USER=" .env || echo "DB_USER=$DB_USER" >> .env
+ grep -q "^DB_PASSWORD=" .env || echo "DB_PASSWORD=$DB_PASSWORD" >> .env
+ fi
+ if [ -z "$EXISTING_DATABASE_URL" ] && ! grep -q "^DATABASE_URL=" .env; then
+ echo "DATABASE_URL=postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME" >> .env
+ echo "β
Added DATABASE_URL for Prisma to .env"
+ fi
+ else
+ echo "β οΈ .env already exists, skipping creation"
+ fi
+fi
+
+echo "π Syncing database schema with Prisma..."
+npx prisma generate
+npx prisma db push --skip-generate
+
+echo "π Setting ICMP capabilities for Node.js..."
+NODE_PATH=$(which node)
+setcap cap_net_raw=ep "$NODE_PATH" 2>/dev/null || true
+
+# Run the service as the invoking user when available; root is the fallback.
+SERVICE_USER="${SUDO_USER:-root}"
+SERVICE_NAME="localping"
+
+echo "π οΈ Creating systemd service..."
+
+# Get Node.js path
+NODE_BIN=$(which node)
+
+# Create systemd service file to run Node.js directly (production-optimized)
+cat > "/etc/systemd/system/${SERVICE_NAME}.service" << SYSTEMD_EOF
+[Unit]
+Description=LocalPing - System Uptime Monitor
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=$SERVICE_USER
+WorkingDirectory=$INSTALL_DIR
+Environment="PATH=/usr/local/bin:/usr/bin:/bin"
+Environment="NODE_ENV=production"
+EnvironmentFile=-$INSTALL_DIR/.env
+
+# Start Node.js app directly
+ExecStart=$NODE_BIN $INSTALL_DIR/src/app.js
+
+# Restart automatically on failure
+Restart=on-failure
+RestartSec=10
+
+# Grant ICMP permissions for ping functionality
+AmbientCapabilities=CAP_NET_RAW
+CapabilityBoundingSet=CAP_NET_RAW
+
+# Security settings
+ProtectHome=true
+NoNewPrivileges=true
+PrivateDevices=yes
+ProtectKernelTunables=yes
+ProtectKernelModules=yes
+ProtectControlGroups=yes
+
+# Process management
+StandardOutput=journal
+StandardError=journal
+SyslogIdentifier=$SERVICE_NAME
+
+[Install]
+WantedBy=multi-user.target
+SYSTEMD_EOF
+
+# Set permissions
+chown root:root "/etc/systemd/system/${SERVICE_NAME}.service"
+chmod 644 "/etc/systemd/system/${SERVICE_NAME}.service"
+
+# Reload systemd
+systemctl daemon-reload
+
+# Enable and start/restart the service
+echo "π Starting LocalPing service..."
+systemctl enable "$SERVICE_NAME"
+systemctl restart "$SERVICE_NAME"
+
+# Wait for service to start
+sleep 3
+
+if ! systemctl is-active --quiet "$SERVICE_NAME"; then
+ echo "β LocalPing failed to start after the update"
+ systemctl status "$SERVICE_NAME" --no-pager 2>&1 | head -n 40 || true
+ exit 1
+fi
+
+echo "β
Systemd service configured"
+echo ""
+
+# Show status
+echo "π Service Status:"
+systemctl status "$SERVICE_NAME" --no-pager 2>&1 | head -n 20 || true
+
+echo ""
+if [ "$IS_UPDATE" = true ]; then
+ echo "β
Update complete!"
+ echo ""
+ echo "What was updated:"
+ echo " β Source code to latest version"
+ echo " β Dependencies (npm packages)"
+ echo " β Systemd service configuration"
+ echo ""
+ echo "What was preserved:"
+ echo " β PostgreSQL database"
+ echo " β Configuration (.env file)"
+ echo " β Admin credentials and monitors"
+else
+ echo "β
Installation complete!"
+ echo ""
+fi
+
+# Get the IPv4 address
+IP_ADDR=$(hostname -I | awk '{print $1}')
+if [ -z "$IP_ADDR" ]; then
+ IP_ADDR="localhost"
+fi
+
+echo "π Access LocalPing:"
+echo " Public Page: http://$IP_ADDR:8000"
+echo " API: http://$IP_ADDR:8000/api"
+echo ""
+
+if [ "$IS_UPDATE" = false ]; then
+ echo "π§ First Time Setup:"
+ echo " 1. Visit http://$IP_ADDR:8000/setup to complete configuration"
+ echo " 2. Create admin credentials and configure gateway IP"
+ echo " 3. You'll be redirected to login at http://$IP_ADDR:8000/admin/login"
+ echo " 4. Login to access the admin panel"
+ echo ""
+else
+ echo "π Service has been restarted with the latest code"
+ echo " Login at http://$IP_ADDR:8000/admin/login"
+ echo ""
+fi
+echo ""
+echo "π Useful Commands:"
+echo " View logs: journalctl -u $SERVICE_NAME -f"
+echo " Service status: systemctl status $SERVICE_NAME"
+echo " Start service: systemctl start $SERVICE_NAME"
+echo " Stop service: systemctl stop $SERVICE_NAME"
+echo " Restart service: systemctl restart $SERVICE_NAME"
+echo " Install directory: $INSTALL_DIR"
+echo ""
+echo "βΉοΈ The service will auto-start on system boot."
+echo "βΉοΈ Environment file located at: $INSTALL_DIR/.env"
+echo ""
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 0000000..c55ef77
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,19 @@
+module.exports = {
+ testEnvironment: 'node',
+ testMatch: ['**/__tests__/**/*.test.js', '**/*.test.js'],
+ collectCoverageFrom: [
+ 'src/**/*.js',
+ '!src/app.js',
+ '!src/cli/**',
+ '!src/electron/**',
+ '!src/public/**',
+ ],
+ coveragePathIgnorePatterns: [
+ '/node_modules/',
+ '/tests/',
+ ],
+ transformIgnorePatterns: [
+ 'node_modules/(?!(default-gateway)/)',
+ ],
+ testTimeout: 10000,
+};
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..6197793
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,9090 @@
+{
+ "name": "localping",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "localping",
+ "version": "0.1.0",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "@prisma/client": "^6.8.2",
+ "axios": "^1.13.2",
+ "better-sqlite3": "^12.4.5",
+ "chalk": "^5.6.2",
+ "cors": "^2.8.5",
+ "default-gateway": "^7.2.2",
+ "dotenv": "^17.2.3",
+ "ejs": "^3.1.10",
+ "electron-is-dev": "^3.0.1",
+ "express": "^5.1.0",
+ "express-session": "^1.17.3",
+ "express-ws": "^5.0.2",
+ "inquirer": "^13.0.1",
+ "isomorphic-form-data": "^2.0.0",
+ "nodemon": "^3.1.11",
+ "pg": "^8.13.1",
+ "pm2": "^6.0.13",
+ "shell-escape": "^0.2.0",
+ "tcp-ping": "^0.1.1",
+ "uuid": "^13.0.0",
+ "yargs": "^18.0.0"
+ },
+ "devDependencies": {
+ "@babel/preset-env": "^7.28.5",
+ "@babel/preset-typescript": "^7.28.5",
+ "jest": "^29.7.0",
+ "prisma": "^6.8.2"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.27.1",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.27.1",
+ "@babel/generator": "^7.28.5",
+ "@babel/helper-compilation-targets": "^7.27.2",
+ "@babel/helper-module-transforms": "^7.28.3",
+ "@babel/helpers": "^7.28.4",
+ "@babel/parser": "^7.28.5",
+ "@babel/template": "^7.27.2",
+ "@babel/traverse": "^7.28.5",
+ "@babel/types": "^7.28.5",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/core/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.28.5",
+ "@babel/types": "^7.28.5",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-annotate-as-pure": {
+ "version": "7.27.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.27.3"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.27.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.27.2",
+ "@babel/helper-validator-option": "^7.27.1",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": {
+ "version": "5.1.1",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets/node_modules/yallist": {
+ "version": "3.1.1",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/@babel/helper-create-class-features-plugin": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.3",
+ "@babel/helper-member-expression-to-functions": "^7.28.5",
+ "@babel/helper-optimise-call-expression": "^7.27.1",
+ "@babel/helper-replace-supers": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1",
+ "@babel/traverse": "^7.28.5",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/helper-create-regexp-features-plugin": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.3",
+ "regexpu-core": "^6.3.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-create-regexp-features-plugin/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/helper-define-polyfill-provider": {
+ "version": "0.6.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-compilation-targets": "^7.27.2",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "debug": "^4.4.1",
+ "lodash.debounce": "^4.0.8",
+ "resolve": "^1.22.10"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.28.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-member-expression-to-functions": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.28.5",
+ "@babel/types": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.27.1",
+ "@babel/types": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.28.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.27.1",
+ "@babel/traverse": "^7.28.3"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-optimise-call-expression": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-plugin-utils": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-remap-async-to-generator": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.1",
+ "@babel/helper-wrap-function": "^7.27.1",
+ "@babel/traverse": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-replace-supers": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-member-expression-to-functions": "^7.27.1",
+ "@babel/helper-optimise-call-expression": "^7.27.1",
+ "@babel/traverse": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-skip-transparent-expression-wrappers": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.27.1",
+ "@babel/types": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-wrap-function": {
+ "version": "7.28.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.27.2",
+ "@babel/traverse": "^7.28.3",
+ "@babel/types": "^7.28.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.28.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.27.2",
+ "@babel/types": "^7.28.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.28.5"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/traverse": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1",
+ "@babel/plugin-transform-optional-chaining": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.13.0"
+ }
+ },
+ "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": {
+ "version": "7.28.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/traverse": "^7.28.3"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-proposal-private-property-in-object": {
+ "version": "7.21.0-placeholder-for-preset-env.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-async-generators": {
+ "version": "7.8.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-bigint": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-class-properties": {
+ "version": "7.12.13",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.12.13"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-class-static-block": {
+ "version": "7.14.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.14.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-import-assertions": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-import-attributes": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-import-meta": {
+ "version": "7.10.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-json-strings": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-jsx": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-logical-assignment-operators": {
+ "version": "7.10.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-numeric-separator": {
+ "version": "7.10.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.10.4"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-object-rest-spread": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-optional-catch-binding": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-optional-chaining": {
+ "version": "7.8.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.8.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-private-property-in-object": {
+ "version": "7.14.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.14.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-top-level-await": {
+ "version": "7.14.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.14.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-typescript": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-syntax-unicode-sets-regex": {
+ "version": "7.18.6",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.18.6",
+ "@babel/helper-plugin-utils": "^7.18.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-arrow-functions": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-async-generator-functions": {
+ "version": "7.28.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-remap-async-to-generator": "^7.27.1",
+ "@babel/traverse": "^7.28.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-async-to-generator": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-remap-async-to-generator": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-block-scoped-functions": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-block-scoping": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-class-properties": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-class-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-class-static-block": {
+ "version": "7.28.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-class-features-plugin": "^7.28.3",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.12.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-classes": {
+ "version": "7.28.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.3",
+ "@babel/helper-compilation-targets": "^7.27.2",
+ "@babel/helper-globals": "^7.28.0",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-replace-supers": "^7.27.1",
+ "@babel/traverse": "^7.28.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-computed-properties": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/template": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-destructuring": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/traverse": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-dotall-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-duplicate-keys": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-dynamic-import": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-explicit-resource-management": {
+ "version": "7.28.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/plugin-transform-destructuring": "^7.28.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-exponentiation-operator": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-export-namespace-from": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-for-of": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-function-name": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-compilation-targets": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/traverse": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-json-strings": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-literals": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-logical-assignment-operators": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-member-expression-literals": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-modules-amd": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-transforms": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-modules-commonjs": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-transforms": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-modules-systemjs": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-transforms": "^7.28.3",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.28.5",
+ "@babel/traverse": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-modules-umd": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-transforms": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-named-capturing-groups-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-new-target": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-nullish-coalescing-operator": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-numeric-separator": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-object-rest-spread": {
+ "version": "7.28.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-compilation-targets": "^7.27.2",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/plugin-transform-destructuring": "^7.28.0",
+ "@babel/plugin-transform-parameters": "^7.27.7",
+ "@babel/traverse": "^7.28.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-object-super": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-replace-supers": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-optional-catch-binding": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-optional-chaining": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-parameters": {
+ "version": "7.27.7",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-private-methods": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-class-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-private-property-in-object": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.1",
+ "@babel/helper-create-class-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-property-literals": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-regenerator": {
+ "version": "7.28.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-regexp-modifiers": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-reserved-words": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-shorthand-properties": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-spread": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-sticky-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-template-literals": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-typeof-symbol": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-typescript": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-annotate-as-pure": "^7.27.3",
+ "@babel/helper-create-class-features-plugin": "^7.28.5",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1",
+ "@babel/plugin-syntax-typescript": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-unicode-escapes": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-unicode-property-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-unicode-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-unicode-sets-regex": {
+ "version": "7.27.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-create-regexp-features-plugin": "^7.27.1",
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/preset-env": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.28.5",
+ "@babel/helper-compilation-targets": "^7.27.2",
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-validator-option": "^7.27.1",
+ "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.28.5",
+ "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.27.1",
+ "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.27.1",
+ "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.27.1",
+ "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.28.3",
+ "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2",
+ "@babel/plugin-syntax-import-assertions": "^7.27.1",
+ "@babel/plugin-syntax-import-attributes": "^7.27.1",
+ "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
+ "@babel/plugin-transform-arrow-functions": "^7.27.1",
+ "@babel/plugin-transform-async-generator-functions": "^7.28.0",
+ "@babel/plugin-transform-async-to-generator": "^7.27.1",
+ "@babel/plugin-transform-block-scoped-functions": "^7.27.1",
+ "@babel/plugin-transform-block-scoping": "^7.28.5",
+ "@babel/plugin-transform-class-properties": "^7.27.1",
+ "@babel/plugin-transform-class-static-block": "^7.28.3",
+ "@babel/plugin-transform-classes": "^7.28.4",
+ "@babel/plugin-transform-computed-properties": "^7.27.1",
+ "@babel/plugin-transform-destructuring": "^7.28.5",
+ "@babel/plugin-transform-dotall-regex": "^7.27.1",
+ "@babel/plugin-transform-duplicate-keys": "^7.27.1",
+ "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.27.1",
+ "@babel/plugin-transform-dynamic-import": "^7.27.1",
+ "@babel/plugin-transform-explicit-resource-management": "^7.28.0",
+ "@babel/plugin-transform-exponentiation-operator": "^7.28.5",
+ "@babel/plugin-transform-export-namespace-from": "^7.27.1",
+ "@babel/plugin-transform-for-of": "^7.27.1",
+ "@babel/plugin-transform-function-name": "^7.27.1",
+ "@babel/plugin-transform-json-strings": "^7.27.1",
+ "@babel/plugin-transform-literals": "^7.27.1",
+ "@babel/plugin-transform-logical-assignment-operators": "^7.28.5",
+ "@babel/plugin-transform-member-expression-literals": "^7.27.1",
+ "@babel/plugin-transform-modules-amd": "^7.27.1",
+ "@babel/plugin-transform-modules-commonjs": "^7.27.1",
+ "@babel/plugin-transform-modules-systemjs": "^7.28.5",
+ "@babel/plugin-transform-modules-umd": "^7.27.1",
+ "@babel/plugin-transform-named-capturing-groups-regex": "^7.27.1",
+ "@babel/plugin-transform-new-target": "^7.27.1",
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1",
+ "@babel/plugin-transform-numeric-separator": "^7.27.1",
+ "@babel/plugin-transform-object-rest-spread": "^7.28.4",
+ "@babel/plugin-transform-object-super": "^7.27.1",
+ "@babel/plugin-transform-optional-catch-binding": "^7.27.1",
+ "@babel/plugin-transform-optional-chaining": "^7.28.5",
+ "@babel/plugin-transform-parameters": "^7.27.7",
+ "@babel/plugin-transform-private-methods": "^7.27.1",
+ "@babel/plugin-transform-private-property-in-object": "^7.27.1",
+ "@babel/plugin-transform-property-literals": "^7.27.1",
+ "@babel/plugin-transform-regenerator": "^7.28.4",
+ "@babel/plugin-transform-regexp-modifiers": "^7.27.1",
+ "@babel/plugin-transform-reserved-words": "^7.27.1",
+ "@babel/plugin-transform-shorthand-properties": "^7.27.1",
+ "@babel/plugin-transform-spread": "^7.27.1",
+ "@babel/plugin-transform-sticky-regex": "^7.27.1",
+ "@babel/plugin-transform-template-literals": "^7.27.1",
+ "@babel/plugin-transform-typeof-symbol": "^7.27.1",
+ "@babel/plugin-transform-unicode-escapes": "^7.27.1",
+ "@babel/plugin-transform-unicode-property-regex": "^7.27.1",
+ "@babel/plugin-transform-unicode-regex": "^7.27.1",
+ "@babel/plugin-transform-unicode-sets-regex": "^7.27.1",
+ "@babel/preset-modules": "0.1.6-no-external-plugins",
+ "babel-plugin-polyfill-corejs2": "^0.4.14",
+ "babel-plugin-polyfill-corejs3": "^0.13.0",
+ "babel-plugin-polyfill-regenerator": "^0.6.5",
+ "core-js-compat": "^3.43.0",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/preset-env/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/@babel/preset-modules": {
+ "version": "0.1.6-no-external-plugins",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/types": "^7.4.4",
+ "esutils": "^2.0.2"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0"
+ }
+ },
+ "node_modules/@babel/preset-typescript": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1",
+ "@babel/helper-validator-option": "^7.27.1",
+ "@babel/plugin-syntax-jsx": "^7.27.1",
+ "@babel/plugin-transform-modules-commonjs": "^7.27.1",
+ "@babel/plugin-transform-typescript": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.27.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.27.1",
+ "@babel/parser": "^7.27.2",
+ "@babel/types": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.27.1",
+ "@babel/generator": "^7.28.5",
+ "@babel/helper-globals": "^7.28.0",
+ "@babel/parser": "^7.28.5",
+ "@babel/template": "^7.27.2",
+ "@babel/types": "^7.28.5",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/types": {
+ "version": "7.28.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@bcoe/v8-coverage": {
+ "version": "0.2.3",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@inquirer/ansi": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ }
+ },
+ "node_modules/@inquirer/checkbox": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/ansi": "^2.0.1",
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/figures": "^2.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/confirm": {
+ "version": "6.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/core": {
+ "version": "11.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/ansi": "^2.0.1",
+ "@inquirer/figures": "^2.0.1",
+ "@inquirer/type": "^4.0.1",
+ "cli-width": "^4.1.0",
+ "mute-stream": "^3.0.0",
+ "signal-exit": "^4.1.0",
+ "wrap-ansi": "^9.0.2"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/core/node_modules/signal-exit": {
+ "version": "4.1.0",
+ "license": "ISC",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/@inquirer/editor": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/external-editor": "^2.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/expand": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/external-editor": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "chardet": "^2.1.1",
+ "iconv-lite": "^0.7.0"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/external-editor/node_modules/iconv-lite": {
+ "version": "0.7.0",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/@inquirer/figures": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ }
+ },
+ "node_modules/@inquirer/input": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/number": {
+ "version": "4.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/password": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/ansi": "^2.0.1",
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/prompts": {
+ "version": "8.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/checkbox": "^5.0.1",
+ "@inquirer/confirm": "^6.0.1",
+ "@inquirer/editor": "^5.0.1",
+ "@inquirer/expand": "^5.0.1",
+ "@inquirer/input": "^5.0.1",
+ "@inquirer/number": "^4.0.1",
+ "@inquirer/password": "^5.0.1",
+ "@inquirer/rawlist": "^5.0.1",
+ "@inquirer/search": "^4.0.1",
+ "@inquirer/select": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/rawlist": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/search": {
+ "version": "4.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/figures": "^2.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/select": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/ansi": "^2.0.1",
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/figures": "^2.0.1",
+ "@inquirer/type": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@inquirer/type": {
+ "version": "4.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@istanbuljs/load-nyc-config": {
+ "version": "1.1.0",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "camelcase": "^5.3.1",
+ "find-up": "^4.1.0",
+ "get-package-type": "^0.1.0",
+ "js-yaml": "^3.13.1",
+ "resolve-from": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": {
+ "version": "1.0.10",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": {
+ "version": "3.14.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/@istanbuljs/load-nyc-config/node_modules/sprintf-js": {
+ "version": "1.0.3",
+ "dev": true,
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@istanbuljs/schema": {
+ "version": "0.1.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/console": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "jest-message-util": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/console/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@jest/console/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@jest/console/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/console/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/core": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/console": "^29.7.0",
+ "@jest/reporters": "^29.7.0",
+ "@jest/test-result": "^29.7.0",
+ "@jest/transform": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^4.0.0",
+ "ci-info": "^3.2.0",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.2.9",
+ "jest-changed-files": "^29.7.0",
+ "jest-config": "^29.7.0",
+ "jest-haste-map": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-regex-util": "^29.6.3",
+ "jest-resolve": "^29.7.0",
+ "jest-resolve-dependencies": "^29.7.0",
+ "jest-runner": "^29.7.0",
+ "jest-runtime": "^29.7.0",
+ "jest-snapshot": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "jest-validate": "^29.7.0",
+ "jest-watcher": "^29.7.0",
+ "micromatch": "^4.0.4",
+ "pretty-format": "^29.7.0",
+ "slash": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
+ },
+ "peerDependenciesMeta": {
+ "node-notifier": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@jest/core/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/core/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@jest/core/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@jest/core/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/core/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/core/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/environment": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/fake-timers": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "jest-mock": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/expect": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "expect": "^29.7.0",
+ "jest-snapshot": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/expect-utils": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "jest-get-type": "^29.6.3"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/fake-timers": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "@sinonjs/fake-timers": "^10.0.2",
+ "@types/node": "*",
+ "jest-message-util": "^29.7.0",
+ "jest-mock": "^29.7.0",
+ "jest-util": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/globals": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/environment": "^29.7.0",
+ "@jest/expect": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "jest-mock": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/reporters": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@bcoe/v8-coverage": "^0.2.3",
+ "@jest/console": "^29.7.0",
+ "@jest/test-result": "^29.7.0",
+ "@jest/transform": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@jridgewell/trace-mapping": "^0.3.18",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "collect-v8-coverage": "^1.0.0",
+ "exit": "^0.1.2",
+ "glob": "^7.1.3",
+ "graceful-fs": "^4.2.9",
+ "istanbul-lib-coverage": "^3.0.0",
+ "istanbul-lib-instrument": "^6.0.0",
+ "istanbul-lib-report": "^3.0.0",
+ "istanbul-lib-source-maps": "^4.0.0",
+ "istanbul-reports": "^3.1.3",
+ "jest-message-util": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "jest-worker": "^29.7.0",
+ "slash": "^3.0.0",
+ "string-length": "^4.0.1",
+ "strip-ansi": "^6.0.0",
+ "v8-to-istanbul": "^9.0.1"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
+ },
+ "peerDependenciesMeta": {
+ "node-notifier": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/reporters/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/schemas": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@sinclair/typebox": "^0.27.8"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/source-map": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "^0.3.18",
+ "callsites": "^3.0.0",
+ "graceful-fs": "^4.2.9"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/test-result": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/console": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "collect-v8-coverage": "^1.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/test-sequencer": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/test-result": "^29.7.0",
+ "graceful-fs": "^4.2.9",
+ "jest-haste-map": "^29.7.0",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/transform": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.11.6",
+ "@jest/types": "^29.6.3",
+ "@jridgewell/trace-mapping": "^0.3.18",
+ "babel-plugin-istanbul": "^6.1.1",
+ "chalk": "^4.0.0",
+ "convert-source-map": "^2.0.0",
+ "fast-json-stable-stringify": "^2.1.0",
+ "graceful-fs": "^4.2.9",
+ "jest-haste-map": "^29.7.0",
+ "jest-regex-util": "^29.6.3",
+ "jest-util": "^29.7.0",
+ "micromatch": "^4.0.4",
+ "pirates": "^4.0.4",
+ "slash": "^3.0.0",
+ "write-file-atomic": "^4.0.2"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/transform/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@jest/transform/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@jest/transform/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/transform/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/types": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/schemas": "^29.6.3",
+ "@types/istanbul-lib-coverage": "^2.0.0",
+ "@types/istanbul-reports": "^3.0.0",
+ "@types/node": "*",
+ "@types/yargs": "^17.0.8",
+ "chalk": "^4.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@jest/types/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@jest/types/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@jest/types/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jest/types/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@pm2/agent": {
+ "version": "2.1.1",
+ "license": "AGPL-3.0",
+ "dependencies": {
+ "async": "~3.2.0",
+ "chalk": "~3.0.0",
+ "dayjs": "~1.8.24",
+ "debug": "~4.3.1",
+ "eventemitter2": "~5.0.1",
+ "fast-json-patch": "^3.1.0",
+ "fclone": "~1.0.11",
+ "pm2-axon": "~4.0.1",
+ "pm2-axon-rpc": "~0.7.0",
+ "proxy-agent": "~6.4.0",
+ "semver": "~7.5.0",
+ "ws": "~7.5.10"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/chalk": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/dayjs": {
+ "version": "1.8.36",
+ "license": "MIT"
+ },
+ "node_modules/@pm2/agent/node_modules/debug": {
+ "version": "4.3.7",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/has-flag": {
+ "version": "4.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/semver": {
+ "version": "7.5.4",
+ "license": "ISC",
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@pm2/agent/node_modules/supports-color": {
+ "version": "7.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@pm2/blessed": {
+ "version": "0.1.81",
+ "license": "MIT",
+ "bin": {
+ "blessed": "bin/tput.js"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/@pm2/io": {
+ "version": "6.1.0",
+ "license": "Apache-2",
+ "dependencies": {
+ "async": "~2.6.1",
+ "debug": "~4.3.1",
+ "eventemitter2": "^6.3.1",
+ "require-in-the-middle": "^5.0.0",
+ "semver": "~7.5.4",
+ "shimmer": "^1.2.0",
+ "signal-exit": "^3.0.3",
+ "tslib": "1.9.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ }
+ },
+ "node_modules/@pm2/io/node_modules/async": {
+ "version": "2.6.4",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.14"
+ }
+ },
+ "node_modules/@pm2/io/node_modules/debug": {
+ "version": "4.3.7",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@pm2/io/node_modules/eventemitter2": {
+ "version": "6.4.9",
+ "license": "MIT"
+ },
+ "node_modules/@pm2/io/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@pm2/io/node_modules/semver": {
+ "version": "7.5.4",
+ "license": "ISC",
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@pm2/js-api": {
+ "version": "0.8.0",
+ "license": "Apache-2",
+ "dependencies": {
+ "async": "^2.6.3",
+ "debug": "~4.3.1",
+ "eventemitter2": "^6.3.1",
+ "extrareqp2": "^1.0.0",
+ "ws": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/@pm2/js-api/node_modules/async": {
+ "version": "2.6.4",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.14"
+ }
+ },
+ "node_modules/@pm2/js-api/node_modules/debug": {
+ "version": "4.3.7",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@pm2/js-api/node_modules/eventemitter2": {
+ "version": "6.4.9",
+ "license": "MIT"
+ },
+ "node_modules/@pm2/pm2-version-check": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@pm2/pm2-version-check/-/pm2-version-check-1.0.4.tgz",
+ "integrity": "sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.3.1"
+ }
+ },
+ "node_modules/@prisma/client": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.19.0.tgz",
+ "integrity": "sha512-QXFT+N/bva/QI2qoXmjBzL7D6aliPffIwP+81AdTGq0FXDoLxLkWivGMawG8iM5B9BKfxLIXxfWWAF6wbuJU6g==",
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "peerDependencies": {
+ "prisma": "*",
+ "typescript": ">=5.1.0"
+ },
+ "peerDependenciesMeta": {
+ "prisma": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@prisma/config": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.19.0.tgz",
+ "integrity": "sha512-zwCayme+NzI/WfrvFEtkFhhOaZb/hI+X8TTjzjJ252VbPxAl2hWHK5NMczmnG9sXck2lsXrxIZuK524E25UNmg==",
+ "devOptional": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "c12": "3.1.0",
+ "deepmerge-ts": "7.1.5",
+ "effect": "3.18.4",
+ "empathic": "2.0.0"
+ }
+ },
+ "node_modules/@prisma/debug": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.19.0.tgz",
+ "integrity": "sha512-8hAdGG7JmxrzFcTzXZajlQCidX0XNkMJkpqtfbLV54wC6LSSX6Vni25W/G+nAANwLnZ2TmwkfIuWetA7jJxJFA==",
+ "devOptional": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/@prisma/engines": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.19.0.tgz",
+ "integrity": "sha512-pMRJ+1S6NVdXoB8QJAPIGpKZevFjxhKt0paCkRDTZiczKb7F4yTgRP8M4JdVkpQwmaD4EoJf6qA+p61godDokw==",
+ "devOptional": true,
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/debug": "6.19.0",
+ "@prisma/engines-version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
+ "@prisma/fetch-engine": "6.19.0",
+ "@prisma/get-platform": "6.19.0"
+ }
+ },
+ "node_modules/@prisma/engines-version": {
+ "version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
+ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773.tgz",
+ "integrity": "sha512-gV7uOBQfAFlWDvPJdQxMT1aSRur3a0EkU/6cfbAC5isV67tKDWUrPauyaHNpB+wN1ebM4A9jn/f4gH+3iHSYSQ==",
+ "devOptional": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/@prisma/fetch-engine": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.19.0.tgz",
+ "integrity": "sha512-OOx2Lda0DGrZ1rodADT06ZGqHzr7HY7LNMaFE2Vp8dp146uJld58sRuasdX0OiwpHgl8SqDTUKHNUyzEq7pDdQ==",
+ "devOptional": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/debug": "6.19.0",
+ "@prisma/engines-version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
+ "@prisma/get-platform": "6.19.0"
+ }
+ },
+ "node_modules/@prisma/get-platform": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.19.0.tgz",
+ "integrity": "sha512-ym85WDO2yDhC3fIXHWYpG3kVMBA49cL1XD2GCsCF8xbwoy2OkDQY44gEbAt2X46IQ4Apq9H6g0Ex1iFfPqEkHA==",
+ "devOptional": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/debug": "6.19.0"
+ }
+ },
+ "node_modules/@sinclair/typebox": {
+ "version": "0.27.8",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@sinonjs/commons": {
+ "version": "3.0.1",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "node_modules/@sinonjs/fake-timers": {
+ "version": "10.3.0",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@sinonjs/commons": "^3.0.0"
+ }
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz",
+ "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/@tootallnate/quickjs-emscripten": {
+ "version": "0.23.0",
+ "license": "MIT"
+ },
+ "node_modules/@types/babel__core": {
+ "version": "7.20.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.20.7",
+ "@babel/types": "^7.20.7",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "node_modules/@types/babel__generator": {
+ "version": "7.27.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__template": {
+ "version": "7.4.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__traverse": {
+ "version": "7.28.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.28.2"
+ }
+ },
+ "node_modules/@types/graceful-fs": {
+ "version": "4.1.9",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/istanbul-lib-coverage": {
+ "version": "2.0.6",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/istanbul-lib-report": {
+ "version": "3.0.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/istanbul-lib-coverage": "*"
+ }
+ },
+ "node_modules/@types/istanbul-reports": {
+ "version": "3.0.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/istanbul-lib-report": "*"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "24.10.1",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.16.0"
+ }
+ },
+ "node_modules/@types/stack-utils": {
+ "version": "2.0.3",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/yargs": {
+ "version": "17.0.35",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/yargs-parser": "*"
+ }
+ },
+ "node_modules/@types/yargs-parser": {
+ "version": "21.0.3",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/accepts": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "^3.0.0",
+ "negotiator": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/agent-base": {
+ "version": "7.1.4",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/amp": {
+ "version": "0.3.1",
+ "license": "MIT"
+ },
+ "node_modules/amp-message": {
+ "version": "0.1.2",
+ "license": "MIT",
+ "dependencies": {
+ "amp": "0.3.1"
+ }
+ },
+ "node_modules/ansi-colors": {
+ "version": "4.1.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/ansi-escapes": {
+ "version": "4.3.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "type-fest": "^0.21.3"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "6.2.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/ansis": {
+ "version": "4.0.0-node10",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "license": "ISC",
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "license": "Python-2.0"
+ },
+ "node_modules/ast-types": {
+ "version": "0.13.4",
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/ast-types/node_modules/tslib": {
+ "version": "2.8.1",
+ "license": "0BSD"
+ },
+ "node_modules/async": {
+ "version": "3.2.6",
+ "license": "MIT"
+ },
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "license": "MIT"
+ },
+ "node_modules/axios": {
+ "version": "1.13.2",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.4",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
+ "node_modules/babel-jest": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/transform": "^29.7.0",
+ "@types/babel__core": "^7.1.14",
+ "babel-plugin-istanbul": "^6.1.1",
+ "babel-preset-jest": "^29.6.3",
+ "chalk": "^4.0.0",
+ "graceful-fs": "^4.2.9",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.8.0"
+ }
+ },
+ "node_modules/babel-jest/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/babel-jest/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/babel-jest/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/babel-jest/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/babel-plugin-istanbul": {
+ "version": "6.1.1",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@istanbuljs/load-nyc-config": "^1.0.0",
+ "@istanbuljs/schema": "^0.1.2",
+ "istanbul-lib-instrument": "^5.0.4",
+ "test-exclude": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": {
+ "version": "5.2.1",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@babel/core": "^7.12.3",
+ "@babel/parser": "^7.14.7",
+ "@istanbuljs/schema": "^0.1.2",
+ "istanbul-lib-coverage": "^3.2.0",
+ "semver": "^6.3.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/babel-plugin-istanbul/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/babel-plugin-jest-hoist": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.3.3",
+ "@babel/types": "^7.3.3",
+ "@types/babel__core": "^7.1.14",
+ "@types/babel__traverse": "^7.0.6"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/babel-plugin-polyfill-corejs2": {
+ "version": "0.4.14",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.27.7",
+ "@babel/helper-define-polyfill-provider": "^0.6.5",
+ "semver": "^6.3.1"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
+ }
+ },
+ "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": {
+ "version": "6.3.1",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/babel-plugin-polyfill-corejs3": {
+ "version": "0.13.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-define-polyfill-provider": "^0.6.5",
+ "core-js-compat": "^3.43.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
+ }
+ },
+ "node_modules/babel-plugin-polyfill-regenerator": {
+ "version": "0.6.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-define-polyfill-provider": "^0.6.5"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
+ }
+ },
+ "node_modules/babel-preset-current-node-syntax": {
+ "version": "1.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/plugin-syntax-async-generators": "^7.8.4",
+ "@babel/plugin-syntax-bigint": "^7.8.3",
+ "@babel/plugin-syntax-class-properties": "^7.12.13",
+ "@babel/plugin-syntax-class-static-block": "^7.14.5",
+ "@babel/plugin-syntax-import-attributes": "^7.24.7",
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
+ "@babel/plugin-syntax-json-strings": "^7.8.3",
+ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
+ "@babel/plugin-syntax-numeric-separator": "^7.10.4",
+ "@babel/plugin-syntax-object-rest-spread": "^7.8.3",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
+ "@babel/plugin-syntax-optional-chaining": "^7.8.3",
+ "@babel/plugin-syntax-private-property-in-object": "^7.14.5",
+ "@babel/plugin-syntax-top-level-await": "^7.14.5"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0 || ^8.0.0-0"
+ }
+ },
+ "node_modules/babel-preset-jest": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "babel-plugin-jest-hoist": "^29.6.3",
+ "babel-preset-current-node-syntax": "^1.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "license": "MIT"
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.8.30",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.js"
+ }
+ },
+ "node_modules/basic-ftp": {
+ "version": "5.0.5",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/better-sqlite3": {
+ "version": "12.4.5",
+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.4.5.tgz",
+ "integrity": "sha512-4NejwX2llfdKYK7Tzwwre/qKzTXiqcbycIagtqMH9oE7Es3LCUGGGXvhw8rWbZ2alx1C/Nh0MeJyYEZKUFs4sw==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "prebuild-install": "^7.1.1"
+ },
+ "engines": {
+ "node": "20.x || 22.x || 23.x || 24.x || 25.x"
+ }
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "license": "MIT",
+ "dependencies": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "node_modules/bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "node_modules/bodec": {
+ "version": "0.1.0",
+ "license": "MIT"
+ },
+ "node_modules/body-parser": {
+ "version": "2.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "^3.1.2",
+ "content-type": "^1.0.5",
+ "debug": "^4.4.0",
+ "http-errors": "^2.0.0",
+ "iconv-lite": "^0.6.3",
+ "on-finished": "^2.4.1",
+ "qs": "^6.14.0",
+ "raw-body": "^3.0.0",
+ "type-is": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.12",
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "license": "MIT",
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.28.0",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "baseline-browser-mapping": "^2.8.25",
+ "caniuse-lite": "^1.0.30001754",
+ "electron-to-chromium": "^1.5.249",
+ "node-releases": "^2.0.27",
+ "update-browserslist-db": "^1.1.4"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/bser": {
+ "version": "2.1.1",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "node-int64": "^0.4.0"
+ }
+ },
+ "node_modules/buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "license": "MIT"
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/c12": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/c12/-/c12-3.1.0.tgz",
+ "integrity": "sha512-uWoS8OU1MEIsOv8p/5a82c3H31LsWVR5qiyXVfBNOzfffjUWtPnhAb4BYI2uG2HfGmZmFjCtui5XNWaps+iFuw==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "chokidar": "^4.0.3",
+ "confbox": "^0.2.2",
+ "defu": "^6.1.4",
+ "dotenv": "^16.6.1",
+ "exsolve": "^1.0.7",
+ "giget": "^2.0.0",
+ "jiti": "^2.4.2",
+ "ohash": "^2.0.11",
+ "pathe": "^2.0.3",
+ "perfect-debounce": "^1.0.0",
+ "pkg-types": "^2.2.0",
+ "rc9": "^2.1.2"
+ },
+ "peerDependencies": {
+ "magicast": "^0.3.5"
+ },
+ "peerDependenciesMeta": {
+ "magicast": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/c12/node_modules/chokidar": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
+ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/c12/node_modules/dotenv": {
+ "version": "16.6.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
+ "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
+ "devOptional": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/c12/node_modules/readdirp": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
+ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
+ "devOptional": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.18.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/camelcase": {
+ "version": "5.3.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001756",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/chalk": {
+ "version": "5.6.2",
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/char-regex": {
+ "version": "1.0.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/chardet": {
+ "version": "2.1.1",
+ "license": "MIT"
+ },
+ "node_modules/charm": {
+ "version": "0.1.2",
+ "license": "MIT/X11"
+ },
+ "node_modules/chokidar": {
+ "version": "3.6.0",
+ "license": "MIT",
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "license": "ISC"
+ },
+ "node_modules/ci-info": {
+ "version": "3.9.0",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/sibiraj-s"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/citty": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/citty/-/citty-0.1.6.tgz",
+ "integrity": "sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "consola": "^3.2.3"
+ }
+ },
+ "node_modules/cjs-module-lexer": {
+ "version": "1.4.3",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cli-tableau": {
+ "version": "2.0.1",
+ "dependencies": {
+ "chalk": "3.0.0"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/cli-tableau/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/cli-tableau/node_modules/chalk": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cli-tableau/node_modules/has-flag": {
+ "version": "4.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cli-tableau/node_modules/supports-color": {
+ "version": "7.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cli-width": {
+ "version": "4.1.0",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "9.0.1",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^7.2.0",
+ "strip-ansi": "^7.1.0",
+ "wrap-ansi": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/co": {
+ "version": "4.6.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "iojs": ">= 1.0.0",
+ "node": ">= 0.12.0"
+ }
+ },
+ "node_modules/collect-v8-coverage": {
+ "version": "1.0.3",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "license": "MIT"
+ },
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/commander": {
+ "version": "2.15.1",
+ "license": "MIT"
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "license": "MIT"
+ },
+ "node_modules/confbox": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz",
+ "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/consola": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
+ "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
+ "devOptional": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.18.0 || >=16.10.0"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.2.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.6.0"
+ }
+ },
+ "node_modules/core-js-compat": {
+ "version": "3.47.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "browserslist": "^4.28.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
+ "node_modules/cors": {
+ "version": "2.8.5",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/create-jest": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "chalk": "^4.0.0",
+ "exit": "^0.1.2",
+ "graceful-fs": "^4.2.9",
+ "jest-config": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "prompts": "^2.0.1"
+ },
+ "bin": {
+ "create-jest": "bin/create-jest.js"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/create-jest/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/create-jest/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/create-jest/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/create-jest/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/croner": {
+ "version": "4.1.97",
+ "license": "MIT"
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/culvert": {
+ "version": "0.1.2",
+ "license": "MIT"
+ },
+ "node_modules/data-uri-to-buffer": {
+ "version": "6.0.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/dayjs": {
+ "version": "1.11.15",
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "license": "MIT",
+ "dependencies": {
+ "mimic-response": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/dedent": {
+ "version": "1.7.0",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "babel-plugin-macros": "^3.1.0"
+ },
+ "peerDependenciesMeta": {
+ "babel-plugin-macros": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/deepmerge": {
+ "version": "4.3.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/deepmerge-ts": {
+ "version": "7.1.5",
+ "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-7.1.5.tgz",
+ "integrity": "sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==",
+ "devOptional": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
+ "node_modules/default-gateway": {
+ "version": "7.2.2",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "execa": "^7.1.1"
+ },
+ "engines": {
+ "node": ">= 16"
+ }
+ },
+ "node_modules/defu": {
+ "version": "6.1.4",
+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
+ "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/degenerator": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "ast-types": "^0.13.4",
+ "escodegen": "^2.1.0",
+ "esprima": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destr": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
+ "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/detect-newline": {
+ "version": "3.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/diff-sequences": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "17.2.3",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "license": "MIT"
+ },
+ "node_modules/effect": {
+ "version": "3.18.4",
+ "resolved": "https://registry.npmjs.org/effect/-/effect-3.18.4.tgz",
+ "integrity": "sha512-b1LXQJLe9D11wfnOKAk3PKxuqYshQ0Heez+y5pnkd3jLj1yx9QhM72zZ9uUrOQyNvrs2GZZd/3maL0ZV18YuDA==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.0.0",
+ "fast-check": "^3.23.1"
+ }
+ },
+ "node_modules/ejs": {
+ "version": "3.1.10",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "jake": "^10.8.5"
+ },
+ "bin": {
+ "ejs": "bin/cli.js"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/electron-is-dev": {
+ "version": "3.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.258",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/emittery": {
+ "version": "0.13.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/emittery?sponsor=1"
+ }
+ },
+ "node_modules/emoji-regex": {
+ "version": "10.6.0",
+ "license": "MIT"
+ },
+ "node_modules/empathic": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz",
+ "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==",
+ "devOptional": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/end-of-stream": {
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
+ "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
+ "license": "MIT",
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
+ "node_modules/enquirer": {
+ "version": "2.3.6",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-colors": "^4.1.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/error-ex": {
+ "version": "1.3.4",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "license": "MIT"
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/escodegen": {
+ "version": "2.1.0",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esprima": "^4.0.1",
+ "estraverse": "^5.2.0",
+ "esutils": "^2.0.2"
+ },
+ "bin": {
+ "escodegen": "bin/escodegen.js",
+ "esgenerate": "bin/esgenerate.js"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "optionalDependencies": {
+ "source-map": "~0.6.1"
+ }
+ },
+ "node_modules/esprima": {
+ "version": "4.0.1",
+ "license": "BSD-2-Clause",
+ "bin": {
+ "esparse": "bin/esparse.js",
+ "esvalidate": "bin/esvalidate.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/eventemitter2": {
+ "version": "5.0.1",
+ "license": "MIT"
+ },
+ "node_modules/execa": {
+ "version": "7.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.1",
+ "human-signals": "^4.3.0",
+ "is-stream": "^3.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^5.1.0",
+ "onetime": "^6.0.0",
+ "signal-exit": "^3.0.7",
+ "strip-final-newline": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || ^16.14.0 || >=18.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/exit": {
+ "version": "0.1.2",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "license": "(MIT OR WTFPL)",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/expect": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/expect-utils": "^29.7.0",
+ "jest-get-type": "^29.6.3",
+ "jest-matcher-utils": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-util": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/express": {
+ "version": "5.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "^2.0.0",
+ "body-parser": "^2.2.0",
+ "content-disposition": "^1.0.0",
+ "content-type": "^1.0.5",
+ "cookie": "^0.7.1",
+ "cookie-signature": "^1.2.1",
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "finalhandler": "^2.1.0",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "merge-descriptors": "^2.0.0",
+ "mime-types": "^3.0.0",
+ "on-finished": "^2.4.1",
+ "once": "^1.4.0",
+ "parseurl": "^1.3.3",
+ "proxy-addr": "^2.0.7",
+ "qs": "^6.14.0",
+ "range-parser": "^1.2.1",
+ "router": "^2.2.0",
+ "send": "^1.1.0",
+ "serve-static": "^2.2.0",
+ "statuses": "^2.0.1",
+ "type-is": "^2.0.1",
+ "vary": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/express-session": {
+ "version": "1.18.2",
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "0.7.2",
+ "cookie-signature": "1.0.7",
+ "debug": "2.6.9",
+ "depd": "~2.0.0",
+ "on-headers": "~1.1.0",
+ "parseurl": "~1.3.3",
+ "safe-buffer": "5.2.1",
+ "uid-safe": "~2.1.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/express-session/node_modules/cookie-signature": {
+ "version": "1.0.7",
+ "license": "MIT"
+ },
+ "node_modules/express-session/node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/express-session/node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/express-ws": {
+ "version": "5.0.2",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "ws": "^7.4.6"
+ },
+ "engines": {
+ "node": ">=4.5.0"
+ },
+ "peerDependencies": {
+ "express": "^4.0.0 || ^5.0.0-alpha.1"
+ }
+ },
+ "node_modules/exsolve": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz",
+ "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/extrareqp2": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.14.0"
+ }
+ },
+ "node_modules/fast-check": {
+ "version": "3.23.2",
+ "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.23.2.tgz",
+ "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==",
+ "devOptional": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/dubzzz"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fast-check"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "pure-rand": "^6.1.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/fast-json-patch": {
+ "version": "3.1.1",
+ "license": "MIT"
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fb-watchman": {
+ "version": "2.0.2",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "bser": "2.1.1"
+ }
+ },
+ "node_modules/fclone": {
+ "version": "1.0.11",
+ "license": "MIT"
+ },
+ "node_modules/file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "license": "MIT"
+ },
+ "node_modules/filelist": {
+ "version": "1.0.4",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "minimatch": "^5.0.1"
+ }
+ },
+ "node_modules/filelist/node_modules/brace-expansion": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/filelist/node_modules/minimatch": {
+ "version": "5.1.6",
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "license": "MIT",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "2.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "on-finished": "^2.4.1",
+ "parseurl": "^1.3.3",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/find-up": {
+ "version": "4.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/follow-redirects": {
+ "version": "1.15.11",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.5",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-db": {
+ "version": "1.52.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-types": {
+ "version": "2.1.35",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "license": "MIT"
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/get-east-asian-width": {
+ "version": "1.4.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-package-type": {
+ "version": "0.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/get-stream": {
+ "version": "6.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/get-uri": {
+ "version": "6.0.5",
+ "license": "MIT",
+ "dependencies": {
+ "basic-ftp": "^5.0.2",
+ "data-uri-to-buffer": "^6.0.2",
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/giget": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/giget/-/giget-2.0.0.tgz",
+ "integrity": "sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "citty": "^0.1.6",
+ "consola": "^3.4.0",
+ "defu": "^6.1.4",
+ "node-fetch-native": "^1.6.6",
+ "nypm": "^0.6.0",
+ "pathe": "^2.0.3"
+ },
+ "bin": {
+ "giget": "dist/cli.mjs"
+ }
+ },
+ "node_modules/git-node-fs": {
+ "version": "1.0.0",
+ "license": "MIT"
+ },
+ "node_modules/git-sha1": {
+ "version": "0.1.2",
+ "license": "MIT"
+ },
+ "node_modules/github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
+ "license": "MIT"
+ },
+ "node_modules/glob": {
+ "version": "7.2.3",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.1.1",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.2.11",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/html-escaper": {
+ "version": "2.0.2",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/http-errors/node_modules/statuses": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/http-proxy-agent": {
+ "version": "7.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.0",
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/human-signals": {
+ "version": "4.3.1",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14.18.0"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/ignore-by-default": {
+ "version": "1.0.1",
+ "license": "ISC"
+ },
+ "node_modules/import-local": {
+ "version": "3.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "pkg-dir": "^4.2.0",
+ "resolve-cwd": "^3.0.0"
+ },
+ "bin": {
+ "import-local-fixture": "fixtures/cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.8.19"
+ }
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "license": "ISC"
+ },
+ "node_modules/ini": {
+ "version": "1.3.8",
+ "license": "ISC"
+ },
+ "node_modules/inquirer": {
+ "version": "13.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@inquirer/ansi": "^2.0.1",
+ "@inquirer/core": "^11.0.1",
+ "@inquirer/prompts": "^8.0.1",
+ "@inquirer/type": "^4.0.1",
+ "mute-stream": "^3.0.0",
+ "run-async": "^4.0.6",
+ "rxjs": "^7.8.2"
+ },
+ "engines": {
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
+ },
+ "peerDependencies": {
+ "@types/node": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ip-address": {
+ "version": "10.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-arrayish": {
+ "version": "0.2.1",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.16.1",
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-generator-fn": {
+ "version": "2.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/is-promise": {
+ "version": "4.0.0",
+ "license": "MIT"
+ },
+ "node_modules/is-stream": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "license": "ISC"
+ },
+ "node_modules/isomorphic-form-data": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "form-data": "^2.3.2"
+ }
+ },
+ "node_modules/isomorphic-form-data/node_modules/form-data": {
+ "version": "2.5.5",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.35",
+ "safe-buffer": "^5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.12"
+ }
+ },
+ "node_modules/isomorphic-form-data/node_modules/mime-db": {
+ "version": "1.52.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/isomorphic-form-data/node_modules/mime-types": {
+ "version": "2.1.35",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/istanbul-lib-coverage": {
+ "version": "3.2.2",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-instrument": {
+ "version": "6.0.3",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@babel/core": "^7.23.9",
+ "@babel/parser": "^7.23.9",
+ "@istanbuljs/schema": "^0.1.3",
+ "istanbul-lib-coverage": "^3.2.0",
+ "semver": "^7.5.4"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-lib-report": {
+ "version": "3.0.1",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^4.0.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-lib-report/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-report/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-source-maps": {
+ "version": "4.0.1",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^3.0.0",
+ "source-map": "^0.6.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-reports": {
+ "version": "3.2.0",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jake": {
+ "version": "10.9.4",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "async": "^3.2.6",
+ "filelist": "^1.0.4",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "jake": "bin/cli.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/jest": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/core": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "import-local": "^3.0.2",
+ "jest-cli": "^29.7.0"
+ },
+ "bin": {
+ "jest": "bin/jest.js"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
+ },
+ "peerDependenciesMeta": {
+ "node-notifier": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/jest-changed-files": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "execa": "^5.0.0",
+ "jest-util": "^29.7.0",
+ "p-limit": "^3.1.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/execa": {
+ "version": "5.1.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/human-signals": {
+ "version": "2.1.0",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=10.17.0"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/is-stream": {
+ "version": "2.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/mimic-fn": {
+ "version": "2.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/npm-run-path": {
+ "version": "4.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/onetime": {
+ "version": "5.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mimic-fn": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/strip-final-newline": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/jest-circus": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/environment": "^29.7.0",
+ "@jest/expect": "^29.7.0",
+ "@jest/test-result": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "co": "^4.6.0",
+ "dedent": "^1.0.0",
+ "is-generator-fn": "^2.0.0",
+ "jest-each": "^29.7.0",
+ "jest-matcher-utils": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-runtime": "^29.7.0",
+ "jest-snapshot": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "p-limit": "^3.1.0",
+ "pretty-format": "^29.7.0",
+ "pure-rand": "^6.0.0",
+ "slash": "^3.0.0",
+ "stack-utils": "^2.0.3"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-circus/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-circus/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-circus/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-circus/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/core": "^29.7.0",
+ "@jest/test-result": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "chalk": "^4.0.0",
+ "create-jest": "^29.7.0",
+ "exit": "^0.1.2",
+ "import-local": "^3.0.2",
+ "jest-config": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "jest-validate": "^29.7.0",
+ "yargs": "^17.3.1"
+ },
+ "bin": {
+ "jest": "bin/jest.js"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
+ },
+ "peerDependenciesMeta": {
+ "node-notifier": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/jest-cli/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-cli/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-cli/node_modules/cliui": {
+ "version": "8.0.1",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/jest-cli/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/jest-cli/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli/node_modules/string-width": {
+ "version": "4.2.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-cli/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/jest-cli/node_modules/yargs": {
+ "version": "17.7.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/jest-cli/node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/jest-config": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.11.6",
+ "@jest/test-sequencer": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "babel-jest": "^29.7.0",
+ "chalk": "^4.0.0",
+ "ci-info": "^3.2.0",
+ "deepmerge": "^4.2.2",
+ "glob": "^7.1.3",
+ "graceful-fs": "^4.2.9",
+ "jest-circus": "^29.7.0",
+ "jest-environment-node": "^29.7.0",
+ "jest-get-type": "^29.6.3",
+ "jest-regex-util": "^29.6.3",
+ "jest-resolve": "^29.7.0",
+ "jest-runner": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "jest-validate": "^29.7.0",
+ "micromatch": "^4.0.4",
+ "parse-json": "^5.2.0",
+ "pretty-format": "^29.7.0",
+ "slash": "^3.0.0",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "@types/node": "*",
+ "ts-node": ">=9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "ts-node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/jest-config/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-config/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-config/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-config/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-diff": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^4.0.0",
+ "diff-sequences": "^29.6.3",
+ "jest-get-type": "^29.6.3",
+ "pretty-format": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-diff/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-diff/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-diff/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-diff/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-docblock": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "detect-newline": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-each": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "chalk": "^4.0.0",
+ "jest-get-type": "^29.6.3",
+ "jest-util": "^29.7.0",
+ "pretty-format": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-each/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-each/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-each/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-each/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-environment-node": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/environment": "^29.7.0",
+ "@jest/fake-timers": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "jest-mock": "^29.7.0",
+ "jest-util": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-get-type": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-haste-map": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "@types/graceful-fs": "^4.1.3",
+ "@types/node": "*",
+ "anymatch": "^3.0.3",
+ "fb-watchman": "^2.0.0",
+ "graceful-fs": "^4.2.9",
+ "jest-regex-util": "^29.6.3",
+ "jest-util": "^29.7.0",
+ "jest-worker": "^29.7.0",
+ "micromatch": "^4.0.4",
+ "walker": "^1.0.8"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "^2.3.2"
+ }
+ },
+ "node_modules/jest-leak-detector": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "jest-get-type": "^29.6.3",
+ "pretty-format": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-matcher-utils": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^4.0.0",
+ "jest-diff": "^29.7.0",
+ "jest-get-type": "^29.6.3",
+ "pretty-format": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-matcher-utils/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-matcher-utils/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-matcher-utils/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-matcher-utils/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-message-util": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.12.13",
+ "@jest/types": "^29.6.3",
+ "@types/stack-utils": "^2.0.0",
+ "chalk": "^4.0.0",
+ "graceful-fs": "^4.2.9",
+ "micromatch": "^4.0.4",
+ "pretty-format": "^29.7.0",
+ "slash": "^3.0.0",
+ "stack-utils": "^2.0.3"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-message-util/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-message-util/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-message-util/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-message-util/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-mock": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "jest-util": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-pnp-resolver": {
+ "version": "1.2.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ },
+ "peerDependencies": {
+ "jest-resolve": "*"
+ },
+ "peerDependenciesMeta": {
+ "jest-resolve": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/jest-regex-util": {
+ "version": "29.6.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-resolve": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^4.0.0",
+ "graceful-fs": "^4.2.9",
+ "jest-haste-map": "^29.7.0",
+ "jest-pnp-resolver": "^1.2.2",
+ "jest-util": "^29.7.0",
+ "jest-validate": "^29.7.0",
+ "resolve": "^1.20.0",
+ "resolve.exports": "^2.0.0",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-resolve-dependencies": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "jest-regex-util": "^29.6.3",
+ "jest-snapshot": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-resolve/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-resolve/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-resolve/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-resolve/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-runner": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/console": "^29.7.0",
+ "@jest/environment": "^29.7.0",
+ "@jest/test-result": "^29.7.0",
+ "@jest/transform": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "emittery": "^0.13.1",
+ "graceful-fs": "^4.2.9",
+ "jest-docblock": "^29.7.0",
+ "jest-environment-node": "^29.7.0",
+ "jest-haste-map": "^29.7.0",
+ "jest-leak-detector": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-resolve": "^29.7.0",
+ "jest-runtime": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "jest-watcher": "^29.7.0",
+ "jest-worker": "^29.7.0",
+ "p-limit": "^3.1.0",
+ "source-map-support": "0.5.13"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-runner/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-runner/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-runner/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-runner/node_modules/source-map-support": {
+ "version": "0.5.13",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "node_modules/jest-runner/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-runtime": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/environment": "^29.7.0",
+ "@jest/fake-timers": "^29.7.0",
+ "@jest/globals": "^29.7.0",
+ "@jest/source-map": "^29.6.3",
+ "@jest/test-result": "^29.7.0",
+ "@jest/transform": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "cjs-module-lexer": "^1.0.0",
+ "collect-v8-coverage": "^1.0.0",
+ "glob": "^7.1.3",
+ "graceful-fs": "^4.2.9",
+ "jest-haste-map": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-mock": "^29.7.0",
+ "jest-regex-util": "^29.6.3",
+ "jest-resolve": "^29.7.0",
+ "jest-snapshot": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "slash": "^3.0.0",
+ "strip-bom": "^4.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-snapshot": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.11.6",
+ "@babel/generator": "^7.7.2",
+ "@babel/plugin-syntax-jsx": "^7.7.2",
+ "@babel/plugin-syntax-typescript": "^7.7.2",
+ "@babel/types": "^7.3.3",
+ "@jest/expect-utils": "^29.7.0",
+ "@jest/transform": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "babel-preset-current-node-syntax": "^1.0.0",
+ "chalk": "^4.0.0",
+ "expect": "^29.7.0",
+ "graceful-fs": "^4.2.9",
+ "jest-diff": "^29.7.0",
+ "jest-get-type": "^29.6.3",
+ "jest-matcher-utils": "^29.7.0",
+ "jest-message-util": "^29.7.0",
+ "jest-util": "^29.7.0",
+ "natural-compare": "^1.4.0",
+ "pretty-format": "^29.7.0",
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-snapshot/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-snapshot/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-snapshot/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-snapshot/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-util": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "chalk": "^4.0.0",
+ "ci-info": "^3.2.0",
+ "graceful-fs": "^4.2.9",
+ "picomatch": "^2.2.3"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-util/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-util/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-util/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-util/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-validate": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/types": "^29.6.3",
+ "camelcase": "^6.2.0",
+ "chalk": "^4.0.0",
+ "jest-get-type": "^29.6.3",
+ "leven": "^3.1.0",
+ "pretty-format": "^29.7.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-validate/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-validate/node_modules/camelcase": {
+ "version": "6.3.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jest-validate/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-validate/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-validate/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-watcher": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/test-result": "^29.7.0",
+ "@jest/types": "^29.6.3",
+ "@types/node": "*",
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^4.0.0",
+ "emittery": "^0.13.1",
+ "jest-util": "^29.7.0",
+ "string-length": "^4.0.1"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-watcher/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/jest-watcher/node_modules/chalk": {
+ "version": "4.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/jest-watcher/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-watcher/node_modules/supports-color": {
+ "version": "7.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-worker": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "jest-util": "^29.7.0",
+ "merge-stream": "^2.0.0",
+ "supports-color": "^8.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/jest-worker/node_modules/has-flag": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-worker/node_modules/supports-color": {
+ "version": "8.1.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
+ "node_modules/jiti": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz",
+ "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
+ "devOptional": true,
+ "license": "MIT",
+ "bin": {
+ "jiti": "lib/jiti-cli.mjs"
+ }
+ },
+ "node_modules/js-git": {
+ "version": "0.7.8",
+ "license": "MIT",
+ "dependencies": {
+ "bodec": "^0.1.0",
+ "culvert": "^0.1.2",
+ "git-sha1": "^0.1.2",
+ "pako": "^0.2.5"
+ }
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/js-yaml": {
+ "version": "4.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json-parse-even-better-errors": {
+ "version": "2.3.1",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json-stringify-safe": {
+ "version": "5.0.1",
+ "license": "ISC",
+ "optional": true
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/kleur": {
+ "version": "3.0.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/leven": {
+ "version": "3.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/locate-path": {
+ "version": "5.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/lodash": {
+ "version": "4.17.21",
+ "license": "MIT"
+ },
+ "node_modules/lodash.debounce": {
+ "version": "4.0.8",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/lru-cache": {
+ "version": "7.18.3",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/make-dir": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/makeerror": {
+ "version": "1.0.12",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "tmpl": "1.0.5"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/merge-stream": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.8",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.54.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "3.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "^1.54.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mimic-fn": {
+ "version": "4.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/mkdirp": {
+ "version": "1.0.4",
+ "license": "MIT",
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "license": "MIT"
+ },
+ "node_modules/module-details-from-path": {
+ "version": "1.0.4",
+ "license": "MIT"
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "license": "MIT"
+ },
+ "node_modules/mute-stream": {
+ "version": "3.0.0",
+ "license": "ISC",
+ "engines": {
+ "node": "^20.17.0 || >=22.9.0"
+ }
+ },
+ "node_modules/napi-build-utils": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
+ "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==",
+ "license": "MIT"
+ },
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/needle": {
+ "version": "2.4.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^3.2.6",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
+ },
+ "bin": {
+ "needle": "bin/needle"
+ },
+ "engines": {
+ "node": ">= 4.4.x"
+ }
+ },
+ "node_modules/needle/node_modules/debug": {
+ "version": "3.2.7",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/needle/node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/negotiator": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/netmask": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/node-abi": {
+ "version": "3.85.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.85.0.tgz",
+ "integrity": "sha512-zsFhmbkAzwhTft6nd3VxcG0cvJsT70rL+BIGHWVq5fi6MwGrHwzqKaxXE+Hl2GmnGItnDKPPkO5/LQqjVkIdFg==",
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.3.5"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/node-fetch-native": {
+ "version": "1.6.7",
+ "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz",
+ "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/node-int64": {
+ "version": "0.4.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.27",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nodemon": {
+ "version": "3.1.11",
+ "license": "MIT",
+ "dependencies": {
+ "chokidar": "^3.5.2",
+ "debug": "^4",
+ "ignore-by-default": "^1.0.1",
+ "minimatch": "^3.1.2",
+ "pstree.remy": "^1.1.8",
+ "semver": "^7.5.3",
+ "simple-update-notifier": "^2.0.0",
+ "supports-color": "^5.5.0",
+ "touch": "^3.1.0",
+ "undefsafe": "^2.0.5"
+ },
+ "bin": {
+ "nodemon": "bin/nodemon.js"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/nodemon"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/npm-run-path": {
+ "version": "5.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^4.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/nypm": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.6.2.tgz",
+ "integrity": "sha512-7eM+hpOtrKrBDCh7Ypu2lJ9Z7PNZBdi/8AT3AX8xoCj43BBVHD0hPSTEvMtkMpfs8FCqBGhxB+uToIQimA111g==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "citty": "^0.1.6",
+ "consola": "^3.4.2",
+ "pathe": "^2.0.3",
+ "pkg-types": "^2.3.0",
+ "tinyexec": "^1.0.1"
+ },
+ "bin": {
+ "nypm": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": "^14.16.0 || >=16.10.0"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/ohash": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz",
+ "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/on-headers": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "license": "ISC",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/onetime": {
+ "version": "6.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "mimic-fn": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "4.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-locate/node_modules/p-limit": {
+ "version": "2.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-try": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-try": {
+ "version": "2.2.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/pac-proxy-agent": {
+ "version": "7.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "@tootallnate/quickjs-emscripten": "^0.23.0",
+ "agent-base": "^7.1.2",
+ "debug": "^4.3.4",
+ "get-uri": "^6.0.1",
+ "http-proxy-agent": "^7.0.0",
+ "https-proxy-agent": "^7.0.6",
+ "pac-resolver": "^7.0.1",
+ "socks-proxy-agent": "^8.0.5"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/pac-resolver": {
+ "version": "7.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "degenerator": "^5.0.0",
+ "netmask": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/pako": {
+ "version": "0.2.9",
+ "license": "MIT"
+ },
+ "node_modules/parse-json": {
+ "version": "5.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.0.0",
+ "error-ex": "^1.3.1",
+ "json-parse-even-better-errors": "^2.3.0",
+ "lines-and-columns": "^1.1.6"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "license": "MIT"
+ },
+ "node_modules/path-to-regexp": {
+ "version": "8.3.0",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/perfect-debounce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
+ "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/pg": {
+ "version": "8.16.3",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz",
+ "integrity": "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==",
+ "license": "MIT",
+ "dependencies": {
+ "pg-connection-string": "^2.9.1",
+ "pg-pool": "^3.10.1",
+ "pg-protocol": "^1.10.3",
+ "pg-types": "2.2.0",
+ "pgpass": "1.0.5"
+ },
+ "engines": {
+ "node": ">= 16.0.0"
+ },
+ "optionalDependencies": {
+ "pg-cloudflare": "^1.2.7"
+ },
+ "peerDependencies": {
+ "pg-native": ">=3.0.1"
+ },
+ "peerDependenciesMeta": {
+ "pg-native": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/pg-cloudflare": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.2.7.tgz",
+ "integrity": "sha512-YgCtzMH0ptvZJslLM1ffsY4EuGaU0cx4XSdXLRFae8bPP4dS5xL1tNB3k2o/N64cHJpwU7dxKli/nZ2lUa5fLg==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/pg-connection-string": {
+ "version": "2.9.1",
+ "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.9.1.tgz",
+ "integrity": "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==",
+ "license": "MIT"
+ },
+ "node_modules/pg-int8": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
+ "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/pg-pool": {
+ "version": "3.10.1",
+ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.10.1.tgz",
+ "integrity": "sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==",
+ "license": "MIT",
+ "peerDependencies": {
+ "pg": ">=8.0"
+ }
+ },
+ "node_modules/pg-protocol": {
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.10.3.tgz",
+ "integrity": "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==",
+ "license": "MIT"
+ },
+ "node_modules/pg-types": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
+ "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
+ "license": "MIT",
+ "dependencies": {
+ "pg-int8": "1.0.1",
+ "postgres-array": "~2.0.0",
+ "postgres-bytea": "~1.0.0",
+ "postgres-date": "~1.0.4",
+ "postgres-interval": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/pgpass": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
+ "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
+ "license": "MIT",
+ "dependencies": {
+ "split2": "^4.1.0"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/pidusage": {
+ "version": "3.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "^5.2.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/pirates": {
+ "version": "4.0.7",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/pkg-dir": {
+ "version": "4.2.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "find-up": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/pkg-types": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz",
+ "integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.2.2",
+ "exsolve": "^1.0.7",
+ "pathe": "^2.0.3"
+ }
+ },
+ "node_modules/pm2": {
+ "version": "6.0.13",
+ "license": "AGPL-3.0",
+ "dependencies": {
+ "@pm2/agent": "~2.1.1",
+ "@pm2/blessed": "0.1.81",
+ "@pm2/io": "~6.1.0",
+ "@pm2/js-api": "~0.8.0",
+ "@pm2/pm2-version-check": "latest",
+ "ansis": "4.0.0-node10",
+ "async": "3.2.6",
+ "chokidar": "3.6.0",
+ "cli-tableau": "2.0.1",
+ "commander": "2.15.1",
+ "croner": "4.1.97",
+ "dayjs": "1.11.15",
+ "debug": "4.4.3",
+ "enquirer": "2.3.6",
+ "eventemitter2": "5.0.1",
+ "fclone": "1.0.11",
+ "js-yaml": "4.1.0",
+ "mkdirp": "1.0.4",
+ "needle": "2.4.0",
+ "pidusage": "3.0.2",
+ "pm2-axon": "~4.0.1",
+ "pm2-axon-rpc": "~0.7.1",
+ "pm2-deploy": "~1.0.2",
+ "pm2-multimeter": "^0.1.2",
+ "promptly": "2.2.0",
+ "semver": "7.7.2",
+ "source-map-support": "0.5.21",
+ "sprintf-js": "1.1.2",
+ "vizion": "~2.2.1"
+ },
+ "bin": {
+ "pm2": "bin/pm2",
+ "pm2-dev": "bin/pm2-dev",
+ "pm2-docker": "bin/pm2-docker",
+ "pm2-runtime": "bin/pm2-runtime"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ },
+ "optionalDependencies": {
+ "pm2-sysmonit": "^1.2.8"
+ }
+ },
+ "node_modules/pm2-axon": {
+ "version": "4.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "amp": "~0.3.1",
+ "amp-message": "~0.1.1",
+ "debug": "^4.3.1",
+ "escape-string-regexp": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=5"
+ }
+ },
+ "node_modules/pm2-axon-rpc": {
+ "version": "0.7.1",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=5"
+ }
+ },
+ "node_modules/pm2-deploy": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "run-series": "^1.1.8",
+ "tv4": "^1.3.0"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/pm2-multimeter": {
+ "version": "0.1.2",
+ "license": "MIT/X11",
+ "dependencies": {
+ "charm": "~0.1.1"
+ }
+ },
+ "node_modules/pm2-sysmonit": {
+ "version": "1.2.8",
+ "license": "Apache",
+ "optional": true,
+ "dependencies": {
+ "async": "^3.2.0",
+ "debug": "^4.3.1",
+ "pidusage": "^2.0.21",
+ "systeminformation": "^5.7",
+ "tx2": "~1.0.4"
+ }
+ },
+ "node_modules/pm2-sysmonit/node_modules/pidusage": {
+ "version": "2.0.21",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "safe-buffer": "^5.2.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/pm2/node_modules/semver": {
+ "version": "7.7.2",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/postgres-array": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
+ "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/postgres-bytea": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
+ "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postgres-date": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
+ "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postgres-interval": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
+ "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "xtend": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/prebuild-install": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
+ "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
+ "license": "MIT",
+ "dependencies": {
+ "detect-libc": "^2.0.0",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^2.0.0",
+ "node-abi": "^3.3.0",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^4.0.0",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0"
+ },
+ "bin": {
+ "prebuild-install": "bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/pretty-format": {
+ "version": "29.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jest/schemas": "^29.6.3",
+ "ansi-styles": "^5.0.0",
+ "react-is": "^18.0.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ }
+ },
+ "node_modules/pretty-format/node_modules/ansi-styles": {
+ "version": "5.2.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/prisma": {
+ "version": "6.19.0",
+ "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.19.0.tgz",
+ "integrity": "sha512-F3eX7K+tWpkbhl3l4+VkFtrwJlLXbAM+f9jolgoUZbFcm1DgHZ4cq9AgVEgUym2au5Ad/TDLN8lg83D+M10ycw==",
+ "devOptional": true,
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/config": "6.19.0",
+ "@prisma/engines": "6.19.0"
+ },
+ "bin": {
+ "prisma": "build/index.js"
+ },
+ "engines": {
+ "node": ">=18.18"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.1.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/promptly": {
+ "version": "2.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "read": "^1.0.4"
+ }
+ },
+ "node_modules/prompts": {
+ "version": "2.4.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kleur": "^3.0.3",
+ "sisteransi": "^1.0.5"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/proxy-agent": {
+ "version": "6.4.0",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.0.2",
+ "debug": "^4.3.4",
+ "http-proxy-agent": "^7.0.1",
+ "https-proxy-agent": "^7.0.3",
+ "lru-cache": "^7.14.1",
+ "pac-proxy-agent": "^7.0.1",
+ "proxy-from-env": "^1.1.0",
+ "socks-proxy-agent": "^8.0.2"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "license": "MIT"
+ },
+ "node_modules/pstree.remy": {
+ "version": "1.1.8",
+ "license": "MIT"
+ },
+ "node_modules/pump": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
+ "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==",
+ "license": "MIT",
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "node_modules/pure-rand": {
+ "version": "6.1.0",
+ "devOptional": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/dubzzz"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fast-check"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/qs": {
+ "version": "6.14.0",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "side-channel": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/random-bytes": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "3.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "3.1.2",
+ "http-errors": "2.0.0",
+ "iconv-lite": "0.7.0",
+ "unpipe": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/raw-body/node_modules/iconv-lite": {
+ "version": "0.7.0",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
+ "dependencies": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "bin": {
+ "rc": "cli.js"
+ }
+ },
+ "node_modules/rc/node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rc9": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/rc9/-/rc9-2.1.2.tgz",
+ "integrity": "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "defu": "^6.1.4",
+ "destr": "^2.0.3"
+ }
+ },
+ "node_modules/react-is": {
+ "version": "18.3.1",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/read": {
+ "version": "1.0.7",
+ "license": "ISC",
+ "dependencies": {
+ "mute-stream": "~0.0.4"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/read/node_modules/mute-stream": {
+ "version": "0.0.8",
+ "license": "ISC"
+ },
+ "node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "license": "MIT",
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/regenerate": {
+ "version": "1.4.2",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/regenerate-unicode-properties": {
+ "version": "10.2.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "regenerate": "^1.4.2"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/regexpu-core": {
+ "version": "6.4.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "regenerate": "^1.4.2",
+ "regenerate-unicode-properties": "^10.2.2",
+ "regjsgen": "^0.8.0",
+ "regjsparser": "^0.13.0",
+ "unicode-match-property-ecmascript": "^2.0.0",
+ "unicode-match-property-value-ecmascript": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/regjsgen": {
+ "version": "0.8.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/regjsparser": {
+ "version": "0.13.0",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "jsesc": "~3.1.0"
+ },
+ "bin": {
+ "regjsparser": "bin/parser"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/require-in-the-middle": {
+ "version": "5.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.1.1",
+ "module-details-from-path": "^1.0.3",
+ "resolve": "^1.22.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/resolve": {
+ "version": "1.22.11",
+ "license": "MIT",
+ "dependencies": {
+ "is-core-module": "^2.16.1",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/resolve-cwd": {
+ "version": "3.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "resolve-from": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "5.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/resolve.exports": {
+ "version": "2.0.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/router": {
+ "version": "2.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "is-promise": "^4.0.0",
+ "parseurl": "^1.3.3",
+ "path-to-regexp": "^8.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/run-async": {
+ "version": "4.0.6",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/run-series": {
+ "version": "1.1.9",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/rxjs": {
+ "version": "7.8.2",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "tslib": "^2.1.0"
+ }
+ },
+ "node_modules/rxjs/node_modules/tslib": {
+ "version": "2.8.1",
+ "license": "0BSD"
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "license": "MIT"
+ },
+ "node_modules/sax": {
+ "version": "1.4.3",
+ "license": "BlueOak-1.0.0"
+ },
+ "node_modules/semver": {
+ "version": "7.7.3",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/send": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.3.5",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "mime-types": "^3.0.1",
+ "ms": "^2.1.3",
+ "on-finished": "^2.4.1",
+ "range-parser": "^1.2.1",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "2.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "parseurl": "^1.3.3",
+ "send": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "license": "ISC"
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shell-escape": {
+ "version": "0.2.0",
+ "license": "MIT"
+ },
+ "node_modules/shimmer": {
+ "version": "1.2.1",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3",
+ "side-channel-list": "^1.0.0",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/signal-exit": {
+ "version": "3.0.7",
+ "license": "ISC"
+ },
+ "node_modules/simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/simple-get": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
+ "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
+ "node_modules/simple-update-notifier": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/sisteransi": {
+ "version": "1.0.5",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/slash": {
+ "version": "3.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/smart-buffer": {
+ "version": "4.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6.0.0",
+ "npm": ">= 3.0.0"
+ }
+ },
+ "node_modules/socks": {
+ "version": "2.8.7",
+ "license": "MIT",
+ "dependencies": {
+ "ip-address": "^10.0.1",
+ "smart-buffer": "^4.2.0"
+ },
+ "engines": {
+ "node": ">= 10.0.0",
+ "npm": ">= 3.0.0"
+ }
+ },
+ "node_modules/socks-proxy-agent": {
+ "version": "8.0.5",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "^4.3.4",
+ "socks": "^2.8.3"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/source-map-support": {
+ "version": "0.5.21",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "node_modules/split2": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
+ "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 10.x"
+ }
+ },
+ "node_modules/sprintf-js": {
+ "version": "1.1.2",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/stack-utils": {
+ "version": "2.0.6",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "escape-string-regexp": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/stack-utils/node_modules/escape-string-regexp": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "node_modules/string-length": {
+ "version": "4.0.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "char-regex": "^1.0.2",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/string-length/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-length/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "7.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^10.3.0",
+ "get-east-asian-width": "^1.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "7.1.2",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/strip-bom": {
+ "version": "4.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-final-newline": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/systeminformation": {
+ "version": "5.27.11",
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin",
+ "linux",
+ "win32",
+ "freebsd",
+ "openbsd",
+ "netbsd",
+ "sunos",
+ "android"
+ ],
+ "bin": {
+ "systeminformation": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "funding": {
+ "type": "Buy me a coffee",
+ "url": "https://www.buymeacoffee.com/systeminfo"
+ }
+ },
+ "node_modules/tar-fs": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz",
+ "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==",
+ "license": "MIT",
+ "dependencies": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "node_modules/tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tcp-ping": {
+ "version": "0.1.1",
+ "license": "MIT"
+ },
+ "node_modules/test-exclude": {
+ "version": "6.0.0",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^7.1.4",
+ "minimatch": "^3.0.4"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/tinyexec": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz",
+ "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==",
+ "devOptional": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tmpl": {
+ "version": "1.0.5",
+ "dev": true,
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/touch": {
+ "version": "3.1.1",
+ "license": "ISC",
+ "bin": {
+ "nodetouch": "bin/nodetouch.js"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "1.9.3",
+ "license": "Apache-2.0"
+ },
+ "node_modules/tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/tv4": {
+ "version": "1.3.0",
+ "license": [
+ {
+ "type": "Public Domain",
+ "url": "http://geraintluff.github.io/tv4/LICENSE.txt"
+ },
+ {
+ "type": "MIT",
+ "url": "http://jsonary.com/LICENSE.txt"
+ }
+ ],
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/tx2": {
+ "version": "1.0.5",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "json-stringify-safe": "^5.0.1"
+ }
+ },
+ "node_modules/type-detect": {
+ "version": "4.0.8",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/type-fest": {
+ "version": "0.21.3",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "content-type": "^1.0.5",
+ "media-typer": "^1.1.0",
+ "mime-types": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/uid-safe": {
+ "version": "2.1.5",
+ "license": "MIT",
+ "dependencies": {
+ "random-bytes": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/undefsafe": {
+ "version": "2.0.5",
+ "license": "MIT"
+ },
+ "node_modules/undici-types": {
+ "version": "7.16.0",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/unicode-canonical-property-names-ecmascript": {
+ "version": "2.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/unicode-match-property-ecmascript": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "unicode-canonical-property-names-ecmascript": "^2.0.0",
+ "unicode-property-aliases-ecmascript": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/unicode-match-property-value-ecmascript": {
+ "version": "2.2.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/unicode-property-aliases-ecmascript": {
+ "version": "2.2.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.1.4",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "license": "MIT"
+ },
+ "node_modules/uuid": {
+ "version": "13.0.0",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist-node/bin/uuid"
+ }
+ },
+ "node_modules/v8-to-istanbul": {
+ "version": "9.3.0",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "^0.3.12",
+ "@types/istanbul-lib-coverage": "^2.0.1",
+ "convert-source-map": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10.12.0"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/vizion": {
+ "version": "2.2.1",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "async": "^2.6.3",
+ "git-node-fs": "^1.0.0",
+ "ini": "^1.3.5",
+ "js-git": "^0.7.8"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/vizion/node_modules/async": {
+ "version": "2.6.4",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.14"
+ }
+ },
+ "node_modules/walker": {
+ "version": "1.0.8",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "makeerror": "1.0.12"
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "9.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.1",
+ "string-width": "^7.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "license": "ISC"
+ },
+ "node_modules/write-file-atomic": {
+ "version": "4.0.2",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "imurmurhash": "^0.1.4",
+ "signal-exit": "^3.0.7"
+ },
+ "engines": {
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+ }
+ },
+ "node_modules/ws": {
+ "version": "7.5.10",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.3.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": "^5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yallist": {
+ "version": "4.0.0",
+ "license": "ISC"
+ },
+ "node_modules/yargs": {
+ "version": "18.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^9.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "string-width": "^7.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^22.0.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.12.0 || >=23"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "22.0.0",
+ "license": "ISC",
+ "engines": {
+ "node": "^20.19.0 || ^22.12.0 || >=23"
+ }
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..45ab95f
--- /dev/null
+++ b/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "localping",
+ "version": "0.1.0",
+ "description": "A local system uptime monitor - Quick-fix your homelab remotely",
+ "main": "src/app.js",
+ "scripts": {
+ "start": "node src/app.js",
+ "dev": "nodemon src/app.js",
+ "gui": "electron src/electron/main.js",
+ "web": "node src/app.js --mode web",
+ "pm2:start": "pm2 start ecosystem.config.js",
+ "pm2:stop": "pm2 stop all",
+ "pm2:logs": "pm2 logs",
+ "pm2:restart": "pm2 restart all",
+ "test": "jest",
+ "test:watch": "jest --watch",
+ "test:coverage": "jest --coverage",
+ "test:backup": "jest __tests__/services/backupService.test.js",
+ "test:backup:watch": "jest __tests__/services/backupService.test.js --watch",
+ "verify:ping": "node scripts/verify-ping-data.js",
+ "prisma:generate": "prisma generate",
+ "prisma:push": "prisma db push",
+ "prisma:studio": "prisma studio",
+ "postinstall": "prisma generate"
+ },
+ "keywords": [
+ "uptime",
+ "monitoring",
+ "homelab",
+ "ping",
+ "dashboard"
+ ],
+ "author": "Your Name",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16.0.0"
+ },
+ "dependencies": {
+ "@prisma/client": "^6.8.2",
+ "axios": "^1.13.2",
+ "better-sqlite3": "^12.4.5",
+ "chalk": "^5.6.2",
+ "cors": "^2.8.5",
+ "default-gateway": "^7.2.2",
+ "dotenv": "^17.2.3",
+ "ejs": "^3.1.10",
+ "electron-is-dev": "^3.0.1",
+ "express": "^5.1.0",
+ "express-session": "^1.17.3",
+ "express-ws": "^5.0.2",
+ "inquirer": "^13.0.1",
+ "isomorphic-form-data": "^2.0.0",
+ "nodemon": "^3.1.11",
+ "pg": "^8.13.1",
+ "pm2": "^6.0.13",
+ "shell-escape": "^0.2.0",
+ "tcp-ping": "^0.1.1",
+ "uuid": "^13.0.0",
+ "yargs": "^18.0.0"
+ },
+ "devDependencies": {
+ "@babel/preset-env": "^7.28.5",
+ "@babel/preset-typescript": "^7.28.5",
+ "jest": "^29.7.0",
+ "prisma": "^6.8.2"
+ }
+}
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
new file mode 100644
index 0000000..a32a529
--- /dev/null
+++ b/prisma/schema.prisma
@@ -0,0 +1,227 @@
+// Prisma Schema for LocalPing
+// Run `npx prisma generate` after changes
+// Run `npx prisma db push` to sync with database
+
+generator client {
+ provider = "prisma-client-js"
+}
+
+datasource db {
+ provider = "postgresql"
+ url = env("DATABASE_URL")
+}
+
+model Target {
+ id String @id @default(uuid()) @map("_id")
+ name String @unique
+ host String
+ protocol String
+ port Int?
+ path String?
+ enabled Boolean @default(true)
+ publicVisible Boolean @default(true)
+ publicShowDetails Boolean @default(false)
+ publicShowStatus Boolean @default(true)
+ publicShowAppLink Boolean @default(true)
+ interval Int @default(60)
+ retries Int @default(0)
+ retryInterval Int @default(5)
+ timeout Int @default(30)
+ httpMethod String @default("GET")
+ statusCodes String @default("200-299")
+ maxRedirects Int @default(5)
+ ignoreSsl Boolean @default(false)
+ upsideDown Boolean @default(false)
+ important Boolean @default(false)
+ auth Json?
+ appUrl String?
+ appIcon String?
+ position Int @default(0)
+ group String?
+ quickCommands Json?
+ description String?
+ tier String @default("normal") // featured | normal | background
+ linkPublic Boolean @default(true)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ pingResults PingResult[]
+ alerts Alert[]
+ statistics Statistic[]
+ actions Action[]
+
+ @@map("targets")
+}
+
+model PingResult {
+ id String @id @default(uuid()) @map("_id")
+ targetId String
+ success Boolean
+ responseTime Int?
+ timestamp DateTime @default(now())
+ statusCode Int?
+ error String?
+ protocol String?
+
+ target Target @relation(fields: [targetId], references: [id], onDelete: Cascade)
+
+ @@index([targetId])
+ @@index([timestamp])
+ @@index([targetId, timestamp])
+ @@map("pingResults")
+}
+
+model Alert {
+ id String @id @default(uuid()) @map("_id")
+ targetId String
+ type String
+ timestamp DateTime @default(now())
+ message String?
+
+ target Target @relation(fields: [targetId], references: [id], onDelete: Cascade)
+
+ @@index([targetId])
+ @@index([timestamp])
+ @@map("alerts")
+}
+
+model Statistic {
+ id String @id @default(uuid()) @map("_id")
+ targetId String
+ date DateTime @db.Date
+ totalPings Int @default(0)
+ successfulPings Int @default(0)
+ failedPings Int @default(0)
+ uptime Float @default(0)
+ lastResponseTime Int @default(0)
+ avgResponseTime Float @default(0)
+ minResponseTime Int?
+ maxResponseTime Int?
+
+ target Target @relation(fields: [targetId], references: [id], onDelete: Cascade)
+
+ @@unique([targetId, date])
+ @@index([targetId])
+ @@index([date])
+ @@map("statistics")
+}
+
+model Incident {
+ id String @id @default(uuid()) @map("_id")
+ title String
+ description String?
+ severity String @default("major")
+ status String @default("investigating")
+ affectedServices Json?
+ updates Json?
+ resolvedAt DateTime?
+ isScheduled Boolean @default(false)
+ scheduledStart DateTime?
+ scheduledEnd DateTime?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ @@index([status])
+ @@index([isScheduled, scheduledStart])
+ @@map("incidents")
+}
+
+model EventRule {
+ id String @id @default(uuid()) @map("_id")
+ name String
+ eventType String
+ enabled Boolean @default(true)
+ conditions Json
+ incidentTitle String
+ incidentDescription String
+ incidentSeverity String @default("major")
+ incidentStatus String @default("investigating")
+ autoResolve Boolean @default(false)
+ autoResolveMessage String?
+ cooldownMinutes Int @default(0)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ @@index([enabled])
+ @@map("eventRules")
+}
+
+model Action {
+ id String @id @default(uuid()) @map("_id")
+ targetId String
+ name String
+ type String
+ command String?
+ createdAt DateTime @default(now())
+
+ target Target @relation(fields: [targetId], references: [id], onDelete: Cascade)
+
+ @@unique([targetId, name])
+ @@index([targetId])
+ @@map("actions")
+}
+
+model Favicon {
+ id String @id @default(uuid()) @map("_id")
+ appUrl String @unique
+ favicon String?
+ updatedAt DateTime @updatedAt
+
+ @@map("favicons")
+}
+
+model SiteBrand {
+ id String @id @default("brand") @map("_id")
+ name String?
+ accent String?
+ tagline String?
+ iconData Bytes?
+ iconType String?
+ updatedAt DateTime @updatedAt
+
+ @@map("siteBrand")
+}
+
+model PublicUISettings {
+ id String @id @default("settings") @map("_id")
+ title String @default("Homelab")
+ subtitle String @default("System Status & Application Dashboard")
+ customCSS String?
+ updatedAt DateTime @updatedAt
+
+ @@map("publicUISettings")
+}
+
+model AdminSettings {
+ id String @id @default("settings") @map("_id")
+ sessionDurationDays Int @default(30)
+ dataRetentionDays Int @default(30)
+ debugLogging Boolean @default(false)
+ updatedAt DateTime @updatedAt
+
+ @@map("adminSettings")
+}
+
+model NotificationSettings {
+ id String @id @default("settings") @map("_id")
+ enabled Boolean @default(false)
+ discord Json?
+ events Json?
+ monitorDownDelayMinutes Int @default(5)
+ updatedAt DateTime @updatedAt
+
+ @@map("notificationSettings")
+}
+
+model Post {
+ id String @id @default(uuid()) @map("_id")
+ title String
+ content String
+ published Boolean @default(true)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ @@index([published])
+ @@index([createdAt])
+ @@map("posts")
+}
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 0000000..7f151fb
--- /dev/null
+++ b/scripts/README.md
@@ -0,0 +1,38 @@
+# CDN Library Download Scripts
+
+These scripts download all external CDN libraries locally to make the project self-sustainable and work offline.
+
+## Usage
+
+### Option 1: Bash Script (Linux/macOS)
+
+```bash
+./scripts/download-cdn-libs.sh
+```
+
+### Option 2: Node.js Script (Cross-platform)
+
+```bash
+node scripts/download-cdn-libs.js
+```
+
+## What Gets Downloaded
+
+The scripts will download the following libraries to `src/public/vendor/`:
+
+1. **Tailwind CSS** β `vendor/tailwindcss.js`
+2. **Chart.js** β `vendor/chart.js`
+3. **Axios** β `vendor/axios.min.js`
+4. **Marked** (Markdown parser) β `vendor/marked.min.js`
+5. **Font Awesome** β `vendor/font-awesome/all.min.css` + webfonts
+
+## After Running
+
+All view files have already been updated to use local paths instead of CDN URLs. The libraries will be served from `/vendor/` when the application runs.
+
+## Notes
+
+- Make sure you have an internet connection when running these scripts
+- The scripts will create the necessary directory structure automatically
+- Font Awesome CSS paths are automatically updated to point to local webfonts
+
diff --git a/scripts/create-db-user.sh b/scripts/create-db-user.sh
new file mode 100755
index 0000000..48fb706
--- /dev/null
+++ b/scripts/create-db-user.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# Create PostgreSQL user and database for localping
+
+echo "π§ Creating PostgreSQL user and database..."
+
+# Check if PostgreSQL is running
+if ! pg_isready > /dev/null 2>&1; then
+ echo "β PostgreSQL is not running. Start it with: sudo systemctl start postgresql"
+ exit 1
+fi
+
+# Create user if it doesn't exist
+echo "π€ Creating user 'localping'..."
+sudo -u postgres psql -c "SELECT 1 FROM pg_roles WHERE rolname='localping';" | grep -q 1 || \
+ sudo -u postgres psql -c "CREATE USER localping WITH PASSWORD 'localping';"
+
+if [ $? -eq 0 ]; then
+ echo "β
User 'localping' created or already exists"
+else
+ echo "β οΈ User creation may have failed (might already exist)"
+fi
+
+# Create database if it doesn't exist
+echo "ποΈ Creating database 'localping'..."
+sudo -u postgres psql -c "SELECT 1 FROM pg_database WHERE datname='localping';" | grep -q 1 || \
+ sudo -u postgres psql -c "CREATE DATABASE localping OWNER localping;"
+
+if [ $? -eq 0 ]; then
+ echo "β
Database 'localping' created or already exists"
+else
+ echo "β οΈ Database creation may have failed (might already exist)"
+fi
+
+# Grant privileges
+echo "π Granting privileges..."
+sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE localping TO localping;"
+
+echo ""
+echo "β
Setup complete! The app should now be able to connect."
+echo ""
+echo "π‘ If you want to use a different password, update your .env file:"
+echo " DB_PASSWORD=your_password_here"
+echo ""
+echo " Then run this script again with the new password in the CREATE USER command."
+
diff --git a/scripts/download-cdn-libs.js b/scripts/download-cdn-libs.js
new file mode 100755
index 0000000..cc19eee
--- /dev/null
+++ b/scripts/download-cdn-libs.js
@@ -0,0 +1,204 @@
+#!/usr/bin/env node
+
+/**
+ * Script to download all CDN libraries locally for offline use
+ * This makes the project self-sustainable without internet connection
+ */
+
+const https = require('https');
+const http = require('http');
+const fs = require('fs');
+const path = require('path');
+const { URL } = require('url');
+
+const PROJECT_ROOT = path.join(__dirname, '..');
+const VENDOR_DIR = path.join(PROJECT_ROOT, 'src', 'public', 'vendor');
+const FONTAWESOME_DIR = path.join(VENDOR_DIR, 'font-awesome');
+
+// Colors for console output
+const colors = {
+ green: '\x1b[32m',
+ yellow: '\x1b[33m',
+ reset: '\x1b[0m'
+};
+
+function log(message, color = 'reset') {
+ console.log(`${colors[color]}${message}${colors.reset}`);
+}
+
+// Create directories
+function ensureDir(dir) {
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+}
+
+// Download file function
+function downloadFile(url, outputPath, maxRedirects = 5) {
+ return new Promise((resolve, reject) => {
+ if (maxRedirects <= 0) {
+ reject(new Error('Too many redirects'));
+ return;
+ }
+
+ const parsedUrl = new URL(url);
+ const protocol = parsedUrl.protocol === 'https:' ? https : http;
+
+ const file = fs.createWriteStream(outputPath);
+
+ const request = protocol.get(url, (response) => {
+ if (response.statusCode === 301 || response.statusCode === 302 || response.statusCode === 307 || response.statusCode === 308) {
+ file.close();
+ if (fs.existsSync(outputPath)) {
+ fs.unlinkSync(outputPath);
+ }
+
+ // Handle redirects - resolve relative URLs
+ let redirectUrl = response.headers.location;
+ if (!redirectUrl) {
+ reject(new Error(`Redirect without location header from ${url}`));
+ return;
+ }
+
+ // Resolve relative URLs
+ if (redirectUrl.startsWith('/')) {
+ redirectUrl = `${parsedUrl.protocol}//${parsedUrl.host}${redirectUrl}`;
+ } else if (!redirectUrl.startsWith('http://') && !redirectUrl.startsWith('https://')) {
+ redirectUrl = new URL(redirectUrl, url).href;
+ }
+
+ return downloadFile(redirectUrl, outputPath, maxRedirects - 1)
+ .then(resolve)
+ .catch(reject);
+ }
+
+ if (response.statusCode !== 200) {
+ file.close();
+ if (fs.existsSync(outputPath)) {
+ fs.unlinkSync(outputPath);
+ }
+ reject(new Error(`Failed to download ${url}: ${response.statusCode}`));
+ return;
+ }
+
+ response.pipe(file);
+
+ file.on('finish', () => {
+ file.close();
+ resolve();
+ });
+ });
+
+ request.on('error', (err) => {
+ file.close();
+ if (fs.existsSync(outputPath)) {
+ fs.unlinkSync(outputPath);
+ }
+ reject(err);
+ });
+
+ file.on('error', (err) => {
+ file.close();
+ if (fs.existsSync(outputPath)) {
+ fs.unlinkSync(outputPath);
+ }
+ reject(err);
+ });
+ });
+}
+
+async function main() {
+ log('Starting CDN library download...', 'green');
+
+ // Create directories
+ ensureDir(VENDOR_DIR);
+ ensureDir(FONTAWESOME_DIR);
+ ensureDir(path.join(FONTAWESOME_DIR, 'webfonts'));
+
+ const downloads = [
+ {
+ name: 'Tailwind CSS',
+ url: 'https://cdn.tailwindcss.com',
+ output: path.join(VENDOR_DIR, 'tailwindcss.js')
+ },
+ {
+ name: 'Chart.js',
+ url: 'https://cdn.jsdelivr.net/npm/chart.js',
+ output: path.join(VENDOR_DIR, 'chart.js')
+ },
+ {
+ name: 'Axios',
+ url: 'https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js',
+ output: path.join(VENDOR_DIR, 'axios.min.js')
+ },
+ {
+ name: 'Marked',
+ url: 'https://cdn.jsdelivr.net/npm/marked/marked.min.js',
+ output: path.join(VENDOR_DIR, 'marked.min.js')
+ },
+ {
+ name: 'Font Awesome CSS',
+ url: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css',
+ output: path.join(FONTAWESOME_DIR, 'all.min.css')
+ }
+ ];
+
+ // Download main libraries
+ for (let i = 0; i < downloads.length; i++) {
+ const item = downloads[i];
+ log(`[${i + 1}/${downloads.length}] Downloading ${item.name}...`, 'green');
+ log(` URL: ${item.url}`, 'yellow');
+
+ try {
+ await downloadFile(item.url, item.output);
+ log(` β Saved to: ${item.output}`, 'green');
+ } catch (error) {
+ log(` β Failed: ${error.message}`, 'yellow');
+ throw error;
+ }
+ }
+
+ // Download Font Awesome fonts
+ log('\nDownloading Font Awesome webfonts...', 'yellow');
+ const fontFiles = [
+ 'fa-solid-900.woff2',
+ 'fa-regular-400.woff2',
+ 'fa-brands-400.woff2',
+ 'fa-v4compatibility.woff2'
+ ];
+
+ for (const font of fontFiles) {
+ const url = `https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/${font}`;
+ const output = path.join(FONTAWESOME_DIR, 'webfonts', font);
+
+ log(` Downloading ${font}...`, 'yellow');
+ try {
+ await downloadFile(url, output);
+ log(` β Saved: ${font}`, 'green');
+ } catch (error) {
+ log(` β Failed to download ${font}: ${error.message}`, 'yellow');
+ }
+ }
+
+ // Update Font Awesome CSS to use local paths
+ log('\nUpdating Font Awesome CSS paths...', 'yellow');
+ const cssPath = path.join(FONTAWESOME_DIR, 'all.min.css');
+ let cssContent = fs.readFileSync(cssPath, 'utf8');
+
+ // Replace relative paths with absolute paths
+ cssContent = cssContent.replace(/url\(\.\.\/webfonts\//g, 'url(/vendor/font-awesome/webfonts/');
+ cssContent = cssContent.replace(/url\(webfonts\//g, 'url(/vendor/font-awesome/webfonts/');
+
+ fs.writeFileSync(cssPath, cssContent);
+ log(' β Updated CSS paths', 'green');
+
+ log('\nβ All libraries downloaded successfully!', 'green');
+ log(`Files saved to: ${VENDOR_DIR}`, 'green');
+ log('\nNext step: Update view files to use local paths instead of CDN URLs', 'yellow');
+}
+
+main().catch((error) => {
+ console.error('Error:', error);
+ process.exit(1);
+});
+
diff --git a/scripts/download-cdn-libs.sh b/scripts/download-cdn-libs.sh
new file mode 100755
index 0000000..6f1cd9f
--- /dev/null
+++ b/scripts/download-cdn-libs.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+# Script to download all CDN libraries locally for offline use
+# This makes the project self-sustainable without internet connection
+
+set -e
+
+# Colors for output
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Base directories
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
+VENDOR_DIR="$PROJECT_ROOT/src/public/vendor"
+FONTAWESOME_DIR="$VENDOR_DIR/font-awesome"
+
+echo -e "${GREEN}Starting CDN library download...${NC}"
+
+# Create vendor directory
+mkdir -p "$VENDOR_DIR"
+mkdir -p "$FONTAWESOME_DIR"
+
+# Function to download file
+download_file() {
+ local url=$1
+ local output=$2
+ echo -e "${YELLOW}Downloading: $url${NC}"
+ curl -L -f -s "$url" -o "$output" || {
+ echo "Failed to download $url"
+ return 1
+ }
+ echo -e "${GREEN}β Saved to: $output${NC}"
+}
+
+# 1. Download Tailwind CSS (standalone build)
+echo -e "\n${GREEN}[1/5] Downloading Tailwind CSS...${NC}"
+download_file "https://cdn.tailwindcss.com" "$VENDOR_DIR/tailwindcss.js"
+
+# 2. Download Chart.js
+echo -e "\n${GREEN}[2/5] Downloading Chart.js...${NC}"
+download_file "https://cdn.jsdelivr.net/npm/chart.js" "$VENDOR_DIR/chart.js"
+
+# 3. Download Axios
+echo -e "\n${GREEN}[3/5] Downloading Axios...${NC}"
+download_file "https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" "$VENDOR_DIR/axios.min.js"
+
+# 4. Download Marked (Markdown parser)
+echo -e "\n${GREEN}[4/5] Downloading Marked...${NC}"
+download_file "https://cdn.jsdelivr.net/npm/marked/marked.min.js" "$VENDOR_DIR/marked.min.js"
+
+# 5. Download Font Awesome CSS and fonts
+echo -e "\n${GREEN}[5/5] Downloading Font Awesome...${NC}"
+download_file "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" "$FONTAWESOME_DIR/all.min.css"
+
+# Download Font Awesome fonts (webfonts)
+echo -e "${YELLOW}Downloading Font Awesome webfonts...${NC}"
+mkdir -p "$FONTAWESOME_DIR/webfonts"
+
+# Get the font file URLs from the CSS
+FONT_FILES=(
+ "fa-solid-900.woff2"
+ "fa-regular-400.woff2"
+ "fa-brands-400.woff2"
+ "fa-v4compatibility.woff2"
+)
+
+for font in "${FONT_FILES[@]}"; do
+ download_file "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/$font" "$FONTAWESOME_DIR/webfonts/$font"
+done
+
+# Update Font Awesome CSS to use local paths
+echo -e "${YELLOW}Updating Font Awesome CSS paths...${NC}"
+sed -i "s|url(../webfonts/|url(/vendor/font-awesome/webfonts/|g" "$FONTAWESOME_DIR/all.min.css"
+sed -i "s|url(webfonts/|url(/vendor/font-awesome/webfonts/|g" "$FONTAWESOME_DIR/all.min.css"
+
+echo -e "\n${GREEN}β All libraries downloaded successfully!${NC}"
+echo -e "${GREEN}Files saved to: $VENDOR_DIR${NC}"
+echo -e "\n${YELLOW}Next step: Update view files to use local paths instead of CDN URLs${NC}"
+
diff --git a/scripts/init-postgres.sh b/scripts/init-postgres.sh
new file mode 100755
index 0000000..0b2d35d
--- /dev/null
+++ b/scripts/init-postgres.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# Initialize PostgreSQL database cluster for Arch Linux
+
+echo "ποΈ Initializing PostgreSQL database cluster..."
+
+# Check if PostgreSQL is installed
+if ! command -v psql &> /dev/null; then
+ echo "β PostgreSQL is not installed. Please install it first:"
+ echo " sudo pacman -S postgresql"
+ exit 1
+fi
+
+# Check if data directory exists and is empty
+DATA_DIR="/var/lib/postgres/data"
+
+if [ -d "$DATA_DIR" ] && [ "$(ls -A $DATA_DIR 2>/dev/null)" ]; then
+ echo "β PostgreSQL data directory already exists and is not empty"
+ echo " If you want to reinitialize, remove it first: sudo rm -rf $DATA_DIR"
+else
+ echo "π¦ Initializing PostgreSQL data directory..."
+ sudo -u postgres initdb --locale=C.UTF-8 --encoding=UTF8 -D "$DATA_DIR"
+
+ if [ $? -eq 0 ]; then
+ echo "β
PostgreSQL database cluster initialized"
+ else
+ echo "β Failed to initialize PostgreSQL"
+ exit 1
+ fi
+fi
+
+# Start PostgreSQL service
+echo "π Starting PostgreSQL service..."
+sudo systemctl start postgresql
+sudo systemctl enable postgresql
+
+# Wait for PostgreSQL to be ready
+echo "β³ Waiting for PostgreSQL to be ready..."
+sleep 2
+
+# Check if PostgreSQL is running
+if pg_isready > /dev/null 2>&1; then
+ echo "β
PostgreSQL is running"
+else
+ echo "β PostgreSQL failed to start. Check logs with: sudo journalctl -u postgresql"
+ exit 1
+fi
+
+# Create database and user if they don't exist
+DB_NAME="localping"
+DB_USER="localping"
+
+echo "π§ Creating database and user..."
+
+# Generate secure password if .env doesn't exist or DB_PASSWORD is not set
+if [ ! -f .env ] || ! grep -q "DB_PASSWORD" .env; then
+ DB_PASSWORD=$(openssl rand -base64 24 | tr -d "=+/" | cut -c1-24)
+ echo "π Generated database password: $DB_PASSWORD"
+ echo " Add this to your .env file: DB_PASSWORD=$DB_PASSWORD"
+else
+ # Extract password from .env file
+ DB_PASSWORD=$(grep "DB_PASSWORD" .env | cut -d '=' -f2 | tr -d '"' | tr -d "'")
+ if [ -z "$DB_PASSWORD" ]; then
+ DB_PASSWORD=$(openssl rand -base64 24 | tr -d "=+/" | cut -c1-24)
+ echo "π Generated database password: $DB_PASSWORD"
+ fi
+fi
+
+# Create user if it doesn't exist
+sudo -u postgres psql -c "SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'" | grep -q 1 || \
+ sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';"
+
+# Create database if it doesn't exist
+sudo -u postgres psql -c "SELECT 1 FROM pg_database WHERE datname='$DB_NAME'" | grep -q 1 || \
+ sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_USER;"
+
+# Grant privileges
+sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
+
+echo "β
PostgreSQL setup complete!"
+echo ""
+echo "π Database connection info:"
+echo " Host: localhost"
+echo " Port: 5432"
+echo " Database: $DB_NAME"
+echo " User: $DB_USER"
+echo " Password: $DB_PASSWORD"
+echo ""
+echo "π‘ Make sure your .env file contains:"
+echo " DB_HOST=localhost"
+echo " DB_PORT=5432"
+echo " DB_NAME=$DB_NAME"
+echo " DB_USER=$DB_USER"
+echo " DB_PASSWORD=$DB_PASSWORD"
+
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
new file mode 100755
index 0000000..a1f95d4
--- /dev/null
+++ b/scripts/run-tests.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Run all unit tests and report results
+# This script should be run after making changes to ensure everything still works
+
+echo "=========================================="
+echo "Running All Unit Tests"
+echo "=========================================="
+echo ""
+
+# Run all tests
+npm test
+
+# Check exit code
+if [ $? -eq 0 ]; then
+ echo ""
+ echo "=========================================="
+ echo "β All tests passed!"
+ echo "=========================================="
+ exit 0
+else
+ echo ""
+ echo "=========================================="
+ echo "β Some tests failed. Please fix errors above."
+ echo "=========================================="
+ exit 1
+fi
+
diff --git a/scripts/test-backup.sh b/scripts/test-backup.sh
new file mode 100755
index 0000000..af4c623
--- /dev/null
+++ b/scripts/test-backup.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Test script for backup/import functionality
+# This script runs the backup service tests and reports any errors
+
+echo "=========================================="
+echo "Running Backup Service Tests"
+echo "=========================================="
+echo ""
+
+# Run the tests
+npm test -- __tests__/services/backupService.test.js
+
+# Check exit code
+if [ $? -eq 0 ]; then
+ echo ""
+ echo "=========================================="
+ echo "β All backup service tests passed!"
+ echo "=========================================="
+ exit 0
+else
+ echo ""
+ echo "=========================================="
+ echo "β Some tests failed. Please fix errors above."
+ echo "=========================================="
+ exit 1
+fi
+
diff --git a/scripts/verify-ping-data.js b/scripts/verify-ping-data.js
new file mode 100755
index 0000000..7ddd7ae
--- /dev/null
+++ b/scripts/verify-ping-data.js
@@ -0,0 +1,113 @@
+#!/usr/bin/env node
+
+/**
+ * Verification script to check if ping data is being saved to the database
+ * Run this script to verify that ping results and statistics are being stored correctly
+ */
+
+require('dotenv').config();
+const { connectDB, getDB } = require('../src/config/db');
+const chalk = require('../src/utils/colors');
+
+async function verifyPingData() {
+ try {
+ console.log(chalk.cyan('Connecting to database...'));
+ await connectDB();
+ const db = getDB();
+
+ console.log(chalk.cyan('\n=== Verifying Ping Data ===\n'));
+
+ // Check targets
+ const targets = await db.collection('targets').find({ enabled: true }).toArray();
+ console.log(chalk.yellow(`Found ${targets.length} enabled target(s)\n`));
+
+ if (targets.length === 0) {
+ console.log(chalk.red('β No enabled targets found. Please create and enable at least one target.'));
+ process.exit(1);
+ }
+
+ // Check ping results for each target
+ for (const target of targets) {
+ console.log(chalk.cyan(`\n--- Target: ${target.name} (${target._id}) ---`));
+
+ // Get recent ping results (last 24 hours)
+ const oneDayAgo = new Date();
+ oneDayAgo.setHours(oneDayAgo.getHours() - 24);
+
+ const recentPings = await db.collection('pingResults').find({
+ targetId: target._id,
+ timestamp: { $gte: oneDayAgo }
+ }).toArray();
+
+ console.log(` Recent ping results (last 24h): ${recentPings.length}`);
+
+ if (recentPings.length > 0) {
+ const latest = recentPings[recentPings.length - 1];
+ const latestTime = new Date(latest.timestamp);
+ const minutesAgo = Math.floor((Date.now() - latestTime.getTime()) / 1000 / 60);
+ console.log(chalk.green(` β Latest ping: ${minutesAgo} minutes ago`));
+ console.log(` Success: ${latest.success}, Response Time: ${latest.responseTime || 'N/A'}ms`);
+ } else {
+ console.log(chalk.red(` β No ping results found in last 24 hours`));
+ }
+
+ // Get total ping results
+ const totalPings = await db.collection('pingResults').find({
+ targetId: target._id
+ }).toArray();
+ console.log(` Total ping results: ${totalPings.length}`);
+
+ // Check statistics
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ const todayStats = await db.collection('statistics').findOne({
+ targetId: target._id,
+ date: today
+ });
+
+ if (todayStats) {
+ console.log(chalk.green(` β Today's statistics:`));
+ console.log(` Total Pings: ${todayStats.totalPings}`);
+ console.log(` Successful: ${todayStats.successfulPings}`);
+ console.log(` Failed: ${todayStats.failedPings}`);
+ console.log(` Avg Response Time: ${Math.round(todayStats.avgResponseTime || 0)}ms`);
+ console.log(` Uptime: ${todayStats.uptime?.toFixed(2) || 0}%`);
+ } else {
+ console.log(chalk.yellow(` β No statistics found for today`));
+ }
+ }
+
+ // Overall summary
+ const allPings = await db.collection('pingResults').find({}).toArray();
+ const allStats = await db.collection('statistics').find({}).toArray();
+
+ console.log(chalk.cyan('\n=== Summary ==='));
+ console.log(`Total ping results in database: ${allPings.length}`);
+ console.log(`Total statistics records: ${allStats.length}`);
+
+ if (allPings.length === 0) {
+ console.log(chalk.red('\nβ WARNING: No ping results found in database!'));
+ console.log(chalk.yellow(' This could mean:'));
+ console.log(chalk.yellow(' 1. Monitoring is not running'));
+ console.log(chalk.yellow(' 2. Targets are not enabled'));
+ console.log(chalk.yellow(' 3. Database writes are failing (check logs)'));
+ process.exit(1);
+ } else {
+ console.log(chalk.green('\nβ Ping data is being saved to the database'));
+ }
+
+ } catch (error) {
+ console.error(chalk.red('\nβ Error verifying ping data:'), error.message);
+ console.error(error);
+ process.exit(1);
+ }
+}
+
+// Run verification
+verifyPingData().then(() => {
+ process.exit(0);
+}).catch(err => {
+ console.error(chalk.red('Fatal error:'), err);
+ process.exit(1);
+});
+
diff --git a/src/app.js b/src/app.js
new file mode 100644
index 0000000..c13eae7
--- /dev/null
+++ b/src/app.js
@@ -0,0 +1,240 @@
+require('dotenv').config();
+const express = require('express');
+const expressWs = require('express-ws');
+const session = require('express-session');
+const cors = require('cors');
+const path = require('path');
+const yargs = require('yargs/yargs');
+const { hideBin } = require('yargs/helpers');
+const chalk = require('./utils/colors');
+
+const { connectDB, disconnectDB, getPrisma } = require('./config/prisma');
+const SQLiteSessionStore = require('./config/sessionStore');
+const monitorService = require('./services/monitorService');
+const gatewayService = require('./services/gatewayService');
+// sqliteService removed - using PostgreSQL via db.js now
+const dataRetentionService = require('./services/dataRetentionService');
+const { apiKeyAuth, createRateLimiter, validateTargetInput } = require('./middleware/auth');
+const { setupCheckMiddleware, isSetupComplete } = require('./middleware/setupCheck');
+
+// Parse command line arguments
+const argv = yargs(hideBin(process.argv))
+ .option('mode', {
+ describe: 'Application mode',
+ choices: ['api', 'admin', 'public', 'all'],
+ default: 'all',
+ })
+ .parse();
+
+const app = express();
+app.set('trust proxy', true);
+expressWs(app);
+
+// Middleware
+const compression = require('compression');
+app.use(compression());
+app.use(express.json());
+app.use(express.urlencoded({ extended: true }));
+app.use(cors());
+
+// Initialize persistent session store
+const sessionStore = new SQLiteSessionStore();
+
+// Helper function to get session duration from database (defaults to 30 days)
+const getSessionDuration = async () => {
+ try {
+ const prisma = getPrisma();
+ const settings = await prisma.adminSettings.findUnique({ where: { id: 'settings' } });
+ const days = settings?.sessionDurationDays || 30;
+ return days * 24 * 60 * 60 * 1000; // Convert days to milliseconds
+ } catch (error) {
+ // If DB not ready, return default
+ return 30 * 24 * 60 * 60 * 1000; // 30 days default
+ }
+};
+
+// Session middleware for admin authentication
+// Note: maxAge will be updated dynamically in login route based on settings
+const sessionMiddleware = session({
+ store: sessionStore,
+ secret: process.env.SESSION_SECRET || 'localping-dev-secret',
+ resave: false,
+ saveUninitialized: false, // Don't save uninitialized sessions
+ cookie: {
+ secure: false, // Allow HTTP cookies for development - can be set via SECURE_COOKIES env var
+ httpOnly: true,
+ sameSite: 'lax', // Use 'lax' instead of 'strict' to allow cross-site requests with cookies
+ maxAge: 30 * 24 * 60 * 60 * 1000 // Default 30 days, will be updated on login
+ }
+});
+
+app.use(sessionMiddleware);
+
+// Rate limiting middleware (skip for localhost development)
+const apiRateLimiter = (req, res, next) => {
+ const isLocalhost = req.ip === '127.0.0.1' || req.ip === '::1' || req.ip === '::ffff:127.0.0.1';
+ if (isLocalhost && process.env.NODE_ENV !== 'production') {
+ // Skip rate limiting for localhost in development
+ return next();
+ }
+ // Apply rate limiter for production or remote IPs
+ createRateLimiter(15 * 60 * 1000, 100)(req, res, next);
+};
+app.use('/api/', apiRateLimiter);
+
+// Set view engine
+app.set('view engine', 'ejs');
+app.set('views', path.join(__dirname, 'views'));
+
+// Static files
+app.use(express.static(path.join(__dirname, "public"), { maxAge: "7d" }));
+
+// Serve favicon.ico (browser default)
+app.get('/favicon.ico', (req, res) => {
+ res.sendFile(path.join(__dirname, 'public', 'favicon.ico'));
+});
+
+// Health check endpoint (must be before setup check middleware)
+app.get('/health', (req, res) => {
+ res.json({
+ status: 'ok',
+ timestamp: new Date(),
+ uptime: process.uptime(),
+ mode: argv.mode,
+ });
+});
+
+// Setup routes - must be registered BEFORE setup check middleware
+const setupRoutes = require('./routes/setup');
+app.use('/setup', setupRoutes);
+console.log(chalk.cyan('β Setup routes loaded'));
+
+// Setup check middleware - redirect to setup if not configured
+// This checks after setup routes are registered
+app.use(setupCheckMiddleware);
+
+// Initialize database
+let prisma = null;
+
+const startServer = async () => {
+ try {
+ // Connect to PostgreSQL database via Prisma
+ prisma = await connectDB();
+
+ // Detect gateway
+ await gatewayService.detectAllGateways();
+
+ // Set up periodic cleanup of old data (handled by dataRetentionService)
+
+ // Set up periodic data retention processing
+ // Run once on startup, then every 6 hours
+ (async () => {
+ try {
+ await dataRetentionService.processRetentionForAllTargets();
+ } catch (error) {
+ console.error(chalk.red('Error processing initial data retention:'), error.message);
+ }
+ })();
+
+ setInterval(async () => {
+ try {
+ await dataRetentionService.processRetentionForAllTargets();
+ } catch (error) {
+ console.error(chalk.red('Error processing data retention:'), error.message);
+ }
+ }, 6 * 60 * 60 * 1000); // Run every 6 hours
+
+ // Set up periodic processing of scheduled incidents
+ const IncidentService = require('./services/incidentService');
+ const incidentService = new IncidentService(prisma);
+ setInterval(async () => {
+ try {
+ await incidentService.processScheduledIncidents();
+ } catch (error) {
+ console.error(chalk.red('Error processing scheduled incidents:'), error.message);
+ }
+ }, 60 * 1000); // Check every minute
+
+ // Check if setup is needed
+ if (!isSetupComplete()) {
+ console.log(chalk.yellow('\nβ οΈ LocalPing setup incomplete!'));
+ console.log(chalk.yellow(' Visit http://localhost:8000/setup to complete setup\n'));
+ }
+
+ // Static public site (src/site, or SITE_DIR to override with your own theme).
+ // SITE_HOSTS (comma-separated) limits it to specific Host headers; unset = all hosts.
+ if (argv.mode === 'public' || argv.mode === 'all') {
+ const siteDir = process.env.SITE_DIR || path.join(__dirname, 'site');
+ if (require('fs').existsSync(path.join(siteDir, 'index.html'))) {
+ const hosts = (process.env.SITE_HOSTS || '').split(',').map((h) => h.trim().toLowerCase()).filter(Boolean);
+ const onlyHosts = (mw) => (req, res, next) => (!hosts.length || hosts.includes(req.hostname.toLowerCase())) ? mw(req, res, next) : next();
+ const spa = (req, res) => res.sendFile(path.join(siteDir, 'index.html'), { headers: { 'Cache-Control': 'no-cache' } });
+ app.use('/', onlyHosts(require('./routes/site')));
+ app.use('/s', onlyHosts(express.static(siteDir, { maxAge: '1h' })));
+ app.use(onlyHosts(express.static(siteDir, { maxAge: '1h', index: false })));
+ ['/', '/status', '/news', '/tools', '/about'].forEach((r) => app.get(r, onlyHosts(spa)));
+ console.log(chalk.cyan('β Static site loaded from ' + siteDir + (hosts.length ? ' for ' + hosts.join(',') : '')));
+ }
+ }
+
+ // Public routes - load FIRST so they don't get caught by authenticated API routes
+ if (argv.mode === 'public' || argv.mode === 'all') {
+ const publicRoutes = require('./routes/public');
+ app.use('/', publicRoutes);
+ console.log(chalk.cyan('β Public routes loaded'));
+ }
+
+ // Admin routes - must be before authenticated API routes
+ if (argv.mode === 'admin' || argv.mode === 'all') {
+ const adminRoutes = require('./routes/admin');
+ app.use('/admin', adminRoutes);
+ console.log(chalk.cyan('β Admin routes loaded'));
+ }
+
+ // Authenticated API routes - load LAST so public routes are matched first
+ if (argv.mode === 'api' || argv.mode === 'all') {
+ const apiRoutes = require('./routes/api');
+ // Apply API key authentication to API routes
+ app.use('/api', apiKeyAuth, apiRoutes);
+ console.log(chalk.cyan('β API routes loaded with authentication'));
+ }
+
+ // Start monitoring (non-blocking - runs in background)
+ monitorService.startMonitoring();
+
+ // Listen on port (starts immediately, doesn't wait for monitoring)
+ const port = process.env.API_PORT || 3000;
+ app.listen(port, () => {
+ console.log(chalk.green(`β Server running on http://localhost:${port}`));
+ console.log(chalk.cyan(` Mode: ${argv.mode}`));
+ });
+ } catch (error) {
+ console.error(chalk.red('Failed to start server:'), error.message);
+ process.exit(1);
+ }
+};
+
+// Graceful shutdown
+const shutdown = async (signal) => {
+ console.log(chalk.yellow(`\nβ Received ${signal}, shutting down gracefully...`));
+
+ try {
+ monitorService.stopAllMonitoring();
+ const pingService = require('./services/pingService');
+ await pingService.shutdown();
+ await disconnectDB();
+ console.log(chalk.green('β Server shut down successfully'));
+ process.exit(0);
+ } catch (error) {
+ console.error(chalk.red('Error during shutdown:'), error.message);
+ process.exit(1);
+ }
+};
+
+process.on('SIGTERM', () => shutdown('SIGTERM'));
+process.on('SIGINT', () => shutdown('SIGINT'));
+
+// Start server
+startServer();
+
+module.exports = app;
diff --git a/src/cli/localping.js b/src/cli/localping.js
new file mode 100644
index 0000000..27fb287
--- /dev/null
+++ b/src/cli/localping.js
@@ -0,0 +1,228 @@
+#!/usr/bin/env node
+
+require('dotenv').config();
+const chalk = require('../utils/colors');
+const yargs = require('yargs/yargs');
+const { hideBin } = require('yargs/helpers');
+const inquirer = require('inquirer');
+const { connectDB, getDB, closeDB } = require('../config/db');
+const pingService = require('../services/pingService');
+const gatewayService = require('../services/gatewayService');
+
+const argv = yargs(hideBin(process.argv))
+ .command('status', 'Show system status')
+ .command('test ', 'Test ping a host')
+ .command('config', 'Configure targets')
+ .command('list', 'List all targets')
+ .command('notify', 'Send test notification')
+ .command('gateway', 'Show detected gateway')
+ .command('monitor', 'Start interactive monitor (for terminal)')
+ .help()
+ .alias('h', 'help')
+ .version()
+ .alias('v', 'version')
+ .parse();
+
+const command = argv._[0];
+
+async function main() {
+ try {
+ switch (command) {
+ case 'status':
+ await showStatus();
+ break;
+ case 'test':
+ await testHost(argv.host);
+ break;
+ case 'config':
+ await configureTargets();
+ break;
+ case 'list':
+ await listTargets();
+ break;
+ case 'notify':
+ await sendTestNotification();
+ break;
+ case 'gateway':
+ await showGateway();
+ break;
+ case 'monitor':
+ await interactiveMonitor();
+ break;
+ default:
+ showHelp();
+ }
+ } catch (error) {
+ console.error(chalk.red('Error:'), error.message);
+ process.exit(1);
+ } finally {
+ await closeDB();
+ }
+}
+
+async function showStatus() {
+ const db = await connectDB();
+
+ const targets = await db.collection('targets').find({}).toArray();
+ const upTargets = targets.filter((t) => t.enabled).length;
+
+ console.log(chalk.cyan('\nπ LocalPing Status\n'));
+ console.log(`Total Targets: ${chalk.bold(targets.length)}`);
+ console.log(`Enabled Targets: ${chalk.bold(upTargets)}`);
+ console.log();
+
+ if (targets.length === 0) {
+ console.log(chalk.yellow('No targets configured. Use "localping config" to add targets.'));
+ } else {
+ console.log(chalk.cyan('\nRecent Alerts:'));
+ const alerts = await db.collection('alerts').find({}).sort({ timestamp: -1 }).limit(5).toArray();
+
+ if (alerts.length === 0) {
+ console.log(chalk.green('β No alerts'));
+ } else {
+ alerts.forEach((alert) => {
+ const icon = alert.type === 'down' ? 'β' : 'β';
+ const color = alert.type === 'down' ? chalk.red : chalk.green;
+ console.log(color(`${icon} ${alert.message}`));
+ });
+ }
+ }
+
+ console.log();
+}
+
+async function testHost(host) {
+ console.log(chalk.cyan(`\nπ Testing ${host}...\n`));
+
+ const tests = [
+ { protocol: 'ICMP', host },
+ { protocol: 'TCP', host, port: 80 },
+ { protocol: 'UDP', host, port: 53 },
+ { protocol: 'HTTP', host, port: 80, path: '/' },
+ { protocol: 'HTTPS', host, port: 443, path: '/' },
+ ];
+
+ for (const test of tests) {
+ const result = await pingService.ping(test);
+ const status = result.success ? chalk.green('β UP') : chalk.red('β DOWN');
+ const time = result.responseTime ? ` (${result.responseTime}ms)` : '';
+ console.log(`${test.protocol.padEnd(8)} ${status}${time}`);
+ }
+
+ console.log();
+}
+
+async function configureTargets() {
+ const db = await connectDB();
+
+ const answers = await inquirer.prompt([
+ {
+ type: 'list',
+ name: 'action',
+ message: 'What would you like to do?',
+ choices: [
+ { name: 'Add target', value: 'add' },
+ { name: 'Edit target', value: 'edit' },
+ { name: 'Delete target', value: 'delete' },
+ { name: 'Back', value: 'back' },
+ ],
+ },
+ ]);
+
+ if (answers.action === 'add') {
+ const target = await inquirer.prompt([
+ { type: 'input', name: 'name', message: 'Target name:' },
+ { type: 'input', name: 'host', message: 'Host/IP:' },
+ {
+ type: 'list',
+ name: 'protocol',
+ message: 'Protocol:',
+ choices: ['ICMP', 'TCP', 'UDP', 'HTTP', 'HTTPS'],
+ },
+ { type: 'input', name: 'port', message: 'Port (optional):', default: '' },
+ { type: 'input', name: 'interval', message: 'Ping interval (seconds):', default: '60' },
+ ]);
+
+ await db.collection('targets').insertOne({
+ ...target,
+ port: target.port ? parseInt(target.port) : null,
+ interval: parseInt(target.interval),
+ enabled: true,
+ createdAt: new Date(),
+ });
+
+ console.log(chalk.green('β Target added successfully!'));
+ }
+}
+
+async function listTargets() {
+ const db = await connectDB();
+
+ const targets = await db.collection('targets').find({}).toArray();
+
+ console.log(chalk.cyan('\nπ Configured Targets\n'));
+
+ if (targets.length === 0) {
+ console.log(chalk.yellow('No targets configured.'));
+ } else {
+ targets.forEach((target, i) => {
+ console.log(`${i + 1}. ${target.name}`);
+ console.log(` Host: ${target.host}${target.port ? ':' + target.port : ''}`);
+ console.log(` Protocol: ${target.protocol}`);
+ console.log(` Interval: ${target.interval}s`);
+ console.log(` Status: ${target.enabled ? chalk.green('Enabled') : chalk.yellow('Disabled')}\n`);
+ });
+ }
+}
+
+async function sendTestNotification() {
+ console.log(chalk.cyan('\nπ’ Browser notifications are available in the public UI\n'));
+ console.log(chalk.yellow('Desktop notifications have been removed for containerized environments.'));
+ console.log(chalk.green('Visit the public dashboard to enable browser notifications.'));
+ console.log();
+}
+
+async function showGateway() {
+ await gatewayService.detectAllGateways();
+
+ console.log(chalk.cyan('\nπ Gateway Information\n'));
+
+ const gateways = gatewayService.getAllGateways();
+
+ if (gateways.length === 0) {
+ console.log(chalk.yellow('No gateway detected.'));
+ } else {
+ gateways.forEach((gw) => {
+ console.log(`IPv${gw.version}: ${gw.ip} (${gw.interface})`);
+ });
+ }
+
+ console.log();
+}
+
+async function interactiveMonitor() {
+ const db = await connectDB();
+
+ console.log(chalk.cyan('\nπ‘ LocalPing Interactive Monitor\n'));
+ console.log(chalk.gray('Press Ctrl+C to exit\n'));
+
+ // Placeholder for terminal UI implementation
+ console.log(chalk.yellow('β Terminal UI not yet implemented.'));
+ console.log('Use the web admin panel instead: http://\n');
+}
+
+function showHelp() {
+ console.log(chalk.cyan('\nLocalPing CLI - Local System Uptime Monitor\n'));
+ console.log('Commands:');
+ console.log(' localping status - Show system status');
+ console.log(' localping test - Test ping a host');
+ console.log(' localping config - Configure targets');
+ console.log(' localping list - List all targets');
+ console.log(' localping notify - Send test notification');
+ console.log(' localping gateway - Show detected gateway');
+ console.log(' localping monitor - Start interactive monitor');
+ console.log();
+}
+
+// Run CLI
+main();
diff --git a/src/config/db.js b/src/config/db.js
new file mode 100644
index 0000000..94f552e
--- /dev/null
+++ b/src/config/db.js
@@ -0,0 +1,880 @@
+require('dotenv').config();
+const { Pool } = require('pg');
+const chalk = require('../utils/colors');
+const cacheService = require('../services/cacheService');
+
+let pool = null;
+
+const connectDB = async (retries = 5, delay = 2000) => {
+ // Get database connection details from environment or use defaults
+ const dbConfig = {
+ host: process.env.DB_HOST || 'localhost',
+ port: process.env.DB_PORT || 5432,
+ database: process.env.DB_NAME || 'localping',
+ user: process.env.DB_USER || 'localping',
+ password: process.env.DB_PASSWORD || 'localping',
+ max: 20, // Maximum number of clients in the pool
+ idleTimeoutMillis: 30000,
+ connectionTimeoutMillis: 2000,
+ };
+
+ for (let attempt = 1; attempt <= retries; attempt++) {
+ try {
+ // Close existing pool if it exists
+ if (pool) {
+ try {
+ await pool.end();
+ } catch (e) {
+ // Ignore errors when closing
+ }
+ pool = null;
+ }
+
+ pool = new Pool(dbConfig);
+
+ // Test connection
+ const client = await pool.connect();
+ await client.query('SELECT NOW()');
+ client.release();
+
+ // Initialize tables
+ await initializeTables();
+
+ console.log(chalk.green('β PostgreSQL database connected'));
+
+ // Return a minimal object compatible with the rest of the code
+ return {
+ collection: (name) => createCollectionWrapper(name),
+ admin: () => ({
+ ping: async () => {
+ try {
+ const client = await pool.connect();
+ await client.query('SELECT 1');
+ client.release();
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ })
+ };
+ } catch (error) {
+ if (attempt === retries) {
+ console.error(chalk.red('β PostgreSQL connection failed after'), retries, 'attempts:', error.message);
+ console.error(chalk.yellow(' Please check:'));
+ console.error(chalk.yellow(' - PostgreSQL is running: systemctl status postgresql'));
+ console.error(chalk.yellow(' - Database credentials in .env file'));
+ console.error(chalk.yellow(' - Connection settings:'), `host=${dbConfig.host}, port=${dbConfig.port}, database=${dbConfig.database}, user=${dbConfig.user}`);
+ process.exit(1);
+ } else {
+ const waitTime = delay * Math.pow(2, attempt - 1); // Exponential backoff
+ console.error(chalk.yellow(`β PostgreSQL connection failed (attempt ${attempt}/${retries}):`), error.message);
+ console.error(chalk.yellow(` Retrying in ${waitTime / 1000} seconds...`));
+ await new Promise(resolve => setTimeout(resolve, waitTime));
+ }
+ }
+ }
+};
+
+const executeQuery = async (text, params) => {
+ const client = await pool.connect();
+ try {
+ const result = await client.query(text, params);
+ return result;
+ } finally {
+ client.release();
+ }
+};
+
+const initializeTables = async () => {
+ try {
+ // Targets table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS targets (
+ _id TEXT PRIMARY KEY,
+ name TEXT UNIQUE NOT NULL,
+ host TEXT NOT NULL,
+ protocol TEXT NOT NULL,
+ port INTEGER,
+ path TEXT,
+ enabled BOOLEAN DEFAULT true,
+ "publicVisible" BOOLEAN DEFAULT true,
+ "publicShowDetails" BOOLEAN DEFAULT false,
+ "publicShowStatus" BOOLEAN DEFAULT true,
+ "publicShowAppLink" BOOLEAN DEFAULT true,
+ interval INTEGER DEFAULT 60,
+ retries INTEGER DEFAULT 0,
+ "retryInterval" INTEGER DEFAULT 5,
+ timeout INTEGER DEFAULT 30,
+ "httpMethod" TEXT DEFAULT 'GET',
+ "statusCodes" TEXT DEFAULT '200-299',
+ "maxRedirects" INTEGER DEFAULT 5,
+ "ignoreSsl" BOOLEAN DEFAULT false,
+ "upsideDown" BOOLEAN DEFAULT false,
+ auth TEXT,
+ "appUrl" TEXT,
+ "appIcon" TEXT,
+ position INTEGER DEFAULT 0,
+ "group" TEXT,
+ "quickCommands" TEXT,
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Migration: Add publicVisible column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE targets ADD COLUMN IF NOT EXISTS "publicVisible" BOOLEAN DEFAULT true`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add publicShowDetails column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE targets ADD COLUMN IF NOT EXISTS "publicShowDetails" BOOLEAN DEFAULT false`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add publicShowStatus column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE targets ADD COLUMN IF NOT EXISTS "publicShowStatus" BOOLEAN DEFAULT true`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add publicShowAppLink column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE targets ADD COLUMN IF NOT EXISTS "publicShowAppLink" BOOLEAN DEFAULT true`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Ping results table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS "pingResults" (
+ _id TEXT PRIMARY KEY,
+ "targetId" TEXT NOT NULL,
+ success BOOLEAN NOT NULL,
+ "responseTime" INTEGER,
+ timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ "statusCode" INTEGER,
+ error TEXT,
+ protocol TEXT,
+ FOREIGN KEY("targetId") REFERENCES targets(_id)
+ )
+ `);
+
+ // Alerts table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS alerts (
+ _id TEXT PRIMARY KEY,
+ "targetId" TEXT NOT NULL,
+ type TEXT NOT NULL,
+ timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ message TEXT,
+ FOREIGN KEY("targetId") REFERENCES targets(_id)
+ )
+ `);
+
+ // Statistics table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS statistics (
+ _id TEXT PRIMARY KEY,
+ "targetId" TEXT NOT NULL,
+ date DATE NOT NULL,
+ "totalPings" INTEGER DEFAULT 0,
+ "successfulPings" INTEGER DEFAULT 0,
+ "failedPings" INTEGER DEFAULT 0,
+ uptime REAL DEFAULT 0,
+ "lastResponseTime" INTEGER DEFAULT 0,
+ "avgResponseTime" REAL DEFAULT 0,
+ "minResponseTime" INTEGER,
+ "maxResponseTime" INTEGER,
+ FOREIGN KEY("targetId") REFERENCES targets(_id),
+ UNIQUE("targetId", date)
+ )
+ `);
+
+ // Incidents table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS incidents (
+ _id TEXT PRIMARY KEY,
+ title TEXT NOT NULL,
+ description TEXT,
+ severity TEXT DEFAULT 'major',
+ status TEXT DEFAULT 'investigating',
+ "affectedServices" TEXT,
+ updates TEXT,
+ "resolvedAt" TIMESTAMP,
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Migration: Add affectedServices column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE incidents ADD COLUMN IF NOT EXISTS "affectedServices" TEXT`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add updates column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE incidents ADD COLUMN IF NOT EXISTS updates TEXT`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add resolvedAt column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE incidents ADD COLUMN IF NOT EXISTS "resolvedAt" TIMESTAMP`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Event Rules table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS "eventRules" (
+ _id TEXT PRIMARY KEY,
+ name TEXT NOT NULL,
+ "eventType" TEXT NOT NULL,
+ enabled BOOLEAN DEFAULT true,
+ conditions TEXT NOT NULL,
+ "incidentTitle" TEXT NOT NULL,
+ "incidentDescription" TEXT NOT NULL,
+ "incidentSeverity" TEXT DEFAULT 'major',
+ "incidentStatus" TEXT DEFAULT 'investigating',
+ "autoResolve" BOOLEAN DEFAULT false,
+ "autoResolveMessage" TEXT,
+ "cooldownMinutes" INTEGER DEFAULT 0,
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Actions table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS actions (
+ _id TEXT PRIMARY KEY,
+ "targetId" TEXT NOT NULL,
+ name TEXT NOT NULL,
+ type TEXT NOT NULL,
+ command TEXT,
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY("targetId") REFERENCES targets(_id),
+ UNIQUE("targetId", name)
+ )
+ `);
+
+ // Favicons table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS favicons (
+ _id TEXT PRIMARY KEY,
+ "appUrl" TEXT NOT NULL UNIQUE,
+ favicon TEXT,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Public UI Settings table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS "publicUISettings" (
+ _id TEXT PRIMARY KEY DEFAULT 'settings',
+ title TEXT DEFAULT 'Homelab',
+ subtitle TEXT DEFAULT 'System Status & Application Dashboard',
+ "customCSS" TEXT,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Initialize default settings if not exists
+ await executeQuery(`
+ INSERT INTO "publicUISettings" (_id, title, subtitle, "customCSS")
+ VALUES ('settings', 'Homelab', 'System Status & Application Dashboard', NULL)
+ ON CONFLICT (_id) DO NOTHING
+ `);
+
+ // Posts table (for blog/changelog)
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS posts (
+ _id TEXT PRIMARY KEY,
+ title TEXT NOT NULL,
+ content TEXT NOT NULL,
+ published BOOLEAN DEFAULT true,
+ "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Admin Settings table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS "adminSettings" (
+ _id TEXT PRIMARY KEY DEFAULT 'settings',
+ "sessionDurationDays" INTEGER DEFAULT 30,
+ "dataRetentionDays" INTEGER DEFAULT 30,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Migration: Add dataRetentionDays column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE "adminSettings" ADD COLUMN IF NOT EXISTS "dataRetentionDays" INTEGER DEFAULT 30`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Migration: Add debugLogging column if it doesn't exist
+ try {
+ await executeQuery(`ALTER TABLE "adminSettings" ADD COLUMN IF NOT EXISTS "debugLogging" BOOLEAN DEFAULT false`);
+ } catch (error) {
+ // Column already exists, ignore
+ }
+
+ // Initialize default admin settings if not exists
+ await executeQuery(`
+ INSERT INTO "adminSettings" (_id, "sessionDurationDays", "dataRetentionDays")
+ VALUES ('settings', 30, 30)
+ ON CONFLICT (_id) DO NOTHING
+ `);
+
+ // Notification Settings table
+ await executeQuery(`
+ CREATE TABLE IF NOT EXISTS "notificationSettings" (
+ _id TEXT PRIMARY KEY DEFAULT 'settings',
+ enabled BOOLEAN DEFAULT false,
+ discord TEXT,
+ events TEXT,
+ "monitorDownDelayMinutes" INTEGER DEFAULT 5,
+ "updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+
+ // Migration: add the sustained-outage notification delay to existing installs.
+ try {
+ await executeQuery(`ALTER TABLE "notificationSettings" ADD COLUMN IF NOT EXISTS "monitorDownDelayMinutes" INTEGER DEFAULT 5`);
+ } catch (error) {
+ // Column already exists, ignore.
+ }
+
+ // Create indices
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_targets_enabled ON targets(enabled)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_pingResults_targetId ON "pingResults"("targetId")`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_pingResults_timestamp ON "pingResults"(timestamp)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_alerts_targetId ON alerts("targetId")`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_alerts_timestamp ON alerts(timestamp)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_statistics_targetId ON statistics("targetId")`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_statistics_date ON statistics(date)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_incidents_status ON incidents(status)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_eventRules_enabled ON "eventRules"(enabled)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_actions_targetId ON actions("targetId")`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_posts_published ON posts(published)`);
+ await executeQuery(`CREATE INDEX IF NOT EXISTS idx_posts_createdAt ON posts("createdAt")`);
+
+ console.log(chalk.green('β PostgreSQL tables initialized'));
+ } catch (error) {
+ console.error(chalk.yellow('β Warning initializing tables:'), error.message);
+ }
+};
+
+// Get TTL for different collections
+const getTTL = (collectionName) => {
+ const ttlMap = {
+ 'adminSettings': 300000, // 5 minutes - rarely changes
+ 'publicUISettings': 300000, // 5 minutes - rarely changes
+ 'targets': 30000, // 30 seconds - may change more often
+ 'statistics': 120000, // 2 minutes - updated periodically
+ 'favicons': 600000, // 10 minutes - very rarely changes
+ 'posts': 60000, // 1 minute - may change occasionally
+ 'incidents': 60000, // 1 minute - may change occasionally
+ };
+ return ttlMap[collectionName] || 60000; // Default 1 minute
+};
+
+const createCollectionWrapper = (name) => {
+ return {
+ find: (queryObj = {}) => {
+ // Store options for chaining
+ let sortOption = null;
+ let limitOption = null;
+
+ const chainable = {
+ sort: (sortObj) => {
+ sortOption = sortObj;
+ return chainable;
+ },
+ limit: (num) => {
+ limitOption = num;
+ return chainable;
+ },
+ toArray: async () => {
+ try {
+ // Check cache first
+ const cacheKey = cacheService.generateKey(name, queryObj, { sort: sortOption, limit: limitOption });
+ const cached = cacheService.get(cacheKey);
+ if (cached !== null) {
+ return cached;
+ }
+
+ const keys = Object.keys(queryObj).filter(k => typeof queryObj[k] !== 'function');
+ let sql = `SELECT * FROM "${name}"`;
+ const params = [];
+ let paramIndex = 1;
+
+ if (keys.length > 0) {
+ const whereClauses = keys.map(k => {
+ const val = queryObj[k];
+ // Handle MongoDB-style operators
+ if (typeof val === 'object' && val !== null && !(val instanceof Date)) {
+ if ('$gte' in val) {
+ const gteVal = val.$gte;
+ if (gteVal instanceof Date) {
+ params.push(gteVal.toISOString().split('T')[0]);
+ } else {
+ params.push(gteVal);
+ }
+ const idx = paramIndex++;
+ return `"${k}" >= $${idx}`;
+ } else if ('$lte' in val) {
+ const lteVal = val.$lte;
+ if (lteVal instanceof Date) {
+ params.push(lteVal.toISOString().split('T')[0]);
+ } else {
+ params.push(lteVal);
+ }
+ const idx = paramIndex++;
+ return `"${k}" <= $${idx}`;
+ } else if ('$gt' in val) {
+ const gtVal = val.$gt;
+ if (gtVal instanceof Date) {
+ params.push(gtVal.toISOString().split('T')[0]);
+ } else {
+ params.push(gtVal);
+ }
+ const idx = paramIndex++;
+ return `"${k}" > $${idx}`;
+ } else if ('$lt' in val) {
+ const ltVal = val.$lt;
+ if (ltVal instanceof Date) {
+ params.push(ltVal.toISOString().split('T')[0]);
+ } else {
+ params.push(ltVal);
+ }
+ const idx = paramIndex++;
+ return `"${k}" < $${idx}`;
+ } else {
+ // Fallback to JSON stringify for other objects
+ params.push(JSON.stringify(val));
+ const idx = paramIndex++;
+ return `"${k}" = $${idx}`;
+ }
+ }
+ // Handle different types
+ if (typeof val === 'boolean') {
+ params.push(val);
+ } else if (val instanceof Date) {
+ // Convert Date to ISO date string (YYYY-MM-DD)
+ params.push(val.toISOString().split('T')[0]);
+ } else {
+ params.push(val);
+ }
+ const idx = paramIndex++;
+ return `"${k}" = $${idx}`;
+ });
+ sql += ' WHERE ' + whereClauses.join(' AND ');
+ }
+
+ // Add sorting
+ if (sortOption) {
+ const sortKey = Object.keys(sortOption)[0];
+ const sortDir = sortOption[sortKey] === 1 ? 'ASC' : 'DESC';
+ sql += ` ORDER BY "${sortKey}" ${sortDir}`;
+ }
+
+ // Add limit
+ if (limitOption) {
+ sql += ` LIMIT ${limitOption}`;
+ }
+
+ const result = await executeQuery(sql, params);
+
+ // Convert boolean integers back to booleans for compatibility
+ const results = result.rows.map(row => {
+ const converted = {};
+ for (const [key, value] of Object.entries(row)) {
+ // PostgreSQL returns booleans as booleans, but keep for consistency
+ converted[key] = value;
+ }
+ return converted;
+ });
+
+ // Cache the results
+ cacheService.set(cacheKey, results, getTTL(name));
+
+ return results;
+ } catch (error) {
+ console.error(chalk.red(`Error finding ${name}:`), error.message);
+ return [];
+ }
+ }
+ };
+
+ return chainable;
+ },
+ findOne: async (queryObj = {}) => {
+ try {
+ // Check cache first
+ const cacheKey = cacheService.generateKey(name, queryObj, { findOne: true });
+ const cached = cacheService.get(cacheKey);
+ if (cached !== null) {
+ return cached;
+ }
+
+ const keys = Object.keys(queryObj).filter(k => typeof queryObj[k] !== 'function');
+ let sql = `SELECT * FROM "${name}"`;
+ const params = [];
+ let paramIndex = 1;
+
+ if (keys.length > 0) {
+ const whereClauses = keys.map(k => {
+ const val = queryObj[k];
+ // Handle different types
+ if (typeof val === 'boolean') {
+ params.push(val);
+ } else if (val instanceof Date) {
+ // Convert Date to ISO date string (YYYY-MM-DD) for DATE columns
+ if (name === 'statistics' && k === 'date') {
+ params.push(val.toISOString().split('T')[0]);
+ } else {
+ params.push(val.toISOString().split('T')[0]);
+ }
+ } else if (typeof val === 'object' && val !== null) {
+ params.push(JSON.stringify(val));
+ } else {
+ params.push(val);
+ }
+ const idx = paramIndex++;
+ return `"${k}" = $${idx}`;
+ });
+ sql += ' WHERE ' + whereClauses.join(' AND ');
+ }
+
+ sql += ' LIMIT 1';
+ const result = await executeQuery(sql, params);
+ const row = result.rows[0] || null;
+
+ // Cache the result
+ cacheService.set(cacheKey, row, getTTL(name));
+
+ return row;
+ } catch (error) {
+ console.error(chalk.red(`Error finding one ${name}:`), error.message);
+ return null;
+ }
+ },
+ insertOne: async (doc) => {
+ try {
+ const id = doc._id || require('uuid').v4();
+ const docWithId = { _id: id, ...doc };
+ const fields = Object.keys(docWithId);
+ const placeholders = fields.map((_, i) => `$${i + 1}`).join(', ');
+ const quotedFields = fields.map(f => `"${f}"`).join(', ');
+ const values = fields.map(f => {
+ const val = docWithId[f];
+ // PostgreSQL handles booleans natively
+ if (typeof val === 'boolean') {
+ return val;
+ }
+ // Convert Date to ISO timestamp string (YYYY-MM-DD HH:MM:SS) or date string for DATE columns
+ if (val instanceof Date) {
+ // For statistics table date column, use date format
+ if (name === 'statistics' && f === 'date') {
+ return val.toISOString().split('T')[0];
+ }
+ return val.toISOString().replace('T', ' ').substring(0, 19);
+ }
+ // Convert arrays and objects to JSON strings
+ if (typeof val === 'object' && val !== null) {
+ return JSON.stringify(val);
+ }
+ return val;
+ });
+
+ // Use INSERT with ON CONFLICT for tables with unique constraints
+ let sql = `INSERT INTO "${name}" (${quotedFields}) VALUES (${placeholders})`;
+
+ // Handle unique constraints with ON CONFLICT for specific tables
+ if (name === 'statistics') {
+ // Statistics has UNIQUE(targetId, date) - use ON CONFLICT to increment values atomically
+ // In ON CONFLICT, reference existing row columns directly (no qualifier needed)
+ // and new row columns with excluded.
+ const updateClauses = [];
+ // Increment counters
+ if (fields.includes('totalPings')) {
+ updateClauses.push(`"totalPings" = statistics."totalPings" + excluded."totalPings"`);
+ }
+ if (fields.includes('successfulPings')) {
+ updateClauses.push(`"successfulPings" = statistics."successfulPings" + excluded."successfulPings"`);
+ }
+ if (fields.includes('failedPings')) {
+ updateClauses.push(`"failedPings" = statistics."failedPings" + excluded."failedPings"`);
+ }
+ // Update latest values
+ if (fields.includes('lastResponseTime')) {
+ updateClauses.push(`"lastResponseTime" = excluded."lastResponseTime"`);
+ }
+ // Recalculate average: weighted average of existing and new
+ if (fields.includes('avgResponseTime')) {
+ updateClauses.push(`"avgResponseTime" = CASE
+ WHEN statistics."totalPings" + excluded."totalPings" > 0
+ THEN (statistics."avgResponseTime" * statistics."totalPings" + excluded."avgResponseTime" * excluded."totalPings") / (statistics."totalPings" + excluded."totalPings")
+ ELSE excluded."avgResponseTime"
+ END`);
+ }
+ // Recalculate uptime percentage
+ if (fields.includes('uptime')) {
+ updateClauses.push(`"uptime" = CASE
+ WHEN statistics."totalPings" + excluded."totalPings" > 0
+ THEN (CAST(statistics."successfulPings" + excluded."successfulPings" AS REAL) / CAST(statistics."totalPings" + excluded."totalPings" AS REAL)) * 100
+ ELSE excluded."uptime"
+ END`);
+ }
+ // Update min/max response times
+ if (fields.includes('minResponseTime')) {
+ updateClauses.push(`"minResponseTime" = CASE
+ WHEN statistics."minResponseTime" IS NULL THEN excluded."minResponseTime"
+ WHEN excluded."minResponseTime" IS NULL THEN statistics."minResponseTime"
+ WHEN statistics."minResponseTime" < excluded."minResponseTime" THEN statistics."minResponseTime"
+ ELSE excluded."minResponseTime"
+ END`);
+ }
+ if (fields.includes('maxResponseTime')) {
+ updateClauses.push(`"maxResponseTime" = CASE
+ WHEN statistics."maxResponseTime" IS NULL THEN excluded."maxResponseTime"
+ WHEN excluded."maxResponseTime" IS NULL THEN statistics."maxResponseTime"
+ WHEN statistics."maxResponseTime" > excluded."maxResponseTime" THEN statistics."maxResponseTime"
+ ELSE excluded."maxResponseTime"
+ END`);
+ }
+ if (updateClauses.length > 0) {
+ sql = `INSERT INTO "${name}" (${quotedFields}) VALUES (${placeholders}) ON CONFLICT("targetId", date) DO UPDATE SET ${updateClauses.join(', ')}`;
+ }
+ } else if (name === 'actions') {
+ // Actions has UNIQUE(targetId, name) - use ON CONFLICT to update instead
+ const updateFields = fields.filter(f => f !== '_id' && f !== 'targetId' && f !== 'name');
+ const updateClauses = updateFields.map(f => `"${f}" = excluded."${f}"`).join(', ');
+ sql = `INSERT INTO "${name}" (${quotedFields}) VALUES (${placeholders}) ON CONFLICT("targetId", name) DO UPDATE SET ${updateClauses}`;
+ } else if (name === 'favicons') {
+ // Favicons has UNIQUE(appUrl) - use ON CONFLICT to update instead
+ const updateFields = fields.filter(f => f !== '_id' && f !== 'appUrl');
+ const updateClauses = updateFields.map(f => `"${f}" = excluded."${f}"`).join(', ');
+ sql = `INSERT INTO "${name}" (${quotedFields}) VALUES (${placeholders}) ON CONFLICT("appUrl") DO UPDATE SET ${updateClauses}`;
+ } else if (name === 'targets') {
+ // Targets has UNIQUE(name) - use ON CONFLICT to update instead
+ const updateFields = fields.filter(f => f !== '_id' && f !== 'name');
+ const updateClauses = updateFields.map(f => `"${f}" = excluded."${f}"`).join(', ');
+ sql = `INSERT INTO "${name}" (${quotedFields}) VALUES (${placeholders}) ON CONFLICT(name) DO UPDATE SET ${updateClauses}`;
+ }
+
+ await executeQuery(sql, values);
+
+ // Invalidate cache for this collection
+ cacheService.invalidateCollection(name);
+
+ return { insertedId: id };
+ } catch (error) {
+ console.error(chalk.red(`Error inserting into ${name}:`), error.message);
+ throw error;
+ }
+ },
+ updateOne: async (queryObj, update) => {
+ try {
+ const { $set } = update;
+ const setClauses = Object.keys($set).map((k, i) => `"${k}" = $${i + 1}`).join(', ');
+ const setValues = Object.values($set).map((v, idx) => {
+ if (typeof v === 'boolean') {
+ return v;
+ }
+ if (v instanceof Date) {
+ // For statistics table date column, use date format (YYYY-MM-DD)
+ const key = Object.keys($set)[idx];
+ if (name === 'statistics' && key === 'date') {
+ return v.toISOString().split('T')[0];
+ }
+ return v.toISOString().replace('T', ' ').substring(0, 19);
+ }
+ if (typeof v === 'object' && v !== null) {
+ return JSON.stringify(v);
+ }
+ return v;
+ });
+
+ const queryKeys = Object.keys(queryObj);
+ const whereClauses = queryKeys.map((k, i) => `"${k}" = $${setValues.length + i + 1}`).join(' AND ');
+ const whereValues = Object.values(queryObj).map((v, idx) => {
+ if (typeof v === 'boolean') {
+ return v;
+ }
+ if (v instanceof Date) {
+ // For statistics table date column, use date format (YYYY-MM-DD)
+ const key = Object.keys(queryObj)[idx];
+ if (name === 'statistics' && key === 'date') {
+ return v.toISOString().split('T')[0];
+ }
+ return v.toISOString().replace('T', ' ').substring(0, 19);
+ }
+ if (typeof v === 'object' && v !== null) {
+ return JSON.stringify(v);
+ }
+ return v;
+ });
+
+ const sql = `UPDATE "${name}" SET ${setClauses} WHERE ${whereClauses}`;
+ const result = await executeQuery(sql, [...setValues, ...whereValues]);
+
+ // Invalidate cache for this collection
+ cacheService.invalidateCollection(name);
+
+ return { modifiedCount: result.rowCount || 0 };
+ } catch (error) {
+ console.error(chalk.red(`Error updating ${name}:`), error.message);
+ throw error;
+ }
+ },
+ deleteOne: async (queryObj) => {
+ try {
+ const keys = Object.keys(queryObj);
+ const whereClauses = keys.map((k, i) => `"${k}" = $${i + 1}`).join(' AND ');
+ const values = Object.values(queryObj).map(v => {
+ if (typeof v === 'boolean') {
+ return v;
+ }
+ if (v instanceof Date) {
+ return v.toISOString().replace('T', ' ').substring(0, 19);
+ }
+ return v;
+ });
+
+ const sql = `DELETE FROM "${name}" WHERE ${whereClauses}`;
+ const result = await executeQuery(sql, values);
+
+ // Invalidate cache for this collection
+ cacheService.invalidateCollection(name);
+
+ return { deletedCount: result.rowCount || 0 };
+ } catch (error) {
+ console.error(chalk.red(`Error deleting from ${name}:`), error.message);
+ throw error;
+ }
+ },
+ deleteMany: async (queryObj = {}) => {
+ try {
+ const keys = Object.keys(queryObj).filter(k => typeof queryObj[k] !== 'function');
+ let sql = `DELETE FROM "${name}"`;
+ const params = [];
+ let paramIndex = 1;
+
+ if (keys.length > 0) {
+ const whereClauses = keys.map(k => {
+ const val = queryObj[k];
+ if (typeof val === 'boolean') {
+ params.push(val);
+ } else if (val instanceof Date) {
+ params.push(val.toISOString().split('T')[0]);
+ } else {
+ params.push(val);
+ }
+ const idx = paramIndex++;
+ return `"${k}" = $${idx}`;
+ });
+ sql += ' WHERE ' + whereClauses.join(' AND ');
+ }
+
+ const result = await executeQuery(sql, params);
+
+ // Invalidate cache for this collection
+ cacheService.invalidateCollection(name);
+
+ return { deletedCount: result.rowCount || 0 };
+ } catch (error) {
+ console.error(chalk.red(`Error deleting from ${name}:`), error.message);
+ throw error;
+ }
+ },
+ countDocuments: async (queryObj = {}) => {
+ try {
+ // Check cache first
+ const cacheKey = cacheService.generateKey(name, queryObj, { count: true });
+ const cached = cacheService.get(cacheKey);
+ if (cached !== null) {
+ return cached;
+ }
+
+ const keys = Object.keys(queryObj).filter(k => typeof queryObj[k] !== 'function');
+ let sql = `SELECT COUNT(*) as count FROM "${name}"`;
+ const params = [];
+ let paramIndex = 1;
+
+ if (keys.length > 0) {
+ const whereClauses = keys.map(k => {
+ const val = queryObj[k];
+ params.push(typeof val === 'boolean' ? val : val);
+ const idx = paramIndex++;
+ return `"${k}" = $${idx}`;
+ });
+ sql += ' WHERE ' + whereClauses.join(' AND ');
+ }
+
+ const result = await executeQuery(sql, params);
+ const count = result.rows[0] ? parseInt(result.rows[0].count) : 0;
+
+ // Cache the count
+ cacheService.set(cacheKey, count, getTTL(name));
+
+ return count;
+ } catch (error) {
+ console.error(chalk.red(`Error counting ${name}:`), error.message);
+ return 0;
+ }
+ },
+ createIndex: async () => true
+ };
+};
+
+const getDB = () => {
+ if (!pool) {
+ throw new Error('Database not connected. Call connectDB() first.');
+ }
+ return {
+ collection: (name) => createCollectionWrapper(name),
+ admin: () => ({
+ ping: async () => {
+ try {
+ const client = await pool.connect();
+ await client.query('SELECT 1');
+ client.release();
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ }),
+ // Direct query method for complex SQL queries
+ query: async (text, params) => {
+ return await executeQuery(text, params);
+ }
+ };
+};
+
+const closeDB = async () => {
+ if (pool) {
+ await pool.end();
+ console.log(chalk.green('β PostgreSQL connection closed'));
+ }
+};
+
+module.exports = {
+ connectDB,
+ getDB,
+ closeDB,
+};
diff --git a/src/config/prisma.js b/src/config/prisma.js
new file mode 100644
index 0000000..d299fbb
--- /dev/null
+++ b/src/config/prisma.js
@@ -0,0 +1,91 @@
+const { PrismaClient } = require('@prisma/client');
+const chalk = require('../utils/colors');
+
+// Singleton pattern for Prisma client
+let prisma = null;
+
+/**
+ * Get or create the Prisma client instance
+ */
+const getPrisma = () => {
+ if (!prisma) {
+ prisma = new PrismaClient({
+ log: process.env.NODE_ENV === 'development'
+ ? ['warn', 'error']
+ : ['error'],
+ });
+ }
+ return prisma;
+};
+
+/**
+ * Keep existing installations compatible with additive schema changes. The
+ * application is commonly upgraded in place, so relying only on a fresh
+ * `prisma db push` would leave the notification settings endpoint unusable on
+ * older databases.
+ */
+const ensureRuntimeSchema = async (client) => {
+ try {
+ await client.$executeRawUnsafe(
+ 'ALTER TABLE "notificationSettings" ADD COLUMN IF NOT EXISTS "monitorDownDelayMinutes" INTEGER NOT NULL DEFAULT 5',
+ );
+ // The public uptime list aggregates recent ping results by monitor and
+ // time bucket. Keep the two predicates together in one index so that
+ // loading the compact graphs does not scan the complete ping history.
+ await client.$executeRawUnsafe(
+ 'CREATE INDEX IF NOT EXISTS idx_pingResults_targetId_timestamp ON "pingResults"("targetId", timestamp)',
+ );
+ } catch (error) {
+ // A first-run database may not have been pushed yet. Prisma's normal
+ // schema deployment remains responsible for creating missing tables.
+ console.warn(chalk.yellow('β Could not apply notification delay migration:'), error.message);
+ }
+};
+
+/**
+ * Connect to the database
+ */
+const connectDB = async () => {
+ try {
+ const client = getPrisma();
+ await client.$connect();
+ await ensureRuntimeSchema(client);
+ console.log(chalk.green('β PostgreSQL database connected via Prisma'));
+ return client;
+ } catch (error) {
+ console.error(chalk.red('β PostgreSQL connection failed:'), error.message);
+ process.exit(1);
+ }
+};
+
+/**
+ * Disconnect from the database
+ */
+const disconnectDB = async () => {
+ if (prisma) {
+ await prisma.$disconnect();
+ console.log(chalk.green('β PostgreSQL connection closed'));
+ prisma = null;
+ }
+};
+
+/**
+ * Execute raw SQL query
+ * @param {string} sql - SQL query with $1, $2, etc. placeholders
+ * @param {Array} params - Query parameters
+ */
+const executeRawQuery = async (sql, params = []) => {
+ const client = getPrisma();
+ // Convert $1, $2 style to Prisma.sql template
+ // For now, use $queryRawUnsafe but be careful with SQL injection
+ const result = await client.$queryRawUnsafe(sql, ...params);
+ return { rows: result };
+};
+
+module.exports = {
+ getPrisma,
+ connectDB,
+ disconnectDB,
+ executeRawQuery,
+ ensureRuntimeSchema,
+};
diff --git a/src/config/sessionStore.js b/src/config/sessionStore.js
new file mode 100644
index 0000000..c1c15ba
--- /dev/null
+++ b/src/config/sessionStore.js
@@ -0,0 +1,136 @@
+const Database = require('better-sqlite3');
+const session = require('express-session');
+const path = require('path');
+const fs = require('fs');
+
+let db = null;
+
+class SQLiteSessionStore extends session.Store {
+ constructor(options = {}) {
+ super(options);
+ const dbDir = path.join(process.cwd(), 'data');
+ const dbPath = path.join(dbDir, 'localping.db');
+
+ // Ensure data directory exists
+ if (!fs.existsSync(dbDir)) {
+ fs.mkdirSync(dbDir, { recursive: true });
+ }
+
+ db = new Database(dbPath);
+ db.pragma('foreign_keys = ON');
+
+ // Create sessions table if it doesn't exist
+ db.exec(`
+ CREATE TABLE IF NOT EXISTS sessions (
+ sid TEXT PRIMARY KEY,
+ sess TEXT NOT NULL,
+ expire INTEGER NOT NULL
+ )
+ `);
+
+ // Create index on expire for cleanup
+ db.exec(`
+ CREATE INDEX IF NOT EXISTS idx_sessions_expire ON sessions(expire)
+ `);
+
+ // Clean up expired sessions periodically (every hour)
+ setInterval(() => {
+ this.cleanup();
+ }, 60 * 60 * 1000);
+ }
+
+ get(sid, callback) {
+ try {
+ const stmt = db.prepare('SELECT sess FROM sessions WHERE sid = ? AND expire > ?');
+ const row = stmt.get(sid, Date.now());
+
+ if (row) {
+ callback(null, JSON.parse(row.sess));
+ } else {
+ callback(null, null);
+ }
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ set(sid, sess, callback) {
+ try {
+ const expire = sess.cookie && sess.cookie.expires
+ ? sess.cookie.expires.getTime()
+ : Date.now() + (24 * 60 * 60 * 1000); // Default 24 hours
+
+ const stmt = db.prepare('INSERT OR REPLACE INTO sessions (sid, sess, expire) VALUES (?, ?, ?)');
+ stmt.run(sid, JSON.stringify(sess), expire);
+ callback(null);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ destroy(sid, callback) {
+ try {
+ const stmt = db.prepare('DELETE FROM sessions WHERE sid = ?');
+ stmt.run(sid);
+ callback(null);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ all(callback) {
+ try {
+ const stmt = db.prepare('SELECT sess FROM sessions WHERE expire > ?');
+ const rows = stmt.all(Date.now());
+ const sessions = rows.map(row => JSON.parse(row.sess));
+ callback(null, sessions);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ length(callback) {
+ try {
+ const stmt = db.prepare('SELECT COUNT(*) as count FROM sessions WHERE expire > ?');
+ const row = stmt.get(Date.now());
+ callback(null, row ? row.count : 0);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ clear(callback) {
+ try {
+ db.exec('DELETE FROM sessions');
+ callback(null);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ touch(sid, sess, callback) {
+ try {
+ const expire = sess.cookie && sess.cookie.expires
+ ? sess.cookie.expires.getTime()
+ : Date.now() + (24 * 60 * 60 * 1000);
+
+ const stmt = db.prepare('UPDATE sessions SET sess = ?, expire = ? WHERE sid = ?');
+ stmt.run(JSON.stringify(sess), expire, sid);
+ callback(null);
+ } catch (error) {
+ callback(error);
+ }
+ }
+
+ cleanup() {
+ try {
+ const stmt = db.prepare('DELETE FROM sessions WHERE expire < ?');
+ stmt.run(Date.now());
+ } catch (error) {
+ console.error('Error cleaning up sessions:', error);
+ }
+ }
+}
+
+module.exports = SQLiteSessionStore;
+
diff --git a/src/electron/main.js b/src/electron/main.js
new file mode 100644
index 0000000..687835c
--- /dev/null
+++ b/src/electron/main.js
@@ -0,0 +1,99 @@
+const { app, BrowserWindow, Menu, ipcMain } = require('electron');
+const path = require('path');
+const isDev = require('electron-is-dev');
+
+let mainWindow;
+
+function createWindow() {
+ mainWindow = new BrowserWindow({
+ width: 1400,
+ height: 900,
+ minWidth: 800,
+ minHeight: 600,
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.js'),
+ contextIsolation: true,
+ enableRemoteModule: false,
+ nodeIntegration: false,
+ },
+ });
+
+ const startURL = isDev
+ ? 'http://localhost:3001/admin'
+ : `file://${path.join(__dirname, '../views/admin/index.ejs')}`;
+
+ mainWindow.loadURL(startURL);
+
+ if (isDev) {
+ mainWindow.webContents.openDevTools();
+ }
+
+ mainWindow.on('closed', () => {
+ mainWindow = null;
+ });
+}
+
+// Create application menu
+function createMenu() {
+ const template = [
+ {
+ label: 'File',
+ submenu: [
+ {
+ label: 'Exit',
+ accelerator: 'CmdOrCtrl+Q',
+ click: () => {
+ app.quit();
+ },
+ },
+ ],
+ },
+ {
+ label: 'View',
+ submenu: [
+ {
+ label: 'Reload',
+ accelerator: 'CmdOrCtrl+R',
+ click: () => {
+ mainWindow.webContents.reload();
+ },
+ },
+ {
+ label: 'Dev Tools',
+ accelerator: 'CmdOrCtrl+Shift+I',
+ click: () => {
+ mainWindow.webContents.toggleDevTools();
+ },
+ },
+ ],
+ },
+ ];
+
+ const menu = Menu.buildFromTemplate(template);
+ Menu.setApplicationMenu(menu);
+}
+
+app.on('ready', () => {
+ createWindow();
+ createMenu();
+});
+
+app.on('window-all-closed', () => {
+ if (process.platform !== 'darwin') {
+ app.quit();
+ }
+});
+
+app.on('activate', () => {
+ if (mainWindow === null) {
+ createWindow();
+ }
+});
+
+// IPC handlers
+ipcMain.handle('get-status', async (event) => {
+ // Implementation for getting status from API
+ return { status: 'ok' };
+});
+
+module.exports = mainWindow;
diff --git a/src/electron/preload.js b/src/electron/preload.js
new file mode 100644
index 0000000..91f775e
--- /dev/null
+++ b/src/electron/preload.js
@@ -0,0 +1,5 @@
+const { contextBridge, ipcMain } = require('electron');
+
+contextBridge.exposeInMainWorld('api', {
+ getStatus: () => ipcMain.invoke('get-status'),
+});
diff --git a/src/middleware/auth.js b/src/middleware/auth.js
new file mode 100644
index 0000000..4bc8a35
--- /dev/null
+++ b/src/middleware/auth.js
@@ -0,0 +1,191 @@
+const chalk = require('../utils/colors');
+
+/**
+ * API Key Authentication Middleware
+ * Checks for valid API key in Authorization header or X-API-Key header
+ */
+function apiKeyAuth(req, res, next) {
+ const apiKey = process.env.ADMIN_API_KEY;
+
+ // If no API key is configured, skip authentication (unsafe - only for local dev)
+ if (!apiKey) {
+ console.warn(chalk.yellow('β No ADMIN_API_KEY configured - authentication disabled'));
+ return next();
+ }
+
+ // Check for API key in headers
+ const authHeader = req.headers.authorization || '';
+ const xApiKey = req.headers['x-api-key'] || '';
+
+ // Support both "Bearer " and direct key
+ const providedKey = authHeader.replace('Bearer ', '') || xApiKey;
+
+ if (!providedKey || providedKey !== apiKey) {
+ return res.status(401).json({
+ success: false,
+ error: 'Unauthorized: Invalid or missing API key',
+ });
+ }
+
+ next();
+}
+
+/**
+ * Admin Page Authentication Middleware
+ * Checks for admin password in session or cookie
+ */
+function adminPageAuth(req, res, next) {
+ const adminPassword = process.env.ADMIN_PASSWORD;
+
+ // If no admin password is configured, skip authentication (shouldn't happen after setup)
+ if (!adminPassword || !adminPassword.trim()) {
+ console.warn(chalk.yellow('β No ADMIN_PASSWORD configured - admin page authentication disabled'));
+ return next();
+ }
+
+ // Allow login page and login POST endpoint without authentication
+ if (req.path === '/login' || (req.method === 'POST' && req.path === '/login')) {
+ return next();
+ }
+
+ // Check if user has valid admin session
+ // Session expiration is handled automatically by the session store and cookie maxAge
+ if (req.session && req.session.adminAuthenticated) {
+ return next();
+ }
+
+ // Not authenticated - redirect to login
+ if (req.headers.accept && req.headers.accept.includes('application/json')) {
+ return res.status(401).json({
+ success: false,
+ error: 'Unauthorized: Admin authentication required',
+ });
+ }
+
+ // For page requests, redirect to login
+ res.redirect('/admin/login');
+}
+
+/**
+ * Rate Limiting Middleware
+ * Prevents brute force attacks on API endpoints
+ */
+function createRateLimiter(windowMs = 15 * 60 * 1000, maxRequests = 100) {
+ const requests = new Map();
+
+ return (req, res, next) => {
+ const ip = req.ip || req.connection.remoteAddress;
+ const now = Date.now();
+
+ // Clean old entries
+ if (!requests.has(ip)) {
+ requests.set(ip, []);
+ }
+
+ const userRequests = requests.get(ip);
+
+ // Remove requests outside the window
+ const recentRequests = userRequests.filter((time) => now - time < windowMs);
+ requests.set(ip, recentRequests);
+
+ // Check if over limit
+ if (recentRequests.length >= maxRequests) {
+ return res.status(429).json({
+ success: false,
+ error: 'Too many requests, please try again later',
+ });
+ }
+
+ // Record this request
+ recentRequests.push(now);
+ next();
+ };
+}
+
+/**
+ * Input Validation Middleware
+ * Validates that required fields are present and valid
+ * For PUT requests, allows partial updates (only validates provided fields)
+ */
+function validateTargetInput(req, res, next) {
+ const { name, host, protocol, port, interval } = req.body;
+ const isUpdate = req.method === 'PUT';
+
+ const errors = [];
+
+ // For PUT requests, only validate fields that are provided
+ // For POST requests, validate all required fields
+ if (!isUpdate) {
+ // Validate name (required for POST)
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
+ errors.push('Target name is required and must be a non-empty string');
+ }
+
+ // Validate host (required for POST)
+ if (!host || typeof host !== 'string' || host.trim().length === 0) {
+ errors.push('Host is required and must be a non-empty string');
+ }
+
+ // Validate protocol (required for POST)
+ const validProtocols = ['ICMP', 'TCP', 'UDP', 'HTTP', 'HTTPS'];
+ if (!protocol || !validProtocols.includes(protocol.toUpperCase())) {
+ errors.push(`Protocol must be one of: ${validProtocols.join(', ')}`);
+ }
+ } else {
+ // For PUT requests, only validate provided fields
+ // Validate name if provided
+ if (name !== undefined) {
+ if (typeof name !== 'string' || name.trim().length === 0) {
+ errors.push('Target name must be a non-empty string');
+ }
+ }
+
+ // Validate host if provided
+ if (host !== undefined) {
+ if (typeof host !== 'string' || host.trim().length === 0) {
+ errors.push('Host must be a non-empty string');
+ }
+ }
+
+ // Validate protocol if provided
+ if (protocol !== undefined) {
+ const validProtocols = ['ICMP', 'TCP', 'UDP', 'HTTP', 'HTTPS'];
+ if (!validProtocols.includes(protocol.toUpperCase())) {
+ errors.push(`Protocol must be one of: ${validProtocols.join(', ')}`);
+ }
+ }
+ }
+
+ // Validate port if provided (null means no custom port, which is valid)
+ if (port !== undefined && port !== null) {
+ const portNum = parseInt(port, 10);
+ if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
+ errors.push('Port must be a number between 1 and 65535');
+ }
+ }
+
+ // Validate interval if provided (null means use default, which is valid)
+ if (interval !== undefined && interval !== null) {
+ const intervalNum = parseInt(interval, 10);
+ if (isNaN(intervalNum) || intervalNum < 5 || intervalNum > 3600) {
+ errors.push('Interval must be a number between 5 and 3600 seconds');
+ }
+ }
+
+ // If there are errors, return them
+ if (errors.length > 0) {
+ return res.status(400).json({
+ success: false,
+ errors: errors,
+ });
+ }
+
+ next();
+}
+
+module.exports = {
+ apiKeyAuth,
+ adminPageAuth,
+ createRateLimiter,
+ validateTargetInput,
+};
diff --git a/src/middleware/setupCheck.js b/src/middleware/setupCheck.js
new file mode 100644
index 0000000..0fb65c3
--- /dev/null
+++ b/src/middleware/setupCheck.js
@@ -0,0 +1,42 @@
+/**
+ * Setup Check Middleware
+ * Checks if LocalPing has been configured (admin password set)
+ * Redirects to setup wizard if not configured
+ */
+
+function isSetupComplete() {
+ const adminPassword = process.env.ADMIN_PASSWORD;
+ return !!(adminPassword && adminPassword.trim());
+}
+
+function setupCheckMiddleware(req, res, next) {
+ // Allow access to setup routes without checking
+ if (req.path.startsWith('/setup')) {
+ return next();
+ }
+
+ // Allow static assets
+ if (req.path.startsWith('/public') || req.path.startsWith('/vendor') || req.path.startsWith('/js') || req.path.startsWith('/css') || req.path.match(/\.(css|js|png|jpg|gif|svg|ico|woff|woff2|ttf|eot)$/)) {
+ return next();
+ }
+
+ // Check if setup is complete
+ if (!isSetupComplete()) {
+ // Allow public API access for status pages, but redirect web UI
+ if (req.path.startsWith('/api/') && req.headers.accept !== 'text/html') {
+ return next();
+ }
+
+ // Redirect web UI to setup
+ if (req.headers.accept && req.headers.accept.includes('text/html')) {
+ return res.redirect('/setup');
+ }
+ }
+
+ next();
+}
+
+module.exports = {
+ setupCheckMiddleware,
+ isSetupComplete,
+};
diff --git a/src/public/android-icon-192x192.png b/src/public/android-icon-192x192.png
new file mode 100644
index 0000000000000000000000000000000000000000..0f6d43c954a5ca4530f5b2b88bae454c38d7e6ce
GIT binary patch
literal 21121
zcmV)+K#0GIP)004R>
z004l5008;`004mK004C`008P>0026e000+ooVrmw00006VoOIv00000008+zyMF)x
z00(qQO+^Rk3l#(=HsS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yK*LZafclq2ry|^TlPOd$C$^1f+p&Q0-FoB@6_~Z54Dtu&LI>!BSO&
zH*Gq<#EpEcvv!Uwf4z_I;a{Ni7B|d0E-CE9KBIEZevrFh0H4mv;Mylx6h2@FLykG))(lyBKCK!;X-(sqq-q
z_KC16}UX(5AcYFK*K>wGJ90NoqC5HkDUp664lZOwCiW|z^weixA*?$AMJlAyq
literal 0
HcmV?d00001
diff --git a/src/public/browserconfig.xml b/src/public/browserconfig.xml
new file mode 100644
index 0000000..7d453d3
--- /dev/null
+++ b/src/public/browserconfig.xml
@@ -0,0 +1,2 @@
+
+#ffffff
diff --git a/src/public/favicon-16x16.png b/src/public/favicon-16x16.png
new file mode 100644
index 0000000000000000000000000000000000000000..a761e90deff2fde9007b75bdb938a9a67c63df55
GIT binary patch
literal 709
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Lb6AYF9SoB8UsT^3j@P1pisjL
z28L1t28LG&3=CE?7#PG0=Ijcz0ZM!h@Ck9{7E$6BQREhq=aSQ5cMfCsjAi$TWp|5W
zcMj)p3}LRH%@$M47G2C5Tf!Do!kSpgnpDNyFo)eenoCN9!^DkSSb+$i^I~JQ`3^uz>(9?iAzj{!`PL>)SbgVm@PPyHKBqvwU#xdhQr#I
zOH_$VT$M{)1?caSoBIy}DaIskcb9<2c|Lo99QG1VUsv{*+@dUMX3w6UFb4{)_H=O!
zk+__kpulEe`IW;L{voW1wy5(ld#@gD}GH2!n
zcI@?Ob33NCEbWKYk_7?@ZYTUeQzXd4(<85mSP_sv7mkei>9nO2Eg1IMnfmw*~H;5L+G=B5^xB<2?2
V))T+}3NKI(gQu&X%Q~loCIFDy%{%}A
literal 0
HcmV?d00001
diff --git a/src/public/favicon-32x32.png b/src/public/favicon-32x32.png
new file mode 100644
index 0000000000000000000000000000000000000000..d94b92dbc686e835dcdcf2ac39ff2e0665a4cfd5
GIT binary patch
literal 1146
zcmZ{hdrVVz6vuzJy|?$#l8ra5QwxPsCnq_l
zS)HEjLU0HGfQvFkkwGcYRJqwWa
z3+To?-Q0(2-lx~~L;Xv@wt?s_!o~Ga?;;kZBmyKjKavO#V~39-g_m$~64bkZ6xZW{
zkxaLPOt%AgxSZBD2K6oCq9cTV1YGh7T-J=mq~l~f)b}NtlmnME;K4Fl_Y7p2!(!FA
zFoAZ(jwT+*q^Xc)mZ2@8wb`&}6|Hj$jBTKbY`Cf$Rb=5o(M&HM(~}B6g3U*Y%wS}V
zUULJ!a1H+GD!s-EZm%I{>#%n-Xzk;Wb&l5l85XA@d`ZGjh^kJ4;m2Tf9SpCc%98{?
z5{r2cKHou5H}Up|jqOnX1Gu!2@bV}21z{ouCP~I46nIDsen?6j3`3Q9w8mlR`aP)U
zKGZ!!uOC3pn9)=n9w5efB0MaPky(PqXA|4|#a^bKipTW~KZaz1c0Lxj|?R4#*4)4UKgyabw+m
zcq$e7n?BxjI9L{#l@=HNU|>_aC>YANDelkM-w8pEEkDfG9QWLxmv`$_?#T7rtRFh`
z1>a&>U@`$`nIgXuOJ<+We9oS!b8x+Og1NJ`Py}z=>A+^%Ty0%L;`ZK^A8*$2AHl9|
zk46DUfKBUIV4SDimPsD7sJ8|f6SIv4`Nl%2{#+p?Ktzfpp+aG(NT?;n(uioOL>x?#
zQj)CvHSL4{0i|UHMTW{Z1K9kZTNEJpZ-cR@wD3b?erfrenNxS4x=;*ICZ;RK6Lhuz
E0_99@_W%F@
literal 0
HcmV?d00001
diff --git a/src/public/favicon.ico b/src/public/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..aa818b4916f5c37187bcfdd99374059beae29d81
GIT binary patch
literal 1150
zcmcgs*)Bs-6g^FQ&b__&K~W^es!A#(<_8fGGZ8}&Q(LnH34$79dc(WnfmffvC-|*p
z?|Yr3Zc5@so7HvB+Veh1h49fg6cY3s5gP#^3WX4H0!gH}I*|}$^M0aX8`)4vIwRBO
zy=U68opp{(&gQ4JNWP7Vyzht>*r+bD5F>CN_VMSBo?9D42FG^fe%+{2`Y_EagHWO_%L3A|)
z(cKsX`?@n(-}b}3m*;XXHjb(8+oKQfPd*$iNUCY0EacAS?VsmotvP04cTVAu{BL&y
z_;?i#Zg&DWOex34KD-0HGtFF^dwn?dV`r|JC=PN(;sc=BPT#xgeE=!!PNW5J8!9F~zo?A2LsVlcI
o-D4m%L>T-6ow+vaGX(a@_I{j)b Number(stat.successfulPings || 0) === 0);
+ return downBuckets.map((isDown, index) => (
+ isDown || downBuckets[index - 1] || downBuckets[index + 1] ? maxValue : null
+ ));
+}
+
+// Keep the graph visually minimal while retaining useful hover details. The
+// downtime series has bridge points around outages for a continuous fill;
+// those points are filtered out of the tooltip via the chart status map.
+function buildGraphTooltipOptions() {
+ return {
+ enabled: true,
+ mode: 'index',
+ intersect: false,
+ displayColors: false,
+ backgroundColor: 'rgba(15, 23, 42, 0.96)',
+ titleColor: '#f8fafc',
+ bodyColor: '#e2e8f0',
+ borderColor: 'rgba(148, 163, 184, 0.25)',
+ borderWidth: 1,
+ callbacks: {
+ title: tooltipItems => tooltipItems[0]?.label || '',
+ label: context => {
+ if (context.datasetIndex === 1) return 'π΄ Service Down';
+ const responseTime = Number(context.raw);
+ return Number.isFinite(responseTime) ? `${Math.round(responseTime)} ms` : '';
+ },
+ },
+ filter: context => {
+ if (context.datasetIndex === 0) {
+ return context.raw !== null && context.raw !== undefined;
+ }
+ const downtimeAtIndex = context.chart?._downtimeAtIndex || [];
+ return Boolean(downtimeAtIndex[context.dataIndex])
+ && context.raw !== null
+ && context.raw !== undefined;
+ },
+ };
+}
+
+// Map URL paths to tab names
+const urlToTabMap = {
+ '/admin': 'monitors',
+ '/admin/incidents': 'incidents',
+ '/admin/events': 'event-rules',
+ '/admin/blogs': 'posts',
+ '/admin/visibility': 'visibility',
+ '/admin/settings': 'settings',
+ '/admin/backup': 'backup'
+};
+
+// Map tab names to URLs
+const tabToUrlMap = {
+ 'monitors': '/admin',
+ 'incidents': '/admin/incidents',
+ 'event-rules': '/admin/events',
+ 'posts': '/admin/blogs',
+ 'visibility': '/admin/visibility',
+ 'settings': '/admin/settings',
+ 'backup': '/admin/backup'
+};
+
+// Get current tab from URL
+function getCurrentTabFromUrl() {
+ const path = window.location.pathname;
+ return urlToTabMap[path] || 'monitors';
+}
+
+// Tab switching with URL navigation
+function switchTab(tabName, eventElement) {
+ if (tabName !== 'monitors') {
+ closeMobileMonitorView();
+ }
+
+ // Update URL without page reload
+ const url = tabToUrlMap[tabName] || '/admin';
+ window.history.pushState({ tab: tabName }, '', url);
+
+ // Hide all tabs
+ document.querySelectorAll('.tab-content').forEach(tab => {
+ tab.classList.remove('active');
+ });
+
+ // Remove active class from all buttons
+ document.querySelectorAll('.tab-button').forEach(btn => {
+ btn.classList.remove('active');
+ });
+
+ // Show selected tab
+ const tabElement = document.getElementById(tabName);
+ if (tabElement) {
+ tabElement.classList.add('active');
+ }
+
+ // Set active button - find by href
+ document.querySelectorAll('.tab-button').forEach(btn => {
+ if (btn.getAttribute('href') === url) {
+ btn.classList.add('active');
+ }
+ });
+
+ // Load tab-specific data
+ if (tabName === 'monitors') {
+ loadMonitors();
+ } else if (tabName === 'incidents') {
+ loadIncidents();
+ } else if (tabName === 'event-rules') {
+ loadEventRules();
+ } else if (tabName === 'posts') {
+ loadPosts();
+ } else if (tabName === 'visibility') {
+ loadVisibility();
+ } else if (tabName === 'settings') {
+ loadPublicUISettings();
+ } else if (tabName === 'backup') {
+ // Backup tab doesn't need to load anything on switch
+ }
+}
+
+// Initialize tab on page load
+document.addEventListener('DOMContentLoaded', () => {
+ const currentTab = getCurrentTabFromUrl();
+ switchTab(currentTab);
+});
+
+// Handle browser back/forward buttons
+window.addEventListener('popstate', (event) => {
+ const currentTab = getCurrentTabFromUrl();
+ switchTab(currentTab);
+});
+
+// Handle tab link clicks - prevent default and use pushState for smooth navigation
+function handleTabClick(event, tabName) {
+ event.preventDefault();
+ switchTab(tabName);
+}
+
+// Load monitors list
+async function loadMonitors() {
+ try {
+ const response = await axios.get('/admin/api/dashboard');
+ const targets = response.data.dashboard.targets;
+
+ const monitorList = document.getElementById('monitorList');
+ monitorList.innerHTML = '';
+
+ if (targets.length === 0) {
+ monitorList.innerHTML = 'No monitors yet
';
+ return;
+ }
+
+ targets.forEach(target => {
+ const status = target.currentStatus === 'up' ? 'up' : 'down';
+ const statusText = status === 'up' ? 'Up' : 'Down';
+
+ // Get favicon - prefer appIcon, then favicon from API, then try to get from appUrl
+ let faviconHtml = '';
+ if (target.appIcon) {
+ // Proxy the icon URL
+ const proxyUrl = `/admin/api/proxy-icon?url=${encodeURIComponent(target.appIcon)}`;
+ faviconHtml = `
`;
+ } else if (target.favicon) {
+ // Use cached favicon from API - if it's base64, use directly, otherwise proxy
+ if (target.favicon.startsWith('data:')) {
+ faviconHtml = `
`;
+ } else {
+ const proxyUrl = `/admin/api/proxy-icon?url=${encodeURIComponent(target.favicon)}`;
+ faviconHtml = `
`;
+ }
+ } else if (target.appUrl) {
+ // Try to get favicon from appUrl
+ const faviconUrl = getFaviconUrl(target.appUrl);
+ if (faviconUrl) {
+ const proxyUrl = `/admin/api/proxy-icon?url=${encodeURIComponent(faviconUrl)}`;
+ faviconHtml = `
`;
+ }
+ }
+
+ const card = document.createElement('div');
+ card.className = 'monitor-card';
+ card.dataset.monitorId = target._id;
+ card.innerHTML = `
+
+ ${faviconHtml ? `
${faviconHtml}
` : ''}
+
+
${target.name}
+
${target.host}
+
+
+
+ ${statusText}
+
+
+ `;
+ card.setAttribute('role', 'button');
+ card.tabIndex = 0;
+ card.onclick = () => selectMonitor(target, { openMobile: true });
+ card.onkeydown = (event) => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ selectMonitor(target, { openMobile: true });
+ }
+ };
+
+ if (currentMonitorId === target._id) {
+ card.classList.add('selected');
+ }
+
+ monitorList.appendChild(card);
+ });
+
+ // Auto-select first monitor if none is selected
+ if (currentMonitorId === null && targets.length > 0) {
+ // Keep the monitor list as the mobile landing view. A detail surface
+ // opens only after an explicit card activation.
+ selectMonitor(targets[0], { openMobile: false });
+ }
+ } catch (error) {
+ console.error('Error loading monitors:', error);
+ showNotification('Error loading monitors', 'error');
+ }
+}
+
+function isCurrentMonitorSelection(targetId, selectionVersion = null) {
+ return currentMonitorId === targetId
+ && (selectionVersion === null || selectionVersion === monitorSelectionVersion);
+}
+
+function setMonitorActionVisibility(visible) {
+ ['editMonitorBtn', 'cloneMonitorBtn', 'clearPingDataBtn'].forEach((id) => {
+ const button = document.getElementById(id);
+ if (button) button.style.display = visible ? 'inline-flex' : 'none';
+ });
+}
+
+function setMonitorLoadingState(isLoading) {
+ const skeleton = document.getElementById('monitorDetailSkeleton');
+ const content = document.getElementById('monitorDetailContent');
+ if (skeleton) skeleton.classList.toggle('hidden', !isLoading);
+ if (content) content.classList.toggle('hidden', isLoading);
+}
+
+function isMobileMonitorViewport() {
+ return typeof window !== 'undefined'
+ && typeof window.matchMedia === 'function'
+ && window.matchMedia('(max-width: 1023px)').matches;
+}
+
+function openMobileMonitorView() {
+ if (!isMobileMonitorViewport()) return;
+
+ const details = document.getElementById('monitorDetails');
+ if (!details) return;
+
+ document.body.classList.add('monitor-detail-open');
+ const backButton = document.getElementById('mobileMonitorBackBtn');
+ if (backButton) {
+ // Focus the escape hatch without scrolling the underlying document.
+ setTimeout(() => backButton.focus({ preventScroll: true }), 0);
+ }
+}
+
+function closeMobileMonitorView() {
+ if (typeof document === 'undefined') return;
+ const shouldRestoreFocus = document.activeElement?.id === 'mobileMonitorBackBtn';
+ document.body.classList.remove('monitor-detail-open');
+
+ if (shouldRestoreFocus && currentMonitorId) {
+ const selectedCard = Array.from(document.querySelectorAll('.monitor-card'))
+ .find(card => card.dataset.monitorId === currentMonitorId);
+ if (selectedCard) setTimeout(() => selectedCard.focus({ preventScroll: true }), 0);
+ }
+}
+
+if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {
+ window.addEventListener('resize', () => {
+ if (!isMobileMonitorViewport()) closeMobileMonitorView();
+ });
+}
+
+function showMonitorSummary() {
+ const summary = document.getElementById('monitorSummaryPane');
+ const editor = document.getElementById('monitorEditor');
+ const content = document.getElementById('monitorDetailContent');
+ if (content) content.classList.remove('hidden');
+ if (summary) summary.classList.remove('hidden');
+ if (editor) editor.classList.add('hidden');
+}
+
+function populateMonitorForm(fullMonitor) {
+ const values = {
+ editName: fullMonitor.name || '',
+ editHost: fullMonitor.host || '',
+ editProtocol: fullMonitor.protocol || 'ICMP',
+ editPort: fullMonitor.port || '',
+ editInterval: fullMonitor.interval || 60,
+ editGroup: fullMonitor.group || '',
+ editAppUrl: fullMonitor.appUrl || '',
+ editAppIcon: fullMonitor.appIcon || '',
+ editRetries: fullMonitor.retries || 0,
+ editRetryInterval: fullMonitor.retryInterval || 5,
+ editHttpMethod: fullMonitor.httpMethod || 'GET',
+ editTimeout: fullMonitor.timeout || 30,
+ editStatusCodes: fullMonitor.statusCodes || '200-299',
+ editMaxRedirects: fullMonitor.maxRedirects || 5,
+ editPosition: fullMonitor.position || 0,
+ editQuickCommands: (fullMonitor.quickCommands || []).join(', '),
+ };
+
+ Object.entries(values).forEach(([id, value]) => {
+ const element = document.getElementById(id);
+ if (element) element.value = value;
+ });
+
+ const checkedValues = {
+ editEnabled: fullMonitor.enabled !== false,
+ editIgnoreSsl: fullMonitor.ignoreSsl === true,
+ editUpsideDown: fullMonitor.upsideDown === true,
+ editImportant: fullMonitor.important === true,
+ editPublicVisible: fullMonitor.publicVisible !== false,
+ };
+ Object.entries(checkedValues).forEach(([id, checked]) => {
+ const element = document.getElementById(id);
+ if (element) element.checked = checked;
+ });
+
+ const authMethod = document.getElementById('editAuthMethod');
+ const authUsername = document.getElementById('editAuthUsername');
+ const authPassword = document.getElementById('editAuthPassword');
+ const authToken = document.getElementById('editAuthToken');
+ if (authMethod) authMethod.value = 'none';
+ if (authUsername) authUsername.value = '';
+ if (authPassword) authPassword.value = '';
+ if (authToken) authToken.value = '';
+
+ let auth = fullMonitor.auth;
+ if (typeof auth === 'string') {
+ try { auth = JSON.parse(auth); } catch (error) { auth = null; }
+ }
+ if (auth?.type === 'basic') {
+ if (authMethod) authMethod.value = 'basic';
+ if (authUsername) authUsername.value = auth.username || '';
+ if (authPassword) authPassword.value = auth.password || '';
+ } else if (auth?.type === 'bearer') {
+ if (authMethod) authMethod.value = 'bearer';
+ if (authToken) authToken.value = auth.token || '';
+ }
+
+ updateProtocolSettings();
+ updateAuthFields();
+ attachFormListeners();
+}
+
+function resetMonitorWorkspace() {
+ monitorSelectionVersion += 1;
+ currentMonitorId = null;
+ closeMobileMonitorView();
+ setMonitorLoadingState(false);
+ setMonitorActionVisibility(false);
+
+ const details = document.getElementById('monitorDetails');
+ const emptyState = document.getElementById('emptyState');
+ const summary = document.getElementById('monitorSummaryPane');
+ const editor = document.getElementById('monitorEditor');
+ if (details) details.classList.add('hidden');
+ if (emptyState) emptyState.classList.remove('hidden');
+ if (summary) summary.classList.remove('hidden');
+ if (editor) editor.classList.add('hidden');
+
+ const form = document.getElementById('editForm');
+ if (form) form.reset();
+ document.querySelectorAll('.monitor-card').forEach(card => card.classList.remove('selected'));
+}
+
+// Select monitor and show details
+async function selectMonitor(monitor, options = {}) {
+ if (!monitor?._id) return;
+
+ const openMobile = options.openMobile !== false;
+
+ const selectionVersion = ++monitorSelectionVersion;
+ currentMonitorId = monitor._id;
+
+ const details = document.getElementById('monitorDetails');
+ const emptyState = document.getElementById('emptyState');
+ const summary = document.getElementById('monitorSummaryPane');
+ const editor = document.getElementById('monitorEditor');
+ if (emptyState) emptyState.classList.add('hidden');
+ if (details) details.classList.remove('hidden');
+ if (summary) summary.classList.remove('hidden');
+ if (editor) editor.classList.add('hidden');
+ setMonitorActionVisibility(false);
+ setMonitorLoadingState(true);
+ if (openMobile) {
+ openMobileMonitorView();
+ } else {
+ closeMobileMonitorView();
+ }
+
+ const mobileToolbarLabel = document.getElementById('mobileMonitorToolbarLabel');
+ if (mobileToolbarLabel) mobileToolbarLabel.textContent = monitor.name || 'Monitor details';
+
+ // Highlight the selection immediately while the detail request is in flight.
+ document.querySelectorAll('.monitor-card').forEach(card => {
+ card.classList.toggle('selected', card.dataset.monitorId === monitor._id);
+ });
+
+ try {
+ const response = await axios.get(`/admin/api/targets/${monitor._id}`);
+ if (!isCurrentMonitorSelection(monitor._id, selectionVersion)) return;
+ const fullMonitor = response.data.target;
+
+ populateMonitorForm(fullMonitor);
+ document.getElementById('monitorName').textContent = fullMonitor.name || monitor.name || 'Monitor';
+ const mobileToolbarLabel = document.getElementById('mobileMonitorToolbarLabel');
+ if (mobileToolbarLabel) mobileToolbarLabel.textContent = fullMonitor.name || monitor.name || 'Monitor details';
+
+ const status = fullMonitor.currentStatus === 'up' ? 'Up' : 'Down';
+ const statusColor = fullMonitor.currentStatus === 'up' ? 'text-green-400' : 'text-red-400';
+ document.getElementById('monitorStatus').textContent = status;
+ document.getElementById('monitorStatus').className = statusColor;
+
+ // Keep the skeleton visible until both the monitor and its chart are ready.
+ await loadMonitorStatistics(fullMonitor._id, fullMonitor.timeout || 30, selectionVersion);
+ if (!isCurrentMonitorSelection(monitor._id, selectionVersion)) return;
+
+ setMonitorLoadingState(false);
+ setMonitorActionVisibility(true);
+ } catch (error) {
+ if (!isCurrentMonitorSelection(monitor._id, selectionVersion)) return;
+ console.error('Error loading monitor details:', error);
+ setMonitorLoadingState(false);
+ showMonitorSummary();
+ showNotification('Error loading monitor details', 'error');
+ }
+}
+
+// Switch chart period (matching public UI style)
+async function switchChartPeriod(period) {
+ currentChartPeriod = period;
+
+ // Update button states
+ const buttons = document.querySelectorAll('.period-btn');
+ buttons.forEach(btn => {
+ if (btn.dataset.period === period) {
+ btn.className = 'period-btn px-4 py-2 rounded-lg text-xs font-medium bg-gradient-to-r from-cyan-600 to-cyan-500 text-white shadow-lg shadow-cyan-500/30 transition-all duration-200 border border-cyan-500/50';
+ } else {
+ btn.className = 'period-btn px-4 py-2 rounded-lg text-xs font-medium bg-slate-700/50 hover:bg-slate-600/70 text-slate-300 transition-all duration-200 border border-slate-600/50';
+ }
+ });
+
+ if (currentMonitorId) {
+ // Statistics endpoint now includes target details, so we only need one call
+ await loadMonitorStatistics(currentMonitorId, 30);
+ }
+}
+
+// Apply custom date range
+function applyCustomRange() {
+ const startDate = document.getElementById('startDate').value;
+ const endDate = document.getElementById('endDate').value;
+
+ if (!startDate || !endDate) {
+ showNotification('Please select both start and end dates', 'error');
+ return;
+ }
+
+ if (new Date(startDate) > new Date(endDate)) {
+ showNotification('Start date must be before end date', 'error');
+ return;
+ }
+
+ currentStartDate = startDate;
+ currentEndDate = endDate;
+ currentTimePeriod = null;
+
+ if (currentMonitorId) {
+ // Statistics endpoint now includes target details, so we only need one call
+ loadMonitorStatistics(currentMonitorId, 30);
+ }
+}
+
+// Navigate time period (previous/next)
+function navigateTimePeriod(direction) {
+ if (currentTimePeriod) {
+ // For fixed periods, shift the window
+ // This is a simple implementation - you could make it more sophisticated
+ showNotification('Time navigation for fixed periods coming soon', 'error');
+ } else if (currentStartDate && currentEndDate) {
+ // For custom ranges, shift by the range duration
+ const start = new Date(currentStartDate);
+ const end = new Date(currentEndDate);
+ const duration = end - start;
+
+ if (direction < 0) {
+ // Previous period
+ end.setTime(start.getTime() - 1);
+ start.setTime(start.getTime() - duration);
+ } else {
+ // Next period
+ start.setTime(end.getTime() + 1);
+ end.setTime(start.getTime() + duration);
+ }
+
+ currentStartDate = start.toISOString().split('T')[0];
+ currentEndDate = end.toISOString().split('T')[0];
+
+ document.getElementById('startDate').value = currentStartDate;
+ document.getElementById('endDate').value = currentEndDate;
+
+ if (currentMonitorId) {
+ // Statistics endpoint now includes target details, so we only need one call
+ loadMonitorStatistics(currentMonitorId, 30);
+ }
+ }
+}
+
+// Load monitor statistics and draw chart
+async function loadMonitorStatistics(targetId, timeout = 30, selectionVersion = null) {
+ try {
+ // Determine period for chart (default to 24h if not set)
+ const period = currentChartPeriod || '24h';
+
+ // Load all data in one API call (target + statistics + uptime)
+ const statsResponse = await axios.get(`/admin/api/targets/${targetId}/statistics?period=${period}`);
+ if (!isCurrentMonitorSelection(targetId, selectionVersion)) return;
+ const stats = statsResponse.data.statistics || [];
+ const uptimeData = statsResponse.data.uptime || {};
+ const dailyStats = statsResponse.data.dailyStats || [];
+ const monitor = statsResponse.data.target || {};
+ const isUp = monitor.currentStatus === 'up';
+
+ const uptime24h = parseFloat(uptimeData['24h']?.uptime || 0);
+ const uptime30d = parseFloat(uptimeData['30d']?.uptime || 0);
+ const totalPings = uptimeData['30d']?.totalPings || 0;
+ const successfulPings = uptimeData['30d']?.successfulPings || 0;
+ const failedPings = uptimeData['30d']?.failedPings || 0;
+
+ // Generate uptime blocks from daily statistics
+ if (dailyStats.length > 0) {
+ generateUptimeBlocksFromDailyStats(dailyStats, 30);
+ } else {
+ generateUptimeBlocks(stats);
+ }
+
+ // Update stats displays
+ document.getElementById('currentStatusDisplay').textContent = isUp ? 'β UP' : 'β DOWN';
+ document.getElementById('currentStatusDisplay').className = `text-base font-bold leading-tight whitespace-nowrap ${isUp ? 'text-green-400' : 'text-red-400'}`;
+ document.getElementById('uptime24hDisplay').textContent = `${uptime24h.toFixed(2)}%`;
+ document.getElementById('uptime30dDisplay').textContent = `${uptime30d.toFixed(2)}%`;
+ document.getElementById('protocolDisplay').textContent = monitor.protocol || '--';
+ document.getElementById('totalPingsDisplay').textContent = totalPings;
+ document.getElementById('successfulPingsDisplay').textContent = successfulPings;
+ document.getElementById('failedPingsDisplay').textContent = failedPings;
+
+ // Update legacy displays
+ document.getElementById('monitorUptime').textContent = `${uptime24h.toFixed(2)}%`;
+ document.getElementById('monitorStatus').textContent = isUp ? 'Up' : 'Down';
+ document.getElementById('monitorStatus').className = isUp ? 'text-green-400' : 'text-red-400';
+
+ const latestStat = stats.length > 0 ? stats[stats.length - 1] : null;
+ const currentPing = latestStat?.lastResponseTime || 0;
+ document.getElementById('monitorPing').textContent = currentPing > 0 ? `${Math.round(currentPing)} ms` : '--';
+
+ // Calculate average ping
+ let totalResponseTime = 0;
+ let responseTimeCount = 0;
+ stats.forEach(stat => {
+ if (stat.avgResponseTime && stat.totalPings) {
+ totalResponseTime += stat.avgResponseTime * stat.totalPings;
+ responseTimeCount += stat.totalPings;
+ }
+ });
+ const avgPing = responseTimeCount > 0 ? totalResponseTime / responseTimeCount : 0;
+ document.getElementById('monitorAvgPing').textContent = avgPing > 0 ? `${Math.round(avgPing)} ms` : '--';
+
+ // Uptime blocks are generated from daily stats above
+
+ // Draw chart (matching public UI style)
+ drawStatusChart(stats, null, timeout * 1000);
+ } catch (error) {
+ if (!isCurrentMonitorSelection(targetId, selectionVersion)) return;
+ console.error('Error loading statistics:', error);
+ document.getElementById('monitorUptime').textContent = '--';
+ document.getElementById('monitorPing').textContent = '--';
+ document.getElementById('monitorAvgPing').textContent = '--';
+ document.getElementById('uptimeBlocksLabel').textContent = 'Error loading data';
+ drawStatusChart([], null, 30000);
+ generateUptimeBlocks([]);
+ }
+}
+
+// Generate uptime block indicator from daily statistics (accurate)
+function generateUptimeBlocksFromDailyStats(dailyStats, days = 30) {
+ const blocksContainer = document.getElementById('uptimeBlocks');
+ const labelElement = document.getElementById('uptimeBlocksLabel');
+ const titleElement = document.getElementById('uptimeBlocksTitle');
+
+ blocksContainer.innerHTML = '';
+
+ // Create a map of date -> stats for quick lookup
+ const statsMap = new Map();
+ dailyStats.forEach(stat => {
+ const dateKey = new Date(stat.date).toISOString().split('T')[0];
+ statsMap.set(dateKey, stat);
+ });
+
+ const now = new Date();
+ const blocks = [];
+ let upCount = 0;
+ let totalCount = 0;
+
+ for (let i = days - 1; i >= 0; i--) {
+ const dayStart = new Date(now);
+ dayStart.setDate(now.getDate() - i);
+ dayStart.setHours(0, 0, 0, 0);
+ const dateKey = dayStart.toISOString().split('T')[0];
+
+ const stat = statsMap.get(dateKey);
+ let isUp = null;
+
+ if (stat) {
+ const totalPings = stat.totalPings || 0;
+ const successfulPings = stat.successfulPings || 0;
+ // Day is considered "up" if >= 50% of pings were successful
+ isUp = totalPings === 0 ? null : (successfulPings / totalPings) >= 0.5;
+ } else if (dayStart > now) {
+ isUp = null; // Future day
+ } else {
+ isUp = null; // No data for past day
+ }
+
+ blocks.push({
+ period: dayStart,
+ isUp: isUp
+ });
+
+ if (isUp === true) upCount++;
+ if (isUp !== null) totalCount++;
+ }
+
+ // Generate blocks
+ blocks.forEach((block) => {
+ const blockEl = document.createElement('div');
+ blockEl.className = 'uptime-block';
+
+ const titleText = block.period.toLocaleDateString([], { month: 'short', day: 'numeric' });
+
+ if (block.isUp === null) {
+ blockEl.classList.add('unknown');
+ blockEl.title = `${titleText} - No data`;
+ } else if (block.isUp) {
+ blockEl.classList.add('up');
+ blockEl.title = `${titleText} - Up`;
+ } else {
+ blockEl.classList.add('down');
+ blockEl.title = `${titleText} - Down`;
+ }
+
+ blocksContainer.appendChild(blockEl);
+ });
+
+ // Update label
+ if (totalCount > 0) {
+ const uptimePercent = (upCount / totalCount) * 100;
+ labelElement.textContent = `${upCount}/${totalCount} days up (${uptimePercent.toFixed(1)}%)`;
+ } else {
+ labelElement.textContent = 'No data available';
+ }
+ titleElement.textContent = `${days}-Day Uptime`;
+}
+
+// Generate uptime block indicator (fallback - uses chart stats)
+function generateUptimeBlocks(stats) {
+ const blocksContainer = document.getElementById('uptimeBlocks');
+ const labelElement = document.getElementById('uptimeBlocksLabel');
+ const titleElement = document.getElementById('uptimeBlocksTitle');
+
+ blocksContainer.innerHTML = '';
+
+ if (stats.length === 0) {
+ labelElement.textContent = 'No data available';
+ titleElement.textContent = 'Uptime Overview';
+ return;
+ }
+
+ // Show last 30 days of uptime blocks
+ const now = new Date();
+ const blocks = [];
+ let upCount = 0;
+ let totalCount = 0;
+
+ for (let i = 29; i >= 0; i--) {
+ const dayStart = new Date(now);
+ dayStart.setDate(now.getDate() - i);
+ dayStart.setHours(0, 0, 0, 0);
+ const dayEnd = new Date(dayStart);
+ dayEnd.setDate(dayStart.getDate() + 1);
+
+ // Find statistics for this day
+ const dayStats = stats.filter(stat => {
+ const statDate = new Date(stat.date);
+ return statDate >= dayStart && statDate < dayEnd;
+ });
+
+ let isUp = true;
+ if (dayStats.length > 0) {
+ const totalPings = dayStats.reduce((sum, s) => sum + (s.totalPings || 0), 0);
+ const successfulPings = dayStats.reduce((sum, s) => sum + (s.successfulPings || 0), 0);
+ isUp = totalPings === 0 || (successfulPings / totalPings) >= 0.5;
+ } else {
+ if (dayStart > now) {
+ isUp = null; // Future day
+ } else {
+ isUp = null; // No data
+ }
+ }
+
+ blocks.push({
+ period: dayStart,
+ isUp: isUp
+ });
+
+ if (isUp === true) upCount++;
+ if (isUp !== null) totalCount++;
+ }
+
+ // Generate blocks
+ blocks.forEach((block) => {
+ const blockEl = document.createElement('div');
+ blockEl.className = 'uptime-block';
+
+ const titleText = block.period.toLocaleDateString([], { month: 'short', day: 'numeric' });
+
+ if (block.isUp === null) {
+ blockEl.classList.add('unknown');
+ blockEl.title = `${titleText} - No data`;
+ } else if (block.isUp) {
+ blockEl.classList.add('up');
+ blockEl.title = `${titleText} - Up`;
+ } else {
+ blockEl.classList.add('down');
+ blockEl.title = `${titleText} - Down`;
+ }
+
+ blocksContainer.appendChild(blockEl);
+ });
+
+ // Update label
+ if (totalCount > 0) {
+ const uptimePercent = (upCount / totalCount) * 100;
+ labelElement.textContent = `${upCount}/${totalCount} days up (${uptimePercent.toFixed(1)}%)`;
+ } else {
+ labelElement.textContent = 'No data available';
+ }
+ titleElement.textContent = '30-Day Uptime';
+}
+
+// Draw status chart with real data (matching public UI style)
+// Data is displayed chronologically: left (oldest) to right (newest)
+function drawStatusChart(stats, testResult = null, timeoutMs = 30000) {
+ const ctx = document.getElementById('statusChart').getContext('2d');
+
+ // Destroy existing chart
+ if (statusChart) {
+ statusChart.destroy();
+ }
+
+ if (stats.length === 0 && !testResult) {
+ statusChart = new Chart(ctx, {
+ type: 'line',
+ data: { labels: [], datasets: [] },
+ options: {
+ responsive: true,
+ maintainAspectRatio: false,
+ plugins: {
+ legend: { display: false },
+ tooltip: { enabled: false }
+ }
+ }
+ });
+ return;
+ }
+
+ // Parse and sort stats by date (oldest first = left to right)
+ const sortedStats = [...stats]
+ .map(stat => ({
+ ...stat,
+ dateObj: new Date(stat.date) // Parse date once
+ }))
+ .sort((a, b) => a.dateObj.getTime() - b.dateObj.getTime()); // Sort chronologically (oldest first)
+
+ // Generate labels based on period (formatted for readability)
+ const labels = sortedStats.map(stat => {
+ const date = stat.dateObj;
+ if (currentChartPeriod === '1h') {
+ // 1H: Show time only (HH:MM)
+ return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
+ } else if (currentChartPeriod === '24h') {
+ // 24H: Show day and time (Mon 15, 14:30)
+ return date.toLocaleString([], { weekday: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ } else if (currentChartPeriod === '7d') {
+ // 7D: Show date and time (Nov 15, 14:30)
+ return date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ } else if (currentChartPeriod === '30d') {
+ // 30D: Show date only (Nov 15)
+ return date.toLocaleString([], { month: 'short', day: 'numeric' });
+ } else {
+ // Default: Show date and time
+ return date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ }
+ });
+
+ const responseTimeData = [];
+
+ sortedStats.forEach(stat => {
+ // Do not plot response time for an entirely failed bucket. A null value
+ // creates a real gap in Chart.js when spanGaps is disabled, leaving the
+ // red downtime series as the only signal for that interval.
+ const avgResponseTime = stat.avgResponseTime || 0;
+ const isDown = Number(stat.successfulPings || 0) === 0;
+ responseTimeData.push(isDown ? null : Math.round(avgResponseTime));
+
+ });
+
+ // Calculate max response time for scaling downtime indicator
+ const validResponseTimes = responseTimeData.filter(v => v > 0);
+ const maxResponseTime = validResponseTimes.length > 0 ? Math.max(...validResponseTimes) : 100;
+ const downtimeMaxValue = Math.round(Math.max(maxResponseTime * 1.1, 100)); // Add 10% padding, minimum 100, rounded
+
+ // Scale downtime indicator to max Y value
+ const scaledDownData = buildDowntimeSeries(sortedStats, downtimeMaxValue);
+
+ // The downtime series intentionally includes one bucket on either side of
+ // an outage to make the red fill meet the response-time line. Keep a
+ // separate status array so those visual bridge points do not appear as
+ // false outage values in the hover tooltip.
+ const downtimeAtIndex = sortedStats.map(stat => Number(stat.successfulPings || 0) === 0);
+
+ // Add test result if provided
+ if (testResult && sortedStats.length > 0) {
+ const lastIndex = responseTimeData.length - 1;
+ if (testResult.success && testResult.responseTime) {
+ responseTimeData[lastIndex] = Math.round(testResult.responseTime);
+ scaledDownData[lastIndex] = null;
+ downtimeAtIndex[lastIndex] = false;
+ } else {
+ responseTimeData[lastIndex] = null;
+ scaledDownData[lastIndex] = downtimeMaxValue;
+ downtimeAtIndex[lastIndex] = true;
+ }
+ }
+
+ statusChart = new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels,
+ datasets: [
+ {
+ label: 'Response Time (ms)',
+ data: responseTimeData,
+ borderColor: '#10b981',
+ backgroundColor: 'rgba(16, 185, 129, 0.15)',
+ fill: true,
+ tension: 0.5,
+ pointRadius: 0,
+ pointHoverRadius: 0,
+ pointHitRadius: 8,
+ borderWidth: 3,
+ spanGaps: false,
+ order: 1,
+ },
+ {
+ label: 'Downtime',
+ data: scaledDownData,
+ borderColor: '#ef4444',
+ backgroundColor: 'rgba(239, 68, 68, 0.25)',
+ fill: true,
+ tension: 0.3,
+ pointRadius: 0,
+ pointHoverRadius: 0,
+ pointHitRadius: 8,
+ borderWidth: 0,
+ spanGaps: false,
+ order: 0,
+ },
+ ],
+ },
+ options: {
+ responsive: true,
+ maintainAspectRatio: false,
+ interaction: {
+ mode: 'index',
+ intersect: false,
+ },
+ plugins: {
+ legend: {
+ display: false,
+ },
+ tooltip: buildGraphTooltipOptions()
+ },
+ scales: {
+ y: {
+ beginAtZero: true,
+ max: downtimeMaxValue, // Set max to ensure downtime indicator reaches top
+ grid: {
+ color: 'rgba(255, 255, 255, 0.08)',
+ drawBorder: false,
+ lineWidth: 1
+ },
+ ticks: { display: false },
+ title: {
+ display: false
+ }
+ },
+ x: {
+ type: 'category',
+ grid: {
+ color: 'rgba(255, 255, 255, 0.05)',
+ drawBorder: false
+ },
+ ticks: { display: false },
+ // Ensure chronological order (left = oldest, right = newest)
+ reverse: false
+ },
+ },
+ elements: {
+ point: {
+ radius: 0,
+ hoverRadius: 0,
+ hoverBorderWidth: 0,
+ }
+ },
+ animation: {
+ duration: 1000,
+ easing: 'easeInOutQuart'
+ }
+ },
+ });
+ statusChart._downtimeAtIndex = downtimeAtIndex;
+}
+
+// Update protocol settings visibility
+function updateProtocolSettings() {
+ const protocolElement = getFormElement('editProtocol');
+ if (!protocolElement) return;
+
+ const protocol = protocolElement.value;
+
+ const formContainer = protocolElement.closest('form') || document.getElementById('editFormContainer');
+ if (!formContainer) return;
+
+ const httpSection = formContainer.querySelector('#httpOptionsSection');
+ const authSection = formContainer.querySelector('#authSection');
+
+ if (httpSection && authSection) {
+ if (protocol === 'HTTP' || protocol === 'HTTPS') {
+ httpSection.classList.remove('hidden');
+ authSection.classList.remove('hidden');
+ } else {
+ httpSection.classList.add('hidden');
+ authSection.classList.add('hidden');
+ }
+ }
+}
+
+// Update auth fields visibility
+function updateAuthFields() {
+ const authMethodElement = getFormElement('editAuthMethod');
+ if (!authMethodElement) return;
+
+ const authMethod = authMethodElement.value;
+
+ const formContainer = authMethodElement.closest('form') || document.getElementById('editFormContainer');
+ if (!formContainer) return;
+
+ const basicFields = formContainer.querySelector('#basicAuthFields');
+ const bearerFields = formContainer.querySelector('#bearerAuthFields');
+
+ if (basicFields && bearerFields) {
+ basicFields.classList.add('hidden');
+ bearerFields.classList.add('hidden');
+
+ if (authMethod === 'basic') {
+ basicFields.classList.remove('hidden');
+ } else if (authMethod === 'bearer') {
+ bearerFields.classList.remove('hidden');
+ }
+ }
+}
+
+// Delete monitor
+async function deleteMonitor() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ if (!confirm('Are you sure you want to delete this monitor?')) {
+ return;
+ }
+
+ try {
+ await axios.delete(`/admin/api/targets/${currentMonitorId}`);
+ showNotification('Monitor deleted successfully', 'success');
+ currentMonitorId = null;
+ cancelEdit();
+ await loadMonitors();
+ } catch (error) {
+ console.error('Error deleting monitor:', error);
+ showNotification(error.response?.data?.error || 'Error deleting monitor', 'error');
+ }
+}
+
+// Add new monitor
+function addNewMonitor() {
+ monitorSelectionVersion += 1;
+ currentMonitorId = null;
+ setMonitorLoadingState(false);
+ document.getElementById('monitorDetails')?.classList.remove('hidden');
+ document.getElementById('emptyState')?.classList.add('hidden');
+ document.getElementById('monitorSummaryPane')?.classList.add('hidden');
+ document.getElementById('monitorEditor')?.classList.remove('hidden');
+ document.getElementById('monitorEditorTitle').textContent = 'Add new monitor';
+ document.getElementById('monitorName').textContent = 'New monitor';
+ const mobileToolbarLabel = document.getElementById('mobileMonitorToolbarLabel');
+ if (mobileToolbarLabel) mobileToolbarLabel.textContent = 'New monitor';
+ openMobileMonitorView();
+
+ const form = document.getElementById('editForm');
+ if (form) form.reset();
+
+ // Set defaults
+ const defaults = {
+ editProtocol: 'ICMP',
+ editInterval: '60',
+ editRetries: '0',
+ editRetryInterval: '5',
+ editHttpMethod: 'GET',
+ editTimeout: '30',
+ editStatusCodes: '200-299',
+ editMaxRedirects: '5',
+ editPosition: '0',
+ editAuthMethod: 'none',
+ };
+ Object.entries(defaults).forEach(([id, value]) => {
+ const element = document.getElementById(id);
+ if (element) element.value = value;
+ });
+ ['editEnabled', 'editPublicVisible'].forEach((id) => {
+ const element = document.getElementById(id);
+ if (element) element.checked = true;
+ });
+
+ // Update protocol settings
+ updateProtocolSettings();
+ updateAuthFields();
+
+ // Update monitor list selection
+ document.querySelectorAll('.monitor-card').forEach(card => {
+ card.classList.remove('selected');
+ });
+
+ // Hide clone and clear ping data buttons for new monitor
+ const cloneBtn = document.getElementById('cloneMonitorBtn');
+ if (cloneBtn) {
+ cloneBtn.style.display = 'none';
+ }
+ const clearPingDataBtn = document.getElementById('clearPingDataBtn');
+ if (clearPingDataBtn) {
+ clearPingDataBtn.style.display = 'none';
+ }
+
+ setTimeout(() => document.getElementById('editName')?.focus(), 0);
+}
+
+// Show clone monitor confirmation modal
+function showCloneMonitorConfirm() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ const monitorName = document.getElementById('monitorName')?.textContent || 'Monitor';
+ document.getElementById('cloneMonitorName').textContent = monitorName;
+
+ const modal = document.getElementById('cloneMonitorModal');
+ modal.classList.add('active');
+}
+
+// Close clone monitor modal
+function closeCloneMonitorModal() {
+ const modal = document.getElementById('cloneMonitorModal');
+ modal.classList.remove('active');
+}
+
+// Find available clone name
+async function findAvailableCloneName(baseName, existingNames) {
+ let cloneName = `${baseName} (clone)`;
+ let counter = 1;
+
+ while (existingNames.includes(cloneName)) {
+ counter++;
+ cloneName = `${baseName} (clone ${counter})`;
+ }
+
+ return cloneName;
+}
+
+// Confirm and clone monitor
+async function confirmCloneMonitor() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ try {
+ // Get current monitor data
+ const response = await axios.get(`/admin/api/targets/${currentMonitorId}`);
+ const monitor = response.data.target;
+
+ // Get all existing monitor names
+ const dashboardResponse = await axios.get('/admin/api/dashboard');
+ const existingNames = dashboardResponse.data.dashboard.targets.map(t => t.name);
+
+ // Find available clone name
+ const cloneName = await findAvailableCloneName(monitor.name, existingNames);
+
+ // Prepare clone data (same settings, but disabled and no data points)
+ const cloneData = {
+ name: cloneName,
+ host: monitor.host || '',
+ protocol: monitor.protocol || 'ICMP',
+ port: monitor.port || null,
+ interval: monitor.interval || 60,
+ enabled: false, // Disabled by default
+ publicVisible: monitor.publicVisible !== false,
+ publicShowDetails: monitor.publicShowDetails === true,
+ group: monitor.group || null,
+ appUrl: monitor.appUrl || null,
+ appIcon: monitor.appIcon || null,
+ retries: monitor.retries || 0,
+ retryInterval: monitor.retryInterval || 5,
+ timeout: monitor.timeout || 30,
+ httpMethod: monitor.httpMethod || 'GET',
+ statusCodes: monitor.statusCodes || '200-299',
+ maxRedirects: monitor.maxRedirects || 5,
+ ignoreSsl: monitor.ignoreSsl || false,
+ upsideDown: monitor.upsideDown || false,
+ position: monitor.position || 0,
+ quickCommands: monitor.quickCommands || [],
+ auth: monitor.auth || null
+ };
+
+ // Create the cloned monitor
+ const createResponse = await axios.post('/admin/api/targets', cloneData);
+ const newMonitorId = createResponse.data.targetId;
+
+ // Close modal
+ closeCloneMonitorModal();
+
+ // Show success notification
+ showNotification('Monitor cloned successfully', 'success');
+
+ // Reload monitors and select the new one
+ await loadMonitors();
+ const newMonitorResponse = await axios.get(`/admin/api/targets/${newMonitorId}`);
+ await selectMonitor(newMonitorResponse.data.target);
+ } catch (error) {
+ console.error('Error cloning monitor:', error);
+ showNotification(error.response?.data?.error || 'Error cloning monitor', 'error');
+ }
+}
+
+// Helper to get form element (works for both desktop, mobile, and modal)
+function getFormElement(id) {
+ return document.getElementById(id);
+}
+
+// Handle edit button click - mobile uses panel, desktop uses modal
+function handleEditClick() {
+ openEditMonitor();
+}
+
+// Open the inline monitor editor.
+function openEditMonitor() {
+ const details = document.getElementById('monitorDetails');
+ const emptyState = document.getElementById('emptyState');
+ const summary = document.getElementById('monitorSummaryPane');
+ const editor = document.getElementById('monitorEditor');
+ if (!editor) return;
+
+ details?.classList.remove('hidden');
+ emptyState?.classList.add('hidden');
+ summary?.classList.add('hidden');
+ editor.classList.remove('hidden');
+
+ const editorTitle = document.getElementById('monitorEditorTitle');
+ if (editorTitle) {
+ editorTitle.textContent = currentMonitorId
+ ? `Edit ${document.getElementById('monitorName')?.textContent || 'monitor'}`
+ : 'Add new monitor';
+ }
+
+ attachFormListeners();
+ updateProtocolSettings();
+ updateAuthFields();
+ setTimeout(() => document.getElementById('editName')?.focus(), 0);
+}
+
+// Save monitor
+async function saveMonitor() {
+ const data = {
+ name: getFormElement('editName')?.value || '',
+ host: getFormElement('editHost')?.value || '',
+ protocol: getFormElement('editProtocol')?.value || 'ICMP',
+ port: getFormElement('editPort')?.value ? parseInt(getFormElement('editPort').value) : null,
+ interval: parseInt(getFormElement('editInterval')?.value) || 60,
+ enabled: getFormElement('editEnabled')?.checked !== false,
+ publicVisible: getFormElement('editPublicVisible')?.checked !== false,
+ group: getFormElement('editGroup')?.value || null,
+ appUrl: getFormElement('editAppUrl')?.value || null,
+ appIcon: getFormElement('editAppIcon')?.value || null,
+ retries: parseInt(getFormElement('editRetries')?.value) || 0,
+ retryInterval: parseInt(getFormElement('editRetryInterval')?.value) || 5,
+ timeout: parseInt(getFormElement('editTimeout')?.value) || 30,
+ httpMethod: getFormElement('editHttpMethod')?.value || 'GET',
+ statusCodes: getFormElement('editStatusCodes')?.value || '200-299',
+ maxRedirects: parseInt(getFormElement('editMaxRedirects')?.value) || 5,
+ ignoreSsl: getFormElement('editIgnoreSsl')?.checked || false,
+ upsideDown: getFormElement('editUpsideDown')?.checked || false,
+ important: getFormElement('editImportant')?.checked || false,
+ position: parseInt(getFormElement('editPosition')?.value) || 0,
+ quickCommands: getFormElement('editQuickCommands')?.value
+ ? getFormElement('editQuickCommands').value.split(',').map(cmd => cmd.trim()).filter(cmd => cmd)
+ : []
+ };
+
+ // Add authentication if set
+ const authMethod = getFormElement('editAuthMethod')?.value;
+ if (authMethod === 'basic') {
+ data.auth = {
+ type: 'basic',
+ username: getFormElement('editAuthUsername')?.value || '',
+ password: getFormElement('editAuthPassword')?.value || ''
+ };
+ } else if (authMethod === 'bearer') {
+ data.auth = {
+ type: 'bearer',
+ token: getFormElement('editAuthToken')?.value || ''
+ };
+ }
+
+ // Validate
+ if (!data.name || !data.host) {
+ showNotification('Please fill in all required fields', 'error');
+ return;
+ }
+
+ try {
+ if (currentMonitorId) {
+ // Update existing
+ await axios.put(`/admin/api/targets/${currentMonitorId}`, data);
+ showNotification('Monitor updated successfully', 'success');
+ } else {
+ // Create new
+ const response = await axios.post('/admin/api/targets', data);
+ currentMonitorId = response.data.targetId;
+ showNotification('Monitor created successfully', 'success');
+ }
+
+ // Reload monitors and refresh the current selection in the same workspace.
+ await loadMonitors();
+ if (currentMonitorId) {
+ const response = await axios.get(`/admin/api/targets/${currentMonitorId}`);
+ await selectMonitor(response.data.target);
+ } else {
+ resetMonitorWorkspace();
+ }
+ } catch (error) {
+ console.error('Error saving monitor:', error);
+ showNotification(error.response?.data?.error || 'Error saving monitor', 'error');
+ }
+}
+
+// Helper to get favicon URL
+function getFaviconUrl(appUrl) {
+ if (!appUrl) return null;
+ try {
+ const url = new URL(appUrl);
+ return `${url.protocol}//${url.host}/favicon.ico`;
+ } catch (e) {
+ return null;
+ }
+}
+
+// Test monitor and update graph instantly
+async function testMonitor() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ try {
+ // Collect form values from the modal
+ const testData = {
+ name: getFormElement('editName')?.value || '',
+ host: getFormElement('editHost')?.value || '',
+ protocol: getFormElement('editProtocol')?.value || 'ICMP',
+ port: getFormElement('editPort')?.value ? parseInt(getFormElement('editPort').value) : null,
+ timeout: parseInt(getFormElement('editTimeout')?.value) || 30,
+ httpMethod: getFormElement('editHttpMethod')?.value || 'GET',
+ statusCodes: getFormElement('editStatusCodes')?.value || '200-299',
+ maxRedirects: parseInt(getFormElement('editMaxRedirects')?.value) || 5,
+ ignoreSsl: getFormElement('editIgnoreSsl')?.checked || false,
+ upsideDown: getFormElement('editUpsideDown')?.checked || false,
+ };
+
+ // Add authentication if set
+ const authMethod = getFormElement('editAuthMethod')?.value;
+ if (authMethod === 'basic') {
+ testData.auth = {
+ type: 'basic',
+ username: getFormElement('editAuthUsername')?.value || '',
+ password: getFormElement('editAuthPassword')?.value || ''
+ };
+ } else if (authMethod === 'bearer') {
+ testData.auth = {
+ type: 'bearer',
+ token: getFormElement('editAuthToken')?.value || ''
+ };
+ }
+
+ // Validate required fields
+ if (!testData.host) {
+ showNotification('Please enter a host address', 'error');
+ return;
+ }
+
+ const response = await axios.post(`/admin/api/targets/${currentMonitorId}/test`, testData);
+ const result = response.data.result;
+
+ // Update status immediately
+ const status = result.success ? 'Up' : 'Down';
+ const statusColor = result.success ? 'text-green-400' : 'text-red-400';
+ document.getElementById('monitorStatus').textContent = status;
+ document.getElementById('monitorStatus').className = statusColor;
+
+ // Update ping displays
+ if (result.success && result.responseTime) {
+ document.getElementById('monitorPing').textContent = `${Math.round(result.responseTime)} ms`;
+ // Update average if we have it
+ const currentAvg = document.getElementById('monitorAvgPing').textContent;
+ if (currentAvg !== '--') {
+ // Keep current average for now, or recalculate if needed
+ }
+ } else {
+ document.getElementById('monitorPing').textContent = '--';
+ }
+
+ // Reload statistics to get updated chart data (includes target details)
+ const statsResponse = await axios.get(`/admin/api/targets/${currentMonitorId}/statistics?period=1h`);
+ const stats = statsResponse.data.statistics || [];
+ const timeoutMs = (statsResponse.data.target?.timeout || 30) * 1000;
+
+ // Draw chart with test result added
+ drawStatusChart(stats, result, timeoutMs);
+
+ // Update monitor list status
+ const card = document.querySelector(`[data-monitor-id="${currentMonitorId}"]`);
+ if (card) {
+ const badge = card.querySelector('.status-badge');
+ if (badge) {
+ badge.className = `status-badge ${result.success ? 'up' : 'down'}`;
+ badge.innerHTML = `
+
+ ${result.success ? 'Up' : 'Down'}
+ `;
+ }
+ }
+
+ if (result.success) {
+ showNotification(`Test successful: ${Math.round(result.responseTime || 0)}ms`, 'success');
+ } else {
+ showNotification(`Test failed: ${result.error || 'Connection failed'}`, 'error');
+ }
+ } catch (error) {
+ console.error('Error testing monitor:', error);
+ showNotification('Error testing monitor', 'error');
+ }
+}
+
+// Cancel edit
+function cancelEdit() {
+ if (currentMonitorId) {
+ showMonitorSummary();
+ setMonitorActionVisibility(true);
+ return;
+ }
+
+ resetMonitorWorkspace();
+}
+
+// Load incidents
+async function loadIncidents() {
+ try {
+ const response = await axios.get('/admin/api/incidents');
+ const incidents = response.data.incidents || [];
+
+ const incidentsList = document.getElementById('incidentsList');
+ incidentsList.innerHTML = '';
+
+ if (incidents.length === 0) {
+ incidentsList.innerHTML = 'No incidents recorded
';
+ return;
+ }
+
+ const severityColors = {
+ minor: 'bg-blue-900 text-blue-200',
+ major: 'bg-yellow-900 text-yellow-200',
+ critical: 'bg-red-900 text-red-200'
+ };
+
+ const statusColors = {
+ investigating: 'bg-yellow-900 text-yellow-200',
+ identified: 'bg-orange-900 text-orange-200',
+ monitoring: 'bg-blue-900 text-blue-200',
+ resolved: 'bg-green-900 text-green-200',
+ scheduled: 'bg-purple-900 text-purple-200'
+ };
+
+ incidents.forEach(incident => {
+ const card = document.createElement('div');
+ card.className = 'bg-slate-900/50 backdrop-blur rounded-lg p-4 border border-slate-700/30';
+ const date = new Date(incident.createdAt).toLocaleString();
+
+ let scheduledInfo = '';
+ if (incident.isScheduled && incident.scheduledStart) {
+ const startDate = new Date(incident.scheduledStart).toLocaleString();
+ const endDate = incident.scheduledEnd ? new Date(incident.scheduledEnd).toLocaleString() : null;
+ scheduledInfo = `
+
+
+
+ Scheduled: ${startDate}
+ ${endDate ? ` - ${endDate}` : ''}
+
+
+ `;
+ }
+
+ card.innerHTML = `
+
+
${incident.title}
+
+ ${incident.severity.toUpperCase()}
+ ${incident.status.toUpperCase()}
+
+
+ ${incident.description}
+ ${scheduledInfo}
+
+
${date}
+
+
+
+
+
+ `;
+ incidentsList.appendChild(card);
+ });
+ } catch (error) {
+ console.error('Error loading incidents:', error);
+ document.getElementById('incidentsList').innerHTML = 'Error loading incidents
';
+ }
+}
+
+let currentIncidentId = null;
+
+// Show create incident modal
+function showCreateIncidentModal() {
+ currentIncidentId = null;
+ document.getElementById('incidentModalTitle').textContent = 'Create New Incident';
+ document.getElementById('incidentTitle').value = '';
+ document.getElementById('incidentDescription').value = '';
+ document.getElementById('incidentSeverity').value = 'major';
+ document.getElementById('incidentStatus').value = 'investigating';
+ document.getElementById('incidentIsScheduled').checked = false;
+ document.getElementById('incidentScheduledStart').value = '';
+ document.getElementById('incidentScheduledEnd').value = '';
+ document.getElementById('scheduledFields').classList.add('hidden');
+ document.getElementById('incidentModal').classList.add('active');
+
+ // Focus on title input
+ setTimeout(() => {
+ document.getElementById('incidentTitle').focus();
+ }, 100);
+}
+
+// Toggle scheduled fields visibility
+function toggleScheduledFields() {
+ const isScheduled = document.getElementById('incidentIsScheduled').checked;
+ const scheduledFields = document.getElementById('scheduledFields');
+ const scheduledStart = document.getElementById('incidentScheduledStart');
+ const scheduledEnd = document.getElementById('incidentScheduledEnd');
+
+ if (isScheduled) {
+ scheduledFields.classList.remove('hidden');
+ scheduledStart.required = true;
+ // Set default start time to 1 hour from now
+ const now = new Date();
+ now.setHours(now.getHours() + 1);
+ scheduledStart.value = now.toISOString().slice(0, 16);
+ } else {
+ scheduledFields.classList.add('hidden');
+ scheduledStart.required = false;
+ scheduledStart.value = '';
+ scheduledEnd.value = '';
+ }
+}
+
+// Close incident modal
+function closeIncidentModal() {
+ document.getElementById('incidentModal').classList.remove('active');
+ currentIncidentId = null;
+ document.getElementById('incidentForm').reset();
+}
+
+// Edit incident
+async function editIncident(incidentId) {
+ try {
+ const response = await axios.get(`/admin/api/incidents/${incidentId}`);
+ const incident = response.data.incident;
+
+ currentIncidentId = incidentId;
+ document.getElementById('incidentModalTitle').textContent = 'Edit Incident';
+ document.getElementById('incidentTitle').value = incident.title;
+ document.getElementById('incidentDescription').value = incident.description;
+ document.getElementById('incidentSeverity').value = incident.severity || 'major';
+ document.getElementById('incidentStatus').value = incident.status || 'investigating';
+
+ // Handle scheduled maintenance fields
+ const isScheduled = incident.isScheduled || false;
+ document.getElementById('incidentIsScheduled').checked = isScheduled;
+
+ if (incident.scheduledStart) {
+ const startDate = new Date(incident.scheduledStart);
+ document.getElementById('incidentScheduledStart').value = startDate.toISOString().slice(0, 16);
+ } else {
+ document.getElementById('incidentScheduledStart').value = '';
+ }
+
+ if (incident.scheduledEnd) {
+ const endDate = new Date(incident.scheduledEnd);
+ document.getElementById('incidentScheduledEnd').value = endDate.toISOString().slice(0, 16);
+ } else {
+ document.getElementById('incidentScheduledEnd').value = '';
+ }
+
+ toggleScheduledFields();
+ document.getElementById('incidentModal').classList.add('active');
+
+ // Focus on title input
+ setTimeout(() => {
+ document.getElementById('incidentTitle').focus();
+ }, 100);
+ } catch (error) {
+ console.error('Error loading incident:', error);
+ showNotification('Error loading incident: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Save incident
+async function saveIncident(event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ const title = document.getElementById('incidentTitle').value.trim();
+ const description = document.getElementById('incidentDescription').value.trim();
+ const severity = document.getElementById('incidentSeverity').value;
+ const status = document.getElementById('incidentStatus').value;
+ const isScheduled = document.getElementById('incidentIsScheduled').checked;
+ const scheduledStart = document.getElementById('incidentScheduledStart').value;
+ const scheduledEnd = document.getElementById('incidentScheduledEnd').value;
+
+ if (!title || !description) {
+ showNotification('Title and description are required', 'error');
+ return;
+ }
+
+ if (isScheduled && !scheduledStart) {
+ showNotification('Scheduled start time is required for scheduled maintenance', 'error');
+ return;
+ }
+
+ try {
+ const incidentData = {
+ title,
+ description,
+ severity,
+ status,
+ isScheduled,
+ scheduledStart: isScheduled && scheduledStart ? scheduledStart : null,
+ scheduledEnd: isScheduled && scheduledEnd ? scheduledEnd : null
+ };
+
+ if (currentIncidentId) {
+ // Update existing incident
+ await axios.put(`/admin/api/incidents/${currentIncidentId}`, incidentData);
+ showNotification('Incident updated successfully', 'success');
+ } else {
+ // Create new incident
+ await axios.post('/admin/api/incidents', incidentData);
+ showNotification('Incident created successfully', 'success');
+ }
+
+ closeIncidentModal();
+ loadIncidents();
+ } catch (error) {
+ console.error('Error saving incident:', error);
+ showNotification('Error saving incident: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Delete incident
+async function deleteIncident(incidentId) {
+ if (!confirm('Are you sure you want to delete this incident?')) return;
+
+ try {
+ await axios.delete(`/admin/api/incidents/${incidentId}`);
+ showNotification('Incident deleted successfully', 'success');
+ loadIncidents();
+ } catch (error) {
+ console.error('Error deleting incident:', error);
+ showNotification('Error deleting incident: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Load posts
+async function loadPosts() {
+ try {
+ const response = await axios.get('/admin/api/posts');
+ const posts = response.data.posts || [];
+
+ const postsList = document.getElementById('postsList');
+ postsList.innerHTML = '';
+
+ if (posts.length === 0) {
+ postsList.innerHTML = 'No posts yet. Create your first post!
';
+ return;
+ }
+
+ posts.forEach(post => {
+ const card = document.createElement('div');
+ card.className = 'bg-slate-900/50 backdrop-blur rounded-lg p-4 border border-slate-700/30';
+ const date = new Date(post.createdAt).toLocaleDateString(undefined, {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ const publishedBadge = post.published
+ ? 'Published'
+ : 'Draft';
+
+ card.innerHTML = `
+
+
${post.title}
+ ${publishedBadge}
+
+ ${post.content.substring(0, 150)}${post.content.length > 150 ? '...' : ''}
+
+
${date}
+
+
+
+
+
+ `;
+ postsList.appendChild(card);
+ });
+ } catch (error) {
+ console.error('Error loading posts:', error);
+ document.getElementById('postsList').innerHTML = 'Error loading posts
';
+ }
+}
+
+// Configure marked.js for markdown rendering
+if (typeof marked !== 'undefined') {
+ marked.setOptions({
+ breaks: true,
+ gfm: true,
+ });
+}
+
+let currentPostId = null;
+
+// Show create post modal
+function showCreatePostModal() {
+ currentPostId = null;
+ document.getElementById('postModalTitle').textContent = 'Create New Post';
+ document.getElementById('postTitle').value = '';
+ document.getElementById('postContent').value = '';
+ document.getElementById('postPublished').checked = true;
+ document.getElementById('markdownPreview').innerHTML = 'Preview will appear here...
';
+ document.getElementById('postModal').classList.add('active');
+
+ // Focus on title input
+ setTimeout(() => {
+ document.getElementById('postTitle').focus();
+ }, 100);
+
+ // Setup markdown preview
+ setupMarkdownPreview();
+}
+
+// Show edit post modal
+async function editPost(postId) {
+ try {
+ const response = await axios.get(`/admin/api/posts/${postId}`);
+ const post = response.data.post;
+
+ currentPostId = postId;
+ document.getElementById('postModalTitle').textContent = 'Edit Post';
+ document.getElementById('postTitle').value = post.title;
+ document.getElementById('postContent').value = post.content;
+ document.getElementById('postPublished').checked = post.published;
+ document.getElementById('postModal').classList.add('active');
+
+ // Update preview immediately
+ updateMarkdownPreview();
+
+ // Setup markdown preview
+ setupMarkdownPreview();
+ } catch (error) {
+ console.error('Error loading post:', error);
+ showNotification('Error loading post: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Close post modal
+function closePostModal() {
+ document.getElementById('postModal').classList.remove('active');
+ currentPostId = null;
+ document.getElementById('postForm').reset();
+}
+
+// Setup markdown preview listener
+function setupMarkdownPreview() {
+ const contentTextarea = document.getElementById('postContent');
+ if (!contentTextarea) return;
+
+ // Remove existing listener if any
+ const newTextarea = contentTextarea.cloneNode(true);
+ contentTextarea.parentNode.replaceChild(newTextarea, contentTextarea);
+
+ // Add new listener
+ newTextarea.addEventListener('input', updateMarkdownPreview);
+ newTextarea.addEventListener('keyup', updateMarkdownPreview);
+}
+
+// Update markdown preview
+function updateMarkdownPreview() {
+ const content = document.getElementById('postContent').value;
+ const preview = document.getElementById('markdownPreview');
+
+ if (!content.trim()) {
+ preview.innerHTML = 'Preview will appear here...
';
+ return;
+ }
+
+ if (typeof marked !== 'undefined') {
+ preview.innerHTML = marked.parse(content);
+ } else {
+ // Fallback: simple line break conversion
+ preview.innerHTML = content
+ .replace(/\n\n/g, '
')
+ .replace(/\n/g, '
')
+ .replace(/^/, '
')
+ .replace(/$/, '
');
+ }
+}
+
+// Save post (create or update)
+async function savePost(event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ const title = document.getElementById('postTitle').value.trim();
+ const content = document.getElementById('postContent').value.trim();
+ const published = document.getElementById('postPublished').checked;
+
+ if (!title || !content) {
+ showNotification('Title and content are required', 'error');
+ return;
+ }
+
+ try {
+ if (currentPostId) {
+ // Update existing post
+ await axios.put(`/admin/api/posts/${currentPostId}`, {
+ title,
+ content,
+ published
+ });
+ showNotification('Post updated successfully', 'success');
+ } else {
+ // Create new post
+ await axios.post('/admin/api/posts', {
+ title,
+ content,
+ published
+ });
+ showNotification('Post created successfully', 'success');
+ }
+
+ closePostModal();
+ loadPosts();
+ } catch (error) {
+ console.error('Error saving post:', error);
+ showNotification('Error saving post: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Setup form submission handler
+document.addEventListener('DOMContentLoaded', () => {
+ const postForm = document.getElementById('postForm');
+ if (postForm) {
+ postForm.addEventListener('submit', savePost);
+ }
+
+ const incidentForm = document.getElementById('incidentForm');
+ if (incidentForm) {
+ incidentForm.addEventListener('submit', saveIncident);
+ }
+});
+
+// Delete post
+async function deletePost(postId) {
+ if (!confirm('Are you sure you want to delete this post?')) return;
+
+ try {
+ await axios.delete(`/admin/api/posts/${postId}`);
+ showNotification('Post deleted successfully', 'success');
+ loadPosts();
+ } catch (error) {
+ console.error('Error deleting post:', error);
+ showNotification('Error deleting post: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Close modal on escape key
+document.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ const modal = document.getElementById('postModal');
+ if (modal && modal.classList.contains('active')) {
+ closePostModal();
+ }
+
+ const clearPingDataModal = document.getElementById('clearPingDataModal');
+ if (clearPingDataModal && clearPingDataModal.classList.contains('active')) {
+ closeClearPingDataModal();
+ }
+
+ const clearMonitorPingDataModal = document.getElementById('clearMonitorPingDataModal');
+ if (clearMonitorPingDataModal && clearMonitorPingDataModal.classList.contains('active')) {
+ closeClearMonitorPingDataModal();
+ }
+
+ const activeModal = document.querySelector('.post-modal.active');
+ if (!activeModal && isMobileMonitorViewport() && document.body.classList.contains('monitor-detail-open')) {
+ closeMobileMonitorView();
+ }
+ }
+});
+
+// Close modal when clicking outside
+document.addEventListener('click', (e) => {
+ const modal = document.getElementById('postModal');
+ if (modal && modal.classList.contains('active') && e.target === modal) {
+ closePostModal();
+ }
+
+ const clearPingDataModal = document.getElementById('clearPingDataModal');
+ if (clearPingDataModal && clearPingDataModal.classList.contains('active') && e.target === clearPingDataModal) {
+ closeClearPingDataModal();
+ }
+
+ const clearMonitorPingDataModal = document.getElementById('clearMonitorPingDataModal');
+ if (clearMonitorPingDataModal && clearMonitorPingDataModal.classList.contains('active') && e.target === clearMonitorPingDataModal) {
+ closeClearMonitorPingDataModal();
+ }
+});
+
+// Change password
+function changePassword() {
+ const newPassword = prompt('Enter new password:');
+ if (!newPassword) return;
+
+ const confirmPassword = prompt('Confirm password:');
+ if (newPassword !== confirmPassword) {
+ showNotification('Passwords do not match', 'error');
+ return;
+ }
+
+ // Note: This would require a new API endpoint to be implemented
+ showNotification('Password change not yet implemented', 'error');
+}
+
+// Show notification
+function showNotification(message, type = 'success') {
+ const notification = document.createElement('div');
+ notification.className = `notification ${type}`;
+ notification.textContent = message;
+
+ document.getElementById('notificationContainer').appendChild(notification);
+
+ setTimeout(() => {
+ notification.style.animation = 'slideIn 0.3s ease-out reverse';
+ setTimeout(() => notification.remove(), 300);
+ }, 3000);
+}
+
+// Test all monitors
+async function testAllMonitors() {
+ const testAllBtn = document.getElementById('testAllBtn');
+ const originalText = testAllBtn.innerHTML;
+
+ try {
+ // Clear cache to ensure live results
+ await axios.post('/admin/api/cache/clear');
+
+ // Get all monitors
+ const response = await axios.get('/admin/api/dashboard');
+ const targets = response.data.dashboard.targets;
+
+ if (targets.length === 0) {
+ showNotification('No monitors to test', 'error');
+ return;
+ }
+
+ // Disable button and show loading
+ testAllBtn.disabled = true;
+ testAllBtn.innerHTML = 'Testing...';
+
+ let successCount = 0;
+ let failCount = 0;
+
+ // Test all monitors in parallel
+ const testPromises = targets.map(async (target) => {
+ try {
+ const testResponse = await axios.post(`/admin/api/targets/${target._id}/test`);
+ const result = testResponse.data.result;
+
+ // Update the monitor card status
+ const card = document.querySelector(`[data-monitor-id="${target._id}"]`);
+ if (card) {
+ const badge = card.querySelector('.status-badge');
+ if (badge) {
+ const isSuccess = result.success;
+ badge.className = `status-badge ${isSuccess ? 'up' : 'down'}`;
+ badge.innerHTML = `
+
+ ${isSuccess ? 'Up' : 'Down'}
+ `;
+ }
+ }
+
+ // Update current monitor if it's selected
+ if (currentMonitorId === target._id) {
+ const status = result.success ? 'Up' : 'Down';
+ const statusColor = result.success ? 'text-green-400' : 'text-red-400';
+ document.getElementById('monitorStatus').textContent = status;
+ document.getElementById('monitorStatus').className = statusColor;
+
+ if (result.success && result.responseTime) {
+ document.getElementById('monitorPing').textContent = `${result.responseTime.toFixed(2)} ms`;
+ }
+
+ // Reload statistics and update chart (get timeout from monitor)
+ // Statistics endpoint now includes target details and daily stats, so we only need one call
+ await loadMonitorStatistics(target._id, 30);
+ }
+
+ if (result.success) {
+ successCount++;
+ } else {
+ failCount++;
+ }
+ } catch (error) {
+ console.error(`Error testing monitor ${target.name}:`, error);
+ failCount++;
+
+ // Update card to show error
+ const card = document.querySelector(`[data-monitor-id="${target._id}"]`);
+ if (card) {
+ const badge = card.querySelector('.status-badge');
+ if (badge) {
+ badge.className = 'status-badge down';
+ badge.innerHTML = `
+
+ Down
+ `;
+ }
+ }
+ }
+ });
+
+ await Promise.all(testPromises);
+
+ // Clear cache again before reloading to ensure fresh data
+ await axios.post('/admin/api/cache/clear');
+
+ // Reload monitors list to refresh all statuses
+ await loadMonitors();
+
+ // Show summary notification
+ showNotification(`Tested ${targets.length} monitors: ${successCount} up, ${failCount} down`,
+ failCount === 0 ? 'success' : 'error');
+
+ } catch (error) {
+ console.error('Error testing all monitors:', error);
+ showNotification('Error testing monitors', 'error');
+ } finally {
+ // Re-enable button
+ testAllBtn.disabled = false;
+ testAllBtn.innerHTML = originalText;
+ }
+}
+
+// Load visibility settings
+async function loadVisibility() {
+ try {
+ const response = await axios.get('/admin/api/targets');
+ const targets = response.data.targets;
+
+ const visibilityList = document.getElementById('visibilityList');
+ visibilityList.innerHTML = '';
+
+ if (targets.length === 0) {
+ visibilityList.innerHTML = 'No monitors found
';
+ return;
+ }
+
+ // Sort by position, then by name
+ targets.sort((a, b) => {
+ const posA = a.position || 0;
+ const posB = b.position || 0;
+ if (posA !== posB) return posA - posB;
+ return (a.name || '').localeCompare(b.name || '');
+ });
+
+ targets.forEach((target, index) => {
+ const isPublic = target.publicVisible !== false; // Default to true if not set
+ const showDetails = target.publicShowDetails === true; // Default to false
+ const showStatus = target.publicShowStatus !== false; // Default to true
+ const showAppLink = target.publicShowAppLink !== false; // Default to true
+ const hasAppUrl = target.appUrl && target.appUrl.trim() !== '';
+
+ const item = document.createElement('div');
+ item.className = 'visibility-item flex flex-col gap-3 p-4 bg-slate-800/50 rounded-lg border border-slate-700/30 cursor-move';
+ item.draggable = true;
+ item.innerHTML = `
+
+
+
+
+
+
+
${target.name}
+ ${hasAppUrl ? 'App Link' : ''}
+ ${!target.enabled ? 'Disabled' : ''}
+
+
${target.host}${target.port ? ':' + target.port : ''} (${target.protocol})
+
+
+
+ `;
+ // Set dataset attributes after innerHTML to ensure they persist
+ item.dataset.targetId = target._id;
+ item.dataset.position = target.position || index;
+ visibilityList.appendChild(item);
+ });
+
+ // Setup drag and drop
+ setupDragAndDrop();
+ } catch (error) {
+ console.error('Error loading visibility settings:', error);
+ showNotification('Error loading visibility settings', 'error');
+ }
+}
+
+// Setup drag and drop for reordering
+function setupDragAndDrop() {
+ const visibilityList = document.getElementById('visibilityList');
+ const items = document.querySelectorAll('.visibility-item');
+ let draggedElement = null;
+ let hasMoved = false;
+
+ items.forEach(item => {
+ item.addEventListener('dragstart', (e) => {
+ draggedElement = item;
+ hasMoved = false;
+ item.style.opacity = '0.5';
+ item.classList.add('dragging');
+ e.dataTransfer.effectAllowed = 'move';
+ });
+
+ item.addEventListener('dragend', async (e) => {
+ item.style.opacity = '1';
+ item.classList.remove('dragging');
+
+ if (hasMoved && draggedElement) {
+ // Update data-position attributes
+ const allItems = visibilityList.querySelectorAll('.visibility-item');
+ allItems.forEach((item, index) => {
+ item.dataset.position = index;
+ });
+ await savePositions();
+ }
+
+ draggedElement = null;
+ hasMoved = false;
+ });
+
+ item.addEventListener('dragover', (e) => {
+ e.preventDefault();
+ e.dataTransfer.dropEffect = 'move';
+
+ if (!draggedElement) return;
+
+ const afterElement = getDragAfterElement(visibilityList, e.clientY);
+ if (afterElement == null) {
+ if (visibilityList.lastElementChild !== draggedElement) {
+ visibilityList.appendChild(draggedElement);
+ hasMoved = true;
+ }
+ } else {
+ if (afterElement !== draggedElement && afterElement.nextSibling !== draggedElement) {
+ visibilityList.insertBefore(draggedElement, afterElement);
+ hasMoved = true;
+ }
+ }
+ });
+
+ item.addEventListener('drop', (e) => {
+ e.preventDefault();
+ });
+ });
+
+ // Also handle drop on the container itself
+ visibilityList.addEventListener('drop', (e) => {
+ e.preventDefault();
+ });
+}
+
+// Get element after which to insert dragged element
+function getDragAfterElement(container, y) {
+ const draggableElements = [...container.querySelectorAll('.visibility-item:not(.dragging)')];
+
+ return draggableElements.reduce((closest, child) => {
+ const box = child.getBoundingClientRect();
+ const offset = y - box.top - box.height / 2;
+
+ if (offset < 0 && offset > closest.offset) {
+ return { offset: offset, element: child };
+ } else {
+ return closest;
+ }
+ }, { offset: Number.NEGATIVE_INFINITY }).element;
+}
+
+// Save positions after reordering
+async function savePositions() {
+ try {
+ const items = document.querySelectorAll('.visibility-item');
+ const positions = Array.from(items).map((item, index) => ({
+ targetId: item.dataset.targetId,
+ position: index
+ }));
+
+ // Validate all targetIds are present
+ const missingIds = positions.filter(p => !p.targetId);
+ if (missingIds.length > 0) {
+ console.error('Missing targetIds:', missingIds);
+ showNotification('Error: Some monitors are missing IDs', 'error');
+ return;
+ }
+
+ await axios.put('/admin/api/targets/positions', { positions });
+ showNotification('Monitor order saved', 'success');
+ } catch (error) {
+ console.error('Error saving positions:', error);
+ const errorMsg = error.response?.data?.error || error.message || 'Unknown error';
+ showNotification(`Error saving monitor order: ${errorMsg}`, 'error');
+ // Reload to reset positions
+ loadVisibility();
+ }
+}
+
+// Toggle visibility field (unified function for all visibility toggles)
+async function toggleVisibilityField(targetId, field, value) {
+ try {
+ const updateData = {};
+ updateData[field] = value;
+
+ await axios.put(`/admin/api/targets/${targetId}`, updateData);
+
+ const fieldNames = {
+ publicVisible: 'Public visibility',
+ publicShowDetails: 'Technical details',
+ publicShowStatus: 'Status monitor',
+ publicShowAppLink: 'App link'
+ };
+
+ showNotification(`${fieldNames[field] || field} ${value ? 'enabled' : 'disabled'}`, 'success');
+
+ // Reload to update UI (show/hide conditional checkboxes)
+ if (field === 'publicVisible') {
+ loadVisibility();
+ }
+ } catch (error) {
+ console.error(`Error updating ${field}:`, error);
+ showNotification(error.response?.data?.error || `Error updating ${field}`, 'error');
+ // Reload to reset checkbox state
+ loadVisibility();
+ }
+}
+
+// Logout
+function logout() {
+ axios.get('/admin/logout').then(() => {
+ window.location.href = '/admin/login';
+ });
+}
+
+// Load public UI settings
+async function loadPublicUISettings() {
+ try {
+ const response = await axios.get('/admin/api/public-ui-settings');
+ const settings = response.data.settings;
+
+ if (settings) {
+ const title = settings.title || 'Homelab';
+ const publicUITitleEl = document.getElementById('publicUITitle');
+ if (publicUITitleEl) {
+ publicUITitleEl.value = title;
+ }
+ const publicUISubtitleEl = document.getElementById('publicUISubtitle');
+ if (publicUISubtitleEl) {
+ publicUISubtitleEl.value = settings.subtitle || 'System Status & Application Dashboard';
+ }
+ const publicUICustomCSSEl = document.getElementById('publicUICustomCSS');
+ if (publicUICustomCSSEl) {
+ publicUICustomCSSEl.value = settings.customCSS || '';
+ }
+
+ // Update header title
+ updateAdminHeaderTitle(title);
+ } else {
+ // No settings, use default
+ updateAdminHeaderTitle('LocalPing');
+ }
+
+ // Also load admin settings and notification settings
+ await loadAdminSettings();
+ await loadNotificationSettings();
+ } catch (error) {
+ console.error('Error loading public UI settings:', error);
+ // Don't show notification on initial load error, just use default
+ updateAdminHeaderTitle('LocalPing');
+ // Still try to load admin settings
+ await loadAdminSettings();
+ }
+}
+
+// Load admin settings
+async function loadAdminSettings() {
+ try {
+ const response = await axios.get('/admin/api/admin-settings');
+ const settings = response.data.settings;
+ const dbSize = response.data.dbSize || 0;
+
+ if (settings) {
+ const sessionDurationEl = document.getElementById('sessionDurationDays');
+ if (sessionDurationEl) {
+ sessionDurationEl.value = settings.sessionDurationDays || 30;
+ }
+ const dataRetentionEl = document.getElementById('dataRetentionDays');
+ if (dataRetentionEl) {
+ dataRetentionEl.value = settings.dataRetentionDays || 30;
+ }
+ const debugLoggingEl = document.getElementById('debugLogging');
+ if (debugLoggingEl) {
+ debugLoggingEl.checked = settings.debugLogging === true;
+ }
+ }
+
+ // Update database size display
+ const dbSizeEl = document.getElementById('databaseSize');
+ if (dbSizeEl) {
+ dbSizeEl.textContent = formatFileSize(dbSize);
+ }
+ } catch (error) {
+ console.error('Error loading admin settings:', error);
+ }
+}
+
+// Format file size to human-readable format
+function formatFileSize(bytes) {
+ if (bytes === 0) return '0 B';
+ const k = 1024;
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
+}
+
+// Save admin settings
+async function saveAdminSettings() {
+ try {
+ const sessionDurationEl = document.getElementById('sessionDurationDays');
+ const dataRetentionEl = document.getElementById('dataRetentionDays');
+ const debugLoggingEl = document.getElementById('debugLogging');
+ const sessionDurationDays = sessionDurationEl ? parseInt(sessionDurationEl.value, 10) : 30;
+ const dataRetentionDays = dataRetentionEl ? parseInt(dataRetentionEl.value, 10) : 30;
+ const debugLogging = debugLoggingEl ? debugLoggingEl.checked : false;
+
+ if (isNaN(sessionDurationDays) || sessionDurationDays < 1 || sessionDurationDays > 365) {
+ showNotification('Session duration must be between 1 and 365 days', 'error');
+ return;
+ }
+
+ if (isNaN(dataRetentionDays) || dataRetentionDays < 1 || dataRetentionDays > 3650) {
+ showNotification('Data retention must be between 1 and 3650 days', 'error');
+ return;
+ }
+
+ await axios.put('/admin/api/admin-settings', {
+ sessionDurationDays: sessionDurationDays,
+ dataRetentionDays: dataRetentionDays,
+ debugLogging: debugLogging
+ });
+
+ showNotification('Admin settings saved successfully', 'success');
+ } catch (error) {
+ console.error('Error saving admin settings:', error);
+ showNotification(error.response?.data?.error || 'Error saving admin settings', 'error');
+ }
+}
+
+// Update admin header title
+function updateAdminHeaderTitle(customTitle) {
+ const headerTitle = document.getElementById('adminHeaderTitle');
+ if (headerTitle) {
+ if (customTitle && customTitle !== 'Homelab' && customTitle !== 'LocalPing') {
+ headerTitle.textContent = `${customTitle} Admin`;
+ } else {
+ headerTitle.textContent = 'LocalPing Admin';
+ }
+ }
+}
+
+// Save public UI settings
+async function savePublicUISettings() {
+ try {
+ const data = {
+ title: document.getElementById('publicUITitle').value || 'Homelab',
+ subtitle: document.getElementById('publicUISubtitle').value || 'System Status & Application Dashboard',
+ customCSS: document.getElementById('publicUICustomCSS').value || null,
+ };
+
+ await axios.put('/admin/api/public-ui-settings', data);
+ showNotification('Public UI settings saved successfully', 'success');
+
+ // Update header title
+ updateAdminHeaderTitle(data.title);
+ } catch (error) {
+ console.error('Error saving public UI settings:', error);
+ showNotification(error.response?.data?.error || 'Error saving public UI settings', 'error');
+ }
+}
+
+// Preview public UI
+function previewPublicUI() {
+ window.open('/', '_blank');
+}
+
+// Load notification settings
+async function loadNotificationSettings() {
+ try {
+ const response = await axios.get('/admin/api/notification-settings');
+ const settings = response.data.settings;
+
+ if (settings) {
+ const enabledEl = document.getElementById('notificationEnabled');
+ if (enabledEl) {
+ enabledEl.checked = settings.enabled === true;
+ }
+
+ const delayEl = document.getElementById('monitorDownDelayMinutes');
+ if (delayEl) {
+ delayEl.value = settings.monitorDownDelayMinutes || 5;
+ }
+
+ const discordEnabledEl = document.getElementById('discordEnabled');
+ if (discordEnabledEl) {
+ discordEnabledEl.checked = settings.discord?.enabled === true;
+ }
+
+ const discordWebhookEl = document.getElementById('discordWebhookUrl');
+ if (discordWebhookEl) {
+ discordWebhookEl.value = settings.discord?.webhookUrl || '';
+ }
+
+ const discordUsernameEl = document.getElementById('discordUsername');
+ if (discordUsernameEl) {
+ discordUsernameEl.value = settings.discord?.username || 'LocalPing';
+ }
+
+ const discordAvatarEl = document.getElementById('discordAvatarUrl');
+ if (discordAvatarEl) {
+ discordAvatarEl.value = settings.discord?.avatarUrl || '';
+ }
+
+ const eventMonitorDownEl = document.getElementById('eventMonitorDown');
+ if (eventMonitorDownEl) {
+ eventMonitorDownEl.checked = settings.events?.monitorDown !== false;
+ }
+
+ const eventMonitorUpEl = document.getElementById('eventMonitorUp');
+ if (eventMonitorUpEl) {
+ eventMonitorUpEl.checked = settings.events?.monitorUp !== false;
+ }
+
+ const eventIncidentCreatedEl = document.getElementById('eventIncidentCreated');
+ if (eventIncidentCreatedEl) {
+ eventIncidentCreatedEl.checked = settings.events?.incidentCreated !== false;
+ }
+
+ const eventIncidentUpdatedEl = document.getElementById('eventIncidentUpdated');
+ if (eventIncidentUpdatedEl) {
+ eventIncidentUpdatedEl.checked = settings.events?.incidentUpdated !== false;
+ }
+ }
+ } catch (error) {
+ console.error('Error loading notification settings:', error);
+ }
+}
+
+// Save notification settings
+async function saveNotificationSettings() {
+ try {
+ const enabled = document.getElementById('notificationEnabled').checked;
+ const delayEl = document.getElementById('monitorDownDelayMinutes');
+ const monitorDownDelayMinutes = parseInt(delayEl?.value, 10) || 5;
+ if (monitorDownDelayMinutes < 1 || monitorDownDelayMinutes > 1440) {
+ showNotification('Monitor notification delay must be between 1 and 1,440 minutes', 'error');
+ return;
+ }
+ const discordEnabled = document.getElementById('discordEnabled').checked;
+ const discordWebhookUrl = document.getElementById('discordWebhookUrl').value.trim();
+ const discordUsername = document.getElementById('discordUsername').value.trim() || 'LocalPing';
+ const discordAvatarUrl = document.getElementById('discordAvatarUrl').value.trim() || null;
+
+ // Validate Discord webhook URL if Discord is enabled
+ if (discordEnabled && !discordWebhookUrl) {
+ showNotification('Discord webhook URL is required when Discord notifications are enabled', 'error');
+ return;
+ }
+
+ if (discordWebhookUrl && !discordWebhookUrl.startsWith('https://discord.com/api/webhooks/')) {
+ showNotification('Invalid Discord webhook URL. It should start with https://discord.com/api/webhooks/', 'error');
+ return;
+ }
+
+ const data = {
+ enabled: enabled,
+ monitorDownDelayMinutes,
+ discord: {
+ enabled: discordEnabled,
+ webhookUrl: discordWebhookUrl || null,
+ username: discordUsername,
+ avatarUrl: discordAvatarUrl,
+ },
+ events: {
+ monitorDown: document.getElementById('eventMonitorDown').checked,
+ monitorUp: document.getElementById('eventMonitorUp').checked,
+ incidentCreated: document.getElementById('eventIncidentCreated').checked,
+ incidentUpdated: document.getElementById('eventIncidentUpdated').checked,
+ },
+ };
+
+ await axios.put('/admin/api/notification-settings', data);
+ showNotification('Notification settings saved successfully', 'success');
+ } catch (error) {
+ console.error('Error saving notification settings:', error);
+ showNotification(error.response?.data?.error || 'Error saving notification settings', 'error');
+ }
+}
+
+// Test Discord notification
+async function testDiscordNotification() {
+ try {
+ const discordEnabled = document.getElementById('discordEnabled').checked;
+ const discordWebhookUrl = document.getElementById('discordWebhookUrl').value.trim();
+
+ if (!discordEnabled) {
+ showNotification('Please enable Discord notifications first', 'error');
+ return;
+ }
+
+ if (!discordWebhookUrl) {
+ showNotification('Please enter a Discord webhook URL first', 'error');
+ return;
+ }
+
+ // Save settings first to ensure webhook URL is saved
+ await saveNotificationSettings();
+
+ showNotification('Sending test notification...', 'success');
+
+ const response = await axios.post('/admin/api/notification-settings/test', {
+ provider: 'discord',
+ });
+
+ if (response.data.success) {
+ showNotification('Test notification sent successfully! Check your Discord channel.', 'success');
+ } else {
+ showNotification(response.data.error || 'Failed to send test notification', 'error');
+ }
+ } catch (error) {
+ console.error('Error testing Discord notification:', error);
+ showNotification(error.response?.data?.error || 'Error testing notification', 'error');
+ }
+}
+
+// Show clear ping data warning modal
+function showClearPingDataWarning() {
+ document.getElementById('clearPingDataModal').classList.add('active');
+}
+
+// Close clear ping data modal
+function closeClearPingDataModal() {
+ document.getElementById('clearPingDataModal').classList.remove('active');
+}
+
+// Confirm and clear all ping data
+async function confirmClearPingData() {
+ try {
+ const response = await axios.post('/admin/api/clear-ping-data');
+ if (response.data.success) {
+ showNotification('All ping data cleared successfully', 'success');
+ closeClearPingDataModal();
+
+ // Reload monitors to refresh statistics
+ if (currentMonitorId) {
+ await loadMonitorStatistics(currentMonitorId);
+ }
+ } else {
+ showNotification(response.data.error || 'Error clearing ping data', 'error');
+ }
+ } catch (error) {
+ console.error('Error clearing ping data:', error);
+ showNotification(error.response?.data?.error || 'Error clearing ping data', 'error');
+ }
+}
+
+// Show clear monitor ping data confirmation modal
+function showClearMonitorPingDataConfirm() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ const monitorName = document.getElementById('monitorName')?.textContent || 'Monitor';
+ document.getElementById('clearMonitorPingDataName').textContent = monitorName;
+
+ const modal = document.getElementById('clearMonitorPingDataModal');
+ modal.classList.add('active');
+}
+
+// Close clear monitor ping data modal
+function closeClearMonitorPingDataModal() {
+ const modal = document.getElementById('clearMonitorPingDataModal');
+ modal.classList.remove('active');
+}
+
+// Confirm and clear monitor ping data
+async function confirmClearMonitorPingData() {
+ if (!currentMonitorId) {
+ showNotification('No monitor selected', 'error');
+ return;
+ }
+
+ try {
+ const response = await axios.post(`/admin/api/targets/${currentMonitorId}/clear-ping-data`);
+ if (response.data.success) {
+ showNotification(response.data.message || 'Ping data cleared successfully', 'success');
+ closeClearMonitorPingDataModal();
+
+ // Reload monitor statistics to refresh the display
+ await loadMonitorStatistics(currentMonitorId);
+ } else {
+ showNotification(response.data.error || 'Error clearing ping data', 'error');
+ }
+ } catch (error) {
+ console.error('Error clearing monitor ping data:', error);
+ showNotification(error.response?.data?.error || 'Error clearing ping data', 'error');
+ }
+}
+
+// Attach form listeners for protocol and auth changes
+function attachFormListeners() {
+ const protocolSelect = document.getElementById('editProtocol');
+ const authSelect = document.getElementById('editAuthMethod');
+
+ if (protocolSelect) {
+ protocolSelect.onchange = updateProtocolSettings;
+ }
+ if (authSelect) {
+ authSelect.onchange = updateAuthFields;
+ }
+}
+
+// ============ BACKUP FUNCTIONS ============
+
+// Toggle export options based on full backup checkbox
+window.toggleExportOptions = function toggleExportOptions() {
+ const fullBackup = document.getElementById('exportFull').checked;
+ const exportOptions = document.getElementById('exportOptions');
+ const checkboxes = exportOptions.querySelectorAll('input[type="checkbox"]');
+
+ if (fullBackup) {
+ checkboxes.forEach(cb => {
+ cb.checked = true;
+ cb.disabled = true;
+ });
+ } else {
+ checkboxes.forEach(cb => {
+ cb.disabled = false;
+ });
+ }
+}
+
+// Export backup
+window.exportBackup = async function exportBackup() {
+ try {
+ const fullBackup = document.getElementById('exportFull').checked;
+ const exportOptions = {
+ full: fullBackup,
+ monitors: document.getElementById('exportMonitors').checked,
+ incidents: document.getElementById('exportIncidents').checked,
+ posts: document.getElementById('exportPosts').checked,
+ dataPoints: document.getElementById('exportDataPoints').checked,
+ actions: document.getElementById('exportActions').checked,
+ alerts: document.getElementById('exportAlerts').checked,
+ settings: document.getElementById('exportSettings').checked,
+ favicons: document.getElementById('exportFavicons').checked,
+ };
+
+ // Check if at least one option is selected
+ if (!fullBackup && !Object.values(exportOptions).slice(1).some(v => v === true)) {
+ showNotification('Please select at least one data type to export', 'error');
+ return;
+ }
+
+ showNotification('Exporting backup...', 'success');
+
+ const response = await axios.post('/admin/api/backup/export', exportOptions);
+
+ if (response.data.success) {
+ // Create download link
+ const dataStr = JSON.stringify(response.data.data, null, 2);
+ const dataBlob = new Blob([dataStr], { type: 'application/json' });
+ const url = URL.createObjectURL(dataBlob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = `localping-backup-${new Date().toISOString().split('T')[0]}.json`;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ URL.revokeObjectURL(url);
+
+ showNotification('Backup exported successfully', 'success');
+ } else {
+ showNotification(response.data.error || 'Error exporting backup', 'error');
+ }
+ } catch (error) {
+ console.error('Error exporting backup:', error);
+ showNotification(error.response?.data?.error || 'Error exporting backup', 'error');
+ }
+}
+
+// Import backup
+window.importBackup = async function importBackup() {
+ try {
+ const fileInput = document.getElementById('importFile');
+ const file = fileInput.files[0];
+
+ if (!file) {
+ showNotification('Please select a backup file to import', 'error');
+ return;
+ }
+
+ if (!file.name.endsWith('.json')) {
+ showNotification('Please select a valid JSON backup file', 'error');
+ return;
+ }
+
+ showNotification('Reading backup file...', 'success');
+
+ const fileContent = await new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.onload = (e) => resolve(e.target.result);
+ reader.onerror = reject;
+ reader.readAsText(file);
+ });
+
+ let importData;
+ try {
+ importData = JSON.parse(fileContent);
+ } catch (error) {
+ showNotification('Invalid JSON file format', 'error');
+ return;
+ }
+
+ // Validate import data structure
+ if (!importData.data || typeof importData.data !== 'object') {
+ showNotification('Invalid backup file format', 'error');
+ return;
+ }
+
+ const overwrite = document.getElementById('importOverwrite').checked;
+
+ showNotification('Importing backup...', 'success');
+
+ const response = await axios.post('/admin/api/backup/import', {
+ importData,
+ overwrite,
+ });
+
+ if (response.data.success) {
+ const results = response.data.results;
+ let message = 'Backup imported successfully:\n';
+
+ // Build summary message
+ if (results.imported) {
+ Object.keys(results.imported).forEach(key => {
+ const data = results.imported[key];
+ const parts = [];
+ if (data.imported) parts.push(`${data.imported} imported`);
+ if (data.updated) parts.push(`${data.updated} updated`);
+ if (data.skipped) parts.push(`${data.skipped} skipped`);
+ if (parts.length > 0) {
+ message += `\n${key}: ${parts.join(', ')}`;
+ }
+ });
+ }
+
+ if (results.errors && results.errors.length > 0) {
+ message += `\n\nErrors: ${results.errors.length} error(s) occurred`;
+ }
+
+ showNotification(message, 'success');
+
+ // Clear file input
+ fileInput.value = '';
+
+ // Reload relevant data
+ if (results.imported.targets || results.imported.incidents || results.imported.posts) {
+ // Reload current tab if applicable
+ const activeTab = document.querySelector('.tab-content.active');
+ if (activeTab) {
+ const tabId = activeTab.id;
+ if (tabId === 'monitors' && results.imported.targets) {
+ loadMonitors();
+ } else if (tabId === 'incidents' && results.imported.incidents) {
+ loadIncidents();
+ } else if (tabId === 'posts' && results.imported.posts) {
+ loadPosts();
+ }
+ }
+ }
+ } else {
+ showNotification(response.data.error || 'Error importing backup', 'error');
+ }
+ } catch (error) {
+ console.error('Error importing backup:', error);
+ showNotification(error.response?.data?.error || 'Error importing backup', 'error');
+ }
+}
+
+// ============ EVENT RULES MANAGEMENT ============
+let currentEventRuleId = null;
+let allTargets = [];
+
+// Load event rules
+async function loadEventRules() {
+ try {
+ const response = await axios.get('/admin/api/event-rules');
+ const rules = response.data.rules || [];
+
+ const rulesList = document.getElementById('eventRulesList');
+ rulesList.innerHTML = '';
+
+ if (rules.length === 0) {
+ rulesList.innerHTML = 'No event rules configured. Create one to automatically detect incidents.
';
+ return;
+ }
+
+ for (const rule of rules) {
+ const ruleCard = document.createElement('div');
+ ruleCard.className = 'bg-slate-800/50 rounded-lg p-4 border border-slate-700';
+ ruleCard.innerHTML = `
+
+
+
+ ${rule.name}
+ ${rule.enabled ? 'Enabled' : 'Disabled'}
+
+
Type: ${rule.eventType.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
+
+
+
+
+
+
+
+
Incident: ${rule.incidentTitle}
+
${rule.incidentDescription}
+
+ `;
+ rulesList.appendChild(ruleCard);
+ }
+ } catch (error) {
+ console.error('Error loading event rules:', error);
+ showNotification('Error loading event rules: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Show create event rule modal
+async function showCreateEventRuleModal() {
+ currentEventRuleId = null;
+ document.getElementById('eventRuleModalTitle').textContent = 'Create New Event Rule';
+ document.getElementById('eventRuleForm').reset();
+ document.getElementById('eventRuleEnabled').checked = true;
+ document.getElementById('eventRuleAutoResolve').checked = false;
+ document.getElementById('autoResolveMessageContainer').classList.add('hidden');
+ document.getElementById('eventRuleConditionsContainer').innerHTML = '';
+ document.getElementById('eventRuleModal').classList.add('active');
+
+ // Load targets for selection
+ try {
+ const response = await axios.get('/admin/api/targets');
+ allTargets = response.data.targets || [];
+ } catch (error) {
+ console.error('Error loading targets:', error);
+ }
+}
+
+// Edit event rule
+async function editEventRule(ruleId) {
+ try {
+ const response = await axios.get(`/admin/api/event-rules/${ruleId}`);
+ const rule = response.data.rule;
+
+ currentEventRuleId = ruleId;
+ document.getElementById('eventRuleModalTitle').textContent = 'Edit Event Rule';
+ document.getElementById('eventRuleName').value = rule.name;
+ document.getElementById('eventRuleType').value = rule.eventType;
+ document.getElementById('eventRuleEnabled').checked = rule.enabled !== false;
+ document.getElementById('eventRuleIncidentTitle').value = rule.incidentTitle;
+ document.getElementById('eventRuleIncidentDescription').value = rule.incidentDescription;
+ document.getElementById('eventRuleIncidentSeverity').value = rule.incidentSeverity || 'major';
+ document.getElementById('eventRuleIncidentStatus').value = rule.incidentStatus || 'investigating';
+ document.getElementById('eventRuleAutoResolve').checked = rule.autoResolve === true;
+ document.getElementById('eventRuleAutoResolveMessage').value = rule.autoResolveMessage || '';
+ document.getElementById('eventRuleCooldown').value = rule.cooldownMinutes || 0;
+
+ toggleAutoResolveMessage();
+ updateEventRuleConditions();
+
+ // Load targets for selection
+ try {
+ const response = await axios.get('/admin/api/targets');
+ allTargets = response.data.targets || [];
+ } catch (error) {
+ console.error('Error loading targets:', error);
+ }
+
+ // Set condition values after loading
+ setTimeout(() => {
+ const conditions = rule.conditions;
+ const currentEventType = document.getElementById('eventRuleType').value;
+
+ // Handle both old format (targetId) and new format (targetIds) for monitor_down/monitor_up
+ if ((currentEventType === 'monitor_down' || currentEventType === 'monitor_up')) {
+ const targetIds = conditions.targetIds && Array.isArray(conditions.targetIds)
+ ? conditions.targetIds
+ : (conditions.targetId ? [conditions.targetId] : []);
+
+ targetIds.forEach(targetId => {
+ const checkbox = document.querySelector(`#conditionTargetIdsDropdown .target-checkbox[value="${targetId}"]`);
+ if (checkbox) {
+ checkbox.checked = true;
+ }
+ });
+
+ updateTargetDisplay('conditionTargetIds');
+ }
+ // Handle targetIds for multiple_monitors_down
+ if (currentEventType === 'multiple_monitors_down') {
+ if (conditions.targetIds && Array.isArray(conditions.targetIds)) {
+ conditions.targetIds.forEach(targetId => {
+ const checkbox = document.querySelector(`#conditionTargetIdsDropdown .target-checkbox[value="${targetId}"]`);
+ if (checkbox) {
+ checkbox.checked = true;
+ }
+ });
+ updateTargetDisplay('conditionTargetIds');
+ }
+ }
+ if (conditions.count !== undefined) {
+ const input = document.getElementById('conditionCount');
+ if (input) input.value = conditions.count;
+ }
+ if (conditions.threshold !== undefined) {
+ const input = document.getElementById('conditionThreshold');
+ if (input) input.value = conditions.threshold;
+ }
+ if (conditions.operator) {
+ const select = document.getElementById('conditionOperator');
+ if (select) select.value = conditions.operator;
+ }
+ if (conditions.period) {
+ const input = document.getElementById('conditionPeriod');
+ if (input) input.value = conditions.period;
+ }
+ if (conditions.expression) {
+ const textarea = document.getElementById('conditionExpression');
+ if (textarea) textarea.value = conditions.expression;
+ }
+ }, 100);
+
+ document.getElementById('eventRuleModal').classList.add('active');
+ } catch (error) {
+ console.error('Error loading event rule:', error);
+ showNotification('Error loading event rule: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Update event rule conditions UI based on event type
+function updateEventRuleConditions() {
+ const eventType = document.getElementById('eventRuleType').value;
+ const container = document.getElementById('eventRuleConditionsContainer');
+
+ if (!eventType) {
+ container.innerHTML = '';
+ return;
+ }
+
+ let html = '';
+ html += '
Conditions
';
+
+ switch (eventType) {
+ case 'monitor_down':
+ case 'monitor_up':
+ html += `
+
+
+
+
+
+ ${allTargets.map(t => `
+
+ `).join('')}
+
+
+
Click to select/deselect monitors
+
+ `;
+ break;
+ case 'multiple_monitors_down':
+ html += `
+
+
+
+
+
+ ${allTargets.map(t => `
+
+ `).join('')}
+
+
+
Select monitors to check. The rule triggers when the specified count of these monitors are down.
+
+
+
+
+
+
+
+
+
+
+
+ `;
+ break;
+ case 'monitor_response_time':
+ html += `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `;
+ break;
+ case 'uptime_threshold':
+ html += `
+
+
+
+
+
+ `;
+ break;
+ case 'custom_condition':
+ html += `
+
+
+
+
Available functions: getTargetStatus(id), getLatestResponseTime(id), getUptimePercentage(id, period)
+
+ `;
+ break;
+ }
+
+ html += '
';
+ container.innerHTML = html;
+}
+
+// Toggle auto-resolve message field
+function toggleAutoResolveMessage() {
+ const autoResolve = document.getElementById('eventRuleAutoResolve').checked;
+ const container = document.getElementById('autoResolveMessageContainer');
+ if (autoResolve) {
+ container.classList.remove('hidden');
+ } else {
+ container.classList.add('hidden');
+ }
+}
+
+// Save event rule
+async function saveEventRule(event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ const eventType = document.getElementById('eventRuleType').value;
+ const conditions = {};
+
+ // Build conditions based on event type
+ switch (eventType) {
+ case 'monitor_down':
+ case 'monitor_up':
+ {
+ const checkboxes = document.querySelectorAll('#conditionTargetIdsDropdown .target-checkbox:checked');
+ if (checkboxes.length > 0) {
+ conditions.targetIds = Array.from(checkboxes).map(cb => cb.value);
+ }
+ }
+ break;
+ case 'multiple_monitors_down':
+ {
+ const checkboxes = document.querySelectorAll('#conditionTargetIdsDropdown .target-checkbox:checked');
+ if (checkboxes.length > 0) {
+ conditions.targetIds = Array.from(checkboxes).map(cb => cb.value);
+ }
+ conditions.count = parseInt(document.getElementById('conditionCount')?.value || '2');
+ conditions.operator = document.getElementById('conditionOperator')?.value || 'gte';
+ }
+ break;
+ case 'monitor_response_time':
+ conditions.targetId = document.getElementById('conditionTargetId')?.value;
+ conditions.threshold = parseInt(document.getElementById('conditionThreshold')?.value || '1000');
+ conditions.operator = document.getElementById('conditionOperator')?.value || 'gt';
+ break;
+ case 'uptime_threshold':
+ conditions.targetId = document.getElementById('conditionTargetId')?.value;
+ conditions.threshold = parseFloat(document.getElementById('conditionThreshold')?.value || '95');
+ conditions.period = document.getElementById('conditionPeriod')?.value || '24h';
+ break;
+ case 'custom_condition':
+ conditions.expression = document.getElementById('conditionExpression')?.value || '';
+ break;
+ }
+
+ const ruleData = {
+ name: document.getElementById('eventRuleName').value.trim(),
+ eventType: eventType,
+ enabled: document.getElementById('eventRuleEnabled').checked,
+ conditions: conditions,
+ incidentTitle: document.getElementById('eventRuleIncidentTitle').value.trim(),
+ incidentDescription: document.getElementById('eventRuleIncidentDescription').value.trim(),
+ incidentSeverity: document.getElementById('eventRuleIncidentSeverity').value,
+ incidentStatus: document.getElementById('eventRuleIncidentStatus').value,
+ autoResolve: document.getElementById('eventRuleAutoResolve').checked,
+ autoResolveMessage: document.getElementById('eventRuleAutoResolveMessage').value.trim() || null,
+ cooldownMinutes: parseInt(document.getElementById('eventRuleCooldown').value || '0'),
+ };
+
+ try {
+ if (currentEventRuleId) {
+ await axios.put(`/admin/api/event-rules/${currentEventRuleId}`, ruleData);
+ showNotification('Event rule updated successfully', 'success');
+ } else {
+ await axios.post('/admin/api/event-rules', ruleData);
+ showNotification('Event rule created successfully', 'success');
+ }
+
+ closeEventRuleModal();
+ loadEventRules();
+ } catch (error) {
+ console.error('Error saving event rule:', error);
+ showNotification('Error saving event rule: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Delete event rule
+async function deleteEventRule(ruleId) {
+ if (!confirm('Are you sure you want to delete this event rule?')) return;
+
+ try {
+ await axios.delete(`/admin/api/event-rules/${ruleId}`);
+ showNotification('Event rule deleted successfully', 'success');
+ loadEventRules();
+ } catch (error) {
+ console.error('Error deleting event rule:', error);
+ showNotification('Error deleting event rule: ' + (error.response?.data?.error || error.message), 'error');
+ }
+}
+
+// Close event rule modal
+function closeEventRuleModal() {
+ document.getElementById('eventRuleModal').classList.remove('active');
+ currentEventRuleId = null;
+}
+
+// Toggle target dropdown
+function toggleTargetDropdown(id) {
+ const dropdown = document.getElementById(`${id}Dropdown`);
+ if (dropdown) {
+ dropdown.classList.toggle('hidden');
+ }
+}
+
+// Update target display text
+function updateTargetDisplay(id) {
+ const checkboxes = document.querySelectorAll(`#${id}Dropdown .target-checkbox:checked`);
+ const display = document.getElementById(`${id}Display`);
+
+ if (checkboxes.length === 0) {
+ display.textContent = 'Select monitors...';
+ } else if (checkboxes.length === 1) {
+ display.textContent = checkboxes[0].getAttribute('data-name');
+ } else {
+ display.textContent = `${checkboxes.length} monitors selected`;
+ }
+}
+
+// Close dropdowns when clicking outside (only if already initialized)
+if (typeof document !== 'undefined') {
+ document.addEventListener('click', (e) => {
+ // Check if click is outside any dropdown container
+ if (!e.target.closest('.relative') && !e.target.closest('[id$="Dropdown"]')) {
+ document.querySelectorAll('[id$="Dropdown"]').forEach(dropdown => {
+ dropdown.classList.add('hidden');
+ });
+ }
+ });
+}
+
+// Initialize on page load
+document.addEventListener('DOMContentLoaded', () => {
+ attachFormListeners();
+ loadPublicUISettings(); // Load custom title for header
+
+ // Hide clone button initially
+ const cloneBtn = document.getElementById('cloneMonitorBtn');
+ if (cloneBtn) {
+ cloneBtn.style.display = 'none';
+ }
+});
diff --git a/src/public/js/admin.js b/src/public/js/admin.js
new file mode 100644
index 0000000..e77cc59
--- /dev/null
+++ b/src/public/js/admin.js
@@ -0,0 +1,934 @@
+let pingChart = null;
+let selectedTargetId = null;
+let allTargets = [];
+
+// Session-based authentication - no API key needed for admin panel
+// API calls use secure session cookies automatically
+axios.interceptors.response.use(
+ (response) => response,
+ (error) => {
+ // If 401, redirect to login
+ if (error.response?.status === 401) {
+ window.location.href = '/admin/login';
+ }
+ return Promise.reject(error);
+ }
+);
+
+// Load on page load
+loadDashboard();
+
+// Auto-refresh every 15 seconds
+setInterval(loadDashboard, 15000);
+
+async function loadDashboard() {
+ try {
+ const res = await axios.get('/admin/api/dashboard');
+ const { dashboard } = res.data;
+
+ allTargets = dashboard.targets;
+
+ // Update stats
+ const upCount = dashboard.targets.filter((t) => t.currentStatus === 'up').length;
+ const downCount = dashboard.targets.length - upCount;
+
+ document.getElementById('total-targets').textContent = dashboard.targets.length;
+ document.getElementById('targets-up').textContent = upCount;
+ document.getElementById('targets-down').textContent = downCount;
+ document.getElementById('active-monitors').textContent = dashboard.targets.filter((t) => t.enabled).length;
+
+ // Display monitors list
+ displayMonitorsList(dashboard.targets);
+
+ // Update selected monitor if one is selected (but NOT if form is open)
+ const formPanel = document.getElementById('form-panel');
+ if (selectedTargetId && !formPanel.classList.contains('hidden')) {
+ // Form is open, don't switch to details view
+ return;
+ }
+
+ if (selectedTargetId) {
+ const selectedTarget = dashboard.targets.find(t => t._id === selectedTargetId);
+ if (selectedTarget) {
+ displayMonitorDetail(selectedTarget);
+ }
+ }
+ } catch (error) {
+ console.error('Error loading dashboard:', error);
+ }
+}
+
+function displayMonitorsList(targets) {
+ const list = document.getElementById('services-list');
+ const searchTerm = document.getElementById('search-input')?.value.toLowerCase() || '';
+
+ const filtered = targets.filter(target =>
+ target.name.toLowerCase().includes(searchTerm) ||
+ target.host.toLowerCase().includes(searchTerm)
+ );
+
+ if (filtered.length === 0) {
+ list.innerHTML = 'No monitors found
';
+ return;
+ }
+
+ list.innerHTML = filtered.map(target => {
+ const isSelected = selectedTargetId === target._id;
+ const statusColor = target.currentStatus === 'up' ? 'bg-green-500' : 'bg-red-500';
+
+ return `
+
+
+
+
+
+
${target.name}
+
${target.host}:${target.port || 'default'}
+
+
+
+ ${target.currentStatus === 'up' ? 'β' : 'β'}
+
+
+
+ Loading...
+
+
+ `;
+ }).join('');
+
+ // Load uptime data for all monitors
+ filtered.forEach(target => {
+ loadAndDisplayMiniUptime(target._id);
+ });
+}
+
+async function loadAndDisplayMiniUptime(targetId) {
+ try {
+ const res = await axios.get(`/api/targets/${targetId}/statistics?days=1`);
+ const stats = res.data.statistics || [];
+
+ let html = '';
+ stats.forEach(stat => {
+ const isUp = stat.successfulPings > 0;
+ html += ``;
+ });
+
+ const el = document.querySelector(`.uptime-bar-${targetId}`);
+ if (el) {
+ el.innerHTML = html;
+ }
+ } catch (error) {
+ console.error('Error loading uptime bars:', error);
+ }
+}
+
+function selectMonitor(targetId) {
+ selectedTargetId = targetId;
+ const selectedTarget = allTargets.find(t => t._id === targetId);
+ if (selectedTarget) {
+ displayMonitorDetail(selectedTarget);
+ // Compact the sidebar when a monitor is selected
+ const sidebarTop = document.getElementById('sidebar-top-section');
+ sidebarTop.classList.remove('sidebar-top-expanded');
+ sidebarTop.classList.add('sidebar-top-compact');
+ }
+}
+
+async function displayMonitorDetail(target) {
+ // Show details panel
+ document.getElementById('no-selection').classList.add('hidden');
+ document.getElementById('details-panel').classList.remove('hidden');
+
+ // Update header immediately
+ document.getElementById('detail-name').textContent = target.name;
+ document.getElementById('detail-host').textContent = `${target.host}:${target.port || 'default'} β’ ${target.protocol}`;
+ document.getElementById('detail-interval').textContent = `Check every ${target.interval || 60} seconds`;
+
+ // Update status badge
+ const statusBadge = document.getElementById('detail-status');
+ if (target.currentStatus === 'up') {
+ statusBadge.textContent = 'β Up';
+ statusBadge.className = 'px-4 py-2 rounded-lg font-medium text-lg bg-green-900 text-green-200';
+ } else {
+ statusBadge.textContent = 'β Down';
+ statusBadge.className = 'px-4 py-2 rounded-lg font-medium text-lg bg-red-900 text-red-200';
+ }
+
+ // Set loading state for chart
+ document.getElementById('detail-uptime-24h').textContent = 'Loading...';
+ document.getElementById('detail-uptime-30d').textContent = 'Loading...';
+ document.getElementById('detail-current-ping').textContent = 'Loading...';
+ document.getElementById('detail-avg-ping').textContent = 'Loading...';
+
+ // Load uptime data
+ try {
+ const res24h = await axios.get(`/api/targets/${target._id}/uptime?days=1`);
+ const res30d = await axios.get(`/api/targets/${target._id}/uptime?days=30`);
+ const resStats = await axios.get(`/api/targets/${target._id}/statistics?days=1`);
+
+ const uptime24h = res24h.data.uptime;
+ const uptime30d = res30d.data.uptime;
+ const stats = resStats.data.statistics || [];
+
+ // Get the most recent avg response time
+ const latestStat = stats.length > 0 ? stats[stats.length - 1] : null;
+ const currentPing = latestStat?.lastResponseTime || 0;
+ const avgPing = latestStat?.avgResponseTime || 0;
+
+ // Update uptime stats
+ document.getElementById('detail-uptime-24h').textContent = `${uptime24h.toFixed(2)}%`;
+ document.getElementById('detail-uptime-30d').textContent = `${uptime30d.toFixed(2)}%`;
+ document.getElementById('detail-current-ping').textContent = currentPing.toFixed(2) + ' ms';
+ document.getElementById('detail-avg-ping').textContent = avgPing.toFixed(2) + ' ms';
+
+ // Generate uptime visualization
+ await generateUptimeVisualization(target._id);
+
+ // Load and display ping chart
+ await loadPingChart(target._id);
+ } catch (error) {
+ console.error('Error loading monitor details:', error);
+ document.getElementById('detail-uptime-24h').textContent = '-- %';
+ document.getElementById('detail-uptime-30d').textContent = '-- %';
+ document.getElementById('detail-current-ping').textContent = '-- ms';
+ document.getElementById('detail-avg-ping').textContent = '-- ms';
+ }
+}
+
+async function generateUptimeVisualization(targetId) {
+ try {
+ const res = await axios.get(`/api/targets/${targetId}/statistics?days=30`);
+ const stats = res.data.statistics || [];
+
+ const viz = document.getElementById('uptime-visualization');
+ viz.innerHTML = '';
+
+ // Create segments based on real statistics data
+ stats.forEach(stat => {
+ const segment = document.createElement('div');
+ segment.className = 'uptime-segment';
+
+ const isUp = stat.successfulPings > 0;
+ if (!isUp) {
+ segment.classList.add('down');
+ } else {
+ segment.classList.add('up');
+ }
+
+ segment.title = `${new Date(stat.date).toLocaleDateString()}: ${isUp ? 'Up' : 'Down'}`;
+ viz.appendChild(segment);
+ });
+ } catch (error) {
+ console.error('Error generating uptime visualization:', error);
+ }
+}
+
+async function loadPingChart(targetId, days = 1) {
+ try {
+ // Update button styling
+ document.querySelectorAll('.period-btn').forEach(btn => {
+ btn.classList.remove('bg-cyan-600', 'text-white');
+ btn.classList.add('bg-slate-700', 'hover:bg-slate-600');
+ });
+
+ // Find and highlight the clicked button
+ const clickedBtn = document.querySelector(`.period-btn[data-period="${days <= 0.05 ? '1h' : days === 1 ? '24h' : days === 7 ? '7d' : '30d'}"]`);
+ if (clickedBtn) {
+ clickedBtn.classList.remove('bg-slate-700', 'hover:bg-slate-600');
+ clickedBtn.classList.add('bg-cyan-600', 'text-white');
+ }
+
+ const res = await axios.get(`/api/targets/${targetId}/statistics?days=${days}`);
+ const stats = res.data.statistics || [];
+
+ const labels = [];
+ const data = [];
+
+ stats.forEach(stat => {
+ const date = new Date(stat.date);
+ const label = days <= 0.05
+ ? date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
+ : days <= 1
+ ? date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
+ : date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ labels.push(label);
+ data.push(stat.avgResponseTime || 0);
+ });
+
+ const ctx = document.getElementById('ping-chart').getContext('2d');
+
+ if (pingChart) {
+ pingChart.destroy();
+ }
+
+ pingChart = new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels,
+ datasets: [
+ {
+ label: 'Response Time (ms)',
+ data,
+ borderColor: '#10b981',
+ backgroundColor: 'rgba(16, 185, 129, 0.1)',
+ fill: true,
+ tension: 0.4,
+ pointRadius: 2,
+ pointBackgroundColor: '#10b981',
+ pointBorderColor: '#fff',
+ pointHoverRadius: 5,
+ borderWidth: 2,
+ },
+ ],
+ },
+ options: {
+ responsive: true,
+ maintainAspectRatio: false,
+ plugins: {
+ legend: {
+ display: true,
+ labels: { color: '#cbd5e1' },
+ },
+ },
+ scales: {
+ y: {
+ beginAtZero: true,
+ grid: { color: '#475569' },
+ ticks: { color: '#cbd5e1' },
+ },
+ x: {
+ grid: { color: '#475569' },
+ ticks: { color: '#cbd5e1', maxRotation: 45, minRotation: 0 },
+ },
+ },
+ },
+ });
+ } catch (error) {
+ console.error('Error loading ping chart:', error);
+ }
+}
+
+// Form panel functions
+function showAddTargetForm() {
+ const formPanel = document.getElementById('form-panel');
+ const detailsPanel = document.getElementById('details-panel');
+ const noSelection = document.getElementById('no-selection');
+ const form = document.getElementById('target-form');
+ const title = document.getElementById('form-title');
+
+ title.textContent = 'Add Monitor';
+ form.reset();
+ delete form.dataset.targetId;
+
+ // Reset protocol-specific sections
+ updateProtocolSettings();
+ resetAuthenticationMethod();
+
+ // Show form panel, hide details
+ formPanel.classList.remove('hidden');
+ detailsPanel.classList.add('hidden');
+ noSelection.classList.add('hidden');
+}
+
+function cancelEditForm() {
+ const formPanel = document.getElementById('form-panel');
+ const detailsPanel = document.getElementById('details-panel');
+ const noSelection = document.getElementById('no-selection');
+ const sidebarTop = document.getElementById('sidebar-top-section');
+
+ // If a monitor is selected, show details. Otherwise show no-selection
+ if (selectedTargetId) {
+ formPanel.classList.add('hidden');
+ detailsPanel.classList.remove('hidden');
+ // Keep sidebar compact when a monitor is selected
+ sidebarTop.classList.remove('sidebar-top-expanded');
+ sidebarTop.classList.add('sidebar-top-compact');
+ } else {
+ formPanel.classList.add('hidden');
+ noSelection.classList.remove('hidden');
+ // Expand sidebar when no monitor is selected
+ sidebarTop.classList.remove('sidebar-top-compact');
+ sidebarTop.classList.add('sidebar-top-expanded');
+ }
+}
+
+function showEditForm() {
+ const formPanel = document.getElementById('form-panel');
+ const detailsPanel = document.getElementById('details-panel');
+ const form = document.getElementById('target-form');
+
+ // First load the target data
+ editTarget();
+
+ // Then show the form panel
+ setTimeout(() => {
+ formPanel.classList.remove('hidden');
+ detailsPanel.classList.add('hidden');
+ }, 10);
+}
+
+function updateProtocolSettings() {
+ const protocol = document.getElementById('target-protocol').value;
+ const httpSection = document.getElementById('http-options-section');
+ const authSection = document.getElementById('auth-section');
+
+ // Show HTTP options for HTTP/HTTPS protocols
+ if (protocol === 'HTTP' || protocol === 'HTTPS') {
+ httpSection.classList.remove('hidden');
+ authSection.classList.remove('hidden');
+ } else {
+ httpSection.classList.add('hidden');
+ authSection.classList.add('hidden');
+ }
+}
+
+function resetAuthenticationMethod() {
+ const authMethod = document.getElementById('target-auth-method');
+ const basicFields = document.getElementById('basic-auth-fields');
+ const bearerFields = document.getElementById('bearer-auth-fields');
+
+ authMethod.value = 'none';
+ basicFields.classList.add('hidden');
+ bearerFields.classList.add('hidden');
+}
+
+// Listen for auth method changes
+document.addEventListener('DOMContentLoaded', () => {
+ const authMethod = document.getElementById('target-auth-method');
+ if (authMethod) {
+ authMethod.addEventListener('change', (e) => {
+ const basicFields = document.getElementById('basic-auth-fields');
+ const bearerFields = document.getElementById('bearer-auth-fields');
+
+ basicFields.classList.add('hidden');
+ bearerFields.classList.add('hidden');
+
+ if (e.target.value === 'basic') {
+ basicFields.classList.remove('hidden');
+ } else if (e.target.value === 'bearer') {
+ bearerFields.classList.remove('hidden');
+ }
+ });
+ }
+});
+
+async function addTarget(event) {
+ event.preventDefault();
+
+ const form = document.getElementById('target-form');
+ const isEdit = form.dataset.targetId;
+
+ const target = {
+ name: document.getElementById('target-name').value,
+ host: document.getElementById('target-host').value,
+ protocol: document.getElementById('target-protocol').value,
+ port: document.getElementById('target-port').value ? parseInt(document.getElementById('target-port').value) : null,
+ interval: document.getElementById('target-interval').value ? parseInt(document.getElementById('target-interval').value) : 60,
+ enabled: document.getElementById('target-enabled').checked,
+ appUrl: document.getElementById('target-app-url').value || null,
+ appIcon: document.getElementById('target-app-icon').value || null,
+ retries: parseInt(document.getElementById('target-retries').value) || 0,
+ retryInterval: parseInt(document.getElementById('target-retry-interval').value) || 5,
+ timeout: parseInt(document.getElementById('target-timeout').value) || 30,
+ httpMethod: document.getElementById('target-http-method').value || 'GET',
+ statusCodes: document.getElementById('target-status-codes').value || '200-299',
+ maxRedirects: parseInt(document.getElementById('target-max-redirects').value) || 5,
+ ignoreSsl: document.getElementById('target-ignore-ssl').checked,
+ upsideDown: document.getElementById('target-upside-down').checked,
+ position: parseInt(document.getElementById('target-position').value) || 0,
+ group: document.getElementById('target-group').value || null,
+ quickCommands: document.getElementById('target-quick-commands').value
+ ? document.getElementById('target-quick-commands').value.split(',').map(cmd => cmd.trim()).filter(cmd => cmd)
+ : [],
+ };
+
+ // Add authentication if set
+ const authMethod = document.getElementById('target-auth-method').value;
+ if (authMethod === 'basic') {
+ target.auth = {
+ type: 'basic',
+ username: document.getElementById('target-auth-username').value,
+ password: document.getElementById('target-auth-password').value,
+ };
+ } else if (authMethod === 'bearer') {
+ target.auth = {
+ type: 'bearer',
+ token: document.getElementById('target-auth-token').value,
+ };
+ }
+
+ try {
+ let savedTargetId;
+ if (isEdit) {
+ await axios.put(`/api/targets/${form.dataset.targetId}`, target);
+ savedTargetId = form.dataset.targetId;
+ } else {
+ const res = await axios.post('/api/targets', target);
+ savedTargetId = res.data.target._id;
+ }
+
+ // Close form and return to details
+ const formPanel = document.getElementById('form-panel');
+ const detailsPanel = document.getElementById('details-panel');
+ formPanel.classList.add('hidden');
+
+ form.reset();
+ document.getElementById('target-enabled').checked = true;
+
+ // Reload dashboard and show the saved monitor details
+ await loadDashboard();
+
+ // If we just saved a new monitor, select the first one
+ if (!isEdit && allTargets.length > 0) {
+ selectMonitor(allTargets[0]._id);
+ } else if (isEdit) {
+ // If editing, refresh the details view
+ displayMonitorDetail(allTargets.find(t => t._id === form.dataset.targetId));
+ }
+
+ // Test the monitor immediately after saving
+ selectedTargetId = savedTargetId;
+ setTimeout(() => {
+ testTarget();
+ }, 500);
+ } catch (error) {
+ alert('Error saving target: ' + error.message);
+ }
+}
+
+async function editTarget() {
+ if (!selectedTargetId) return;
+
+ try {
+ const res = await axios.get(`/api/targets/${selectedTargetId}`);
+ const target = res.data.target;
+
+ // General section
+ document.getElementById('target-name').value = target.name;
+ document.getElementById('target-host').value = target.host;
+ document.getElementById('target-protocol').value = target.protocol;
+ document.getElementById('target-port').value = target.port || '';
+ document.getElementById('target-interval').value = target.interval || 60;
+
+ // Application section
+ document.getElementById('target-app-url').value = target.appUrl || '';
+ document.getElementById('target-app-icon').value = target.appIcon || '';
+
+ // Retries section
+ document.getElementById('target-retries').value = target.retries || 0;
+ document.getElementById('target-retry-interval').value = target.retryInterval || 5;
+
+ // HTTP Options section
+ document.getElementById('target-http-method').value = target.httpMethod || 'GET';
+ document.getElementById('target-timeout').value = target.timeout || 30;
+ document.getElementById('target-status-codes').value = target.statusCodes || '200-299';
+ document.getElementById('target-max-redirects').value = target.maxRedirects || 5;
+
+ // Authentication section
+ if (target.auth) {
+ if (target.auth.type === 'basic') {
+ document.getElementById('target-auth-method').value = 'basic';
+ document.getElementById('target-auth-username').value = target.auth.username || '';
+ document.getElementById('target-auth-password').value = target.auth.password || '';
+ } else if (target.auth.type === 'bearer') {
+ document.getElementById('target-auth-method').value = 'bearer';
+ document.getElementById('target-auth-token').value = target.auth.token || '';
+ }
+ } else {
+ document.getElementById('target-auth-method').value = 'none';
+ }
+
+ // Advanced section
+ document.getElementById('target-ignore-ssl').checked = target.ignoreSsl || false;
+ document.getElementById('target-upside-down').checked = target.upsideDown || false;
+ document.getElementById('target-enabled').checked = target.enabled !== false;
+
+ // Public UI settings
+ document.getElementById('target-position').value = target.position || 0;
+ document.getElementById('target-group').value = target.group || '';
+ const quickCommandsInput = document.getElementById('target-quick-commands');
+ if (quickCommandsInput) {
+ quickCommandsInput.value = (target.quickCommands || []).join(', ');
+ }
+
+ const form = document.getElementById('target-form');
+ const title = document.getElementById('form-title');
+
+ title.textContent = 'Edit Monitor';
+ form.dataset.targetId = selectedTargetId;
+
+ // Update protocol settings to show HTTP/auth options if needed
+ updateProtocolSettings();
+ } catch (error) {
+ alert('Error loading target: ' + error.message);
+ }
+}
+
+async function deleteTarget() {
+ if (!selectedTargetId) return;
+ if (!confirm('Are you sure you want to delete this monitor?')) return;
+
+ try {
+ await axios.delete(`/api/targets/${selectedTargetId}`);
+ selectedTargetId = null;
+ document.getElementById('no-selection').classList.remove('hidden');
+ document.getElementById('details-panel').classList.add('hidden');
+ loadDashboard();
+ } catch (error) {
+ alert('Error deleting target: ' + error.message);
+ }
+}
+
+async function testTarget() {
+ if (!selectedTargetId) return;
+
+ try {
+ const res = await axios.post(`/api/targets/${selectedTargetId}/test`);
+ const result = res.data.result;
+
+ showTestNotification(result);
+ } catch (error) {
+ showTestNotification(null, error.message);
+ }
+}
+
+function showTestNotification(result, errorMessage) {
+ const notificationId = 'test-notification-' + Date.now();
+ const isSuccess = result && result.success;
+ const targetName = allTargets.find(t => t._id === selectedTargetId)?.name || 'Target';
+
+ let container = document.getElementById('notificationContainer');
+ if (!container) {
+ container = document.createElement('div');
+ container.id = 'notificationContainer';
+ container.style.cssText = 'position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 400px; pointer-events: none;';
+ document.body.appendChild(container);
+ }
+
+ const notification = document.createElement('div');
+ notification.id = notificationId;
+ notification.className = `notification ${isSuccess ? 'success' : 'error'}`;
+
+ if (isSuccess) {
+ notification.innerHTML = `
+
+ β ${targetName} is UP
+
+ Response Time:
+ ${(result.responseTime || 0).toFixed(2)} ms
+
+
+ Protocol:
+ ${result.protocol || 'N/A'}
+
+
+ Timestamp:
+ ${new Date().toLocaleTimeString()}
+
+ `;
+ } else {
+ notification.innerHTML = `
+
+ β ${targetName} is DOWN
+
+ Error:
+ ${errorMessage || result?.error || 'Connection failed'}
+
+
+ Timestamp:
+ ${new Date().toLocaleTimeString()}
+
+ `;
+ }
+
+ container.appendChild(notification);
+
+ // Auto-remove after 5 seconds
+ setTimeout(() => {
+ const el = document.getElementById(notificationId);
+ if (el) {
+ el.style.animation = 'slideOut 0.3s ease-in forwards';
+ setTimeout(() => el.remove(), 300);
+ }
+ }, 5000);
+}
+
+// Search functionality
+document.getElementById('search-input')?.addEventListener('input', () => {
+ displayMonitorsList(allTargets);
+});
+
+// Public UI Settings functions
+function showPublicUISettings() {
+ const modal = document.getElementById('public-settings-modal');
+ const settingsList = document.getElementById('public-settings-list');
+
+ if (allTargets.length === 0) {
+ settingsList.innerHTML = 'No monitors available
';
+ modal.classList.remove('hidden');
+ return;
+ }
+
+ settingsList.innerHTML = allTargets.map(target => {
+ const isEnabled = target.enabled !== false;
+ return `
+
+ `;
+ }).join('');
+
+ modal.classList.remove('hidden');
+}
+
+async function savePublicSettings() {
+ const checkboxes = document.querySelectorAll('.public-ui-setting');
+ const updates = [];
+
+ for (const checkbox of checkboxes) {
+ const targetId = checkbox.dataset.targetId;
+ const isEnabled = checkbox.checked;
+ updates.push({ targetId, enabled: isEnabled });
+ }
+
+ try {
+ // Update each target's enabled status
+ for (const update of updates) {
+ await axios.put(`/api/targets/${update.targetId}`, {
+ enabled: update.enabled
+ });
+ }
+
+ document.getElementById('public-settings-modal').classList.add('hidden');
+
+ // Show success notification
+ showSuccessNotification('Public UI settings saved successfully!');
+
+ // Reload dashboard
+ await loadDashboard();
+ } catch (error) {
+ alert('Error saving settings: ' + error.message);
+ }
+}
+
+function showSuccessNotification(message) {
+ const notificationId = 'success-notification-' + Date.now();
+
+ let container = document.getElementById('notificationContainer');
+ if (!container) {
+ container = document.createElement('div');
+ container.id = 'notificationContainer';
+ container.style.cssText = 'position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 400px; pointer-events: none;';
+ document.body.appendChild(container);
+ }
+
+ const notification = document.createElement('div');
+ notification.id = notificationId;
+ notification.className = 'notification success';
+ notification.innerHTML = `
+
+ β ${message}
+ `;
+
+ container.appendChild(notification);
+
+ setTimeout(() => {
+ const el = document.getElementById(notificationId);
+ if (el) {
+ el.style.animation = 'slideOut 0.3s ease-in forwards';
+ setTimeout(() => el.remove(), 300);
+ }
+ }, 3000);
+}
+
+// ============ INCIDENT MANAGEMENT FUNCTIONS ============
+
+function showIncidentsPanel() {
+ // Hide details and form panels
+ document.getElementById('details-panel').classList.add('hidden');
+ document.getElementById('form-panel').classList.add('hidden');
+ document.getElementById('no-selection').classList.add('hidden');
+
+ // Show incidents panel
+ document.getElementById('incidents-panel').classList.remove('hidden');
+
+ loadIncidentsPanel();
+}
+
+function hideIncidentsPanel() {
+ const incidentsPanel = document.getElementById('incidents-panel');
+ const noSelection = document.getElementById('no-selection');
+ const sidebarTop = document.getElementById('sidebar-top-section');
+
+ incidentsPanel.classList.add('hidden');
+
+ // If a monitor is selected, show details with compact sidebar. Otherwise show no-selection with expanded sidebar
+ if (selectedTargetId) {
+ noSelection.classList.add('hidden');
+ const selectedTarget = allTargets.find(t => t._id === selectedTargetId);
+ if (selectedTarget) {
+ displayMonitorDetail(selectedTarget);
+ sidebarTop.classList.remove('sidebar-top-expanded');
+ sidebarTop.classList.add('sidebar-top-compact');
+ }
+ } else {
+ noSelection.classList.remove('hidden');
+ sidebarTop.classList.remove('sidebar-top-compact');
+ sidebarTop.classList.add('sidebar-top-expanded');
+ }
+}
+
+function loadIncidentsPanel() {
+ loadIncidents();
+}
+
+async function loadIncidents() {
+ try {
+ const res = await axios.get('/admin/api/incidents');
+ const incidents = res.data.incidents || [];
+
+ const list = document.getElementById('incidents-list-panel');
+
+ if (incidents.length === 0) {
+ list.innerHTML = 'No incidents reported
';
+ return;
+ }
+
+ list.innerHTML = incidents.map(incident => {
+ const severityColor = {
+ minor: 'bg-yellow-900 text-yellow-200',
+ major: 'bg-orange-900 text-orange-200',
+ critical: 'bg-red-900 text-red-200'
+ }[incident.severity] || 'bg-slate-700';
+
+ const statusColor = {
+ investigating: 'bg-blue-900 text-blue-200',
+ identified: 'bg-cyan-900 text-cyan-200',
+ monitoring: 'bg-purple-900 text-purple-200',
+ resolved: 'bg-green-900 text-green-200'
+ }[incident.status] || 'bg-slate-700';
+
+ return `
+
+
+
+
${incident.title}
+
${new Date(incident.createdAt).toLocaleString()}
+
+
+
+ ${incident.severity.toUpperCase()}
+
+
+ ${incident.status.toUpperCase()}
+
+
+
+
${incident.description}
+
+
+
+
+
+ `;
+ }).join('');
+ } catch (error) {
+ console.error('Error loading incidents:', error);
+ const list = document.getElementById('incidents-list-panel');
+ if (list) {
+ list.innerHTML = `Error loading incidents
`;
+ }
+ }
+}
+
+function showCreateIncidentModal() {
+ document.getElementById('incident-form').reset();
+ document.getElementById('incident-form-modal').classList.remove('hidden');
+ delete document.getElementById('incident-form').dataset.incidentId;
+}
+
+async function editIncident(incidentId) {
+ try {
+ const res = await axios.get(`/admin/api/incidents/${incidentId}`);
+ const incident = res.data.incident;
+
+ document.getElementById('incident-title').value = incident.title;
+ document.getElementById('incident-description').value = incident.description;
+ document.getElementById('incident-severity').value = incident.severity;
+ document.getElementById('incident-status').value = incident.status;
+
+ document.getElementById('incident-form').dataset.incidentId = incidentId;
+ document.getElementById('incident-form-modal').classList.remove('hidden');
+ } catch (error) {
+ alert('Error loading incident: ' + error.message);
+ }
+}
+
+async function saveIncident(event) {
+ event.preventDefault();
+
+ const title = document.getElementById('incident-title').value;
+ const description = document.getElementById('incident-description').value;
+ const severity = document.getElementById('incident-severity').value;
+ const status = document.getElementById('incident-status').value;
+ const incidentId = document.getElementById('incident-form').dataset.incidentId;
+
+ try {
+ if (incidentId) {
+ // Update existing incident
+ await axios.put(`/admin/api/incidents/${incidentId}`, {
+ title,
+ description,
+ severity,
+ status
+ });
+ showSuccessNotification('Incident updated successfully!');
+ } else {
+ // Create new incident
+ await axios.post('/admin/api/incidents', {
+ title,
+ description,
+ severity,
+ status
+ });
+ showSuccessNotification('Incident reported successfully!');
+ }
+
+ document.getElementById('incident-form-modal').classList.add('hidden');
+ loadIncidents();
+ } catch (error) {
+ alert('Error saving incident: ' + error.message);
+ }
+}
+
+async function deleteIncident(incidentId) {
+ if (!confirm('Are you sure you want to delete this incident?')) return;
+
+ try {
+ await axios.delete(`/admin/api/incidents/${incidentId}`);
+ showSuccessNotification('Incident deleted successfully!');
+ loadIncidents();
+ } catch (error) {
+ alert('Error deleting incident: ' + error.message);
+ }
+}
diff --git a/src/public/js/notifications.js b/src/public/js/notifications.js
new file mode 100644
index 0000000..bbd3bd9
--- /dev/null
+++ b/src/public/js/notifications.js
@@ -0,0 +1,339 @@
+/**
+ * Browser Notification System for LocalPing
+ * Handles desktop and in-app notifications for status changes
+ */
+
+class NotificationManager {
+ constructor() {
+ this.notificationPermission = Notification.permission;
+ this.targetStates = new Map(); // Track previous states and delayed notification state
+ this.inPageNotifications = [];
+ this.maxInPageNotifications = 5;
+
+ // Request notification permission if not already granted
+ if (this.notificationPermission === 'default') {
+ this.requestPermission();
+ }
+
+ // Initialize notification container
+ this.initializeContainer();
+ }
+
+ /**
+ * Request notification permission from user
+ */
+ async requestPermission() {
+ try {
+ const permission = await Notification.requestPermission();
+ this.notificationPermission = permission;
+
+ if (permission === 'granted') {
+ console.log('β Browser notifications enabled');
+ } else if (permission === 'denied') {
+ console.log('β Browser notifications disabled by user');
+ }
+ } catch (err) {
+ console.error('Error requesting notification permission:', err);
+ }
+ }
+
+ /**
+ * Initialize notification container in DOM
+ */
+ initializeContainer() {
+ if (!document.getElementById('notification-container')) {
+ const container = document.createElement('div');
+ container.id = 'notification-container';
+ container.style.cssText = `
+ position: fixed;
+ top: 20px;
+ right: 20px;
+ z-index: 9999;
+ max-width: 400px;
+ pointer-events: none;
+ `;
+ document.body.appendChild(container);
+ }
+ }
+
+ /**
+ * Show browser notification
+ */
+ showBrowserNotification(title, options = {}) {
+ if (this.notificationPermission !== 'granted') {
+ return;
+ }
+
+ try {
+ const notification = new Notification(title, {
+ icon: '/android-icon-192x192.png',
+ badge: '/favicon-32x32.png',
+ ...options,
+ });
+
+ // Auto-close after 5 seconds
+ setTimeout(() => notification.close(), 5000);
+
+ // Handle click
+ notification.onclick = () => {
+ window.focus();
+ notification.close();
+ };
+
+ return notification;
+ } catch (err) {
+ console.error('Error showing browser notification:', err);
+ }
+ }
+
+ /**
+ * Show in-page toast notification
+ */
+ showToastNotification(message, type = 'info', duration = 4000) {
+ const container = document.getElementById('notification-container');
+ if (!container) {
+ this.initializeContainer();
+ return this.showToastNotification(message, type, duration);
+ }
+
+ const notification = document.createElement('div');
+ notification.className = `notification notification-${type}`;
+ notification.innerHTML = message;
+
+ const colors = {
+ success: '#10b981',
+ error: '#ef4444',
+ warning: '#f59e0b',
+ info: '#3b82f6',
+ };
+
+ notification.style.cssText = `
+ background-color: ${colors[type] || colors.info};
+ color: white;
+ padding: 16px;
+ border-radius: 8px;
+ margin-bottom: 10px;
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
+ animation: slideIn 0.3s ease-out;
+ pointer-events: auto;
+ cursor: pointer;
+ `;
+
+ // Add animation
+ if (!document.querySelector('style[data-notification-styles]')) {
+ const style = document.createElement('style');
+ style.setAttribute('data-notification-styles', 'true');
+ style.textContent = `
+ @keyframes slideIn {
+ from {
+ transform: translateX(400px);
+ opacity: 0;
+ }
+ to {
+ transform: translateX(0);
+ opacity: 1;
+ }
+ }
+ @keyframes slideOut {
+ from {
+ transform: translateX(0);
+ opacity: 1;
+ }
+ to {
+ transform: translateX(400px);
+ opacity: 0;
+ }
+ }
+ `;
+ document.head.appendChild(style);
+ }
+
+ container.appendChild(notification);
+
+ // Click to dismiss
+ notification.addEventListener('click', () => {
+ notification.style.animation = 'slideOut 0.3s ease-out';
+ setTimeout(() => notification.remove(), 300);
+ });
+
+ // A zero duration means the toast should remain until the user dismisses
+ // it (used for sustained outage notifications).
+ if (duration > 0) {
+ setTimeout(() => {
+ if (notification.parentElement) {
+ notification.style.animation = 'slideOut 0.3s ease-out';
+ setTimeout(() => notification.remove(), 300);
+ }
+ }, duration);
+ }
+
+ // Track notifications
+ this.inPageNotifications.push(notification);
+ if (this.inPageNotifications.length > this.maxInPageNotifications) {
+ const old = this.inPageNotifications.shift();
+ old.remove();
+ }
+ }
+
+ /**
+ * Update target status and send notifications if changed
+ */
+ updateTargetStatus(targetId, targetName, newStatus, metadata = {}) {
+ const previous = this.targetStates.get(targetId);
+ const previousStatus = previous?.status || previous;
+ const hadDownNotification = previous?.downNotified === true;
+
+ // No change
+ if (previousStatus === newStatus && !(newStatus === 'down' && metadata.notificationEligible && !previous?.downNotified)) {
+ return;
+ }
+
+ // Keep the status immediately visible, but gate monitor toasts/browser
+ // notifications on the server's sustained-outage eligibility signal.
+ const state = typeof previous === 'object' && previous ? previous : { status: previousStatus };
+ state.status = newStatus;
+ if (newStatus === 'up') state.downNotified = false;
+ this.targetStates.set(targetId, state);
+
+ // Only send notifications if transitioning from a known state
+ if (previousStatus === undefined) {
+ return;
+ }
+
+ if (newStatus === 'up' && previousStatus === 'down' && hadDownNotification) {
+ this.notifyTargetUp(targetName);
+ state.downNotified = false;
+ } else if (newStatus === 'down' && metadata.notificationEligible && !state.downNotified) {
+ state.downNotified = true;
+ this.notifyTargetDown(targetName);
+ }
+ }
+
+ /**
+ * Notify when target comes online
+ */
+ notifyTargetUp(targetName) {
+ const message = `β ${targetName} is back online`;
+
+ // Browser notification
+ this.showBrowserNotification('Target Online', {
+ body: message,
+ tag: `target-${targetName}`,
+ requireInteraction: false,
+ });
+
+ // In-page notification
+ this.showToastNotification(message, 'success');
+ }
+
+ /**
+ * Notify when target goes offline
+ */
+ notifyTargetDown(targetName) {
+ const message = `β ${targetName} is offline`;
+
+ // Browser notification
+ this.showBrowserNotification('Target Offline', {
+ body: message,
+ tag: `target-${targetName}`,
+ requireInteraction: true,
+ });
+
+ // In-page notification
+ this.showToastNotification(message, 'error', 0); // Don't auto-dismiss for errors
+ }
+
+ /**
+ * Get notification preference from localStorage
+ */
+ getPreference(key, defaultValue = true) {
+ const stored = localStorage.getItem(`notification-${key}`);
+ return stored !== null ? stored === 'true' : defaultValue;
+ }
+
+ /**
+ * Set notification preference
+ */
+ setPreference(key, value) {
+ localStorage.setItem(`notification-${key}`, value ? 'true' : 'false');
+ }
+
+ /**
+ * Check if notifications are enabled
+ */
+ isEnabled() {
+ return this.getPreference('enabled', true) && this.notificationPermission === 'granted';
+ }
+
+ /**
+ * Toggle notifications
+ */
+ async toggleNotifications(enabled) {
+ this.setPreference('enabled', enabled);
+ if (enabled && this.notificationPermission === 'default') {
+ await this.requestPermission();
+ }
+ return this.isEnabled();
+ }
+
+ /**
+ * Notify about new incident
+ */
+ notifyIncident(incident) {
+ if (!this.isEnabled()) return;
+
+ const severityEmojis = {
+ 'minor': 'β οΈ',
+ 'major': 'πΆ',
+ 'critical': 'π΄'
+ };
+
+ const emoji = severityEmojis[incident.severity] || 'π’';
+ const message = `${emoji} ${incident.title}`;
+
+ // Browser notification
+ this.showBrowserNotification('New Incident', {
+ body: `${incident.severity.toUpperCase()}: ${incident.description}`,
+ tag: `incident-${incident._id}`,
+ requireInteraction: incident.severity === 'critical',
+ });
+
+ // In-page notification
+ this.showToastNotification(message, incident.severity === 'critical' ? 'error' : incident.severity === 'major' ? 'warning' : 'info', incident.severity === 'critical' ? 0 : 5000);
+ }
+
+ /**
+ * Notify about incident update
+ */
+ notifyIncidentUpdate(incident) {
+ if (!this.isEnabled()) return;
+
+ const statusMessages = {
+ 'investigating': 'π Investigating',
+ 'identified': 'β οΈ Issue Identified',
+ 'monitoring': 'ποΈ Monitoring',
+ 'resolved': 'β
Resolved'
+ };
+
+ const message = `${statusMessages[incident.status] || 'π’'} ${incident.title}`;
+
+ // Browser notification
+ this.showBrowserNotification('Incident Update', {
+ body: `${incident.status.toUpperCase()}: ${incident.description}`,
+ tag: `incident-update-${incident._id}`,
+ requireInteraction: false,
+ });
+
+ // In-page notification
+ const type = incident.status === 'resolved' ? 'success' : 'info';
+ this.showToastNotification(message, type);
+ }
+}
+
+// Initialize and export
+const notificationManager = new NotificationManager();
+
+// Make available globally
+if (typeof window !== 'undefined') {
+ window.notificationManager = notificationManager;
+}
diff --git a/src/public/js/public.js b/src/public/js/public.js
new file mode 100644
index 0000000..b2dcb89
--- /dev/null
+++ b/src/public/js/public.js
@@ -0,0 +1,2271 @@
+let allTargets = [];
+let expandedServiceId = null;
+let charts = {};
+let chartPeriods = {}; // Track current period for each chart
+let targetUptimeCache = {};
+let faviconCache = {}; // Cache for favicons in localStorage
+let previousIncidents = new Map(); // Track previous incidents for change detection
+let statisticsCache = null; // Cache for statistics data
+let statisticsCacheTime = null; // Timestamp of when cache was created
+let viewerIsAdmin = false;
+let dataLoadInFlight = null;
+let blogLoadInFlight = null;
+let blogLoadedAt = 0;
+let lastAppsStructureKey = null;
+let lastDeepLinkedMonitorId = null;
+const PUBLIC_DATA_CACHE_DURATION = 60 * 60 * 1000;
+const STATISTICS_CACHE_DURATION = PUBLIC_DATA_CACHE_DURATION;
+const GRAPH_CACHE_STORAGE_KEY = 'localping:graph-cache:v1';
+const GRAPH_CACHE_DURATION = PUBLIC_DATA_CACHE_DURATION;
+const BLOG_CACHE_DURATION = 60 * 1000;
+let graphDataCache = {};
+let graphRefreshes = new Map();
+
+// Extend each outage to the edges of its bucket so the red fill reads as one
+// connected interval between the surrounding response-time segments.
+function buildDowntimeSeries(stats, maxValue) {
+ const downBuckets = stats.map(stat => Number(stat.successfulPings || 0) === 0);
+ return downBuckets.map((isDown, index) => (
+ isDown || downBuckets[index - 1] || downBuckets[index + 1] ? maxValue : null
+ ));
+}
+
+// Keep the graph visually minimal while retaining useful hover details. The
+// downtime series has bridge points around outages for a continuous fill;
+// those points are filtered out of the tooltip via the chart status map.
+function buildGraphTooltipOptions() {
+ return {
+ enabled: true,
+ mode: 'index',
+ intersect: false,
+ displayColors: false,
+ backgroundColor: 'rgba(15, 23, 42, 0.96)',
+ titleColor: '#f8fafc',
+ bodyColor: '#e2e8f0',
+ borderColor: 'rgba(148, 163, 184, 0.25)',
+ borderWidth: 1,
+ callbacks: {
+ title: tooltipItems => tooltipItems[0]?.label || '',
+ label: context => {
+ if (context.datasetIndex === 1) return 'π΄ Service Down';
+ const responseTime = Number(context.raw);
+ return Number.isFinite(responseTime) ? `${Math.round(responseTime)} ms` : '';
+ },
+ },
+ filter: context => {
+ if (context.datasetIndex === 0) {
+ return context.raw !== null && context.raw !== undefined;
+ }
+ const downtimeAtIndex = context.chart?._downtimeAtIndex || [];
+ return Boolean(downtimeAtIndex[context.dataIndex])
+ && context.raw !== null
+ && context.raw !== undefined;
+ },
+ };
+}
+
+// Values returned by the API are user-configurable. Keep generated markup
+// safe and resilient when a monitor name contains quotes or HTML characters.
+function escapeHtml(value) {
+ return String(value ?? '').replace(/[&<>"']/g, (character) => ({
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ }[character]));
+}
+
+function escapeInlineArgument(value) {
+ return escapeHtml(JSON.stringify(String(value ?? '')));
+}
+
+function serviceIconKey(target) {
+ return [target.appIcon || '', target.appUrl || '', target.favicon || '', target.name || ''].join('|');
+}
+
+const MINI_GRAPH_WIDTH = 240;
+const MINI_GRAPH_HEIGHT = 44;
+
+function miniGraphStats(target) {
+ if (Array.isArray(target?.miniStats)) return target.miniStats;
+ const cached = graphDataCache[graphCacheKey(target?._id, '24h')];
+ return Array.isArray(cached?.statistics) ? cached.statistics : [];
+}
+
+function miniGraphDataKey(target) {
+ return miniGraphStats(target).map(stat => [
+ stat.date || '',
+ Number(stat.totalPings) || 0,
+ Number(stat.successfulPings) || 0,
+ Number(stat.avgResponseTime) || 0,
+ ].join(':')).join('|');
+}
+
+function miniGraphPointState(stat) {
+ const totalPings = Number(stat.totalPings) || 0;
+ const successfulPings = Number(stat.successfulPings) || 0;
+ const hasPings = totalPings > 0;
+ const isDown = hasPings && successfulPings === 0;
+ const responseTime = hasPings && successfulPings > 0 && Number(stat.avgResponseTime) > 0
+ ? Number(stat.avgResponseTime)
+ : null;
+ return { isDown, responseTime };
+}
+
+function buildMiniGraphContent(target) {
+ const insetX = 2;
+ const topY = 3;
+ const bottomY = MINI_GRAPH_HEIGHT - 3;
+ const stats = miniGraphStats(target)
+ .filter(stat => stat && stat.date)
+ .map(stat => ({
+ ...stat,
+ dateObj: new Date(stat.date),
+ ...miniGraphPointState(stat),
+ }))
+ .sort((a, b) => a.dateObj.getTime() - b.dateObj.getTime());
+ const pointCount = stats.length;
+ const xForIndex = index => pointCount <= 1
+ ? MINI_GRAPH_WIDTH / 2
+ : insetX + (index / (pointCount - 1)) * (MINI_GRAPH_WIDTH - insetX * 2);
+
+ const values = stats
+ .map(stat => stat.responseTime)
+ .filter(value => Number.isFinite(value) && value > 0);
+ const minValue = values.length > 0 ? Math.min(...values) : 0;
+ const maxValue = values.length > 0 ? Math.max(...values) : 1;
+ const range = Math.max(maxValue - minValue, 1);
+ const domainMin = Math.max(0, minValue - range * 0.15);
+ const domainMax = maxValue + range * 0.15;
+ const yForValue = value => bottomY - ((value - domainMin) / Math.max(domainMax - domainMin, 1)) * (bottomY - topY);
+
+ const downAreas = [];
+ let downStart = null;
+ const flushDownArea = endIndex => {
+ if (downStart === null || pointCount === 0) return;
+ const startX = downStart === 0
+ ? insetX
+ : (xForIndex(downStart - 1) + xForIndex(downStart)) / 2;
+ const endX = endIndex === pointCount - 1
+ ? MINI_GRAPH_WIDTH - insetX
+ : (xForIndex(endIndex) + xForIndex(endIndex + 1)) / 2;
+ downAreas.push(``);
+ downStart = null;
+ };
+
+ stats.forEach((stat, index) => {
+ if (stat.isDown && downStart === null) downStart = index;
+ if ((!stat.isDown || index === pointCount - 1) && downStart !== null) {
+ flushDownArea(stat.isDown && index === pointCount - 1 ? index : index - 1);
+ }
+ });
+
+ const responsePaths = [];
+ let responseSegment = [];
+ const flushResponseSegment = () => {
+ if (responseSegment.length === 0) return;
+ if (responseSegment.length === 1) {
+ const point = responseSegment[0];
+ const startX = Math.max(insetX, point.x - 2);
+ const endX = Math.min(MINI_GRAPH_WIDTH - insetX, point.x + 2);
+ responsePaths.push(`M ${startX.toFixed(2)} ${point.y.toFixed(2)} L ${endX.toFixed(2)} ${point.y.toFixed(2)}`);
+ } else {
+ responsePaths.push(responseSegment
+ .map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.x.toFixed(2)} ${point.y.toFixed(2)}`)
+ .join(' '));
+ }
+ responseSegment = [];
+ };
+
+ stats.forEach((stat, index) => {
+ if (stat.responseTime === null || stat.isDown) {
+ flushResponseSegment();
+ return;
+ }
+ responseSegment.push({
+ x: xForIndex(index),
+ y: yForValue(stat.responseTime),
+ });
+ });
+ flushResponseSegment();
+
+ const svg = `
+
+ ${target.currentStatus === 'down' ? 'Down' : ''}
+ `;
+ return svg;
+}
+
+function buildMiniGraphMarkup(target) {
+ return `${buildMiniGraphContent(target)}
`;
+}
+
+function buildIconImage(source, name, className, errorHandler) {
+ return `
`;
+}
+
+viewerIsAdmin = document.body?.dataset.viewerAdmin === 'true';
+
+try {
+ const storedGraphCache = JSON.parse(localStorage.getItem(GRAPH_CACHE_STORAGE_KEY) || '{}');
+ graphDataCache = storedGraphCache && typeof storedGraphCache === 'object' && !Array.isArray(storedGraphCache)
+ ? storedGraphCache
+ : {};
+} catch (error) {
+ graphDataCache = {};
+}
+
+try {
+ const cachedSummary = JSON.parse(sessionStorage.getItem('localping:summary-cache:v2') || 'null');
+ if (cachedSummary?.data?.targets && cachedSummary.cachedAt && cachedSummary.viewerIsAdmin === viewerIsAdmin) {
+ statisticsCache = cachedSummary.data;
+ statisticsCacheTime = cachedSummary.cachedAt;
+ if (typeof cachedSummary.data.viewer?.isAdmin === 'boolean') {
+ viewerIsAdmin = cachedSummary.data.viewer.isAdmin;
+ }
+ }
+} catch (error) {
+ // Session storage is optional.
+}
+
+// Load previous incidents from localStorage on page load
+function loadPreviousIncidents() {
+ try {
+ const stored = localStorage.getItem('previousIncidents');
+ if (stored) {
+ const data = JSON.parse(stored);
+ previousIncidents = new Map(Object.entries(data));
+ }
+ } catch (error) {
+ console.error('Error loading previous incidents from localStorage:', error);
+ previousIncidents = new Map();
+ }
+}
+
+// Save previous incidents to localStorage
+function savePreviousIncidents() {
+ try {
+ const data = Object.fromEntries(previousIncidents);
+ localStorage.setItem('previousIncidents', JSON.stringify(data));
+ } catch (error) {
+ console.error('Error saving previous incidents to localStorage:', error);
+ }
+}
+
+// Initialize previous incidents from localStorage
+loadPreviousIncidents();
+
+// Paint the last known summary before the first network round-trip. This is
+// deliberately best-effort; live status replaces it as soon as the API responds.
+if (statisticsCache?.targets) {
+ allTargets = statisticsCache.targets;
+ displayApps(allTargets);
+ updateServicesList(allTargets);
+ if (statisticsCache.status) updateHeaderStatus(statisticsCache.status);
+}
+
+// Load immediately from the URL-selected view and refresh at a modest cadence
+// so the browser is responsive even with many monitors.
+loadData();
+setInterval(loadData, 30000);
+
+function persistGraphCache() {
+ try {
+ const entries = Object.entries(graphDataCache).slice(-120);
+ graphDataCache = Object.fromEntries(entries);
+ localStorage.setItem(GRAPH_CACHE_STORAGE_KEY, JSON.stringify(graphDataCache));
+ } catch (error) {
+ // Storage can be disabled or full; the in-memory cache still works.
+ }
+}
+
+function graphCacheKey(targetId, period) {
+ return `${targetId}:${period}`;
+}
+
+async function refreshGraphData(targetId, period) {
+ const key = graphCacheKey(targetId, period);
+ if (graphRefreshes.has(key)) return graphRefreshes.get(key);
+ const request = axios.get(`/api/targets/${encodeURIComponent(targetId)}/statistics?period=${encodeURIComponent(period)}`)
+ .then((response) => {
+ const entry = { statistics: response.data.statistics || [], updatedAt: Date.now() };
+ graphDataCache[key] = entry;
+ persistGraphCache();
+ return entry.statistics;
+ })
+ .finally(() => graphRefreshes.delete(key));
+ graphRefreshes.set(key, request);
+ return request;
+}
+
+async function getGraphData(targetId, period) {
+ const cached = graphDataCache[graphCacheKey(targetId, period)];
+ if (cached && Array.isArray(cached.statistics)) {
+ // Stale-while-refresh: paint the cached chart now and refresh it in the
+ // background if it is older than the short freshness window.
+ if (Date.now() - (cached.updatedAt || 0) > GRAPH_CACHE_DURATION) {
+ refreshGraphData(targetId, period)
+ .then(() => {
+ // Keep an already-open chart current without making the user wait
+ // for the background refresh to complete.
+ if (charts[targetId] && chartPeriods[targetId] === period) {
+ return updateChartData(targetId, period);
+ }
+ return undefined;
+ })
+ .catch(() => {});
+ }
+ return cached.statistics;
+ }
+ return refreshGraphData(targetId, period);
+}
+
+async function loadBlogPosts() {
+ if (blogLoadInFlight) return blogLoadInFlight;
+ if (blogLoadedAt && Date.now() - blogLoadedAt < BLOG_CACHE_DURATION) return;
+
+ blogLoadInFlight = (async () => {
+ try {
+ const response = await axios.get('/api/posts');
+ const posts = response.data.posts || [];
+ blogLoadedAt = Date.now();
+
+ const blogContainer = document.getElementById('blog-posts');
+ if (!blogContainer) return;
+
+ if (posts.length === 0) {
+ blogContainer.innerHTML = 'No posts yet. Check back soon!
';
+ return;
+ }
+
+ // Configure marked.js if available
+ if (typeof marked !== 'undefined') {
+ marked.setOptions({
+ breaks: true,
+ gfm: true,
+ });
+ }
+
+ blogContainer.innerHTML = posts.map(post => {
+ const date = new Date(post.createdAt);
+ const formattedDate = date.toLocaleDateString(undefined, {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+
+ // Render markdown if available, otherwise fallback to simple conversion
+ let contentHtml;
+ if (typeof marked !== 'undefined') {
+ contentHtml = marked.parse(post.content);
+ } else {
+ // Fallback: simple line break conversion
+ contentHtml = post.content
+ .replace(/\n\n/g, '')
+ .replace(/\n/g, '
');
+ contentHtml = `
${contentHtml}
`;
+ }
+
+ return `
+
+
+
${post.title}
+ ${formattedDate}
+
+
+ ${contentHtml}
+
+
+ `;
+ }).join('');
+ } catch (error) {
+ console.error('Error loading blog posts:', error);
+ const blogContainer = document.getElementById('blog-posts');
+ if (blogContainer) {
+ blogContainer.innerHTML = 'Error loading posts
';
+ }
+ }
+ })().finally(() => {
+ blogLoadInFlight = null;
+ });
+ return blogLoadInFlight;
+}
+
+async function loadData() {
+ if (dataLoadInFlight) return dataLoadInFlight;
+ dataLoadInFlight = (async () => {
+ try {
+ const now = Date.now();
+ const hasMiniGraphData = Array.isArray(statisticsCache?.targets)
+ && statisticsCache.targets.every(target => Array.isArray(target.miniStats));
+ const shouldRefreshStats = !statisticsCache || !statisticsCacheTime || (now - statisticsCacheTime) > STATISTICS_CACHE_DURATION || !hasMiniGraphData;
+
+ // Load incidents (always fresh)
+ const incidentsPromise = axios.get('/api/incidents');
+
+ // Load targets and statistics (use cache if available and not expired)
+ let statusRes;
+ if (shouldRefreshStats) {
+ // Use consolidated endpoint for fresh data
+ statusRes = await axios.get('/api/public/all');
+ statisticsCache = statusRes.data;
+ statisticsCacheTime = now;
+ if (typeof statusRes.data.viewer?.isAdmin === 'boolean') {
+ viewerIsAdmin = statusRes.data.viewer.isAdmin;
+ }
+ try { sessionStorage.setItem('localping:summary-cache:v2', JSON.stringify({ data: statisticsCache, cachedAt: now, viewerIsAdmin })); } catch (error) { /* optional */ }
+ } else {
+ // Use cached statistics but get fresh status
+ if (statisticsCache) {
+ // Get fresh status only
+ const statusOnlyRes = await axios.get('/api/status');
+ if (typeof statusOnlyRes.data.viewer?.isAdmin === 'boolean') {
+ viewerIsAdmin = statusOnlyRes.data.viewer.isAdmin;
+ }
+ const cachedTargets = Array.isArray(statisticsCache.targets) ? statisticsCache.targets : [];
+ const freshTargets = Array.isArray(statusOnlyRes.data.targets) ? statusOnlyRes.data.targets : [];
+ const cachedTargetIds = new Set(cachedTargets.map(target => String(target._id)));
+ const freshTargetIds = new Set(freshTargets.map(target => String(target._id)));
+ const targetSetChanged = cachedTargetIds.size !== freshTargetIds.size
+ || [...freshTargetIds].some(targetId => !cachedTargetIds.has(targetId));
+
+ if (targetSetChanged) {
+ // A monitor was added or removed while the summary cache was warm.
+ // Refresh the consolidated payload so newly added rows get their
+ // mini graph immediately instead of waiting for the cache timeout.
+ statusRes = await axios.get('/api/public/all');
+ statisticsCache = statusRes.data;
+ statisticsCacheTime = now;
+ try { sessionStorage.setItem('localping:summary-cache:v2', JSON.stringify({ data: statisticsCache, cachedAt: now, viewerIsAdmin })); } catch (error) { /* optional */ }
+ } else {
+ // Merge fresh status with cached statistics
+ statusRes = {
+ data: {
+ status: statusOnlyRes.data.status,
+ targets: freshTargets.map(freshTarget => {
+ const cachedTarget = cachedTargets.find(t => t._id === freshTarget._id);
+ if (cachedTarget) {
+ // Merge fresh status with cached statistics
+ return {
+ ...cachedTarget,
+ ...freshTarget,
+ // The status endpoint intentionally omits expensive
+ // aggregates; keep those fields from the summary cache.
+ uptime: cachedTarget.uptime,
+ miniStats: cachedTarget.miniStats,
+ currentStatus: freshTarget.currentStatus,
+ isUp: freshTarget.isUp,
+ isDown: freshTarget.isDown,
+ notification: freshTarget.notification,
+ };
+ }
+ return { ...freshTarget };
+ }),
+ },
+ };
+ }
+ } else {
+ // No cache, fetch everything
+ statusRes = await axios.get('/api/public/all');
+ statisticsCache = statusRes.data;
+ statisticsCacheTime = now;
+ try { sessionStorage.setItem('localping:summary-cache:v2', JSON.stringify({ data: statisticsCache, cachedAt: now, viewerIsAdmin })); } catch (error) { /* optional */ }
+ }
+ }
+
+ const incidentsRes = await incidentsPromise;
+ const { status, targets } = statusRes.data;
+ const { incidents = [] } = incidentsRes.data || {};
+
+ if (typeof statusRes.data.viewer?.isAdmin === 'boolean') {
+ viewerIsAdmin = statusRes.data.viewer.isAdmin;
+ }
+
+ // Check for status changes and send notifications. The server only marks
+ // a monitor eligible after the configured sustained-outage delay.
+ if (window.notificationManager && window.notificationManager.isEnabled()) {
+ targets.forEach((target) => {
+ const status = target.currentStatus || (target.isUp ? 'up' : 'down');
+ window.notificationManager.updateTargetStatus(target._id, target.name, status, target.notification || {});
+ });
+ }
+
+ allTargets = targets;
+
+ // Update header status
+ updateHeaderStatus(status);
+
+ // Check for new/updated incidents and send notifications
+ if (window.notificationManager && window.notificationManager.isEnabled()) {
+ incidents.forEach((incident) => {
+ const prevIncident = previousIncidents.get(incident._id);
+
+ if (!prevIncident) {
+ // New incident
+ window.notificationManager.notifyIncident(incident);
+ } else if (prevIncident.status !== incident.status) {
+ // Status changed
+ window.notificationManager.notifyIncidentUpdate(incident);
+ }
+
+ // Update stored incident
+ previousIncidents.set(incident._id, { ...incident });
+ });
+
+ // Save to localStorage after processing all incidents
+ savePreviousIncidents();
+ }
+
+ // Display incidents
+ displayIncidents(incidents);
+ displayIncidentHistory(incidents);
+ displayHomeIncidents(incidents);
+
+ // Update both pages
+ displayApps(targets);
+ updateServicesList(targets);
+ if (pageFromLocation() === 'status') openDeepLinkedMonitor();
+ } catch (error) {
+ console.error('Error loading data:', error);
+ }
+ })().finally(() => {
+ dataLoadInFlight = null;
+ });
+ return dataLoadInFlight;
+}
+
+function updateHeaderStatus(status) {
+ const statusEl = document.getElementById('status-text');
+ const statusIndicator = document.getElementById('status-indicator');
+ const statusMessage = document.getElementById('overall-status-message');
+ const timeEl = document.getElementById('status-time');
+
+ let statusText = '';
+ let statusClass = '';
+ let message = '';
+
+ if (status.overallStatus === 'operational') {
+ statusText = 'β All Systems Operational';
+ statusClass = 'operational';
+ message = 'All systems are operational. No incidents reported.';
+ } else if (status.overallStatus === 'degraded') {
+ statusText = 'β Degraded Performance';
+ statusClass = 'degraded';
+ message = `${status.downTargets} system(s) experiencing issues.`;
+ } else {
+ statusText = 'β System Down';
+ statusClass = 'down';
+ message = `${status.downTargets} system(s) down.`;
+ }
+
+ statusEl.textContent = statusText;
+ statusEl.className = `text-lg font-semibold ${
+ statusClass === 'operational' ? 'text-green-400' :
+ statusClass === 'degraded' ? 'text-yellow-400' :
+ 'text-red-400'
+ }`;
+
+ statusIndicator.className = `status-indicator ${statusClass}`;
+ statusMessage.textContent = message;
+ timeEl.textContent = `Last updated: ${new Date().toLocaleTimeString()}`;
+}
+
+// Format date for scheduled maintenance display
+function formatScheduledTime(dateString) {
+ if (!dateString) return '';
+ const date = new Date(dateString);
+ return date.toLocaleString([], {
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
+ hour12: true
+ });
+}
+
+// Display active incidents on home page - Mobile Optimized
+function displayHomeIncidents(incidents) {
+ const homeIncidentsContainer = document.getElementById('home-incidents');
+ if (!homeIncidentsContainer) return;
+
+ // Filter for active incidents (investigating, identified, monitoring, scheduled)
+ const activeIncidents = incidents.filter(i => i.status !== 'resolved');
+
+ if (activeIncidents.length === 0) {
+ homeIncidentsContainer.innerHTML = '';
+ return;
+ }
+
+ const statusIcons = {
+ 'investigating': 'π',
+ 'identified': 'β οΈ',
+ 'monitoring': 'ποΈ',
+ 'scheduled': 'π
'
+ };
+
+ const statusLabels = {
+ 'investigating': 'Investigating',
+ 'identified': 'Identified',
+ 'monitoring': 'Monitoring',
+ 'scheduled': 'Scheduled'
+ };
+
+ homeIncidentsContainer.innerHTML = `
+
+
+
Ongoing Incidents
+ ${activeIncidents.length}
+
+ ${activeIncidents.map(incident => {
+ const severityClass = incident.severity || 'minor';
+ const statusIcon = statusIcons[incident.status] || 'β οΈ';
+ const statusLabel = statusLabels[incident.status] || incident.status;
+
+ const statusBadgeColors = {
+ 'investigating': 'bg-blue-500/20 text-blue-300',
+ 'identified': 'bg-yellow-500/20 text-yellow-300',
+ 'monitoring': 'bg-orange-500/20 text-orange-300',
+ 'scheduled': 'bg-purple-500/20 text-purple-300'
+ };
+
+ const severityBadgeColors = {
+ 'critical': 'bg-red-500/20 text-red-300',
+ 'major': 'bg-orange-500/20 text-orange-300',
+ 'minor': 'bg-yellow-500/20 text-yellow-300'
+ };
+
+ const isScheduled = incident.isScheduled && (incident.scheduledStart || incident.scheduledEnd);
+ let scheduledTimeHtml = '';
+
+ if (isScheduled) {
+ if (incident.scheduledStart && incident.scheduledEnd) {
+ scheduledTimeHtml = `
+
+
+
+ ${formatScheduledTime(incident.scheduledStart)} - ${formatScheduledTime(incident.scheduledEnd)}
+
+
+ `;
+ } else if (incident.scheduledStart) {
+ scheduledTimeHtml = `
+
+
+
+ Starts: ${formatScheduledTime(incident.scheduledStart)}
+
+
+ `;
+ }
+ }
+
+ const timeAgo = getTimeAgo(new Date(incident.createdAt));
+
+ return `
+
+
+
${incident.description}
+ ${scheduledTimeHtml}
+
+
+ ${severityClass.toUpperCase()}
+
+ β’
+ ${timeAgo}
+
+
+ `;
+ }).join('')}
+
+ `;
+}
+
+// Helper function to get time ago
+function getTimeAgo(date) {
+ const now = new Date();
+ const diffMs = now - date;
+ const diffMins = Math.floor(diffMs / 60000);
+ const diffHours = Math.floor(diffMs / 3600000);
+ const diffDays = Math.floor(diffMs / 86400000);
+
+ if (diffMins < 1) return 'Just now';
+ if (diffMins < 60) return `${diffMins}m ago`;
+ if (diffHours < 24) return `${diffHours}h ago`;
+ if (diffDays < 7) return `${diffDays}d ago`;
+ return date.toLocaleDateString();
+}
+
+// Display active incidents at the top of status page
+function displayIncidents(incidents) {
+ const incidentsContainer = document.getElementById('incidents-container');
+ if (!incidentsContainer) return;
+
+ // Filter for active incidents (investigating, identified, monitoring, scheduled)
+ const activeIncidents = incidents.filter(i => i.status !== 'resolved');
+
+ if (activeIncidents.length === 0) {
+ incidentsContainer.innerHTML = '';
+ incidentsContainer.style.display = 'none';
+ return;
+ }
+
+ incidentsContainer.style.display = 'block';
+
+ incidentsContainer.innerHTML = `
+
+
Active Incidents
+ ${activeIncidents.map(incident => {
+ const severityColors = {
+ 'minor': 'bg-yellow-900/30 border-yellow-700 text-yellow-300',
+ 'major': 'bg-orange-900/30 border-orange-700 text-orange-300',
+ 'critical': 'bg-red-900/30 border-red-700 text-red-300'
+ };
+
+ const statusColors = {
+ 'investigating': 'bg-blue-900/30 text-blue-300',
+ 'identified': 'bg-yellow-900/30 text-yellow-300',
+ 'monitoring': 'bg-orange-900/30 text-orange-300',
+ 'scheduled': 'bg-purple-900/30 text-purple-300'
+ };
+
+ const isScheduled = incident.isScheduled && (incident.scheduledStart || incident.scheduledEnd);
+ let scheduledTimeHtml = '';
+
+ if (isScheduled) {
+ if (incident.scheduledStart && incident.scheduledEnd) {
+ scheduledTimeHtml = `
+
+
+
+ Scheduled: ${formatScheduledTime(incident.scheduledStart)} - ${formatScheduledTime(incident.scheduledEnd)}
+
+
+ `;
+ } else if (incident.scheduledStart) {
+ scheduledTimeHtml = `
+
+
+
+ Starts: ${formatScheduledTime(incident.scheduledStart)}
+
+
+ `;
+ }
+ }
+
+ return `
+
+
+
${incident.title}
+ ${incident.status.toUpperCase()}
+
+
${incident.description}
+ ${scheduledTimeHtml}
+
Reported: ${new Date(incident.createdAt).toLocaleString()}
+
+ `;
+ }).join('')}
+
+ `;
+}
+
+// Display incident history (all incidents)
+function displayIncidentHistory(incidents) {
+ const historyContainer = document.getElementById('incident-history');
+ if (!historyContainer) return;
+
+ // Sort by creation date (newest first)
+ const sortedIncidents = [...incidents].sort((a, b) =>
+ new Date(b.createdAt) - new Date(a.createdAt)
+ );
+
+ if (sortedIncidents.length === 0) {
+ historyContainer.innerHTML = 'No incidents have been reported
';
+ return;
+ }
+
+ historyContainer.innerHTML = `
+
+ ${sortedIncidents.map(incident => {
+ const severityColors = {
+ 'minor': 'bg-yellow-900/20 border-yellow-700',
+ 'major': 'bg-orange-900/20 border-orange-700',
+ 'critical': 'bg-red-900/20 border-red-700'
+ };
+
+ const statusIcons = {
+ 'investigating': 'π',
+ 'identified': 'β οΈ',
+ 'monitoring': 'ποΈ',
+ 'resolved': 'β
',
+ 'scheduled': 'π
'
+ };
+
+ const isResolved = incident.status === 'resolved';
+ const isScheduled = incident.isScheduled && (incident.scheduledStart || incident.scheduledEnd);
+ let scheduledTimeHtml = '';
+
+ if (isScheduled) {
+ if (incident.scheduledStart && incident.scheduledEnd) {
+ scheduledTimeHtml = `
+
+
+ Scheduled: ${formatScheduledTime(incident.scheduledStart)} - ${formatScheduledTime(incident.scheduledEnd)}
+
+ `;
+ } else if (incident.scheduledStart) {
+ scheduledTimeHtml = `
+
+
+ Starts: ${formatScheduledTime(incident.scheduledStart)}
+
+ `;
+ }
+ }
+
+ return `
+
+
+
+ ${statusIcons[incident.status] || 'β’'}
+
${incident.title}
+
+
+ ${incident.severity.toUpperCase()}
+ ${incident.status.toUpperCase()}
+
+
+
${incident.description}
+ ${scheduledTimeHtml}
+
Reported: ${new Date(incident.createdAt).toLocaleString()}
+
+ `;
+ }).join('')}
+
+ `;
+}
+
+// Page switching
+function switchPage(page, options = {}) {
+ const pageAliases = { home: '/', status: '/uptime', blog: '/blog' };
+ const normalizedPage = page === 'uptime' ? 'status' : page;
+ const pageEl = document.getElementById(`page-${normalizedPage}`);
+ const tabEl = document.getElementById(`tab-${normalizedPage}`);
+ if (!pageEl || !tabEl) return;
+
+ // Hide all pages
+ document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
+ document.querySelectorAll('.nav-tab').forEach(t => t.classList.remove('active'));
+
+ // Show selected page
+ pageEl.classList.add('active');
+ tabEl.classList.add('active');
+
+ if (window.history && window.history.pushState && options.pushState !== false && pageAliases[normalizedPage] && location.pathname !== pageAliases[normalizedPage]) {
+ const hash = normalizedPage === 'status' ? (location.hash || '') : '';
+ window.history.pushState({ page: normalizedPage }, '', pageAliases[normalizedPage] + hash);
+ }
+
+ const pageTitles = { home: 'Apps', status: 'Uptime', blog: 'Blog' };
+ document.title = `${pageTitles[normalizedPage] || 'Status'} Β· LocalPing`;
+
+ // Load blog posts if switching to blog page
+ if (normalizedPage === 'blog') {
+ loadBlogPosts();
+ }
+
+ if (normalizedPage === 'status') {
+ openDeepLinkedMonitor();
+ }
+}
+
+function pageFromLocation() {
+ const pathname = (location.pathname || '/').replace(/\/+$/, '') || '/';
+ if (pathname === '/uptime') return 'status';
+ if (pathname === '/blog') return 'blog';
+ return 'home';
+}
+
+window.addEventListener('popstate', () => switchPage(pageFromLocation(), { pushState: false }));
+window.addEventListener('hashchange', () => {
+ const page = pageFromLocation();
+ switchPage(page, { pushState: false });
+ if (page === 'status') openDeepLinkedMonitor();
+});
+
+function openDeepLinkedMonitor() {
+ const monitorId = new URLSearchParams((location.hash || '').replace(/^#/, '')).get('monitor');
+ if (!monitorId) {
+ lastDeepLinkedMonitorId = null;
+ return;
+ }
+ const serviceEl = document.getElementById(`service-${monitorId}`);
+ if (!serviceEl) return;
+ const needsOpen = expandedServiceId !== monitorId;
+ if (needsOpen) toggleServiceExpand(monitorId, { preserveHash: true });
+ if (!needsOpen && lastDeepLinkedMonitorId === monitorId) return;
+ lastDeepLinkedMonitorId = monitorId;
+ requestAnimationFrame(() => {
+ serviceEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ });
+}
+
+// ==================== APPS PAGE ====================
+
+function displayApps(targets) {
+ const pageHome = document.getElementById('apps-content') || document.getElementById('page-home');
+
+ const appTargets = targets.filter(t => t.enabled !== false && t.publicVisible !== false);
+ const structureKey = appTargets.map(t => `${t._id}:${t.name}:${t.appUrl || ''}:${t.appIcon || ''}:${t.position || 0}:${t.group || ''}:${t.publicShowAppLink !== false}:${JSON.stringify(t.quickCommands || [])}`).join('|');
+ if (lastAppsStructureKey === structureKey) {
+ updateAppCardStatuses(appTargets);
+ return;
+ }
+ lastAppsStructureKey = structureKey;
+
+ // Check if there are ANY targets at all
+ if (appTargets.length === 0) {
+ pageHome.innerHTML = `
+
+
Welcome to LocalPing
+
Get started by adding monitors
+
+
+
+
+
No Monitors Yet
+
+ Start monitoring your homelab services and apps. Add monitors to track the status, uptime, and performance of your infrastructure.
+
+
+
+ Step 1: Go to the admin panel
+
+
+
+ Open Admin Panel
+
+
+
+ You'll be able to add monitors and configure their settings there.
+
+
+
+
+ `;
+ return;
+ }
+
+ // Separate targets into apps and services
+ // Only show apps if publicShowAppLink is true (default true)
+ const apps = appTargets.filter(t => (t.appUrl || t.appIcon) && (t.publicShowAppLink !== false));
+ const appCount = apps.length;
+
+ if (appCount === 0) {
+ pageHome.innerHTML = `
+
+
+
No apps configured with icons. You have ${appTargets.length} monitor${appTargets.length !== 1 ? 's' : ''} on the Uptime tab.
+
+ `;
+ return;
+ }
+
+ // Sort apps by position, then by name
+ const sortedApps = [...apps].sort((a, b) => {
+ const posA = a.position || 0;
+ const posB = b.position || 0;
+ if (posA !== posB) return posA - posB;
+ return a.name.localeCompare(b.name);
+ });
+
+ // Group apps by category
+ const groupedApps = {};
+ const ungroupedApps = [];
+
+ sortedApps.forEach(app => {
+ if (app.group) {
+ if (!groupedApps[app.group]) {
+ groupedApps[app.group] = [];
+ }
+ groupedApps[app.group].push(app);
+ } else {
+ ungroupedApps.push(app);
+ }
+ });
+
+ // Build the UI with search bar and grouped apps
+ let html = `
+
+
Apps
+
(${appCount} app${appCount !== 1 ? 's' : ''})
+
+
+
+
+
+
+ Type a service name to filter, or use / commands. Example: /jellyfin opens Jellyfin instantly.
+
+
+ `;
+
+ // Display ungrouped apps first
+ if (ungroupedApps.length > 0) {
+ html += '';
+ html += ungroupedApps.map(app => buildAppCard(app)).join('');
+ html += '
';
+ }
+
+ // Display grouped apps
+ Object.entries(groupedApps).forEach(([group, appsInGroup]) => {
+ html += `
+
+
${escapeHtml(group)}
+
+ ${appsInGroup.map(app => buildAppCard(app)).join('')}
+
+
+ `;
+ });
+
+ pageHome.innerHTML = html;
+
+ // Attach event listeners
+ setupAppCardListeners();
+ setupSearchAndCommands(sortedApps);
+}
+
+function updateAppCardStatuses(targets) {
+ const cardsById = new Map(Array.from(document.querySelectorAll('.app-card[data-app-id]'))
+ .map(card => [String(card.dataset.appId), card]));
+ targets.forEach((target) => {
+ const card = cardsById.get(String(target._id));
+ if (!card) return;
+ const down = target.currentStatus === 'down';
+ card.dataset.isDown = String(down);
+ const statusEl = card.querySelector('.app-status');
+ if (!statusEl) return;
+ const nextText = down ? 'Down' : target.currentStatus === 'up' ? 'Up' : 'Checking';
+ if (down && statusEl.tagName !== 'BUTTON') {
+ const button = document.createElement('button');
+ button.type = 'button';
+ button.className = 'app-status down';
+ button.dataset.monitorLink = target._id;
+ button.setAttribute('aria-label', `View ${target.name} uptime`);
+ button.textContent = nextText;
+ statusEl.replaceWith(button);
+ setupAppCardListeners();
+ return;
+ }
+ if (!down && statusEl.tagName === 'BUTTON') {
+ const span = document.createElement('span');
+ span.className = 'app-status up';
+ span.textContent = nextText;
+ statusEl.replaceWith(span);
+ return;
+ }
+ const statusClass = down ? 'down' : target.currentStatus === 'up' ? 'up' : 'unknown';
+ statusEl.className = `app-status ${statusClass}`;
+ statusEl.textContent = nextText;
+ if (down) {
+ statusEl.setAttribute('role', 'button');
+ statusEl.setAttribute('tabindex', '0');
+ } else {
+ statusEl.removeAttribute('role');
+ statusEl.removeAttribute('tabindex');
+ }
+ });
+}
+
+function buildAppCard(app) {
+ const isDown = app.currentStatus === 'down';
+ const statusClass = isDown ? 'down' : app.currentStatus === 'up' ? 'up' : 'unknown';
+ const statusText = isDown ? 'Down' : app.currentStatus === 'up' ? 'Up' : 'Checking';
+
+ // Determine icon - prioritize appIcon (manually configured), then cached favicon, then API favicon, then fallback icon
+ let iconHTML = '';
+
+ if (app.appIcon) {
+ // Use manually configured app icon - proxy it
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(app.appIcon)}`;
+ iconHTML = buildIconImage(proxyUrl, app.name, 'app-favicon', 'handleIconError');
+ } else {
+ const cachedFavicon = faviconCache[app.appUrl];
+
+ if (cachedFavicon) {
+ // If favicon is a data URL (base64), use it directly, otherwise proxy it
+ if (cachedFavicon.startsWith('data:')) {
+ iconHTML = buildIconImage(cachedFavicon, app.name, 'app-favicon', 'handleIconError');
+ } else {
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(cachedFavicon)}`;
+ iconHTML = buildIconImage(proxyUrl, app.name, 'app-favicon', 'handleIconError');
+ }
+ } else if (app.favicon) {
+ faviconCache[app.appUrl] = app.favicon;
+ // If favicon is a data URL (base64), use it directly, otherwise proxy it
+ if (app.favicon.startsWith('data:')) {
+ iconHTML = buildIconImage(app.favicon, app.name, 'app-favicon', 'handleIconError');
+ } else {
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(app.favicon)}`;
+ iconHTML = buildIconImage(proxyUrl, app.name, 'app-favicon', 'handleIconError');
+ }
+ } else {
+ // Fallback to Font Awesome icon
+ const fallbackIcon = getIconForApp(app.name);
+ iconHTML = ``;
+ }
+ }
+
+ return `
+
+
+ ${iconHTML}
+
+
${escapeHtml(app.name)}
+ ${isDown ? '
' : '
' + statusText + ''}
+
+ `;
+}
+
+// Handle icon loading errors
+function handleIconError(img, appName = img?.dataset?.iconName || '') {
+ // Replace failed image with fallback icon
+ const fallbackIcon = getIconForApp(appName);
+ img.outerHTML = ``;
+}
+
+// Get icon HTML for a service/monitor
+function getServiceIconHTML(target) {
+ let iconHTML = '';
+
+ if (target.appIcon) {
+ // Use manually configured app icon - proxy it
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(target.appIcon)}`;
+ iconHTML = buildIconImage(proxyUrl, target.name, 'service-favicon', 'handleServiceIconError');
+ } else if (target.appUrl) {
+ const cachedFavicon = faviconCache[target.appUrl];
+
+ if (cachedFavicon) {
+ // If favicon is a data URL (base64), use it directly, otherwise proxy it
+ if (cachedFavicon.startsWith('data:')) {
+ iconHTML = buildIconImage(cachedFavicon, target.name, 'service-favicon', 'handleServiceIconError');
+ } else {
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(cachedFavicon)}`;
+ iconHTML = buildIconImage(proxyUrl, target.name, 'service-favicon', 'handleServiceIconError');
+ }
+ } else if (target.favicon) {
+ faviconCache[target.appUrl] = target.favicon;
+ // If favicon is a data URL (base64), use it directly, otherwise proxy it
+ if (target.favicon.startsWith('data:')) {
+ iconHTML = buildIconImage(target.favicon, target.name, 'service-favicon', 'handleServiceIconError');
+ } else {
+ const proxyUrl = `/api/proxy-icon?url=${encodeURIComponent(target.favicon)}`;
+ iconHTML = buildIconImage(proxyUrl, target.name, 'service-favicon', 'handleServiceIconError');
+ }
+ } else {
+ // Fallback to Font Awesome icon
+ const fallbackIcon = getIconForApp(target.name);
+ iconHTML = ``;
+ }
+ } else {
+ // Fallback to Font Awesome icon
+ const fallbackIcon = getIconForApp(target.name);
+ iconHTML = ``;
+ }
+
+ return iconHTML;
+}
+
+// Handle service icon loading errors
+function handleServiceIconError(img, serviceName = img?.dataset?.iconName || '') {
+ // Replace failed image with fallback icon
+ const fallbackIcon = getIconForApp(serviceName);
+ img.outerHTML = ``;
+}
+
+function setupAppCardListeners() {
+ document.querySelectorAll('.app-status.down[data-monitor-link]').forEach(status => {
+ if (status.dataset.listenersBound === 'true') return;
+ status.dataset.listenersBound = 'true';
+ status.addEventListener('click', (event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ openMonitorFromApps(status.dataset.monitorLink);
+ });
+ status.addEventListener('keydown', (event) => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ event.stopPropagation();
+ openMonitorFromApps(status.dataset.monitorLink);
+ }
+ });
+ });
+
+ // Add event listeners for left-click and middle-click
+ document.querySelectorAll('.app-card[data-app-url]').forEach(card => {
+ if (card.dataset.listenersBound === 'true') return;
+ card.dataset.listenersBound = 'true';
+ card.style.cursor = 'pointer';
+
+ card.addEventListener('mousedown', (e) => {
+ const url = card.getAttribute('data-app-url');
+
+ if (e.button === 0) {
+ // Left click - will be handled by click event
+ } else if (e.button === 1) {
+ // Middle click - open in background tab without focus
+ e.preventDefault();
+ window.open(url, '_blank');
+ } else if (e.button === 2) {
+ // Right click - let context menu handle it
+ e.preventDefault();
+ window.open(url, '_blank');
+ }
+ });
+
+ card.addEventListener('click', (e) => {
+ // Handle left click
+ if (e.button === 0 && !e.target.closest('.app-status.down')) {
+ const url = card.getAttribute('data-app-url');
+ if (url) window.open(url, '_blank');
+ }
+ });
+ });
+}
+
+function openMonitorFromApps(serviceId) {
+ if (!serviceId) return;
+ const hash = `#monitor=${encodeURIComponent(serviceId)}`;
+ if (window.history?.pushState) {
+ window.history.pushState({ page: 'status', monitor: serviceId }, '', `/uptime${hash}`);
+ }
+ switchPage('status', { pushState: false });
+ setTimeout(openDeepLinkedMonitor, 0);
+}
+
+function setupSearchAndCommands(allApps) {
+ const searchInput = document.getElementById('search-input');
+ if (!searchInput) return;
+
+ let suggestedCommand = null;
+
+ searchInput.addEventListener('keyup', (e) => {
+ const query = e.target.value.toLowerCase().trim();
+
+ // Handle quick commands (starting with /)
+ if (query.startsWith('/')) {
+ const command = query.substring(1);
+
+ // Find matching command
+ const matchingApp = findAppByCommand(command, allApps);
+
+ // If exact match found, suggest it
+ if (matchingApp && e.key !== 'Enter') {
+ suggestedCommand = matchingApp;
+ showCommandSuggestion(matchingApp, command);
+ } else {
+ hideCommandSuggestion();
+ }
+
+ // Show all apps when typing a command
+ const allCards = document.querySelectorAll('.app-card');
+ allCards.forEach(card => {
+ card.style.display = '';
+ });
+ return;
+ }
+
+ hideCommandSuggestion();
+
+ // Filter apps based on search query (only for non-command searches)
+ if (query.length === 0) {
+ const allCards = document.querySelectorAll('.app-card');
+ allCards.forEach(card => {
+ card.style.display = '';
+ });
+ } else {
+ const allCards = document.querySelectorAll('.app-card');
+ allCards.forEach(card => {
+ const appName = card.getAttribute('data-app-name') || '';
+ const quickCommands = card.getAttribute('data-quick-commands') || '';
+ const matches = appName.includes(query) || quickCommands.includes(query);
+ card.style.display = matches ? '' : 'none';
+ });
+ }
+ });
+
+ searchInput.addEventListener('keydown', (e) => {
+ const query = e.target.value.toLowerCase().trim();
+
+ // Tab completion for commands
+ if (e.key === 'Tab') {
+ e.preventDefault();
+
+ if (query.startsWith('/')) {
+ const command = query.substring(1);
+ const matchingApp = findAppByCommand(command, allApps);
+
+ if (matchingApp) {
+ // Use the first quick command or the app name
+ const fullCommand = matchingApp.quickCommands?.[0] || matchingApp.name.toLowerCase();
+ searchInput.value = `/${fullCommand}`;
+ suggestedCommand = null;
+ hideCommandSuggestion();
+ }
+ }
+ return;
+ }
+
+ // Enter key handling
+ if (e.key === 'Enter') {
+ const query = e.target.value.toLowerCase().trim();
+
+ if (query.startsWith('/')) {
+ e.preventDefault();
+ const command = query.substring(1);
+ handleQuickCommand(command, allApps);
+ e.target.value = '';
+ hideCommandSuggestion();
+ } else {
+ // DuckDuckGo search
+ e.preventDefault();
+ window.open(`https://duckduckgo.com/?q=${encodeURIComponent(query)}`, '_blank');
+ e.target.value = '';
+ }
+ }
+ });
+}
+
+function findAppByCommand(command, allApps) {
+ const lowerCommand = command.toLowerCase();
+
+ // First try exact match with quick commands
+ for (const app of allApps) {
+ const quickCommands = (app.quickCommands || []).map(c => c.toLowerCase());
+ if (quickCommands.some(c => c.startsWith(lowerCommand))) {
+ return app;
+ }
+ }
+
+ // Then try partial match with app names
+ for (const app of allApps) {
+ const appName = app.name.toLowerCase();
+ if (appName.startsWith(lowerCommand)) {
+ return app;
+ }
+ }
+
+ return null;
+}
+
+function showCommandSuggestion(app, partialCommand) {
+ let suggestionEl = document.getElementById('command-suggestion');
+
+ if (!suggestionEl) {
+ suggestionEl = document.createElement('div');
+ suggestionEl.id = 'command-suggestion';
+ suggestionEl.style.cssText = `
+ background: rgba(15, 23, 42, 0.95);
+ border: 1px solid rgba(148, 163, 184, 0.3);
+ border-radius: 0.5rem;
+ padding: 0.75rem 1rem;
+ margin-top: 0.5rem;
+ margin-bottom: 0.5rem;
+ font-size: 0.875rem;
+ color: #cbd5e1;
+ z-index: 10;
+ white-space: nowrap;
+ max-width: 300px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ `;
+ const searchInput = document.getElementById('search-input');
+ searchInput.parentNode.insertBefore(suggestionEl, searchInput.nextSibling);
+ }
+
+ const suggestedCommand = app.quickCommands?.[0] || app.name.toLowerCase();
+ const remaining = suggestedCommand.substring(partialCommand.length);
+
+ suggestionEl.innerHTML = `Press Tab to complete: /${suggestedCommand}`;
+ suggestionEl.style.display = 'block';
+}
+
+function hideCommandSuggestion() {
+ const suggestionEl = document.getElementById('command-suggestion');
+ if (suggestionEl) {
+ suggestionEl.style.display = 'none';
+ }
+}
+
+function handleQuickCommand(command, allApps) {
+ const lowerCommand = command.toLowerCase();
+
+ // Search for matching app by quick command or name
+ for (const app of allApps) {
+ const quickCommands = (app.quickCommands || []).map(c => c.toLowerCase());
+ const appName = app.name.toLowerCase();
+
+ // Check if command matches quick command or app name
+ if (quickCommands.includes(lowerCommand) || appName === lowerCommand) {
+ if (!app.isUp) {
+ alert(`${app.name} is currently down and cannot be opened.`);
+ return;
+ }
+
+ if (app.appUrl) {
+ window.open(app.appUrl, '_blank');
+ return;
+ }
+ }
+ }
+
+ // Command not found
+ alert(`Service not found. Try one of these commands:\n${allApps
+ .filter(a => a.appUrl)
+ .slice(0, 5)
+ .map(a => `/${a.quickCommands?.[0] || a.name.toLowerCase()}`)
+ .join('\n')}`);
+}
+
+function getIconForApp(appName, customIcon) {
+ if (customIcon) return customIcon;
+
+ const iconMap = {
+ 'nginx': 'fa-server',
+ 'apache': 'fa-server',
+ 'docker': 'fa-docker',
+ 'kubernetes': 'fa-cube',
+ 'prometheus': 'fa-chart-line',
+ 'grafana': 'fa-chart-area',
+ 'jenkins': 'fa-gears',
+ 'gitlab': 'fa-gitlab',
+ 'github': 'fa-github',
+ 'gitea': 'fa-git-alt',
+ 'sonarqube': 'fa-code',
+ 'vault': 'fa-lock',
+ 'consul': 'fa-sitemap',
+ 'minio': 'fa-database',
+ 'postgresql': 'fa-database',
+ 'mysql': 'fa-database',
+ 'sqlite': 'fa-database',
+ 'redis': 'fa-database',
+ 'elasticsearch': 'fa-search',
+ 'kibana': 'fa-chart-line',
+ 'nexus': 'fa-box',
+ 'artifactory': 'fa-box',
+ 'portainer': 'fa-docker',
+ 'pihole': 'fa-shield-alt',
+ 'adguard': 'fa-shield-alt',
+ 'jellyfin': 'fa-film',
+ 'plex': 'fa-film',
+ 'kodi': 'fa-tv',
+ 'emby': 'fa-film',
+ 'nextcloud': 'fa-cloud',
+ 'synology': 'fa-hdd',
+ 'qnap': 'fa-hdd',
+ 'home assistant': 'fa-home',
+ 'homebridge': 'fa-home',
+ 'openwrt': 'fa-network-wired',
+ 'unifi': 'fa-wifi',
+ 'piaware': 'fa-plane',
+ 'resin': 'fa-flask',
+ 'wireguard': 'fa-lock',
+ 'openvpn': 'fa-lock',
+ };
+
+ const lowerName = appName.toLowerCase();
+ for (const [key, icon] of Object.entries(iconMap)) {
+ if (lowerName.includes(key)) {
+ return icon;
+ }
+ }
+
+ // Default icon
+ return 'fa-cube';
+}
+
+function openApp(url) {
+ if (url) {
+ window.open(url, '_blank');
+ }
+}
+
+// ==================== STATUS PAGE ====================
+
+async function getTargetUptime(targetId) {
+ // Use cached data from consolidated endpoint if available
+ const target = allTargets.find(t => t._id === targetId);
+ if (target && target.uptime) {
+ return target.uptime['30d']?.uptime || 0;
+ }
+
+ if (targetUptimeCache[targetId]) {
+ return targetUptimeCache[targetId];
+ }
+
+ try {
+ const res = await axios.get(`/api/targets/${targetId}/uptime?days=30`);
+ const uptime = res.data.uptime;
+ targetUptimeCache[targetId] = uptime;
+ return uptime;
+ } catch (error) {
+ console.error('Error fetching uptime:', error);
+ return 0;
+ }
+}
+
+async function getTargetCurrentPing(targetId) {
+ // Try to get from cached data first (we don't cache individual ping, but we can skip the request)
+ // For now, return 0 as we don't have current ping in the consolidated endpoint
+ // This can be enhanced later if needed
+ return 0;
+}
+
+async function loadAndDisplayPing(targetId) {
+ const ping = await getTargetCurrentPing(targetId);
+ const el = document.querySelector(`.ping-${targetId}`);
+ if (el) {
+ if (ping > 0) {
+ el.textContent = ping.toFixed(0) + 'ms';
+ } else {
+ el.textContent = '-';
+ }
+ }
+}
+
+function updateServicesList(targets) {
+ const list = document.getElementById('services-list');
+ const countEl = document.getElementById('service-count');
+
+ if (!list) return;
+
+ // Admins get the complete configured monitor inventory. Public visitors see
+ // only enabled monitors explicitly exposed on the status page.
+ const deepLinkedMonitorId = new URLSearchParams((location.hash || '').replace(/^#/, '')).get('monitor');
+ const visibleTargets = targets.filter(t => viewerIsAdmin || (
+ t.enabled !== false &&
+ t.publicVisible !== false &&
+ (t.publicShowStatus !== false || String(t._id) === String(deepLinkedMonitorId || ''))
+ ));
+
+ // Show all targets in status page
+ if (visibleTargets.length === 0) {
+ // Only clear if we're not on the status page or if there are no existing services
+ const existingServices = list.querySelectorAll('.service-item');
+ if (existingServices.length === 0) {
+ list.innerHTML = 'No services found
';
+ }
+ countEl.textContent = '(0)';
+ return;
+ }
+
+ countEl.textContent = `(${visibleTargets.length})`;
+
+ // Check if services list is still showing loading message (only clear if it's the ONLY content)
+ const loadingMsg = list.querySelector('.text-center.text-slate-400');
+ if (loadingMsg && list.children.length === 1) {
+ // Only clear if this is the only child (the loading message)
+ list.innerHTML = '';
+ }
+
+ // Get list of existing service IDs to track what needs to be removed
+ const existingServiceIds = new Set();
+ list.querySelectorAll('.service-item').forEach(el => {
+ const id = el.id.replace('service-', '');
+ if (id) existingServiceIds.add(id);
+ });
+
+ // Update each service row dynamically without re-rendering
+ visibleTargets.forEach(target => {
+ existingServiceIds.delete(target._id); // Mark as still existing
+ const serviceEl = document.getElementById(`service-${target._id}`);
+
+ if (!serviceEl) {
+ // If service doesn't exist, add it using appendChild to preserve DOM state
+ const tempDiv = document.createElement('div');
+ tempDiv.innerHTML = createServiceElement(target);
+ const newServiceEl = tempDiv.firstElementChild;
+ list.appendChild(newServiceEl);
+ const newMiniGraph = newServiceEl.querySelector('.service-mini-graph');
+ if (newMiniGraph) {
+ newMiniGraph._miniKey = miniGraphDataKey(target);
+ newMiniGraph._miniStatus = target.currentStatus || 'unknown';
+ }
+
+ // If this service should be expanded, restore its expanded state
+ if (expandedServiceId === target._id) {
+ const wrapper = document.getElementById(`details-wrapper-${target._id}`);
+ const row = newServiceEl.querySelector('.service-row');
+ const icon = row ? row.querySelector('.expand-icon') : null;
+
+ if (wrapper) wrapper.classList.add('open');
+ if (row) row.classList.add('expanded');
+ if (icon) icon.classList.add('rotated');
+
+ // Load details if not already loaded
+ const contentEl = document.getElementById(`service-content-${target._id}`);
+ if (contentEl && contentEl.innerHTML.includes('Loading details...')) {
+ loadServiceDetails(target._id);
+ }
+ }
+ } else {
+ // Update existing service - preserve expanded state at all costs
+ const isDown = target.currentStatus === 'down';
+
+ const row = serviceEl.querySelector('.service-row');
+ if (!row) return; // Safety check
+
+ const wrapper = document.getElementById(`details-wrapper-${target._id}`);
+ const icon = row?.querySelector('.expand-icon');
+ const iconEl = row.querySelector('.service-icon');
+
+ // Update icon if it exists
+ if (iconEl && iconEl.dataset.iconKey !== serviceIconKey(target)) {
+ const newIconHTML = getServiceIconHTML(target);
+ iconEl.innerHTML = newIconHTML;
+ iconEl.dataset.iconKey = serviceIconKey(target);
+ }
+
+ // Keep the row itself as the status signal. Down monitors get a subtle
+ // red wash and the graph adds the explicit "Down" label.
+ serviceEl.classList.toggle('service-item-down', isDown);
+ updateServiceMiniGraph(target, serviceEl);
+
+ // CRITICAL: Always preserve expanded state - never close if it's expanded
+ const isExpanded = expandedServiceId === target._id;
+ if (isExpanded) {
+ // Force open state - don't check, just ensure it's open
+ if (wrapper) wrapper.classList.add('open');
+ if (row) row.classList.add('expanded');
+ if (icon) icon.classList.add('rotated');
+ } else {
+ // Only close if it's not supposed to be expanded
+ if (wrapper && wrapper.classList.contains('open')) {
+ wrapper.classList.remove('open');
+ }
+ if (row && row.classList.contains('expanded')) {
+ row.classList.remove('expanded');
+ }
+ if (icon) icon.classList.remove('rotated');
+ }
+
+ }
+ });
+
+ // Remove services that no longer exist (but preserve expanded state if it's the expanded one)
+ if (expandedServiceId && !visibleTargets.some(target => String(target._id) === String(expandedServiceId))) {
+ if (charts[expandedServiceId]) {
+ charts[expandedServiceId].destroy();
+ delete charts[expandedServiceId];
+ }
+ delete chartPeriods[expandedServiceId];
+ expandedServiceId = null;
+ }
+ existingServiceIds.forEach(serviceId => {
+ const serviceEl = document.getElementById(`service-${serviceId}`);
+ if (serviceEl) {
+ serviceEl.remove();
+ }
+ });
+
+ // Update expanded service details if one is open - do this AFTER all DOM updates
+ if (expandedServiceId) {
+ // Use setTimeout to ensure DOM is stable
+ setTimeout(() => {
+ loadServiceDetailsUpdate(expandedServiceId);
+ }, 0);
+ }
+}
+
+function createServiceElement(target) {
+ const isDown = target.currentStatus === 'down';
+ const isExpanded = expandedServiceId === target._id;
+
+ // Get icon HTML for the service
+ const iconHTML = getServiceIconHTML(target);
+
+ return `
+
+
+
+ ${iconHTML}
+
+
+
${escapeHtml(target.name)}
+
+
+ ${buildMiniGraphMarkup(target)}
+
+
+
+
+
+ `;
+}
+
+function updateServiceMiniGraph(target, serviceEl) {
+ const graphEl = serviceEl?.querySelector('.service-mini-graph');
+ if (!graphEl) return;
+
+ const dataKey = miniGraphDataKey(target);
+ const status = target.currentStatus || 'unknown';
+ if (graphEl._miniKey === dataKey && graphEl._miniStatus === status) return;
+
+ graphEl._miniKey = dataKey;
+ graphEl._miniStatus = status;
+ graphEl.innerHTML = buildMiniGraphContent(target);
+}
+
+async function loadAndDisplayUptime(targetId) {
+ const uptime = await getTargetUptime(targetId);
+ const el = document.querySelector(`.uptime-${targetId}`);
+ if (el) {
+ el.textContent = uptime + '%';
+ }
+}
+
+async function loadAndDisplayUptimeBars(targetId) {
+ try {
+ // Daily bars are detail data. Fetch them only when the monitor's detail
+ // view asks for them instead of including them in the landing-page
+ // summary for every monitor.
+ const stats = await getGraphData(targetId, '30d');
+
+ // Get the uptime bar container
+ const serviceEl = document.getElementById(`service-${targetId}`);
+ if (!serviceEl) return;
+
+ const uptimeBar = serviceEl.querySelector('.uptime-bar');
+ if (!uptimeBar) return;
+
+ // Clear loading segments and rebuild with actual data
+ let html = '';
+ stats.forEach(stat => {
+ const isUp = stat.successfulPings > 0;
+ const status = isUp ? 'up' : 'down';
+ const uptime = stat.successfulPings > 0 ? ((stat.successfulPings / stat.totalPings) * 100).toFixed(0) : 0;
+ html += ``;
+ });
+
+ // If no stats yet, show loading state
+ if (stats.length === 0) {
+ html = '';
+ for (let i = 0; i < 40; i++) {
+ html += ``;
+ }
+ }
+
+ uptimeBar.innerHTML = html;
+ } catch (error) {
+ console.error('Error loading uptime bars:', error);
+ }
+}
+
+function generateUptimeBars(targetId) {
+ let html = '';
+ for (let i = 0; i < 40; i++) {
+ html += ``;
+ }
+ return `${html}
`;
+}
+
+function toggleServiceExpand(serviceId, options = {}) {
+ // A deep link owns the hash while it is being resolved. A normal user click
+ // should release that ownership so the next polling refresh cannot reopen a
+ // row the user deliberately collapsed or replace it with another row.
+ if (!options.preserveHash) {
+ const hashMonitorId = new URLSearchParams((location.hash || '').replace(/^#/, '')).get('monitor');
+ if (hashMonitorId) {
+ const url = `${location.pathname}${location.search}`;
+ if (window.history?.replaceState) window.history.replaceState({}, '', url);
+ lastDeepLinkedMonitorId = null;
+ }
+ }
+
+ // If clicking the same service, close it
+ if (expandedServiceId === serviceId) {
+ expandedServiceId = null;
+ const wrapper = document.getElementById(`details-wrapper-${serviceId}`);
+ const row = document.querySelector(`#service-${serviceId} .service-row`);
+ const icon = row?.querySelector('.expand-icon');
+
+ if (wrapper) {
+ wrapper.classList.remove('open');
+ }
+ if (row) {
+ row.classList.remove('expanded');
+ }
+ if (icon) {
+ icon.classList.remove('rotated');
+ }
+ } else {
+ // Close previous expanded service
+ if (expandedServiceId) {
+ const prevWrapper = document.getElementById(`details-wrapper-${expandedServiceId}`);
+ const prevRow = document.querySelector(`#service-${expandedServiceId} .service-row`);
+ const prevIcon = prevRow?.querySelector('.expand-icon');
+
+ if (prevWrapper) {
+ prevWrapper.classList.remove('open');
+ }
+ if (prevRow) {
+ prevRow.classList.remove('expanded');
+ }
+ if (prevIcon) {
+ prevIcon.classList.remove('rotated');
+ }
+ }
+
+ // Open new service
+ expandedServiceId = serviceId;
+ const wrapper = document.getElementById(`details-wrapper-${serviceId}`);
+ const row = document.querySelector(`#service-${serviceId} .service-row`);
+ const icon = row?.querySelector('.expand-icon');
+
+ if (wrapper) {
+ wrapper.classList.add('open');
+ }
+ if (row) {
+ row.classList.add('expanded');
+ }
+ if (icon) {
+ icon.classList.add('rotated');
+ }
+
+ // Load the details
+ loadServiceDetails(serviceId);
+ }
+}
+
+async function loadServiceDetails(serviceId) {
+ const target = allTargets.find(t => t._id === serviceId);
+ if (!target) return;
+
+ const contentEl = document.getElementById(`service-content-${serviceId}`);
+
+ try {
+ // Replacing the details markup also replaces the canvas. Destroy the
+ // previous Chart.js instance first so it cannot keep rendering to a
+ // detached canvas when a user collapses and reopens a service.
+ if (charts[serviceId]) {
+ charts[serviceId].destroy();
+ delete charts[serviceId];
+ }
+
+ // Use cached uptime data if available, otherwise fetch
+ let uptime24h = 0;
+ let uptime30d = 0;
+
+ if (target.uptime) {
+ uptime24h = parseFloat(target.uptime['24h']?.uptime || 0);
+ uptime30d = parseFloat(target.uptime['30d']?.uptime || 0);
+ } else {
+ // Fallback: fetch if not in cache
+ const statsResponse = await axios.get(`/api/targets/${serviceId}/statistics?period=24h`);
+ const uptimeData = statsResponse.data.uptime || {};
+ uptime24h = parseFloat(uptimeData['24h']?.uptime || 0);
+ uptime30d = parseFloat(uptimeData['30d']?.uptime || 0);
+ }
+
+ // Chart data will be loaded separately when needed (only when details are expanded)
+
+ contentEl.innerHTML = `
+
+
+
+
+
Current Status
+
${!target.enabled ? 'PAUSED' : target.currentStatus === 'up' ? 'β UP' : target.currentStatus === 'down' ? 'β DOWN' : 'CHECKING'}
+
+
+
Uptime (24h)
+
${uptime24h.toFixed(2)}%
+
+
+
Uptime (30d)
+
${uptime30d.toFixed(2)}%
+
+ ${target.publicShowDetails ? `
+
+
Protocol
+
${escapeHtml(target.protocol)}
+
+ ` : ''}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Response Time & Status
+
+
+
+
+
+
+
+ `;
+
+ // Load initial chart
+ setTimeout(() => {
+ loadServiceChart(serviceId, '24h');
+ }, 100);
+ } catch (error) {
+ console.error('Error loading service details:', error);
+ contentEl.innerHTML = `Error loading details
`;
+ }
+}
+
+async function loadServiceDetailsUpdate(serviceId) {
+ const target = allTargets.find(t => t._id === serviceId);
+ if (!target) return;
+
+ try {
+ // Ensure wrapper stays open if this is the expanded service
+ const wrapper = document.getElementById(`details-wrapper-${serviceId}`);
+ if (expandedServiceId === serviceId && wrapper) {
+ wrapper.classList.add('open');
+ }
+
+ // Only update the values if the details panel exists
+ const contentEl = document.getElementById(`service-content-${serviceId}`);
+ if (!contentEl) {
+ // If content doesn't exist but service is expanded, load it
+ if (expandedServiceId === serviceId) {
+ loadServiceDetails(serviceId);
+ }
+ return;
+ }
+
+ // Uptime summaries are already part of the consolidated payload. Avoid a
+ // second database request on every status refresh.
+ const uptimeData = target.uptime || {};
+
+ const uptime24h = parseFloat(uptimeData['24h']?.uptime || 0).toFixed(2);
+ const uptime30d = parseFloat(uptimeData['30d']?.uptime || 0).toFixed(2);
+
+ // Update values dynamically
+ const uptime24hEl = contentEl.querySelector(`.uptime-24h-${serviceId}`);
+ const uptime30dEl = contentEl.querySelector(`.uptime-30d-${serviceId}`);
+
+ // Find status element - it's in the first compact stat card
+ const statusEl = contentEl.querySelector('.monitor-current-status');
+
+ if (uptime24hEl) uptime24hEl.textContent = uptime24h + '%';
+ if (uptime30dEl) uptime30dEl.textContent = uptime30d + '%';
+
+ // Update status if changed
+ if (statusEl) {
+ const isUp = target.currentStatus === 'up';
+ const isDown = target.currentStatus === 'down';
+ statusEl.className = `monitor-current-status text-base font-bold leading-tight whitespace-nowrap ${isUp ? 'text-green-400' : isDown ? 'text-red-400' : 'text-slate-400'}`;
+ statusEl.textContent = !target.enabled ? 'PAUSED' : isUp ? 'β UP' : isDown ? 'β DOWN' : 'CHECKING';
+ }
+
+ // Update chart data dynamically if chart exists
+ if (charts[serviceId] && chartPeriods[serviceId]) {
+ await updateChartData(serviceId, chartPeriods[serviceId]);
+ } else if (contentEl.querySelector(`#chart-${serviceId}`)) {
+ // Chart canvas exists but chart wasn't created yet, create it now
+ const currentPeriod = chartPeriods[serviceId] || '24h';
+ await loadServiceChart(serviceId, currentPeriod);
+ }
+ } catch (error) {
+ console.error('Error updating service details:', error);
+ }
+}
+
+async function switchChartPeriod(serviceId, period) {
+ // Update button states
+ const buttons = document.querySelectorAll(`#service-content-${serviceId} .period-btn`);
+ buttons.forEach(btn => {
+ if (btn.dataset.period === period) {
+ btn.className = 'period-btn px-4 py-2 rounded-lg text-xs font-medium bg-gradient-to-r from-cyan-600 to-cyan-500 text-white shadow-lg shadow-cyan-500/30 transition-all duration-200 border border-cyan-500/50';
+ } else {
+ btn.className = 'period-btn px-4 py-2 rounded-lg text-xs font-medium bg-slate-700/50 hover:bg-slate-600/70 text-slate-300 transition-all duration-200 border border-slate-600/50';
+ }
+ });
+
+ await loadServiceChart(serviceId, period);
+}
+
+async function updateChartData(serviceId, period) {
+ try {
+ const chart = charts[serviceId];
+ if (!chart) return;
+
+ // Fetch real statistics from the API with period parameter
+ const statistics = await getGraphData(serviceId, period);
+
+ // Parse and sort statistics chronologically (oldest first = left to right)
+ const sortedStats = [...statistics]
+ .map(stat => ({
+ ...stat,
+ dateObj: new Date(stat.date) // Parse date once
+ }))
+ .sort((a, b) => a.dateObj.getTime() - b.dateObj.getTime()); // Sort chronologically (oldest first)
+
+ const labels = [];
+ const responseTimeData = [];
+
+ sortedStats.forEach(stat => {
+ const date = stat.dateObj;
+ if (period === '1h') {
+ // 1H: Show time only (HH:MM)
+ labels.push(date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '24h') {
+ // 24H: Show day and time (Mon 15, 14:30)
+ labels.push(date.toLocaleString([], { weekday: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '7d') {
+ // 7D: Show date and time (Nov 15, 14:30)
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '30d') {
+ // 30D: Show date only (Nov 15)
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric' }));
+ } else {
+ // Default: Show date and time
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ }
+
+ // Leave the response-time series blank during downtime. Chart.js treats
+ // null as a gap when spanGaps is false, so no green segment is rendered
+ // through the red downtime region.
+ const avgResponseTime = stat.avgResponseTime || 0;
+ const isDown = Number(stat.successfulPings || 0) === 0;
+ responseTimeData.push(isDown ? null : Math.round(avgResponseTime));
+
+ });
+
+ // Calculate max response time for scaling downtime indicator
+ const validResponseTimes = responseTimeData.filter(v => v > 0);
+ const maxResponseTime = validResponseTimes.length > 0 ? Math.max(...validResponseTimes) : 100;
+ const downtimeMaxValue = Math.round(Math.max(maxResponseTime * 1.1, 100)); // Add 10% padding, minimum 100, rounded
+
+ // Scale downtime indicator to max Y value
+ const scaledDownData = buildDowntimeSeries(sortedStats, downtimeMaxValue);
+ const downtimeAtIndex = sortedStats.map(stat => Number(stat.successfulPings || 0) === 0);
+
+ // Update chart data dynamically
+ chart.data.labels = labels;
+ chart.data.datasets[0].data = responseTimeData;
+ chart.data.datasets[1].data = scaledDownData;
+ chart._downtimeAtIndex = downtimeAtIndex;
+
+ // Keep the line clean at every period. A hit radius still allows chart
+ // interaction without rendering a marker at each sample.
+ chart.data.datasets[0].pointRadius = 0;
+ chart.data.datasets[0].pointHoverRadius = 0;
+
+ chart.update('none'); // Update without animation for smooth refresh
+ } catch (error) {
+ console.error('Error updating chart data:', error);
+ }
+}
+
+async function loadServiceChart(serviceId, period) {
+ try {
+ const canvas = document.getElementById(`chart-${serviceId}`);
+ if (!canvas) return;
+
+ // If chart already exists and period hasn't changed, just update the data
+ if (charts[serviceId] && chartPeriods[serviceId] === period) {
+ await updateChartData(serviceId, period);
+ return;
+ }
+
+ // Fetch real statistics from the API with period parameter
+ const statistics = await getGraphData(serviceId, period);
+
+ // Parse and sort statistics chronologically (oldest first = left to right)
+ const sortedStats = [...statistics]
+ .map(stat => ({
+ ...stat,
+ dateObj: new Date(stat.date) // Parse date once
+ }))
+ .sort((a, b) => a.dateObj.getTime() - b.dateObj.getTime()); // Sort chronologically (oldest first)
+
+ const labels = [];
+ const responseTimeData = [];
+
+ sortedStats.forEach(stat => {
+ const date = stat.dateObj;
+ if (period === '1h') {
+ // 1H: Show time only (HH:MM)
+ labels.push(date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '24h') {
+ // 24H: Show day and time (Mon 15, 14:30)
+ labels.push(date.toLocaleString([], { weekday: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '7d') {
+ // 7D: Show date and time (Nov 15, 14:30)
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ } else if (period === '30d') {
+ // 30D: Show date only (Nov 15)
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric' }));
+ } else {
+ // Default: Show date and time
+ labels.push(date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }));
+ }
+
+ // Leave the response-time series blank during downtime. Chart.js treats
+ // null as a gap when spanGaps is false, so no green segment is rendered
+ // through the red downtime region.
+ const avgResponseTime = stat.avgResponseTime || 0;
+ const isDown = Number(stat.successfulPings || 0) === 0;
+ responseTimeData.push(isDown ? null : Math.round(avgResponseTime));
+
+ });
+
+ // Destroy existing chart if any
+ if (charts[serviceId]) {
+ charts[serviceId].destroy();
+ }
+
+ const ctx = canvas.getContext('2d');
+
+ // Calculate min/max for better scaling
+ const validResponseTimes = responseTimeData.filter(v => v > 0);
+ const minResponseTime = validResponseTimes.length > 0 ? Math.min(...validResponseTimes) : 0;
+ const maxResponseTime = validResponseTimes.length > 0 ? Math.max(...validResponseTimes) : 100;
+ const downtimeMaxValue = Math.round(Math.max(maxResponseTime * 1.1, 100)); // Add 10% padding, minimum 100, rounded
+
+ // Scale downtime indicator to max Y value
+ const scaledDownData = buildDowntimeSeries(sortedStats, downtimeMaxValue);
+ const downtimeAtIndex = sortedStats.map(stat => Number(stat.successfulPings || 0) === 0);
+
+ // Store the period for this chart
+ chartPeriods[serviceId] = period;
+
+ charts[serviceId] = new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels,
+ datasets: [
+ {
+ label: 'Response Time (ms)',
+ data: responseTimeData,
+ borderColor: '#10b981',
+ backgroundColor: 'rgba(16, 185, 129, 0.15)',
+ fill: true,
+ tension: 0.5,
+ pointRadius: 0,
+ pointHoverRadius: 0,
+ pointHitRadius: 8,
+ borderWidth: 3,
+ spanGaps: false,
+ order: 1,
+ },
+ {
+ label: 'Downtime',
+ data: scaledDownData,
+ borderColor: '#ef4444',
+ backgroundColor: 'rgba(239, 68, 68, 0.25)',
+ fill: true,
+ tension: 0.3,
+ pointRadius: 0,
+ pointHoverRadius: 0,
+ pointHitRadius: 8,
+ borderWidth: 0,
+ spanGaps: false,
+ order: 0,
+ },
+ ],
+ },
+ options: {
+ responsive: true,
+ maintainAspectRatio: false,
+ interaction: {
+ mode: 'index',
+ intersect: false,
+ },
+ plugins: {
+ legend: {
+ display: false,
+ },
+ tooltip: buildGraphTooltipOptions()
+ },
+ scales: {
+ y: {
+ beginAtZero: true,
+ max: downtimeMaxValue, // Set max to ensure downtime indicator reaches top
+ grid: {
+ color: 'rgba(255, 255, 255, 0.08)',
+ drawBorder: false,
+ lineWidth: 1
+ },
+ ticks: { display: false },
+ title: {
+ display: false
+ }
+ },
+ x: {
+ type: 'category',
+ grid: {
+ color: 'rgba(255, 255, 255, 0.05)',
+ drawBorder: false
+ },
+ ticks: { display: false },
+ // Ensure chronological order (left = oldest, right = newest)
+ reverse: false
+ },
+ },
+ elements: {
+ point: {
+ radius: 0,
+ hoverRadius: 0,
+ hoverBorderWidth: 0,
+ }
+ },
+ animation: {
+ duration: 1000,
+ easing: 'easeInOutQuart'
+ }
+ },
+ });
+ charts[serviceId]._downtimeAtIndex = downtimeAtIndex;
+ } catch (error) {
+ console.error('Error loading chart:', error);
+ }
+}
diff --git a/src/public/manifest.json b/src/public/manifest.json
new file mode 100644
index 0000000..c6e4d47
--- /dev/null
+++ b/src/public/manifest.json
@@ -0,0 +1,11 @@
+{
+ "name": "App",
+ "icons": [
+ {
+ "src": "\/android-icon-192x192.png",
+ "sizes": "192x192",
+ "type": "image\/png",
+ "purpose": "any maskable"
+ }
+ ]
+}
diff --git a/src/public/ms-icon-150x150.png b/src/public/ms-icon-150x150.png
new file mode 100644
index 0000000000000000000000000000000000000000..0a2c30e25031c7588e5b9d40f50e07b313e7f32c
GIT binary patch
literal 12643
zcmZ{L1xzJP(CtMQSbWjN-QC?5cV8~(VkO;ttEj-7mhlE$;5_?(UB-FL}vJ{=bu%
zN@h}1>FTbYQ+2w-l@uhA;Bnyr005G-l$gq=O!@DEgZaGkLpW}K3Swg^6?p)_ixL0`
z2nGP2KOY4g0syYe0Kl;U0KoeP0Kj(0Xi?_>d;w!5D=GFVKiiXNtN*8fb&-}Ahdn~T
zgr?+*-+s&m0GLIk#YEIRmgjtr8f_&VH>&P=9@e=Oy%eG9dP#vSiGMQ1nXM^mq*GY*
zYNF$8exm*A)*LE+rSp+y?&YR~VIhx!VqsbA{;eDk0AT447nZW{^YZe_KX-83>&YrB
zD{t}6eu1W|EOeh(Z*6V)Y@zxWfymh%ArJtA0Jy{0h>)C<T2S8
ziH`^rn4sG^YZ_5$k2Rh($v4XQARfe*E$d228^4tg1bM4N)^xhnkCTV)ah3yGaw^Cn
zXZL8CF}l#v9e)UaoT9aTWl@$Rf?xtg`wPT9c}ht@X2&9PN5<*
z*D&g6RceNq=>U^rFJ6gJ?Qv}pz0}$)b(7aFZWIOn*h5A_#&9!&!|kcySPY}>n{{qY
z4p}j$xhR=*d_Ln*uNE%5*1aVUvMu*yk(O!Amc_Xjt){PLAJD2n$qv$t)#gjzj4~=g
z6155JAs^{VmMHG~-Qv2JU6KT*gGu^i`mTYl>#*uEZgI=J!2TY0$>E@RDUC*U2F3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